Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions i18n/si/msgs.jaml
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,8 @@ main.py:
Application level CSS style sheet to use: false
--config: false
Configuration namespace: false
--no-shadow: false
Disable drop shadows in the UI: false
Deprecated: false
--qt: false
'Additional arguments for QApplication.\nDeprecated. ': false
Expand Down
22 changes: 21 additions & 1 deletion orangecanvas/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
from contextlib import ExitStack, closing

from AnyQt.QtGui import QFont, QColor, QPalette
from AnyQt.QtCore import Qt, QSettings, QTimer, QUrl, QDir
from AnyQt.QtCore import Qt, QSettings, QTimer, QUrl, QDir, QObject, QEvent
from AnyQt.QtWidgets import QWidget

from orangecanvas import localization
from .utils.after_exit import run_after_exit
Expand Down Expand Up @@ -97,6 +98,18 @@ def activate_default_config(self):
# Init config
config.init()

def install_shadow_remover(self):
class ShadowRemover(QObject):
def eventFilter(self, obj, event):
if event.type() == QEvent.Type.Polish:
if isinstance(obj, QWidget) and obj.isWindow():
obj.setWindowFlags(
obj.windowFlags() | Qt.WindowType.NoDropShadowWindowHint)
return super().eventFilter(obj, event)

self.__remover = ShadowRemover()
self.application.installEventFilter(self.__remover)

def show_splash_message(self, message: str, color=QColor()):
"""Display splash screen message"""
splash = self.splash_screen()
Expand Down Expand Up @@ -201,6 +214,8 @@ def run(self, argv: List[str]) -> int:
with ExitStack() as stack:
self.stack = stack
self.setup_application()
if self.options.no_shadow:
self.install_shadow_remover()
stack.callback(self.tear_down_application)
self.setup_sys_redirections()
stack.callback(self.tear_down_sys_redirections)
Expand Down Expand Up @@ -526,6 +541,11 @@ def log_level(value):
type=str, default=None,
)

parser.add_argument(
"--no-shadow", help="Disable drop shadows in the UI",
action="store_true", default=False
)

deprecated = parser.add_argument_group("Deprecated")
deprecated.add_argument(
"--qt", help="Additional arguments for QApplication.\nDeprecated. "
Expand Down