From cd233c42f5ee07610781a1faf0541018b2d4f1a6 Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Tue, 6 Feb 2024 16:47:49 +0100 Subject: [PATCH] remove pype prefixes in tray tool --- client/ayon_core/tools/tray/__init__.py | 2 +- client/ayon_core/tools/tray/__main__.py | 6 +++--- .../{pype_info_widget.py => info_widget.py} | 20 +++++++++---------- .../tools/tray/{pype_tray.py => tray.py} | 19 +++++++++--------- 4 files changed, 23 insertions(+), 24 deletions(-) rename client/ayon_core/tools/tray/{pype_info_widget.py => info_widget.py} (96%) rename client/ayon_core/tools/tray/{pype_tray.py => tray.py} (97%) diff --git a/client/ayon_core/tools/tray/__init__.py b/client/ayon_core/tools/tray/__init__.py index 38c59d2a43..f5e558e0bb 100644 --- a/client/ayon_core/tools/tray/__init__.py +++ b/client/ayon_core/tools/tray/__init__.py @@ -1,4 +1,4 @@ -from .pype_tray import main +from .tray import main __all__ = ( "main", diff --git a/client/ayon_core/tools/tray/__main__.py b/client/ayon_core/tools/tray/__main__.py index 830cf45d0e..51ae93ae28 100644 --- a/client/ayon_core/tools/tray/__main__.py +++ b/client/ayon_core/tools/tray/__main__.py @@ -1,7 +1,7 @@ try: - from . import pype_tray + from . import tray except ImportError: - import pype_tray + import tray -pype_tray.main() +tray.main() diff --git a/client/ayon_core/tools/tray/pype_info_widget.py b/client/ayon_core/tools/tray/info_widget.py similarity index 96% rename from client/ayon_core/tools/tray/pype_info_widget.py rename to client/ayon_core/tools/tray/info_widget.py index c3c9b57b24..597a4fc2c5 100644 --- a/client/ayon_core/tools/tray/pype_info_widget.py +++ b/client/ayon_core/tools/tray/info_widget.py @@ -205,11 +205,11 @@ class CollapsibleWidget(QtWidgets.QWidget): self.content_widget.updateGeometry() -class PypeInfoWidget(QtWidgets.QWidget): +class InfoWidget(QtWidgets.QWidget): _resized = QtCore.Signal() def __init__(self, parent=None): - super(PypeInfoWidget, self).__init__(parent) + super(InfoWidget, self).__init__(parent) self._scroll_at_bottom = False @@ -220,7 +220,7 @@ class PypeInfoWidget(QtWidgets.QWidget): self.setWindowTitle("AYON info") scroll_area = QtWidgets.QScrollArea(self) - info_widget = PypeInfoSubWidget(scroll_area) + info_widget = InfoSubWidget(scroll_area) scroll_area.setWidget(info_widget) scroll_area.setWidgetResizable(True) @@ -250,14 +250,14 @@ class PypeInfoWidget(QtWidgets.QWidget): vertical_bar.setValue(vertical_bar.maximum()) def resizeEvent(self, event): - super(PypeInfoWidget, self).resizeEvent(event) + super(InfoWidget, self).resizeEvent(event) self._resized.emit() self.info_widget.set_content_height( self.scroll_area.height() ) def showEvent(self, event): - super(PypeInfoWidget, self).showEvent(event) + super(InfoWidget, self).showEvent(event) self.info_widget.set_content_height( self.scroll_area.height() ) @@ -314,18 +314,18 @@ class PypeInfoWidget(QtWidgets.QWidget): ) -class PypeInfoSubWidget(QtWidgets.QWidget): +class InfoSubWidget(QtWidgets.QWidget): not_applicable = "N/A" def __init__(self, parent=None): - super(PypeInfoSubWidget, self).__init__(parent) + super(InfoSubWidget, self).__init__(parent) self.env_view = None main_layout = QtWidgets.QVBoxLayout(self) main_layout.setContentsMargins(0, 0, 0, 0) main_layout.setAlignment(QtCore.Qt.AlignTop) - main_layout.addWidget(self._create_openpype_info_widget(), 0) + main_layout.addWidget(self._create_info_widget(), 0) main_layout.addWidget(self._create_separator(), 0) main_layout.addWidget(self._create_workstation_widget(), 0) main_layout.addWidget(self._create_separator(), 0) @@ -408,8 +408,8 @@ class PypeInfoSubWidget(QtWidgets.QWidget): return env_widget - def _create_openpype_info_widget(self): - """Create widget with information about OpenPype application.""" + def _create_info_widget(self): + """Create widget with information about application.""" executable_args = get_ayon_launcher_args() username = "N/A" diff --git a/client/ayon_core/tools/tray/pype_tray.py b/client/ayon_core/tools/tray/tray.py similarity index 97% rename from client/ayon_core/tools/tray/pype_tray.py rename to client/ayon_core/tools/tray/tray.py index 09f3195fcb..3a70d68466 100644 --- a/client/ayon_core/tools/tray/pype_tray.py +++ b/client/ayon_core/tools/tray/tray.py @@ -25,7 +25,7 @@ from ayon_core.tools.utils import ( get_ayon_qt_app, ) -from .pype_info_widget import PypeInfoWidget +from .info_widget import InfoWidget # TODO PixmapLabel should be moved to 'utils' in other future PR so should be @@ -73,7 +73,7 @@ class TrayManager: def __init__(self, tray_widget, main_window): self.tray_widget = tray_widget self.main_window = main_window - self.pype_info_widget = None + self._info_widget = None self._restart_action = None self.log = Logger.get_logger(self.__class__.__name__) @@ -289,12 +289,12 @@ class TrayManager: self._addons_manager.on_exit() def _on_version_action(self): - if self.pype_info_widget is None: - self.pype_info_widget = PypeInfoWidget() + if self._info_widget is None: + self._info_widget = InfoWidget() - self.pype_info_widget.show() - self.pype_info_widget.raise_() - self.pype_info_widget.activateWindow() + self._info_widget.show() + self._info_widget.raise_() + self._info_widget.activateWindow() class SystemTrayIcon(QtWidgets.QSystemTrayIcon): @@ -398,7 +398,7 @@ class SystemTrayIcon(QtWidgets.QSystemTrayIcon): QtCore.QCoreApplication.exit() -class PypeTrayStarter(QtCore.QObject): +class TrayStarter(QtCore.QObject): def __init__(self, app): app.setQuitOnLastWindowClosed(False) self._app = app @@ -457,9 +457,8 @@ class PypeTrayStarter(QtCore.QObject): def main(): app = get_ayon_qt_app() - starter = PypeTrayStarter(app) + starter = TrayStarter(app) - # TODO remove when pype.exe will have an icon if not is_running_from_build() and os.name == "nt": import ctypes ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(