def setup_S_hybrid_buttons(self): """Displays the Sulfur hybrid buttons. """ self.sp3_btn.setIcon(imagename_to_icon('modeltree/O_sp3.png')) # S and O are the same. self.sp3_btn.show() self.sp2_btn.setIcon(imagename_to_icon('modeltree/O_sp2.png')) self.sp2_btn.show() self.sp_btn.hide() self.graphitic_btn.hide()
def setup_O_hybrid_buttons(self): """Displays the Oxygen hybrid buttons. """ self.sp3_btn.setIcon(imagename_to_icon('modeltree/O_sp3.png')) self.sp3_btn.show() self.sp2_btn.setIcon(imagename_to_icon('modeltree/O_sp2.png')) self.sp2_btn.show() self.sp_btn.hide() self.graphitic_btn.hide()
def setup_N_hybrid_buttons(self): """Displays the Nitrogen hybrid buttons. """ self.sp3_btn.setIcon(imagename_to_icon('modeltree/N_sp3.png')) self.sp3_btn.show() self.sp2_btn.setIcon(imagename_to_icon('modeltree/N_sp2.png')) self.sp2_btn.show() self.sp_btn.setIcon(imagename_to_icon('modeltree/N_sp.png')) self.sp_btn.show() self.graphitic_btn.setIcon(imagename_to_icon('modeltree/N_graphitic.png')) self.graphitic_btn.show()
def setup_C_hybrid_buttons(self): """Displays the Carbon hybrid buttons. """ self.theElements.button(self.w.Element).setChecked(True) self.sp3_btn.setIcon(imagename_to_icon('modeltree/C_sp3.png')) self.sp3_btn.show() self.sp2_btn.setIcon(imagename_to_icon('modeltree/C_sp2.png')) self.sp2_btn.show() self.sp_btn.setIcon(imagename_to_icon('modeltree/C_sp.png')) self.sp_btn.show() self.graphitic_btn.hide()
def update_clipboard_page_icon(self): """Updates the Clipboard page (tab) icon with a full or empty clipboard icon based on whether there is anything on the clipboard (pasteables). """ if not self.icon_tabs: # Work around for bug 1659. mark 060310 [revised by bruce 060313] return if self.w.assy.shelf.get_pastable_chunks(): clipboard_ic = imagename_to_icon("actions/Properties Manager/clipboard-full.png") else: clipboard_ic = imagename_to_icon("actions/Properties Manager/clipboard-empty.png") self.mmkit_tab.setTabIcon(self.mmkit_tab.indexOf(self.clipboardPage), QIcon(clipboard_ic))
def __init__(self, parentMode, win): QDialog.__init__(self, win, Qt.Dialog)# Qt.WStyle_Customize | Qt.WStyle_Tool | Qt.WStyle_Title | Qt.WStyle_NoBorder) self.w = win self.o = self.w.glpane #@NOTE: As of 20070717, MMKit supports only depositMode as its parent #(and perhaps subclasses of depositMode ..but such a class that also #uses MMKit is NIY so it is unconfirmed) -- ninad self.parentMode = parentMode self.setupUi(self) # setupUi() did not add the icon or title. We do that here. pmSetPropMgrIcon( self, self.iconPath ) pmSetPropMgrTitle( self, self.title ) #self.connect(self.hybrid_btngrp,SIGNAL("buttonClicked(int)"),self.set_hybrid_type) self.pw = None # pw = partwindow self.connect(self.mmkit_tab, SIGNAL("currentChanged(int)"), self.tabCurrentChanged) self.connect(self.chunkListBox, SIGNAL("currentItemChanged(QListWidgetItem*,QListWidgetItem*)"), self.chunkChanged) self.connect(self.browseButton, SIGNAL("clicked(bool)"), self.browseDirectories) self.connect(self.defaultPartLibButton, SIGNAL("clicked(bool)"), self.useDefaultPartLibDirectory) #self.connect(self.elementButtonGroup,SIGNAL("buttonClicked(int)"),self.setElementInfo) self.connect(self.thumbView_groupBoxButton, SIGNAL("clicked()"), self.toggle_thumbView_groupBox) self.connect(self.bondTool_groupBoxButton , SIGNAL("clicked()"), self.toggle_bondTool_groupBox) self.connect(self.MMKitGrpBox_TitleButton, SIGNAL("clicked()"), self.toggle_MMKit_groupBox) self.connect(self.filterCB, SIGNAL("stateChanged(int)"), self.toggle_selectionFilter_groupBox) self.connect(self.advancedOptions_groupBoxButton, SIGNAL("clicked()"), self.toggle_advancedOptions_groupBox) # Make the elements act like a big exclusive radio button. self.theElements = QtGui.QButtonGroup() self.theElements.setExclusive(True) self.theElements.addButton(self.toolButton1, 1) self.theElements.addButton(self.toolButton2, 2) self.theElements.addButton(self.toolButton6, 6) self.theElements.addButton(self.toolButton7, 7) self.theElements.addButton(self.toolButton8, 8) self.theElements.addButton(self.toolButton10, 10) self.theElements.addButton(self.toolButton9, 9) self.theElements.addButton(self.toolButton13,13) self.theElements.addButton(self.toolButton17,17) self.theElements.addButton(self.toolButton5, 5) self.theElements.addButton(self.toolButton10_2, 18) self.theElements.addButton(self.toolButton15, 15) self.theElements.addButton(self.toolButton16, 16) self.theElements.addButton(self.toolButton14, 14) self.theElements.addButton(self.toolButton33, 33) self.theElements.addButton(self.toolButton34, 34) self.theElements.addButton(self.toolButton35, 35) self.theElements.addButton(self.toolButton32, 32) self.theElements.addButton(self.toolButton36, 36) self.connect(self.theElements, SIGNAL("buttonPressed(int)"), self.update_dialog) self.theHybridizations = QtGui.QButtonGroup() self.theHybridizations.setExclusive(True) self.theHybridizations.addButton(self.sp3_btn, 0) self.theHybridizations.addButton(self.sp2_btn, 1) self.theHybridizations.addButton(self.sp_btn, 2) self.theHybridizations.addButton(self.graphitic_btn, 3) self.connect(self.theHybridizations, SIGNAL("buttonClicked(int)"), self.update_hybrid_btngrp) self.connect(self.filterCB, SIGNAL("toggled(bool)"),self.set_selection_filter) self.elemTable = PeriodicTable self.displayMode = diTUBES self.elm = None self.newModel = None ## used to save the selected lib part self.flayout = None # It looks like we now have correct fixes for bugs 1659 and bug 1824. If so, it would be safe to simply # hardware self.icon_tabs to True and simplify code accordingly. But we're not 100% certain, so by leaving # it as a debug pref, we can help any users who see those bugs come up again. # wware 060420 # # Update, bruce 070328: the False value of this debug_pref is known to fail in the Qt4 version (on Mac anyway), # due to AttributeError exceptions for setMargin and setTabLabel, # so I'm changing the prefs key for it in order to let Qt3 and Qt4 have independent debug_pref settings, # adding a warning in the menu text, and adding a try/except to help in debugging this if anyone ever wants to. # (If the bugs Will mentioned go away entirely, we can abandon support for the False value instead of fixing it, # as Will suggested.) from utilities.debug_prefs import debug_pref, Choice_boolean_True self.icon_tabs = debug_pref("use icons in MMKit tabs? (only True works in Qt4)", Choice_boolean_True, prefs_key = "A7/mmkit tab icons/Qt4") #e Changes to this only take effect in the next session. # Ideally we'd add a history message about that, when this is changed. # (It's not yet easy to do that in a supported way in debug_pref.) [bruce 060313] if not self.icon_tabs: # This code is known to fail in Qt4 Mac version, as explained above. [bruce 061222 and 070328] try: self.mmkit_tab.setMargin ( 0 ) except: print_compact_traceback("ignoring this Qt4-specific exception: ") #bruce 061222 pass self.mmkit_tab.setTabLabel (self.atomsPage, 'Atoms') self.mmkit_tab.setTabLabel (self.clipboardPage, 'Clipbd') self.mmkit_tab.setTabLabel (self.libraryPage, 'Lib') else: # Add icons to MMKit's tabs. mark 060223. atoms_ic = imagename_to_icon("actions/Properties Manager/MMKit.png") self.mmkit_tab.setTabIcon(self.mmkit_tab.indexOf(self.atomsPage), QIcon(atoms_ic)) self.update_clipboard_page_icon() # Loads proper icon for clibpoard tab. Mark 2007-06-01 library_ic = imagename_to_icon("actions/Properties Manager/library.png") self.mmkit_tab.setTabIcon(self.mmkit_tab.indexOf(self.libraryPage), QIcon(library_ic)) # Tab tooltips. mark 060326 self.mmkit_tab.setTabToolTip(self.mmkit_tab.indexOf(self.atomsPage), 'Atoms') self.mmkit_tab.setTabToolTip(self.mmkit_tab.indexOf(self.clipboardPage), 'Clipboard') self.mmkit_tab.setTabToolTip(self.mmkit_tab.indexOf(self.libraryPage), 'Part Library') self._setNewView('MMKitView') # Set current element in element button group. self.theElements.button(self.w.Element).setChecked(True) #self.connect(self., SIGNAL("), ) self.connect(self.w.hybridComboBox, SIGNAL("activated(int)"), self.hybridChangedOutside) self.connect(self.w.hybridComboBox, SIGNAL("activated(const QString&)"), self.change2AtomsPage) self.connect(self.w.elemChangeComboBox, SIGNAL("activated(const QString&)"), self.change2AtomsPage) self.connect(self.w.pasteComboBox, SIGNAL("activated(const QString&)"), self.change2ClipboardPage) #self.connect(self.w.depositAtomDashboard.pasteBtn, SIGNAL("pressed()"), self.change2ClipboardPage) self.connect(self.w.depositAtomDashboard.pasteBtn, SIGNAL("stateChanged(int)"), self.pasteBtnStateChanged) self.connect(self.w.depositAtomDashboard.depositBtn, SIGNAL("stateChanged(int)"), self.depositBtnStateChanged) self.connect(self.dirView, SIGNAL("selectionChanged(QItemSelection *, QItemSelection *)"), self.partChanged) self.add_whats_this_text() return # from __init__