class EWidget(QSplitter): Message = pyqtSignal() def __init__(self): QSplitter.__init__(self, Qt.Vertical) self.__view = EView(EController()) self.__console = EConsole() EHighlighter(self.__console.document(), ['cwd'], ['createNode', 'getNode', 'deleteNode', 'connectAttr', 'getTransform', 'setPos', 'NodeTypes']) self.__console.updateNamespace({'cwd': self.__view.Controller, 'history': self.__console.getHistory}) self.addWidget(self.__view) self.addWidget(self.__console) @property def View(self): return self.__view @property def Console(self): return self.__console def processMenuItem(self, data): print '...Data from menu: < %s >' % data def contextMenuEvent(self, mouseEvent): menu = QMenu() action_1 = QAction("Create Node A", menu, triggered=functools.partial(self.processMenuItem, 'MyNodeOne')) action_2 = QAction("Create Node B", menu, triggered=functools.partial(self.processMenuItem, 'MyNodeTwo')) menu.addAction(action_1) menu.addAction(action_2) menu.exec_(QCursor.pos())
class EWidget(QSplitter): Message = pyqtSignal() def __init__(self): QSplitter.__init__(self, Qt.Vertical) self.__view = EView(EController()) self.__console = EConsole() controllerCmd = [] for item in inspect.getmembers(self.__view.Controller): if not inspect.isbuiltin(item[1]) and not item[0].startswith('_'): controllerCmd.append(str(item[0])) EHighlighter(self.__console.document(), ['cwd'], controllerCmd) self.__console.updateNamespace({'cwd': self.__view.Controller, 'history': self.__console.getHistory}) self.addWidget(self.__view) self.addWidget(self.__console) @property def View(self): return self.__view @property def Console(self): return self.__console def processMenuItem(self, data): print '...Data from menu: < %s >' % data def contextMenuEvent(self, mouseEvent): pass
def __init__(self): QSplitter.__init__(self, Qt.Vertical) self.__view = EView(EController()) self.__console = EConsole() EHighlighter(self.__console.document(), ['cwd'], ['createNode', 'getNode', 'deleteNode', 'connectAttr', 'getTransform', 'setPos', 'NodeTypes']) self.__console.updateNamespace({'cwd': self.__view.Controller, 'history': self.__console.getHistory}) self.addWidget(self.__view) self.addWidget(self.__console)
def __init__(self): QSplitter.__init__(self, Qt.Vertical) self.__view = EView(EController()) self.__console = EConsole() controllerCmd = [] for item in inspect.getmembers(self.__view.Controller): if not inspect.isbuiltin(item[1]) and not item[0].startswith('_'): controllerCmd.append(str(item[0])) EHighlighter(self.__console.document(), ['cwd'], controllerCmd) self.__console.updateNamespace({'cwd': self.__view.Controller, 'history': self.__console.getHistory}) self.addWidget(self.__view) self.addWidget(self.__console)