def _init_context_menu(self): MatplotlibWidget._init_context_menu(self) self._graph_menu.addSeparator() self._graph_menu.addAction( QtGui.QAction(QtGui.QIcon(":/graph_smooth.svg"), "S&mooth...", self, triggered=self._smooth))
def _createActions(self): self.generateControlAction = QtGui.QAction( QtGui.QIcon(":/document_edit_24x32.png"), "&Edit ctr file...", self, triggered=self.viewControl, shortcut='Ctrl+E') self.generateControlAction.setToolTip("Edit LEED control file...")
def _init_context_menu(self): import res_rc self._graph_menu = QtGui.QMenu() self._graph_menu.addAction( QtGui.QAction(QtGui.QIcon(":/arrow_right.svg"), "&Export graph", self, triggered=self._export, shortcut='Ctrl+Shift+E')) self._graph_menu.addAction( QtGui.QAction(QtGui.QIcon(":/save.svg"), "&Save data", self, triggered=self._save, shortcut='Ctrl+S')) self.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) self.customContextMenuRequested.connect(self._popupMenu)
def __init__(self, parent=None): super(ProjectTreeWidget, self).__init__(parent) self.setColumnCount(1) self.setHeaderLabel("Projects") # explorer actions self.renameAction = QtGui.QAction(QtGui.QIcon(":/tag_stroke.svg"), "&Rename", self, triggered=self.rename) self.renameAction.setToolTip("Rename project...") self.refreshAction = QtGui.QAction(QtGui.QIcon(":/spin.svg"), "Refresh", self, triggered=self.refresh, shortcut="F5") self.refreshAction.setToolTip("Refresh") self.newProjectAction = QtGui.QAction( QtGui.QIcon(":/document_alt_stroke.svg"), "&New Project", self, triggered=self.newProject) self.newProjectAction.setToolTip("Create new project...") self.importProjectAction = QtGui.QAction(QtGui.QIcon(":/import.svg"), "&Import Project", self, triggered=self.importProject) self.importProjectAction.setToolTip("Import existing project...") self.newModelAction = QtGui.QAction(QtGui.QIcon(":/atoms.svg"), "&New Model", self, triggered=self.newModel) self.newModelAction.setToolTip("Create new model...") self.importModelAction = QtGui.QAction(QtGui.QIcon(":/import.svg"), "&Import Model", self, triggered=self.importModel) self.importModelAction.setToolTip("Import existing model...") self.removeProjectAction = QtGui.QAction(QtGui.QIcon(":/x.svg"), "&Remove Project", self, triggered=self.removeProject, shortcut='Del') self.newProjectAction.setToolTip("Remove project") self.removeProjectAction = QtGui.QAction( QtGui.QIcon(":/folder_fill.svg"), "Open Project &Location", self, triggered=self.removeProject) self.newProjectAction.setToolTip( "Opens project location in file explorer") # explorer menus self.explorerDefaultMenu = QtGui.QMenu() self.explorerDefaultMenu.addAction(self.newProjectAction) self.explorerDefaultMenu.addAction(self.importProjectAction) self.explorerDefaultMenu.addSeparator() #self.explorerDefaultMenu.addAction(self.copyAction) #self.explorerDefaultMenu.addAction(self.cutAction) #self.explorerDefaultMenu.addAction(self.pasteAction) self.explorerDefaultMenu.addAction(self.renameAction) self.explorerDefaultMenu.addSeparator() self.explorerDefaultMenu.addAction(self.refreshAction) self.explorerProjectMenu = QtGui.QMenu() self.explorerProjectMenu.addAction(self.newModelAction) self.explorerProjectMenu.addAction(self.importModelAction) #self.explorerProjectMenu.addSeparator() #self.explorerProjectMenu.addAction(self.copyAction) #self.explorerProjectMenu.addAction(self.cutAction) #self.explorerProjectMenu.addAction(self.pasteAction) self.explorerProjectMenu.addAction(self.renameAction) self.explorerProjectMenu.addAction(self.removeProjectAction) self.explorerProjectMenu.addSeparator() self.explorerProjectMenu.addAction(self.refreshAction) self.explorerFileMenu = QtGui.QMenu() #self.explorerFileMenu.addAction(self.newAction) self.explorerFileMenu.addAction(self.refreshAction) #setup signals and slots self.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) self.customContextMenuRequested.connect(self.explorerPopupMenu) #recent projects self.recent_projects = []