def __init__(self, parent=None): QMenu.__init__(self, "&Signals") self.parent = parent self.addSignalAction = self.addAction(self.trUtf8("&Add Signal")) self.addSignalAction.triggered.connect(self.addSignal) self.addSignalAction.setEnabled(False) self.applyOperationAction = self.addAction(self.trUtf8("&Apply Operation")) self.applyOperationAction.triggered.connect(self.applyOperation) self.applyOperationAction.setEnabled(False)
def __init__(self, p_def): """ :param p_def: [{NAME:..., STR:...}, ...] :return: """ QMenu.__init__(self) for _def in p_def: _act = QAction(_def["NAME"], self) _act.triggered.connect(partial(self.menu_emit, _def["STR"])) self.addAction(_act)
def __init__(self): QMenu.__init__(self, "Set Status", None) global gStatusTags # ant: Could use hiero.core.defaultFrameRates() here but messes up with string matching because we seem to mix decimal points self.statuses = gStatusTags self._statusActions = self.createStatusMenuActions() # Add the Actions to the Menu. for act in self.menuActions: self.addAction(act) hiero.core.events.registerInterest("kShowContextMenu/kTimeline", self.eventHandler) hiero.core.events.registerInterest("kShowContextMenu/kSpreadsheet", self.eventHandler)
def __init__( self, parent ): QMenu.__init__( self, parent ) # add actions and a separator hello = self.addAction("Print 'Hello!'") self.addSeparator() world = self.addAction("Print 'World!'") # connect to the individual action's signal hello.triggered.connect( self.hello ) world.triggered.connect( self.world ) # connect to the menu level signal self.triggered.connect( self.menuTrigger )
def __init__(self, parent=None): QMenu.__init__(self, "&Files") self.parent = parent newProjectAction = self.addAction(self.trUtf8("&New Project")) newProjectAction.triggered.connect(self.createNewProject) openProjectAction = self.addAction(self.trUtf8("&Open Project")) openProjectAction.triggered.connect(self.openProject) self.saveProjectAction = self.addAction(self.trUtf8("&Save Project")) self.saveProjectAction.triggered.connect(self.saveProject) self.saveProjectAction.setEnabled(False) quitAction = self.addAction(self.trUtf8("&Quit Program")) quitAction.triggered.connect(self.parent.close)
def __init__(self, *args, **kwargs): self.parentUi = args[0] loadType = None if kwargs.has_key('loadTypes'): loadType = kwargs['loadTypes'] del kwargs['loadTypes'] QMenu.__init__(self, *args, **kwargs) self.parentUi.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) QtCore.QObject.connect( self.parentUi, QtCore.SIGNAL('customContextMenuRequested(QPoint)'), self.loadContextMenu) if loadType and loadType == 'multi': self.addAction("Load Objects", self.cmd_loadObjects) else: self.addAction("Load Object", self.cmd_loadObject)
def __init__ ( self, manager, parent, controller ): """ Creates a new tree. """ # Base class constructor: QMenu.__init__( self, parent ) # The parent of the menu: self._parent = parent # The manager that the menu is a view of: self._manager = manager # The controller: self._controller = controller # Create the menu structure: self.refresh() # Listen to the manager being updated: self._manager.on_facet_set( self.refresh, 'changed' ) self._manager.on_facet_set( self._on_enabled_modified, 'enabled' )