def __init__(self, parent=None):
        QMainWindow.__init__(self, parent)
        # ui
        self.ver = '2.0.3'
        self.setupUi(self)
        self.setWindowTitle('pw Multi Script Editor v%s' % self.ver)
        self.setObjectName('pw_scriptEditor')
        # widgets
        self.out = outputWidget.outputClass()
        self.out_ly.addWidget(self.out)
        self.tab = tabWidget.tabWidgetClass(self)
        self.in_ly.addWidget(self.tab)

        for m in self.file_menu, self.tools_menu, self.options_menu, self.run_menu, self.help_menu:
            m.setWindowTitle('MSE '+self.ver)

        #variables
        self.s = settingsManager.scriptEditorClass()
        self.namespace = {}
        self.dial = None

        self.updateNamespace({'self_main':self,
                              'self_version':self.ver,
                              'self_output': self.out,
                              'self_help': self.mse_help,
                              'self_context':managers.context})
        self.session = sessionManager.sessionManagerClass()
        self.execAll_act.setIcon(QIcon(icons['all']))
        self.execSel_act.setIcon(QIcon(icons['sel']))
        self.clearHistory_act.setIcon(QIcon(icons['clear']))
        self.toolBar.setIconSize(QSize(32,32))
        self.menubar.setNativeMenuBar(False)
        # connects

        self.save_act.triggered.connect(self.saveScript)
        self.load_act.triggered.connect(self.loadScript)
        self.exit_act.triggered.connect(self.close)
        self.tabToSpaces_act.triggered.connect(self.tabsToSpaces)
        self.saveSeccion_act.triggered.connect(lambda:self.saveSession(True))
        self.settingsFile_act.triggered.connect(self.openSettingsFile)
        self.splitter.splitterMoved.connect(self.adjustColmpeters)
        self.donate_act.triggered.connect(lambda :self.openLink('donate'))
        self.openManual_act.triggered.connect(lambda :self.openLink('manual'))
        self.about_act.triggered.connect(self.about)
        self.shortcuts_act.triggered.connect(self.shortcuts)
        self.printHelp_act.triggered.connect(self.mse_help)
        # editor
        c = Qt.WindowShortcut
        self.undo_act.triggered.connect(self.tab.undo)
        self.undo_act.setShortcut('Ctrl+Z')
        self.undo_act.setShortcutContext(Qt.WidgetShortcut)

        self.redo_act.triggered.connect(self.tab.redo)
        self.redo_act.setShortcut('Ctrl+Y')
        self.redo_act.setShortcutContext(Qt.WidgetShortcut)

        self.copy_act.triggered.connect(self.tab.copy)
        self.copy_act.setShortcut('Ctrl+C')
        self.copy_act.setShortcutContext(Qt.WidgetShortcut)

        self.cut_act.triggered.connect(self.tab.cut)
        self.cut_act.setShortcut('Ctrl+X')
        self.cut_act.setShortcutContext(Qt.WidgetShortcut)

        self.paste_act.triggered.connect(self.tab.paste)
        self.paste_act.setShortcut('Ctrl+V')
        self.paste_act.setShortcutContext(Qt.WidgetShortcut)

        self.find_act.triggered.connect(self.findWidget)
        self.find_act.setShortcut('Ctrl+F')
        self.find_act.setShortcutContext(Qt.WindowShortcut)

        self.comment_cat.triggered.connect(self.tab.comment)
        self.comment_cat.setShortcut(QKeySequence( Qt.ALT+Qt.Key_Q))
        self.comment_cat.setShortcutContext(Qt.WidgetShortcut)

        self.fillThemeMenu()

        #shortcuts
        if managers.context == 'nuke':
            import nuke
            if nuke.NUKE_VERSION_MAJOR>8:
                self.execSel_act.setShortcut('Ctrl+Return')
                self.execSel_act.setShortcutContext(Qt.ApplicationShortcut)
        self.execSel_act.triggered.connect(self.executeSelected)
        self.execSel_act.setShortcut('Ctrl+Return')
        self.execSel_act.setShortcutContext(Qt.WidgetWithChildrenShortcut)

        self.execAll_act.setShortcut('Ctrl+Shift+Return')
        self.execAll_act.triggered.connect(self.executeAll)
        self.execAll_act.setShortcutContext(Qt.ApplicationShortcut)

        self.clearHistory_act.triggered.connect(self.clearHistory)

        #start
        self.loadSession()
        self.loadSettings()
        self.setWindowStyle()
        self.out.showMessage('>>> pw Multi Script Editor v.%s\npaulwinex.ru' % self.ver)
        self.tab.widget(0).edit.setFocus()
        self.appContextMenu()
        self.addArgs()
