From 866fc2146dbebcda65a1258a91abb9fa3d3ef7bd Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Wed, 25 Aug 2021 09:58:13 +0200 Subject: [PATCH] fixed imports in new publisher --- openpype/tools/new_publisher/__init__.py | 5 +++ openpype/tools/new_publisher/app.py | 17 +++++++ .../tools/new_publisher/widgets/__init__.py | 2 +- .../widgets/instance_views_widgets.py | 2 +- openpype/tools/new_publisher/window.py | 45 ++----------------- 5 files changed, 27 insertions(+), 44 deletions(-) create mode 100644 openpype/tools/new_publisher/app.py diff --git a/openpype/tools/new_publisher/__init__.py b/openpype/tools/new_publisher/__init__.py index e69de29bb2..2d81de8fee 100644 --- a/openpype/tools/new_publisher/__init__.py +++ b/openpype/tools/new_publisher/__init__.py @@ -0,0 +1,5 @@ +from .app import show + +__all__ = ( + "show", +) diff --git a/openpype/tools/new_publisher/app.py b/openpype/tools/new_publisher/app.py new file mode 100644 index 0000000000..2176d6facb --- /dev/null +++ b/openpype/tools/new_publisher/app.py @@ -0,0 +1,17 @@ +from .window import PublisherWindow + + +class _WindowCache: + window = None + + +def show(parent=None): + window = _WindowCache.window + if window is None: + window = PublisherWindow() + _WindowCache.window = window + + window.show() + window.activateWindow() + + return window diff --git a/openpype/tools/new_publisher/widgets/__init__.py b/openpype/tools/new_publisher/widgets/__init__.py index 57434c38c4..9980606248 100644 --- a/openpype/tools/new_publisher/widgets/__init__.py +++ b/openpype/tools/new_publisher/widgets/__init__.py @@ -26,7 +26,7 @@ __all__ = ( "SubsetAttributesWidget", - "PublishOverlayFrame", + "PublishFrame", "CreateDialog", diff --git a/openpype/tools/new_publisher/widgets/instance_views_widgets.py b/openpype/tools/new_publisher/widgets/instance_views_widgets.py index fde83c3a44..989dcf3aaf 100644 --- a/openpype/tools/new_publisher/widgets/instance_views_widgets.py +++ b/openpype/tools/new_publisher/widgets/instance_views_widgets.py @@ -2,7 +2,7 @@ import collections from Qt import QtWidgets, QtCore, QtGui -from constants import ( +from ..constants import ( INSTANCE_ID_ROLE, SORT_VALUE_ROLE ) diff --git a/openpype/tools/new_publisher/window.py b/openpype/tools/new_publisher/window.py index e574b47c37..928724e217 100644 --- a/openpype/tools/new_publisher/window.py +++ b/openpype/tools/new_publisher/window.py @@ -1,35 +1,9 @@ -import os -import sys - -openpype_dir = "" -mongo_url = "" -project_name = "" -asset_name = "" -task_name = "" -host_name = "" - -os.environ["OPENPYPE_MONGO"] = mongo_url -os.environ["AVALON_MONGO"] = mongo_url -os.environ["AVALON_PROJECT"] = project_name -os.environ["AVALON_ASSET"] = asset_name -os.environ["AVALON_TASK"] = task_name -os.environ["AVALON_APP"] = host_name -os.environ["OPENPYPE_DATABASE_NAME"] = "openpype" -os.environ["AVALON_CONFIG"] = "openpype" -os.environ["AVALON_TIMEOUT"] = "1000" -os.environ["AVALON_DB"] = "avalon" -for path in [ - openpype_dir, - r"{}\repos\avalon-core".format(openpype_dir), - r"{}\.venv\Lib\site-packages".format(openpype_dir) -]: - sys.path.append(path) - from Qt import QtWidgets from openpype import style -from control import PublisherController -from widgets import ( + +from .control import PublisherController +from .widgets import ( PublishFrame, SubsetAttributesWidget, InstanceCardView, @@ -381,16 +355,3 @@ class PublisherWindow(QtWidgets.QWidget): self.validate_btn.setEnabled(validate_enabled) self.publish_btn.setEnabled(publish_enabled) - - -def main(): - """Main function for testing purposes.""" - - app = QtWidgets.QApplication([]) - window = PublisherWindow() - window.show() - app.exec_() - - -if __name__ == "__main__": - main()