def __init__(self, nextep, parent=None): """ initialisation """ super(Actions, self).__init__() self.parent = parent self.nextep = nextep self.listActions = [] self.listActionsFile = [] self.listActions.append(("&File", self.listActionsFile)) self.listActionsPref = [] self.listActions.append(("&Options", self.listActionsPref)) self.listActionsMT = [] self.listActions.append(("&Manage TvShow", self.listActionsMT)) separator = QAction(self.parent) separator.setSeparator(True) # Define actions # Options self.addActionToList("&Settings", self.listActionsPref, self.setApp, "Open settings window.", QKeySequence.Preferences) self.addActionToList("Site O&rder", self.listActionsPref, self.sortApp, "Define which site to download from first") self.addActionToList("&Dict bug", self.listActionsPref, self.dictApp, "Dictbug") self.listActionsPref.append(separator) self.addActionToList("&Interactive", self.listActionsPref, self.intApp, "If checked, user is asked some things") self.listActionsPref[len(self.listActionsPref) - 1].setCheckable(True) # Manage TvShow self.addActionToList("&Add a show", self.listActionsMT, self.addApp, "To track a new show.") self.addActionToList("&Remove a show", self.listActionsMT, self.delApp, "Remove a show from watching list.") self.addActionToList("&Track a show", self.listActionsMT, self.trackS, "To track a show.") self.addActionToList("&Untrack", self.listActionsMT, self.untrackS, "To Untrack a show.") # File self.addActionToList("&Update", self.listActionsFile, self.refreshApp, "Update from nextep.", QKeySequence.Refresh) self.listActionsFile.append(separator) self.addActionToList("&Quit", self.listActionsFile, self.quitApp, "Quit the app.", QKeySequence.Quit)
def getFlyoutActionList(self): #Ninad 20070618 """ Returns custom actionlist that will be used in a specific mode or editing a feature etc Example: while in movie mode, the _createFlyoutToolBar method calls this. """ #'allActionsList' returns all actions in the flyout toolbar #including the subcontrolArea actions allActionsList = [] #Action List for subcontrol Area buttons. #In this mode there is really no subcontrol area. #We will treat subcontrol area same as 'command area' #(subcontrol area buttons will have an empty list as their command area #list). We will set the Comamnd Area palette background color to the #subcontrol area. subControlAreaActionList =[] self.exitMovieAction = NE1_QWidgetAction(self.w, win = self.w) self.exitMovieAction.setText("Exit Movie") self.exitMovieAction.setWhatsThis("Exits Movie Mode") self.exitMovieAction.setCheckable(True) self.exitMovieAction.setChecked(True) self.exitMovieAction.setIcon( geticon("ui/actions/Toolbars/Smart/Exit.png")) subControlAreaActionList.append(self.exitMovieAction) separator = QAction(self.w) separator.setSeparator(True) subControlAreaActionList.append(separator) subControlAreaActionList.append(self.w.simPlotToolAction) allActionsList.extend(subControlAreaActionList) #Empty actionlist for the 'Command Area' commandActionLists = [] #Append empty 'lists' in 'commandActionLists equal to the #number of actions in subControlArea for i in range(len(subControlAreaActionList)): lst = [] commandActionLists.append(lst) params = (subControlAreaActionList, commandActionLists, allActionsList) return params
def getFlyoutActionList(self): #Ninad 20070618 """ Returns custom actionlist that will be used in a specific mode or editing a feature etc Example: while in movie mode, the _createFlyoutToolBar method calls this. """ #'allActionsList' returns all actions in the flyout toolbar #including the subcontrolArea actions allActionsList = [] #Action List for subcontrol Area buttons. #In this mode there is really no subcontrol area. #We will treat subcontrol area same as 'command area' #(subcontrol area buttons will have an empty list as their command area #list). We will set the Comamnd Area palette background color to the #subcontrol area. subControlAreaActionList = [] self.exitMovieAction = NE1_QWidgetAction(self.w, win=self.w) self.exitMovieAction.setText("Exit Movie") self.exitMovieAction.setWhatsThis("Exits Movie Mode") self.exitMovieAction.setCheckable(True) self.exitMovieAction.setChecked(True) self.exitMovieAction.setIcon( geticon("ui/actions/Toolbars/Smart/Exit.png")) subControlAreaActionList.append(self.exitMovieAction) separator = QAction(self.w) separator.setSeparator(True) subControlAreaActionList.append(separator) subControlAreaActionList.append(self.w.simPlotToolAction) allActionsList.extend(subControlAreaActionList) #Empty actionlist for the 'Command Area' commandActionLists = [] #Append empty 'lists' in 'commandActionLists equal to the #number of actions in subControlArea for i in range(len(subControlAreaActionList)): lst = [] commandActionLists.append(lst) params = (subControlAreaActionList, commandActionLists, allActionsList) return params
def getFlyoutActionList(self): #Ninad 20070618 """ Returns a tuple that contains mode spcific actionlists in the added in the flyout toolbar of the mode. CommandToolbar._createFlyoutToolBar method calls this @return: params: A tuple that contains 3 lists: (subControlAreaActionList, commandActionLists, allActionsList) """ #'allActionsList' returns all actions in the flyout toolbar #including the subcontrolArea actions allActionsList = [] #Action List for subcontrol Area buttons. #In this mode, there is really no subcontrol area. #We will treat subcontrol area same as 'command area' #(subcontrol area buttons will have an empty list as their command area #list). We will set the Comamnd Area palette background color to the #subcontrol area. subControlAreaActionList =[] self.exitFuseAction = NE1_QWidgetAction(self.w, win = self.w) self.exitFuseAction.setText("Exit Fuse") self.exitFuseAction.setCheckable(True) self.exitFuseAction.setChecked(True) self.exitFuseAction.setIcon( geticon("ui/actions/Toolbars/Smart/Exit.png")) subControlAreaActionList.append(self.exitFuseAction) separator = QAction(self.w) separator.setSeparator(True) subControlAreaActionList.append(separator) allActionsList.extend(subControlAreaActionList) #Empty actionlist for the 'Command Area' commandActionLists = [] #Append empty 'lists' in 'commandActionLists equal to the #number of actions in subControlArea for i in range(len(subControlAreaActionList)): lst = [] commandActionLists.append(lst) params = (subControlAreaActionList, commandActionLists, allActionsList) return params
def getFlyoutActionList(self): #Ninad 20070618 """ Returns a tuple that contains mode spcific actionlists in the added in the flyout toolbar of the mode. CommandToolbar._createFlyoutToolBar method calls this @return: params: A tuple that contains 3 lists: (subControlAreaActionList, commandActionLists, allActionsList) """ #'allActionsList' returns all actions in the flyout toolbar #including the subcontrolArea actions allActionsList = [] #Action List for subcontrol Area buttons. #In this mode, there is really no subcontrol area. #We will treat subcontrol area same as 'command area' #(subcontrol area buttons will have an empty list as their command area #list). We will set the Comamnd Area palette background color to the #subcontrol area. subControlAreaActionList =[] subControlAreaActionList.append(self.exitModeAction) separator = QAction(self.win) separator.setSeparator(True) subControlAreaActionList.append(separator) subControlAreaActionList.append(self.win.toolsMoveMoleculeAction) subControlAreaActionList.append(self.win.rotateComponentsAction) subControlAreaActionList.append(self.win.modifyAlignCommonAxisAction) allActionsList.extend(subControlAreaActionList) #Empty actionlist for the 'Command Area' commandActionLists = [] #Append empty 'lists' in 'commandActionLists equal to the #number of actions in subControlArea for i in range(len(subControlAreaActionList)): lst = [] commandActionLists.append(lst) params = (subControlAreaActionList, commandActionLists, allActionsList) return params
def getFlyoutActionList(self): #Ninad 20070618 """ Returns a tuple that contains mode spcific actionlists in the added in the flyout toolbar of the mode. CommandToolbar._createFlyoutToolBar method calls this @return: params: A tuple that contains 3 lists: (subControlAreaActionList, commandActionLists, allActionsList) """ #'allActionsList' returns all actions in the flyout toolbar #including the subcontrolArea actions allActionsList = [] #Action List for subcontrol Area buttons. #In this mode, there is really no subcontrol area. #We will treat subcontrol area same as 'command area' #(subcontrol area buttons will have an empty list as their command area #list). We will set the Comamnd Area palette background color to the #subcontrol area. subControlAreaActionList = [] subControlAreaActionList.append(self.exitModeAction) separator = QAction(self.win) separator.setSeparator(True) subControlAreaActionList.append(separator) subControlAreaActionList.append(self.win.toolsMoveMoleculeAction) subControlAreaActionList.append(self.win.rotateComponentsAction) subControlAreaActionList.append(self.win.modifyAlignCommonAxisAction) allActionsList.extend(subControlAreaActionList) #Empty actionlist for the 'Command Area' commandActionLists = [] #Append empty 'lists' in 'commandActionLists equal to the #number of actions in subControlArea for i in range(len(subControlAreaActionList)): lst = [] commandActionLists.append(lst) params = (subControlAreaActionList, commandActionLists, allActionsList) return params
def getFlyoutActionList(self): """ returns custom actionlist that will be used in a specific mode or editing a feature etc Example: while in movie mode, the _createFlyoutToolBar method calls this """ #'allActionsList' returns all actions in the flyout toolbar #including the subcontrolArea actions allActionsList = [] #Action List for subcontrol Area buttons. #In this mode there is really no subcontrol area. #We will treat subcontrol area same as 'command area' #(subcontrol area buttons will have an empty list as their command area #list). We will set the Comamnd Area palette background color to the #subcontrol area. subControlAreaActionList =[] self.exitEditCommandAction.setChecked(True) subControlAreaActionList.append(self.exitEditCommandAction) separator = QAction(self.w) separator.setSeparator(True) subControlAreaActionList.append(separator) allActionsList.extend(subControlAreaActionList) #Empty actionlist for the 'Command Area' commandActionLists = [] #Append empty 'lists' in 'commandActionLists equal to the #number of actions in subControlArea for i in range(len(subControlAreaActionList)): lst = [] commandActionLists.append(lst) params = (subControlAreaActionList, commandActionLists, allActionsList) return params
def _create_context_menu(self): self.plugin_view.setContextMenuPolicy(Qt.ActionsContextMenu) self.install_action = QAction(QIcon(I('plugins/plugin_upgrade_ok.png')), _('&Install'), self) self.install_action.setToolTip(_('Install the selected plugin')) self.install_action.triggered.connect(self._install_clicked) self.install_action.setEnabled(False) self.plugin_view.addAction(self.install_action) self.history_action = QAction(QIcon(I('chapters.png')), _('Version &History'), self) self.history_action.setToolTip(_('Show history of changes to this plugin')) self.history_action.triggered.connect(self._history_clicked) self.history_action.setEnabled(False) self.plugin_view.addAction(self.history_action) self.forum_action = QAction(QIcon(I('plugins/mobileread.png')), _('Plugin &Forum Thread'), self) self.forum_action.triggered.connect(self._forum_label_activated) self.forum_action.setEnabled(False) self.plugin_view.addAction(self.forum_action) sep1 = QAction(self) sep1.setSeparator(True) self.plugin_view.addAction(sep1) self.toggle_enabled_action = QAction(_('Enable/&Disable plugin'), self) self.toggle_enabled_action.setToolTip(_('Enable or disable this plugin')) self.toggle_enabled_action.triggered.connect(self._toggle_enabled_clicked) self.toggle_enabled_action.setEnabled(False) self.plugin_view.addAction(self.toggle_enabled_action) self.uninstall_action = QAction(_('&Remove plugin'), self) self.uninstall_action.setToolTip(_('Uninstall the selected plugin')) self.uninstall_action.triggered.connect(self._uninstall_clicked) self.uninstall_action.setEnabled(False) self.plugin_view.addAction(self.uninstall_action) sep2 = QAction(self) sep2.setSeparator(True) self.plugin_view.addAction(sep2) self.donate_enabled_action = QAction(QIcon(I('donate.png')), _('Donate to developer'), self) self.donate_enabled_action.setToolTip(_('Donate to the developer of this plugin')) self.donate_enabled_action.triggered.connect(self._donate_clicked) self.donate_enabled_action.setEnabled(False) self.plugin_view.addAction(self.donate_enabled_action) sep3 = QAction(self) sep3.setSeparator(True) self.plugin_view.addAction(sep3) self.configure_action = QAction(QIcon(I('config.png')), _('&Customize plugin'), self) self.configure_action.setToolTip(_('Customize the options for this plugin')) self.configure_action.triggered.connect(self._configure_clicked) self.configure_action.setEnabled(False) self.plugin_view.addAction(self.configure_action)
def getFlyoutActionList(self): """ Returns a tuple that contains mode spcific actionlists in the added in the flyout toolbar of the mode. CommandToolbar._createFlyoutToolBar method calls this @return: params: A tuple that contains 3 lists: (subControlAreaActionList, commandActionLists, allActionsList) """ #ninad070330 This implementation may change in future. #'allActionsList' returns all actions in the flyout toolbar #including the subcontrolArea actions. allActionsList = [] #Action List for subcontrol Area buttons. #For now this list is just used to set a different palette to thisaction #buttons in the toolbar subControlAreaActionList =[] #Append subcontrol area actions to subControlAreaActionList #The 'Exit button' althought in the subcontrol area, would #look as if its in the Control area because of the different color #palette #and the separator after it. This is intentional. subControlAreaActionList.append(self.exitModeAction) separator1 = QAction(self.win) separator1.setSeparator(True) subControlAreaActionList.append(separator1) subControlAreaActionList.append(self.atomsToolAction) subControlAreaActionList.append(self.bondsToolAction) separator = QAction(self.win) separator.setSeparator(True) subControlAreaActionList.append(separator) #Also add the subcontrol Area actions to the 'allActionsList' for a in subControlAreaActionList: allActionsList.append(a) ##actionlist.append(self.win.modifyAdjustSelAction) ##actionlist.append(self.win.modifyAdjustAllAction) #Ninad 070330: #Command Actions : These are the actual actions that will respond the #a button pressed in the 'subControlArea (if present). #Each Subcontrol area button can have its own 'command list' #The subcontrol area buuton and its command list form a 'key:value pair #in a python dictionary object #In Build mode, as of 070330 we have 3 subcontrol area buttons #(or 'actions)' commandActionLists = [] #Append empty 'lists' in 'commandActionLists equal to the #number of actions in subControlArea for i in range(len(subControlAreaActionList)): lst = [] commandActionLists.append(lst) #Command list for the subcontrol area button 'Atoms Tool' #For others, this list will remain empty for now -- ninad070330 depositAtomsCmdLst = [] depositAtomsCmdLst.append(self.win.modifyHydrogenateAction) depositAtomsCmdLst.append(self.win.modifyDehydrogenateAction) depositAtomsCmdLst.append(self.win.modifyPassivateAction) separatorAfterPassivate = QAction(self.win) separatorAfterPassivate.setSeparator(True) depositAtomsCmdLst.append(separatorAfterPassivate) depositAtomsCmdLst.append(self.transmuteAtomsAction) separatorAfterTransmute = QAction(self.win) separatorAfterTransmute.setSeparator(True) depositAtomsCmdLst.append(separatorAfterTransmute) depositAtomsCmdLst.append(self.win.modifyDeleteBondsAction) depositAtomsCmdLst.append(self.win.modifySeparateAction) depositAtomsCmdLst.append(self.win.makeChunkFromSelectedAtomsAction) commandActionLists[2].extend(depositAtomsCmdLst) ##for action in self.win.buildToolsMenu.actions(): ##commandActionLists[2].append(action) # Command list for the subcontrol area button 'Bonds Tool' # For others, this list will remain empty for now -- ninad070405 bondsToolCmdLst = [] bondsToolCmdLst.append(self.bond1Action) bondsToolCmdLst.append(self.bond2Action) bondsToolCmdLst.append(self.bond3Action) bondsToolCmdLst.append(self.bondaAction) bondsToolCmdLst.append(self.bondgAction) bondsToolCmdLst.append(self.cutBondsAction) commandActionLists[3].extend(bondsToolCmdLst) params = (subControlAreaActionList, commandActionLists, allActionsList) return params
def getFlyoutActionList(self): """ Returns a tuple that contains mode spcific actionlists in the added in the flyout toolbar of the mode. CommandToolbar._createFlyoutToolBar method calls this @return: params: A tuple that contains 3 lists: (subControlAreaActionList, commandActionLists, allActionsList) """ allActionsList = [] subControlAreaActionList =[] #Append subcontrol area actions to subControlAreaActionList #The 'Exit button' althought in the subcontrol area, would #look as if its in the Control area because of the different color #palette #and the separator after it. This is intentional. subControlAreaActionList.append(self.exitModeAction) separator1 = QAction(self.win) separator1.setSeparator(True) subControlAreaActionList.append(separator1) subControlAreaActionList.append(self.modelProteinAction) subControlAreaActionList.append(self.simulateProteinAction) separator = QAction(self.win) separator.setSeparator(True) subControlAreaActionList.append(separator) #Also add the subcontrol Area actions to the 'allActionsList' for a in subControlAreaActionList: allActionsList.append(a) commandActionLists = [] #Append empty 'lists' in 'commandActionLists equal to the #number of actions in subControlArea for i in range(len(subControlAreaActionList)): lst = [] commandActionLists.append(lst) #Command list for the subcontrol area button 'Model Proteins Tool' modelProteinsCmdLst = [] modelProteinsCmdLst.append(self.buildPeptideAction) modelProteinsCmdLst.append(self.compareProteinsAction) modelProteinsCmdLst.append(self.displayProteinStyleAction) commandActionLists[2].extend(modelProteinsCmdLst) # Command list for the subcontrol area button 'Simulate Proteins Tool' if self.rosetta_enabled: simulateProteinsCmdLst = [] simulateProteinsCmdLst.append(self.rosetta_fixedbb_design_Action) simulateProteinsCmdLst.append(self.rosetta_backrub_Action) simulateProteinsCmdLst.append(self.editResiduesAction) simulateProteinsCmdLst.append(self.rosetta_score_Action) commandActionLists[3].extend(simulateProteinsCmdLst) else: modelProteinsCmdLst = [] modelProteinsCmdLst.append(self.buildPeptideAction) modelProteinsCmdLst.append(self.compareProteinsAction) modelProteinsCmdLst.append(self.displayProteinStyleAction) commandActionLists[0].extend(modelProteinsCmdLst) params = (subControlAreaActionList, commandActionLists, allActionsList) return params
def getFlyoutActionList(self): """ Returns a tuple that contains mode spcific actionlists in the added in the flyout toolbar of the mode. CommandToolbar._createFlyoutToolBar method calls this @return: params: A tuple that contains 3 lists: (subControlAreaActionList, commandActionLists, allActionsList) """ #ninad070330 This implementation may change in future. #'allActionsList' returns all actions in the flyout toolbar #including the subcontrolArea actions. allActionsList = [] #Action List for subcontrol Area buttons. #For now this list is just used to set a different palette to thisaction #buttons in the toolbar subControlAreaActionList = [] #Append subcontrol area actions to subControlAreaActionList #The 'Exit button' althought in the subcontrol area, would #look as if its in the Control area because of the different color #palette #and the separator after it. This is intentional. subControlAreaActionList.append(self.exitModeAction) separator1 = QAction(self.win) separator1.setSeparator(True) subControlAreaActionList.append(separator1) subControlAreaActionList.append(self.atomsToolAction) subControlAreaActionList.append(self.bondsToolAction) separator = QAction(self.win) separator.setSeparator(True) subControlAreaActionList.append(separator) #Also add the subcontrol Area actions to the 'allActionsList' for a in subControlAreaActionList: allActionsList.append(a) ##actionlist.append(self.win.modifyAdjustSelAction) ##actionlist.append(self.win.modifyAdjustAllAction) #Ninad 070330: #Command Actions : These are the actual actions that will respond the #a button pressed in the 'subControlArea (if present). #Each Subcontrol area button can have its own 'command list' #The subcontrol area buuton and its command list form a 'key:value pair #in a python dictionary object #In Build mode, as of 070330 we have 3 subcontrol area buttons #(or 'actions)' commandActionLists = [] #Append empty 'lists' in 'commandActionLists equal to the #number of actions in subControlArea for i in range(len(subControlAreaActionList)): lst = [] commandActionLists.append(lst) #Command list for the subcontrol area button 'Atoms Tool' #For others, this list will remain empty for now -- ninad070330 depositAtomsCmdLst = [] depositAtomsCmdLst.append(self.win.modifyHydrogenateAction) depositAtomsCmdLst.append(self.win.modifyDehydrogenateAction) depositAtomsCmdLst.append(self.win.modifyPassivateAction) separatorAfterPassivate = QAction(self.win) separatorAfterPassivate.setSeparator(True) depositAtomsCmdLst.append(separatorAfterPassivate) depositAtomsCmdLst.append(self.transmuteAtomsAction) separatorAfterTransmute = QAction(self.win) separatorAfterTransmute.setSeparator(True) depositAtomsCmdLst.append(separatorAfterTransmute) depositAtomsCmdLst.append(self.win.modifyDeleteBondsAction) depositAtomsCmdLst.append(self.win.modifySeparateAction) depositAtomsCmdLst.append(self.win.makeChunkFromSelectedAtomsAction) commandActionLists[2].extend(depositAtomsCmdLst) ##for action in self.win.buildToolsMenu.actions(): ##commandActionLists[2].append(action) # Command list for the subcontrol area button 'Bonds Tool' # For others, this list will remain empty for now -- ninad070405 bondsToolCmdLst = [] bondsToolCmdLst.append(self.bond1Action) bondsToolCmdLst.append(self.bond2Action) bondsToolCmdLst.append(self.bond3Action) bondsToolCmdLst.append(self.bondaAction) bondsToolCmdLst.append(self.bondgAction) bondsToolCmdLst.append(self.cutBondsAction) commandActionLists[3].extend(bondsToolCmdLst) params = (subControlAreaActionList, commandActionLists, allActionsList) return params