Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

tk421storm
Copy link

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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