def __init__(self, parent, menu, toolbar): QObject.__init__(self, parent) self._currier = PersistentCurrier() # get list of mouse modes from config modelist = [] for mid in Config.get("mouse-modes", _DefaultModes).split(","): if not ConfigFile.has_section(mid): print("ERROR: unknown mouse-mode '%s', skipping. Check your %s." % (mid, ConfigFileName)) else: modelist.append(self._readModeConfig(mid)) self._modes = dict([(mode.id, mode) for mode in modelist]) self._qag_mode = QActionGroup(self) self._qag_submode = QActionGroup(self) self._all_submodes = [] # make entries for main modes for mode in modelist: mode.addAction(menu, self._qag_mode, callback=self._currier.curry(self._setMode, mode.id)) if mode.submodes: self._all_submodes += list(mode.submodes) # make entries for submodes self._qa_submode_sep = menu.addSeparator() self._modes.update([(mode.id, mode) for mode in self._all_submodes]) for mode in self._all_submodes: mode.addAction(menu, self._qag_submode, toolbar=toolbar, callback=self._currier.curry(self._setSubmode, mode.id)) # other init self._current_context = None self._available_submodes = [] # set initial mode initmode = Config.get("current-mouse-mode", _DefaultInitialMode) if initmode not in self._modes: initmode = modelist[0].id self._modes[initmode].qa.setChecked(True) self._setMode(initmode, write_config=False)
def __init__(self, parent=None): QObject.__init__(self, parent) self.free = [-1, -1, -1] self.count = 0 self.location_actions = QActionGroup(self) self.location_actions.setExclusive(True) self.current_location = 'library' self._mem = [] self.tooltips = {} self.all_actions = [] def ac(name, text, icon, tooltip): icon = QIcon(I(icon)) ac = self.location_actions.addAction(icon, text) setattr(self, 'location_' + name, ac) ac.setAutoRepeat(False) ac.setCheckable(True) receiver = partial(self._location_selected, name) ac.triggered.connect(receiver) self.tooltips[name] = tooltip m = QMenu(parent) self._mem.append(m) a = m.addAction(icon, tooltip) a.triggered.connect(receiver) if name != 'library': self._mem.append(a) a = m.addAction(QIcon(I('eject.png')), _('Eject this device')) a.triggered.connect(self._eject_requested) self._mem.append(a) a = m.addAction(QIcon(I('config.png')), _('Configure this device')) a.triggered.connect(self._configure_requested) self._mem.append(a) a = m.addAction(QIcon(I('sync.png')), _('Update cached metadata on device')) a.triggered.connect( lambda x: self.update_device_metadata.emit()) self._mem.append(a) else: ac.setToolTip(tooltip) ac.setMenu(m) ac.calibre_name = name self.all_actions.append(ac) return ac self.library_action = ac('library', _('Library'), 'lt.png', _('Show books in calibre library')) ac('main', _('Device'), 'reader.png', _('Show books in the main memory of the device')) ac('carda', _('Card A'), 'sd.png', _('Show books in storage card A')) ac('cardb', _('Card B'), 'sd.png', _('Show books in storage card B'))
def _createSimulateProteinsActions(self, parentWidget): """ Create the actions to be included in flyout toolbar, when the 'Simulate Proteins' is active. @see: self._createActions() where this is called. """ self.subControlActionGroupForSimulateProtein = QActionGroup( parentWidget) # Shouldn't the parent be self.win? # Isn't parentWidget = BuildProteinPropertyManager? # Ask Bruce about this. --Mark 2008-12-07. self.subControlActionGroupForSimulateProtein.setExclusive(True) self.rosetta_fixedbb_design_Action = \ NE1_QWidgetAction(self.subControlActionGroupForSimulateProtein, win = self.win) self.rosetta_fixedbb_design_Action.setText("Fixed BB") self.rosetta_fixedbb_design_Action.setCheckable(True) self.rosetta_fixedbb_design_Action.setIcon( geticon( "ui/actions/Command Toolbar/BuildProtein/FixedBackbone.png")) self.rosetta_backrub_Action = \ NE1_QWidgetAction(self.subControlActionGroupForSimulateProtein, win = self.win) self.rosetta_backrub_Action.setText("Backrub") self.rosetta_backrub_Action.setCheckable(True) self.rosetta_backrub_Action.setIcon( geticon("ui/actions/Command Toolbar/BuildProtein/Backrub.png")) self.editResiduesAction = \ NE1_QWidgetAction(self.subControlActionGroupForSimulateProtein, win = self.win) self.editResiduesAction.setText("Residues") self.editResiduesAction.setCheckable(True) self.editResiduesAction.setIcon( geticon("ui/actions/Command Toolbar/BuildProtein/Residues.png")) self.rosetta_score_Action = \ NE1_QWidgetAction(self.subControlActionGroupForSimulateProtein, win = self.win) self.rosetta_score_Action.setText("Score") self.rosetta_score_Action.setCheckable(True) self.rosetta_score_Action.setIcon( geticon("ui/actions/Command Toolbar/BuildProtein/Score.png")) self.subControlActionGroupForSimulateProtein.addAction( self.rosetta_fixedbb_design_Action) self.subControlActionGroupForSimulateProtein.addAction( self.rosetta_backrub_Action) self.subControlActionGroupForSimulateProtein.addAction( self.editResiduesAction) self.subControlActionGroupForSimulateProtein.addAction( self.rosetta_score_Action) return
def _createActions(self, parentWidget): """ Define flyout toolbar actions for this mode. """ #@NOTE: In Build mode, some of the actions defined in this method are also #used in Build Atoms PM. (e.g. bond actions) So probably better to rename #it as _init_modeActions. Not doing that change in mmkit code cleanup #commit(other modes still implement a method by same name)-ninad20070717 _superclass._createActions(self, parentWidget) # The subControlActionGroup is the parent of all flyout QActions. self.subControlActionGroup = QActionGroup(parentWidget) # Shouldn't the parent be self.win? # Isn't parentWidget = BuildAtomsPropertyManager. # Ask Bruce about this. --Mark 2008-12-07. self.subControlActionGroup.setExclusive(True) #Following Actions are added in the Flyout toolbar. #Defining them outside that method as those are being used #by the subclasses of deposit mode (testmode.py as of 070410) -- ninad self.atomsToolAction = \ NE1_QWidgetAction(self.subControlActionGroup, win = self.win) self.atomsToolAction.setText("Atoms Tool") self.atomsToolAction.setIcon( geticon("ui/actions/Command Toolbar/BuildAtoms/AtomsTool.png")) self.atomsToolAction.setCheckable(True) self.atomsToolAction.setChecked(True) self.atomsToolAction.setObjectName('ACTION_ATOMS_TOOL') self.bondsToolAction = \ NE1_QWidgetAction(self.subControlActionGroup, win = self.win) self.bondsToolAction.setText("Bonds Tool") self.bondsToolAction.setIcon( geticon("ui/actions/Command Toolbar/BuildAtoms/BondsTool.png")) self.bondsToolAction.setCheckable(True) self.bondsToolAction.setObjectName('ACTION_BOND_TOOL') self.subControlActionGroup.addAction(self.atomsToolAction) self.subControlActionGroup.addAction(self.bondsToolAction) self.transmuteAtomsAction = \ NE1_QWidgetAction(self.subControlActionGroup, win = self.win) self.transmuteAtomsAction.setText("Transmute Atoms") self.transmuteAtomsAction.setIcon( geticon( "ui/actions/Command Toolbar/BuildAtoms/TransmuteAtoms.png")) self.transmuteAtomsAction.setCheckable(False) self._createBondToolActions(parentWidget)
def _createActions(self, parentWidget): """ Define flyout toolbar actions for this mode. """ _superclass._createActions(self, parentWidget) #Urmi 20080814: show this flyout toolbar only when rosetta plugin path # is there #Probably only rosetta_enabled_prefs_key check would have sufficed plugin_name = "ROSETTA" plugin_prefs_keys = (rosetta_enabled_prefs_key, rosetta_path_prefs_key) errorcode, errortext_or_path = \ checkPluginPreferences(plugin_name, plugin_prefs_keys, ask_for_help = False) #print "Error code =", errorcode, errortext_or_path if errorcode == 0: self.rosetta_enabled = True else: self.rosetta_enabled = False # The subControlActionGroup is the parent of all flyout QActions. self.subControlActionGroup = QActionGroup(parentWidget) # Shouldn't the parent be self.win? # Isn't parentWidget = BuildProteinPropertyManager? # Ask Bruce about this. --Mark 2008-12-07. self.subControlActionGroup.setExclusive(True) self.modelProteinAction = \ NE1_QWidgetAction(self.subControlActionGroup, win = self.win) self.modelProteinAction.setText("Model") self.modelProteinAction.setIcon(geticon( 'ui/actions/Command Toolbar/BuildProtein/ModelProtein.png')) self.modelProteinAction.setCheckable(True) self.modelProteinAction.setChecked(True) self.modelProteinAction.setObjectName('ACTION_MODEL_PROTEINS') self.simulateProteinAction = \ NE1_QWidgetAction(self.subControlActionGroup, win = self.win) self.simulateProteinAction.setText("Simulate") self.simulateProteinAction.setIcon(geticon( "ui/actions/Command Toolbar/BuildProtein/Simulate.png")) self.simulateProteinAction.setCheckable(True) self.simulateProteinAction.setObjectName('ACTION_SIMULATE_PROTEINS') self.subControlActionGroup.addAction(self.modelProteinAction) self.subControlActionGroup.addAction(self.simulateProteinAction) self._createModelProteinsActions(parentWidget) self._createSimulateProteinsActions(parentWidget)
def __init__(self, parent): QMenu.__init__(self, _('Choose theme (needs restart)')) parent.addMenu(self) self.group = QActionGroup(self) current = prefs['theme'] alls = list(sorted(get_all_styles())) if current not in alls: current = prefs['theme'] = 'default' self.actions = [] for style in alls: ac = self.group.addAction(style) ac.setCheckable(True) if current == style: ac.setChecked(True) self.actions.append(ac) ac.triggered.connect(partial(self.set_theme, style)) self.addAction(ac)
def _createModelProteinsActions(self, parentWidget): """ Create the actions to be included in flyout toolbar, when the 'Model Proteins' is active. @see: self._createActions() where this is called. """ self.subControlActionGroupForModelProtein = QActionGroup(parentWidget) # Shouldn't the parent be self.win? # Isn't parentWidget = BuildProteinPropertyManager? # Ask Bruce about this. --Mark 2008-12-07. self.subControlActionGroupForModelProtein.setExclusive(True) self.buildPeptideAction = \ NE1_QWidgetAction(self.subControlActionGroupForModelProtein, win = self.win) self.buildPeptideAction.setText("Insert Peptide") self.buildPeptideAction.setCheckable(True) self.buildPeptideAction.setIcon( geticon( "ui/actions/Command Toolbar/BuildProtein/InsertPeptide.png")) self.compareProteinsAction = \ NE1_QWidgetAction(self.subControlActionGroupForModelProtein, win = self.win) self.compareProteinsAction.setText("Compare") self.compareProteinsAction.setCheckable(True) self.compareProteinsAction.setIcon( geticon("ui/actions/Command Toolbar/BuildProtein/Compare.png")) self.displayProteinStyleAction = \ NE1_QWidgetAction(self.subControlActionGroupForModelProtein, win = self.win) self.displayProteinStyleAction.setText("Edit Style") self.displayProteinStyleAction.setCheckable(True) self.displayProteinStyleAction.setIcon( geticon( "ui/actions/Command Toolbar/BuildProtein/EditProteinDisplayStyle.png" )) self.subControlActionGroupForModelProtein.addAction( self.buildPeptideAction) self.subControlActionGroupForModelProtein.addAction( self.displayProteinStyleAction) self.subControlActionGroupForModelProtein.addAction( self.compareProteinsAction) return
def __init__(self, *args): QWidget.__init__(self, *args) # init layout self._lo = QVBoxLayout(self) self._lo.setContentsMargins(0, 0, 0, 0) self._lo.setSpacing(0) # init internal state self._currier = PersistentCurrier() self._z0 = 0 # z-depth of first image, the rest count down from it self._updating_imap = False self._locked_display_range = False self._imagecons = [] self._imagecon_loadorder = [] self._center_image = None self._plot = None self._border_pen = None self._drawing_key = None self._load_image_dialog = None self._model_imagecons = set() # init menu and standard actions self._menu = QMenu("&Image", self) qag = QActionGroup(self) # exclusive controls for plotting topmost or all images self._qa_plot_top = qag.addAction("Display topmost image only") self._qa_plot_all = qag.addAction("Display all images") self._qa_plot_top.setCheckable(True) self._qa_plot_all.setCheckable(True) self._qa_plot_top.setChecked(True) QObject.connect(self._qa_plot_all, SIGNAL("toggled(bool)"), self._displayAllImages) self._closing = False self._qa_load_clipboard = None self._clipboard_mode = QClipboard.Clipboard QObject.connect(QApplication.clipboard(), SIGNAL("changed(QClipboard::Mode)"), self._checkClipboardPath) # populate the menu self._repopulateMenu()
def __init__(self, parent): QWidget.__init__(self, parent) self.parent = parent self._layout = QVBoxLayout() self.setLayout(self._layout) self._layout.setContentsMargins(0,0,0,0) # Set up the find box & button search_layout = QHBoxLayout() self._layout.addLayout(search_layout) self.item_search = HistoryLineEdit(parent) self.item_search.setMinimumContentsLength(5) self.item_search.setSizeAdjustPolicy(self.item_search.AdjustToMinimumContentsLengthWithIcon) try: self.item_search.lineEdit().setPlaceholderText( _('Find item in tag browser')) except: pass # Using Qt < 4.7 self.item_search.setToolTip(_( 'Search for items. This is a "contains" search; items containing the\n' 'text anywhere in the name will be found. You can limit the search\n' 'to particular categories using syntax similar to search. For example,\n' 'tags:foo will find foo in any tag, but not in authors etc. Entering\n' '*foo will filter all categories at once, showing only those items\n' 'containing the text "foo"')) search_layout.addWidget(self.item_search) # Not sure if the shortcut should be translatable ... sc = QShortcut(QKeySequence(_('ALT+f')), parent) sc.activated.connect(self.set_focus_to_find_box) self.search_button = QToolButton() self.search_button.setText(_('F&ind')) self.search_button.setToolTip(_('Find the first/next matching item')) search_layout.addWidget(self.search_button) self.expand_button = QToolButton() self.expand_button.setText('-') self.expand_button.setToolTip(_('Collapse all categories')) search_layout.addWidget(self.expand_button) search_layout.setStretch(0, 10) search_layout.setStretch(1, 1) search_layout.setStretch(2, 1) self.current_find_position = None self.search_button.clicked.connect(self.find) self.item_search.initialize('tag_browser_search') self.item_search.lineEdit().returnPressed.connect(self.do_find) self.item_search.lineEdit().textEdited.connect(self.find_text_changed) self.item_search.activated[QString].connect(self.do_find) self.item_search.completer().setCaseSensitivity(Qt.CaseSensitive) parent.tags_view = TagsView(parent) self.tags_view = parent.tags_view self.expand_button.clicked.connect(self.tags_view.collapseAll) self._layout.addWidget(parent.tags_view) # Now the floating 'not found' box l = QLabel(self.tags_view) self.not_found_label = l l.setFrameStyle(QFrame.StyledPanel) l.setAutoFillBackground(True) l.setText('<p><b>'+_('No More Matches.</b><p> Click Find again to go to first match')) l.setAlignment(Qt.AlignVCenter) l.setWordWrap(True) l.resize(l.sizeHint()) l.move(10,20) l.setVisible(False) self.not_found_label_timer = QTimer() self.not_found_label_timer.setSingleShot(True) self.not_found_label_timer.timeout.connect(self.not_found_label_timer_event, type=Qt.QueuedConnection) parent.alter_tb = l = QPushButton(parent) l.setText(_('Alter Tag Browser')) l.setIcon(QIcon(I('tags.png'))) l.m = QMenu() l.setMenu(l.m) self._layout.addWidget(l) sb = l.m.addAction(_('Sort by')) sb.m = l.sort_menu = QMenu(l.m) sb.setMenu(sb.m) sb.bg = QActionGroup(sb) # Must be in the same order as db2.CATEGORY_SORTS for i, x in enumerate((_('Sort by name'), _('Sort by number of books'), _('Sort by average rating'))): a = sb.m.addAction(x) sb.bg.addAction(a) a.setCheckable(True) if i == 0: a.setChecked(True) sb.setToolTip( _('Set the sort order for entries in the Tag Browser')) sb.setStatusTip(sb.toolTip()) ma = l.m.addAction(_('Search type when selecting multiple items')) ma.m = l.match_menu = QMenu(l.m) ma.setMenu(ma.m) ma.ag = QActionGroup(ma) # Must be in the same order as db2.MATCH_TYPE for i, x in enumerate((_('Match any of the items'), _('Match all of the items'))): a = ma.m.addAction(x) ma.ag.addAction(a) a.setCheckable(True) if i == 0: a.setChecked(True) ma.setToolTip( _('When selecting multiple entries in the Tag Browser ' 'match any or all of them')) ma.setStatusTip(ma.toolTip()) mt = l.m.addAction(_('Manage authors, tags, etc')) mt.setToolTip(_('All of these category_managers are available by right-clicking ' 'on items in the tag browser above')) mt.m = l.manage_menu = QMenu(l.m) mt.setMenu(mt.m)
def _createBondToolActions(self, parentWidget): """ Create the actions to be included in flyout toolbar , when the 'bonds tool' is active. Note that the object names of these action will be be used to find the Bond Tool type to which each action corresponds to. @see: self._createActions() where this is called. """ self.bondToolsActionGroup = QActionGroup(parentWidget) self.bondToolsActionGroup.setExclusive(True) self.bond1Action = \ NE1_QWidgetAction(self.bondToolsActionGroup, win = self.win) self.bond1Action.setText("Single") self.bond1Action.setIcon( geticon("ui/actions/Command Toolbar/BuildAtoms/SingleBond.png")) self.bond1Action.setObjectName('ACTION_SINGLE_BOND_TOOL') self.bond2Action = \ NE1_QWidgetAction(self.bondToolsActionGroup, win = self.win) self.bond2Action.setText("Double") self.bond2Action.setIcon( geticon("ui/actions/Command Toolbar/BuildAtoms/DoubleBond.png")) self.bond2Action.setObjectName('ACTION_DOUBLE_BOND_TOOL') self.bond3Action = \ NE1_QWidgetAction(self.bondToolsActionGroup, win = self.win) self.bond3Action.setText("Triple") self.bond3Action.setIcon( geticon("ui/actions/Command Toolbar/BuildAtoms/TripleBond.png")) self.bond3Action.setObjectName('ACTION_TRIPLE_BOND_TOOL') self.bondaAction = \ NE1_QWidgetAction(self.bondToolsActionGroup, win = self.win) self.bondaAction.setText("Aromatic") self.bondaAction.setIcon( geticon("ui/actions/Command Toolbar/BuildAtoms/AromaticBond.png")) self.bondaAction.setObjectName('ACTION_AROMATIC_BOND_TOOL') self.bondgAction = \ NE1_QWidgetAction(self.bondToolsActionGroup, win = self.win) self.bondgAction.setText("Graphitic") self.bondgAction.setIcon( geticon("ui/actions/Command Toolbar/BuildAtoms/GraphiticBond.png")) self.bondgAction.setObjectName('ACTION_GRAPHITIC_BOND_TOOL') self.cutBondsAction = \ NE1_QWidgetAction(self.bondToolsActionGroup, win = self.win) self.cutBondsAction.setText("Cut Bonds") self.cutBondsAction.setIcon( geticon("ui/actions/Command Toolbar/BuildAtoms/CutBonds.png")) self.cutBondsAction.setObjectName('ACTION_DELETE_BOND_TOOL') for action in [ self.bond1Action, self.bond2Action, self.bond3Action, self.bondaAction, self.bondgAction, self.cutBondsAction ]: self.bondToolsActionGroup.addAction(action) action.setCheckable(True) return
def _init_flyoutActions(self): """ Define flyout toolbar actions for this command """ #Create an action group and add all the cookie selection shape buttons to it self.cookieSelectionGroup = QActionGroup(self.w) #Action List for subcontrol Area buttons. #In cookie cutter, 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. This list will be used in getFlyoutActionList self.subControlAreaActionList = [] self.exitCrystalAction = NE1_QWidgetAction(self.w, win=self.w) self.exitCrystalAction.setText("Exit Crystal") self.exitCrystalAction.setCheckable(True) self.exitCrystalAction.setChecked(True) self.exitCrystalAction.setIcon( geticon('ui/actions/Toolbars/Smart/Exit.png')) self.subControlAreaActionList.append(self.exitCrystalAction) separator = QtGui.QAction(self.w) separator.setSeparator(True) self.subControlAreaActionList.append(separator) self.DefaultSelAction = NE1_QWidgetAction(self.w, win=self.w) self.DefaultSelAction.setObjectName("DEFAULT") self.DefaultSelAction.setText("Default") self.subControlAreaActionList.append(self.DefaultSelAction) self.DefaultSelAction.setToolTip("Default Selection (D)") self.DefaultSelAction.setWhatsThis("""<b>Default </b> <p> Defines the crystal shape as a polygon with the user specifying the sides </p>""") self.CircleSelAction = NE1_QWidgetAction(self.w, win=self.w) self.CircleSelAction.setObjectName("CIRCLE") self.CircleSelAction.setText("Circle") self.subControlAreaActionList.append(self.CircleSelAction) self.CircleSelAction.setToolTip("Circle (C)") self.CircleSelAction.setWhatsThis("""<b>Circle </b> <p> Draws the crystal geometry as a circle </p>""") self.RectCtrSelAction = NE1_QWidgetAction(self.w, win=self.w) self.RectCtrSelAction.setObjectName("RECTANGLE") self.RectCtrSelAction.setText("RectCenter") self.subControlAreaActionList.append(self.RectCtrSelAction) self.RectCtrSelAction.setToolTip("Rectangular Center (R)") self.RectCtrSelAction.setWhatsThis("""<b>Rectangle - Center Select</b> <p> Draws the crystal geometry as a rectangle with the cursor defining the center of the rectangle </p>""") self.HexagonSelAction = NE1_QWidgetAction(self.w, win=self.w) self.HexagonSelAction.setObjectName("HEXAGON") self.HexagonSelAction.setText("Hexagon") self.subControlAreaActionList.append(self.HexagonSelAction) self.HexagonSelAction.setToolTip("Hexagon (H)") self.HexagonSelAction.setWhatsThis("""<b>Hexagon </b> <p> Draws the crystal geometry as a hexagon </p>""") self.TriangleSelAction = NE1_QWidgetAction(self.w, win=self.w) self.TriangleSelAction.setObjectName("TRIANGLE") self.TriangleSelAction.setText("Triangle") self.subControlAreaActionList.append(self.TriangleSelAction) self.TriangleSelAction.setToolTip("Triangle (T)") self.TriangleSelAction.setWhatsThis("""<b>Triangle </b> <p> Draws the crystal geometry as a triangle </p>""") self.RectCornerSelAction = NE1_QWidgetAction(self.w, win=self.w) self.RectCornerSelAction.setObjectName("RECT_CORNER") self.RectCornerSelAction.setText("RectCorners") self.subControlAreaActionList.append(self.RectCornerSelAction) self.RectCornerSelAction.setToolTip("Rectangular Corner (Shift+R)") self.RectCornerSelAction.setWhatsThis( """<b>Rectangle - Corner Select</b> <p> Draws the crystal geometry as a rectangle with the cursor defining the initial corner </p>""") self.LassoSelAction = NE1_QWidgetAction(self.w, win=self.w) self.LassoSelAction.setObjectName("LASSO") self.LassoSelAction.setText("Lasso") self.subControlAreaActionList.append(self.LassoSelAction) self.LassoSelAction.setToolTip("Lasso (L)") self.LassoSelAction.setWhatsThis("""<b>Lasso</b> <p> Can be used to draw irregular crystal geometries </p>""") self.DiamondSelAction = NE1_QWidgetAction(self.w, win=self.w) self.DiamondSelAction.setObjectName("DIAMOND") self.DiamondSelAction.setText("Diamond") self.subControlAreaActionList.append(self.DiamondSelAction) self.DiamondSelAction.setToolTip("Diamond (D)") self.DiamondSelAction.setWhatsThis("""<b>Diamond</b> <p> Draws the crystal geometry as a diamond </p>""") self.SquareSelAction = NE1_QWidgetAction(self.w, win=self.w) self.SquareSelAction.setObjectName("SQUARE") self.SquareSelAction.setText("Square") self.subControlAreaActionList.append(self.SquareSelAction) self.SquareSelAction.setToolTip("Square(S)") self.SquareSelAction.setWhatsThis("""<b>Square</b> <p> Draws the crystal geometry as a square </p>""") for action in self.subControlAreaActionList[1:]: if isinstance(action, QtGui.QWidgetAction): action.setCheckable(True) self.cookieSelectionGroup.addAction(action) iconpath = "ui/actions/Toolbars/Smart/" + str( action.text()) + ".png" action.setIcon(geticon(iconpath)) if not self.cookieSelectionGroup.checkedAction(): self.DefaultSelAction.setChecked(True)