From 26142007452d7c0d213797af729587da39ef1354 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Sat, 15 Aug 2020 03:01:32 +0200 Subject: [PATCH] app.py renamed to window.py --- pype/tools/launcher/__init__.py | 2 +- pype/tools/launcher/{app.py => window.py} | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) rename pype/tools/launcher/{app.py => window.py} (97%) diff --git a/pype/tools/launcher/__init__.py b/pype/tools/launcher/__init__.py index 8f7bf5a769..109d642e86 100644 --- a/pype/tools/launcher/__init__.py +++ b/pype/tools/launcher/__init__.py @@ -1,4 +1,4 @@ -from .app import LauncherWindow +from .window import LauncherWindow from . import actions __all__ = [ diff --git a/pype/tools/launcher/app.py b/pype/tools/launcher/window.py similarity index 97% rename from pype/tools/launcher/app.py rename to pype/tools/launcher/window.py index df2a47eed8..b53b5b415c 100644 --- a/pype/tools/launcher/app.py +++ b/pype/tools/launcher/window.py @@ -1,4 +1,5 @@ import copy +import logging from Qt import QtWidgets, QtCore, QtGui from avalon import style @@ -247,6 +248,9 @@ class LauncherWindow(QtWidgets.QDialog): def __init__(self, parent=None): super(LauncherWindow, self).__init__(parent) + self.log = logging.getLogger( + ".".join([__name__, self.__class__.__name__]) + ) self.dbcon = DbConnector() self.setWindowTitle("Launcher") @@ -365,7 +369,7 @@ class LauncherWindow(QtWidgets.QDialog): def echo(self, message): self.message_label.setText(str(message)) QtCore.QTimer.singleShot(5000, lambda: self.message_label.setText("")) - print(message) + self.log.debug(message) def on_project_changed(self): project_name = self.asset_panel.project_bar.get_current_project() @@ -399,7 +403,7 @@ class LauncherWindow(QtWidgets.QDialog): self.actions_bar.model.refresh() def on_action_clicked(self, action): - self.echo("Running action: %s" % action.name) + self.echo("Running action: {}".format(action.name)) self.run_action(action) def on_history_action(self, history_data): @@ -440,7 +444,11 @@ class LauncherWindow(QtWidgets.QDialog): self.action_history.add_action(action, session) # Process the Action - action().process(session) + try: + action().process(session) + except Exception as exc: + self.log.warning("Action launch failed.", exc_info=True) + self.echo("Failed: {}".format(str(exc))) def set_session(self, session): project_name = session.get("AVALON_PROJECT")