def updateToolBar(self): QCellToolBar.updateToolBar(self) sw = self.getSnappedWidget() for action in self.actions(): if type(action) == ViewLayerAction: #disenable all action refering to data we don't have action.setEnabled(action.tag in sw.all_layers)
def createToolBar(self): """ createToolBar() -> None This will get call initially to add customizable widgets """ QCellToolBar.updateToolBar(self) sw = self.getSnappedWidget() actions = [] self.appendAction(sync_changes(self)) lyrs_label = QtGui.QLabel() # lyrs_label.setText("Layers:") # self.appendWidget(lyrs_label) # for action_dict in actions: # self.appendAction(ViewLayerAction(action_dict, self)) nav_label = QtGui.QLabel() nav_label.setText(" Navigation:") self.addSeparator() self.addSeparator() self.appendWidget(nav_label) # self.appendAction(viewTitleLegend(self)) self.appendAction(fullExtent(self)) mplActions = [{"icon":"move.png", "checked":True, "label":"Pan", "tooltip":"Pan axes with left mouse, zoom with right", "checkable":True, "actionfunc":"pan"}, {"icon":"zoom.png", "checked":False, "label":"Zoom", "tooltip":"Zoom to rectangle", "checkable":True, "actionfunc":"zoom"}, {"icon":"back.png", "checked":False, "label":"Last Extent", "tooltip":"Back to previous view", "checkable":False, "actionfunc":"back"}, {"icon":"forward.png", "checked":False, "label":"Next Extent", "tooltip":"Forward to next extent", "checkable":False, "actionfunc":"forward"}, {"icon":"filesave.png", "checked":False, "label":"Save", "tooltip":"Save the figure", "checkable":False, "actionfunc":"save_figure"},] for action_dict in mplActions: self.appendAction(MPL_action(action_dict, self))
def updateToolBar(self): QCellToolBar.updateToolBar(self) sw = self.getSnappedWidget() # for action in self.actions(): # if type(action) == ViewLayerAction: # #disenable all action refering to data we don't have # action.setEnabled(sw.all_layers[action.tag]['enabled']) #Strip out the unused actions keep_actions = ['Zoom', 'Save', 'Back', 'Forward', 'Pan'] keep_actions = [] for action in sw.mpl_toolbar.actions(): if not action.text() in keep_actions and action.text(): continue if action.text() == 'Zoom': icon = os.path.abspath(os.path.join( os.path.dirname(__file__), "Images", "zoom.png")) action.setIcon(QtGui.QIcon(icon)) if action.text() == 'Pan': action.setChecked(True) self.appendAction(action) sw.popMenu = self.gen_popup_menu()
def createToolBar(self): """ createToolBar() -> None This will get call initially to add customizable widgets """ QCellToolBar.createToolBar(self) self.appendAction(QCellToolBarShowLabels(self))