Exemplo n.º 2
0
    def __init__(self, parent=None):
        QMainWindow.__init__(self, parent)
        # ui
        self.ver = '2.0.3'
        self.setupUi(self)
        self.setWindowTitle('pw Multi Script Editor v%s' % self.ver)
        self.setObjectName('pw_scriptEditor')
        # widgets
        self.out = outputWidget.outputClass()
        self.out_ly.addWidget(self.out)
        self.tab = tabWidget.tabWidgetClass(self)
        self.in_ly.addWidget(self.tab)

        for m in self.file_menu, self.tools_menu, self.options_menu, self.run_menu, self.help_menu:
            m.setWindowTitle('MSE ' + self.ver)

        #variables
        self.s = settingsManager.scriptEditorClass()
        # self.namespace = {}
        self.namespace = __import__('__main__').__dict__
        self.dial = None

        self.updateNamespace({
            'self_main': self,
            'self_version': self.ver,
            'self_output': self.out,
            'self_help': self.mse_help,
            'self_context': managers.context
        })
        self.session = sessionManager.sessionManagerClass()
        self.execAll_act.setIcon(QIcon(icons['all']))
        self.execSel_act.setIcon(QIcon(icons['sel']))
        self.clearHistory_act.setIcon(QIcon(icons['clear']))
        self.toolBar.setIconSize(QSize(32, 32))
        self.menubar.setNativeMenuBar(False)
        # connects

        self.save_act.triggered.connect(self.saveScript)
        self.load_act.triggered.connect(self.loadScript)
        self.exit_act.triggered.connect(self.close)
        self.tabToSpaces_act.triggered.connect(self.tabsToSpaces)
        self.saveSeccion_act.triggered.connect(lambda: self.saveSession(True))
        self.settingsFile_act.triggered.connect(self.openSettingsFile)
        self.splitter.splitterMoved.connect(self.adjustColmpeters)
        self.donate_act.triggered.connect(lambda: self.openLink('donate'))
        self.openManual_act.triggered.connect(lambda: self.openLink('manual'))
        self.about_act.triggered.connect(self.about)
        self.shortcuts_act.triggered.connect(self.shortcuts)
        self.printHelp_act.triggered.connect(self.mse_help)
        # editor
        c = Qt.WindowShortcut
        self.undo_act.triggered.connect(self.tab.undo)
        self.undo_act.setShortcut('Ctrl+Z')
        self.undo_act.setShortcutContext(Qt.WidgetShortcut)

        self.redo_act.triggered.connect(self.tab.redo)
        self.redo_act.setShortcut('Ctrl+Y')
        self.redo_act.setShortcutContext(Qt.WidgetShortcut)

        self.copy_act.triggered.connect(self.tab.copy)
        self.copy_act.setShortcut('Ctrl+C')
        self.copy_act.setShortcutContext(Qt.WidgetShortcut)

        self.cut_act.triggered.connect(self.tab.cut)
        self.cut_act.setShortcut('Ctrl+X')
        self.cut_act.setShortcutContext(Qt.WidgetShortcut)

        self.paste_act.triggered.connect(self.tab.paste)
        self.paste_act.setShortcut('Ctrl+V')
        self.paste_act.setShortcutContext(Qt.WidgetShortcut)

        self.find_act.triggered.connect(self.findWidget)
        self.find_act.setShortcut('Ctrl+F')
        self.find_act.setShortcutContext(Qt.WindowShortcut)

        self.comment_cat.triggered.connect(self.tab.comment)
        self.comment_cat.setShortcut(QKeySequence(Qt.ALT + Qt.Key_Q))
        self.comment_cat.setShortcutContext(Qt.WidgetShortcut)

        self.fillThemeMenu()

        #shortcuts
        if managers.context == 'nuke':
            import nuke
            if nuke.NUKE_VERSION_MAJOR > 8:
                self.execSel_act.setShortcut('Ctrl+Return')
                self.execSel_act.setShortcutContext(Qt.ApplicationShortcut)

        self.execSel_act.triggered.connect(self.executeSelected)
        self.execSel_act.setShortcut('Ctrl+Return')
        self.execSel_act.setShortcutContext(Qt.WidgetWithChildrenShortcut)

        self.execAll_act.setShortcut('Ctrl+Shift+Return')
        self.execAll_act.triggered.connect(self.executeAll)
        self.execAll_act.setShortcutContext(Qt.ApplicationShortcut)

        self.clearHistory_act.triggered.connect(self.clearHistory)

        #start
        self.loadSession()
        self.loadSettings()
        self.setWindowStyle()
        self.out.showMessage('>>> pw Multi Script Editor v.%s\npaulwinex.ru' %
                             self.ver)
        self.tab.widget(0).edit.setFocus()
        self.appContextMenu()
        self.addArgs()