Skip to content

Include context switching during regular File->Open operation#17

Open
tk421storm wants to merge 5 commits into
shotgunsoftware:masterfrom
tk421storm:mike_dev
Open

Include context switching during regular File->Open operation#17
tk421storm wants to merge 5 commits into
shotgunsoftware:masterfrom
tk421storm:mike_dev

Conversation

@tk421storm

Copy link
Copy Markdown

Pulled mostly from similar code in the tk-nuke engine, adapted to 3dsMax. I wasn't able to do testing in the environment without an "engine", since I don't understand how that could occur in our standard environment.

#if we don't have an engine, we'll need to do some of the legwork ourselves
def showWarningDialog(message, details=None):

parent=QtGui.QApplication.activeWindow()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentation contains tabs
local variable 'parent' is assigned to but never used
missing whitespace around operator
over-indented


#if we don't have an engine, we'll need to do some of the legwork ourselves
def showWarningDialog(message, details=None):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blank line contains whitespace
indentation contains tabs

self._layout.addWidget(self._text)

#if we don't have an engine, we'll need to do some of the legwork ourselves
def showWarningDialog(message, details=None):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expected 2 blank lines, found 1

self._layout.addWidget(self._label)
self._layout.addWidget(self._text)

#if we don't have an engine, we'll need to do some of the legwork ourselves

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

block comment should start with '# '

self._layout = QtGui.QVBoxLayout(self)
self._layout.addWidget(self._label)
self._layout.addWidget(self._text)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blank line contains whitespace
indentation contains tabs


self._label = QtGui.QLabel("<h3>"+message+"</h3>")
self._label.setTextFormat(QtCore.Qt.RichText)
self._text = QtGui.QTextEdit()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentation contains tabs

self.setObjectName("SGTK_WARNING_DIALOG")

self._label = QtGui.QLabel("<h3>"+message+"</h3>")
self._label.setTextFormat(QtCore.Qt.RichText)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentation contains tabs


self.setObjectName("SGTK_WARNING_DIALOG")

self._label = QtGui.QLabel("<h3>"+message+"</h3>")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentation contains tabs
missing whitespace around arithmetic operator


super(WarningDialog, self).__init__(*args, **kwargs)

self.setObjectName("SGTK_WARNING_DIALOG")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentation contains tabs

def __init__(self, message, details=None, *args, **kwargs):

super(WarningDialog, self).__init__(*args, **kwargs)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blank line contains whitespace
indentation contains tabs


def __init__(self, message, details=None, *args, **kwargs):

super(WarningDialog, self).__init__(*args, **kwargs)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentation contains tabs
over-indented

class WarningDialog(QtGui.QWidget):

def __init__(self, message, details=None, *args, **kwargs):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blank line contains whitespace
indentation contains tabs

#if we have an engine, we can simply use this class
class WarningDialog(QtGui.QWidget):

def __init__(self, message, details=None, *args, **kwargs):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentation contains tabs
over-indented


#if we have an engine, we can simply use this class
class WarningDialog(QtGui.QWidget):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blank line contains whitespace
indentation contains tabs

from sgtk.platform.qt import QtGui, QtCore #@UnresolvedImport

#if we have an engine, we can simply use this class
class WarningDialog(QtGui.QWidget):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expected 2 blank lines, found 1

#but leave tools that can direct a user back to the correct context (ie Workfiles)

#engine._remove_shotgun_menu()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blank line contains whitespace

#TODO: replace with command that just remove tools requiring specific context (ie Publish)
#but leave tools that can direct a user back to the correct context (ie Workfiles)

#engine._remove_shotgun_menu()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

block comment should start with '# '


#TODO: replace with command that just remove tools requiring specific context (ie Publish)
#but leave tools that can direct a user back to the correct context (ie Workfiles)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blank line contains whitespace

logger.exception("Engine could not be started.")

#TODO: replace with command that just remove tools requiring specific context (ie Publish)
#but leave tools that can direct a user back to the correct context (ie Workfiles)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

block comment should start with '# '

# context was not sufficient! - disable tank!
logger.exception("Engine could not be started.")

#TODO: replace with command that just remove tools requiring specific context (ie Publish)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

block comment should start with '# '

Switches from using the support email alias to pointing to the support site
except sgtk.TankEngineInitError as e:
# context was not sufficient! - disable tank!
logger.exception("Engine could not be started.")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blank line contains whitespace

)
sgtk.platform.start_engine(engine_name, new_context.sgtk, new_context)

except sgtk.TankEngineInitError as e:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

local variable 'e' is assigned to but never used

)
)
sgtk.platform.start_engine(engine_name, new_context.sgtk, new_context)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blank line contains whitespace

logger.debug(
"Starting new engine: %s, %s, %s" % (
engine_name,
new_context.sgtk,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trailing whitespace

try:
logger.debug(
"Starting new engine: %s, %s, %s" % (
engine_name,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trailing whitespace

logger.debug("SGTK Registering onLoad callback")
MaxPlus.NotificationManager.Register(MaxPlus.NotificationCodes.FilePostOpen, PostOpenProcess)
g_tank_callbacks_registered = True
#else:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

block comment should start with '# '

logger.debug("Setting up 3dsMax Context Switching callbacks")

# we'll assume context switching is allowed for now
#if engine.get_setting("automatic_context_switch"):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

block comment should start with '# '

"""

global g_tank_callbacks_registered

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blank line contains whitespace

there is no current script open in your Nuke session. If there is a script currently open then this will spawn a
new Nuke instance and the callback won't be called.
"""

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blank line contains whitespace

details=error)
return

def tank_ensure_callbacks_registered(engine=None):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expected 2 blank lines, found 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant