class DFF_Ide(QDockWidget): def __init__(self, mainWindow, actions): super(DFF_Ide, self).__init__(mainWindow) self.init(mainWindow, actions) self.initCallbacks() self.g_display() self.show() def init(self, mainWindow, actions): self.type = "ide" self.name = "ide" self.setMaximumSize(QSize(3000, 3000)) self.actions = actions self.__mainWindow = mainWindow self.configure() def configure(self): self.setAllowedAreas(Qt.AllDockWidgetAreas) self.setObjectName("IDE") self.setWindowTitle(QApplication.translate("IDE", "IDE", None, QApplication.UnicodeUTF8)) def g_display(self): self.ide = Ide(self) self.ide.g_display() self.setWidget(self.ide) def initCallbacks(self): self.connect(self, SIGNAL("visibilityChanged(bool)"), self.visibility) def closeEvent(self, cEvent): self.actions.disableActions() self.actions.idetoolbar.setVisible(False) cEvent.accept() def visibility(self, bool): if bool == False: self.actions.disableActions() self.actions.idetoolbar.setVisible(False) else: self.actions.enableActions() self.actions.idetoolbar.setVisible(True) def getParent(self): return self.__mainWindow
def loadSequence(fullpath, browser, openIde): from Ide import Ide try: with warnings.catch_warnings(record=True) as w: # Cause all warnings to always be triggered. warnings.simplefilter("always") AppData.initConfigParams() loadParents(os.path.dirname(fullpath), browser.rootPath) loader = importlib.machinery.SourceFileLoader( "my_module", fullpath) my_module = loader.load_module() gears.makeCurrent() gears.setSequence(my_module.create(None), os.path.basename(fullpath)) #gears.SetCurrentSurface(browser.surfaceHandle) #gears.RenderFrame(600) for e in w: browser.launcherWindow.warn(e.message) except SequenceError as e: if not openIde: box = QMessageBox(browser) horizontalSpacer = QSpacerItem(1000, 0, QSizePolicy.Minimum, QSizePolicy.Expanding) box.setText('Error in sequence file!\n' + e.tb[-1][0] + '(' + str(e.tb[-1][1]) + '):\n in function "' + e.tb[-1][2] + '":\n ' + e.tb[-1][3] + '\n\n' + str(e)) if e.deepertb: box.setDetailedText(''.join(traceback.format_list(e.deepertb))) box.setWindowTitle('Error in sequence file ' + fullpath + '!') box.setWindowFlags(Qt.Dialog) box.addButton("Abort sequence", QMessageBox.RejectRole) box.addButton("Open script editor", QMessageBox.AcceptRole) box.setDefaultButton(QMessageBox.Abort) layout = box.layout() layout.addItem(horizontalSpacer, layout.rowCount(), 0, 1, layout.columnCount()) if box.exec() == QMessageBox.RejectRole: openIde = True if openIde: browser.launcherWindow.ide = Ide(fullpath, browser, e.tb[-1][1]) browser.launcherWindow.ide.show() return False except: if not openIde: exc_type, exc_value, exc_traceback = sys.exc_info() formatted_lines = traceback.format_exc().splitlines() box = QMessageBox(browser) horizontalSpacer = QSpacerItem(1000, 0, QSizePolicy.Minimum, QSizePolicy.Expanding) message = '' for l in formatted_lines: message += l + '\n' box.setText(message) box.setWindowTitle('Sequence error!') box.setWindowFlags(Qt.Dialog) box.addButton("Abort sequence", QMessageBox.RejectRole) box.addButton("Open script editor", QMessageBox.AcceptRole) box.setDefaultButton(QMessageBox.Abort) layout = box.layout() layout.addItem(horizontalSpacer, layout.rowCount(), 0, 1, layout.columnCount()) if box.exec() == QMessageBox.RejectRole: openIde = True if openIde: browser.launcherWindow.ide = Ide(fullpath, browser) browser.launcherWindow.ide.show() return False pathInCalibs = fullpath.replace('Sequences', 'Tonemapping', 1) calibFilePattern = pathInCalibs.replace('.pyx', '*_measurement.py', 1) calibFiles = glob.glob(calibFilePattern) for f in calibFiles: cloader = importlib.machinery.SourceFileLoader("c_module", f) c_module = cloader.load_module() try: c_module.apply(gears.getSequence()) except: browser.launcherWindow.warn( 'Measurement file ' + f + ' is no longer valid, as the sequence has been edited. File skipped. Please recalibrate the sequence.' ) calibFilePattern = pathInCalibs.replace('.pyx', '*_tonemap.py', 1) calibFiles = glob.glob(calibFilePattern) for f in calibFiles: cloader = importlib.machinery.SourceFileLoader("c_module", f) c_module = cloader.load_module() try: c_module.apply(gears.getSequence()) except: browser.launcherWindow.warn( 'Tone mapping file ' + f + ' is no longer valid, as the sequence has been edited. File skipped. Please recalibrate the sequence.' ) if openIde: browser.launcherWindow.ide = Ide(fullpath, browser) browser.launcherWindow.ide.show() return False return True
def g_display(self): self.ide = Ide(self) self.ide.g_display() self.setWidget(self.ide)