本文整理汇总了Python中PM.PM_ComboBox.PM_ComboBox.addItem方法的典型用法代码示例。如果您正苦于以下问题:Python PM_ComboBox.addItem方法的具体用法?Python PM_ComboBox.addItem怎么用?Python PM_ComboBox.addItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PM.PM_ComboBox.PM_ComboBox
的用法示例。
在下文中一共展示了PM_ComboBox.addItem方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ColorScheme_PropertyManager
# 需要导入模块: from PM.PM_ComboBox import PM_ComboBox [as 别名]
# 或者: from PM.PM_ComboBox.PM_ComboBox import addItem [as 别名]
#.........这里部分代码省略.........
selColorList = [darkgreen, green, orange, red,
magenta, cyan, blue, white, black,
gray]
selColorNames = ["Dark green (default)", "Green", "Orange", "Red",
"Magenta", "Cyan", "Blue", "White", "Black",
"Other color..."]
self.selectionColorComboBox = \
PM_ColorComboBox(pmGroupBox,
colorList = selColorList,
colorNames = selColorNames,
color = env.prefs[selectionColor_prefs_key]
)
return
def _updateAllWidgets(self):
"""
Update all the PM widgets. This is typically called after applying
a favorite.
"""
self._updateBackgroundColorComboBoxIndex()
self.updateCustomColorItemIcon(RGBf_to_QColor(env.prefs[backgroundColor_prefs_key]))
self.hoverHighlightingStyleComboBox.setCurrentIndex(HHS_INDEXES.index(env.prefs[hoverHighlightingColorStyle_prefs_key]))
self.hoverHighlightingColorComboBox.setColor(env.prefs[hoverHighlightingColor_prefs_key])
self.selectionStyleComboBox.setCurrentIndex(SS_INDEXES.index(env.prefs[selectionColorStyle_prefs_key]))
self.selectionColorComboBox.setColor(env.prefs[selectionColor_prefs_key])
return
def _loadSelectionStyleItems(self):
"""
Load the selection color style combobox with items.
"""
for selectionStyle in SS_OPTIONS:
self.selectionStyleComboBox.addItem(selectionStyle)
return
def _loadHoverHighlightingStyleItems(self):
"""
Load the hover highlighting style combobox with items.
"""
for hoverHighlightingStyle in HHS_OPTIONS:
self.hoverHighlightingStyleComboBox.addItem(hoverHighlightingStyle)
return
def _loadBackgroundColorItems(self):
"""
Load the background color combobox with all the color options and sets
the current background color
"""
backgroundIndexes = [bg_BLUE_SKY, bg_EVENING_SKY, bg_SEAGREEN,
bg_BLACK, bg_WHITE, bg_GRAY, bg_CUSTOM]
backgroundNames = ["Blue Sky (default)", "Evening Sky", "Sea Green",
"Black", "White", "Gray", "Custom..."]
backgroundIcons = ["Background_BlueSky", "Background_EveningSky",
"Background_SeaGreen",
"Background_Black", "Background_White",
"Background_Gray", "Background_Custom"]
backgroundIconsDict = dict(zip(backgroundNames, backgroundIcons))
backgroundNamesDict = dict(zip(backgroundIndexes, backgroundNames))
for backgroundName in backgroundNames:
basename = backgroundIconsDict[backgroundName] + ".png"
示例2: DnaGeneratorPropertyManager
# 需要导入模块: from PM.PM_ComboBox import PM_ComboBox [as 别名]
# 或者: from PM.PM_ComboBox.PM_ComboBox import addItem [as 别名]
#.........这里部分代码省略.........
elif conformation == "Z-DNA":
self.basesPerTurnComboBox.insertItem(0, "12.0")
elif inIndex == -1:
# Caused by clear(). This is tolerable for now. Mark 2007-05-24.
conformation = "B-DNA" # Workaround for "Restore Defaults".
pass
else:
msg = redmsg("conformationComboBoxChanged(): \
Error - unknown DNA conformation. Index = "+ inIndex)
env.history.message(msg)
self.duplexLengthSpinBox.setSingleStep(
self.getDuplexRise(conformation) )
def modelComboBoxChanged( self, inIndex ):
"""
Slot for the Model combobox. It is called whenever the
Model choice is changed.
@param inIndex: The new index.
@type inIndex: int
"""
conformation = self._modelChoices[ inIndex ]
self.disconnect( self.conformationComboBox,
SIGNAL("currentIndexChanged(int)"),
self.conformationComboBoxChanged )
self.conformationComboBox.clear() # Generates signal!
if conformation == self._modeltype_PAM3:
self.conformationComboBox.addItem("B-DNA")
elif conformation == self._modeltype_PAM5:
self.conformationComboBox.addItem("B-DNA")
elif conformation == self._modeltype_Atomistic:
self.conformationComboBox.addItem("B-DNA")
self.conformationComboBox.addItem("Z-DNA")
elif inIndex == -1:
# Caused by clear(). This is tolerable for now. Mark 2007-05-24.
pass
else:
msg = "Error - unknown model representation. Index = " + inIndex
env.history.message(redmsg(msg))
self.connect( self.conformationComboBox,
SIGNAL("currentIndexChanged(int)"),
self.conformationComboBoxChanged)
# GroupBox3 slots (and other methods) supporting the Strand Sequence groupbox.
def getDuplexRise( self, inConformation ):
"""
Return the 'rise' between base pairs of the
specified DNA type (conformation).
@param inConformation: The current conformation.
@type inConformation: int
"""
return dnaDict[str(inConformation)]['DuplexRise']
示例3: DnaDisplayStyle_PropertyManager
# 需要导入模块: from PM.PM_ComboBox import PM_ComboBox [as 别名]
# 或者: from PM.PM_ComboBox.PM_ComboBox import addItem [as 别名]
#.........这里部分代码省略.........
# check for duplicate files in the
# $HOME/Nanorex/Favorites/DnaDisplayStyle/ directory
fname = getFavoritePathFromBasename( name )
if os.path.exists(fname):
#favorite file already exists!
_ext= ".txt"
ret = QMessageBox.warning( self, "Warning!",
"The favorite file \"" + name + _ext + "\"already exists.\n"
"Do you want to overwrite the existing file?",
"&Overwrite", "&Cancel", "",
0, # Enter == button 0
1) # Escape == button 1
if ret == 0:
#overwrite favorite file
ok2, text = writeDnaDisplayStyleSettingsToFavoritesFile(name)
indexOfDuplicateItem = self.favoritesComboBox.findText(name)
self.favoritesComboBox.removeItem(indexOfDuplicateItem)
print "Add Favorite: removed duplicate favorite item."
else:
env.history.message("Add Favorite: cancelled overwriting favorite item.")
return
else:
ok2, text = writeDnaDisplayStyleSettingsToFavoritesFile(name)
else:
# User cancelled.
return
if ok2:
self.favoritesComboBox.addItem(name)
_lastItem = self.favoritesComboBox.count()
self.favoritesComboBox.setCurrentIndex(_lastItem - 1)
msg = "New favorite [%s] added." % (text)
else:
msg = "Can't add favorite [%s]: %s" % (name, text) # text is reason why not
env.history.message(msg)
return
def deleteFavorite(self):
"""
Deletes the current favorite from the user's personal list of favorites
(and from disk, only in the favorites folder though).
@note: Cannot delete "Factory default settings".
"""
currentIndex = self.favoritesComboBox.currentIndex()
currentText = self.favoritesComboBox.currentText()
if currentIndex == 0:
msg = "Cannot delete '%s'." % currentText
else:
self.favoritesComboBox.removeItem(currentIndex)
# delete file from the disk
deleteFile= getFavoritePathFromBasename( currentText )
os.remove(deleteFile)
msg = "Deleted favorite named [%s].\n" \
"and the favorite file [%s.txt]." \
示例4: LightingScheme_PropertyManager
# 需要导入模块: from PM.PM_ComboBox import PM_ComboBox [as 别名]
# 或者: from PM.PM_ComboBox.PM_ComboBox import addItem [as 别名]
#.........这里部分代码省略.........
# check for duplicate files in the
# $HOME/Nanorex/Favorites/LightingScheme/ directory
fname = getFavoritePathFromBasename( name )
if os.path.exists(fname):
#favorite file already exists!
_ext= ".txt"
ret = QMessageBox.warning( self, "Warning!",
"The favorite file \"" + name + _ext + "\"already exists.\n"
"Do you want to overwrite the existing file?",
"&Overwrite", "&Cancel", "",
0, # Enter == button 0
1) # Escape == button 1
if ret == 0:
#overwrite favorite file
ok2, text = writeLightingSchemeToFavoritesFile(name)
indexOfDuplicateItem = self.favoritesComboBox.findText(name)
self.favoritesComboBox.removeItem(indexOfDuplicateItem)
print "Add Favorite: removed duplicate favorite item."
else:
env.history.message("Add Favorite: cancelled overwriting favorite item.")
return
else:
ok2, text = writeLightingSchemeToFavoritesFile(name)
else:
# User cancelled.
return
if ok2:
self.favoritesComboBox.addItem(name)
_lastItem = self.favoritesComboBox.count()
self.favoritesComboBox.setCurrentIndex(_lastItem - 1)
msg = "New favorite [%s] added." % (text)
else:
msg = "Can't add favorite [%s]: %s" % (name, text) # text is reason why not
env.history.message(msg)
return
def deleteFavorite(self):
"""
Deletes the current favorite from the user's personal list of favorites
(and from disk, only in the favorites folder though).
@note: Cannot delete "Factory default settings".
"""
currentIndex = self.favoritesComboBox.currentIndex()
currentText = self.favoritesComboBox.currentText()
if currentIndex == 0:
msg = "Cannot delete '%s'." % currentText
else:
self.favoritesComboBox.removeItem(currentIndex)
# delete file from the disk
deleteFile= getFavoritePathFromBasename( currentText )
os.remove(deleteFile)
msg = "Deleted favorite named [%s].\n" \
"and the favorite file [%s.txt]." \
示例5: ProteinDisplayStyle_PropertyManager
# 需要导入模块: from PM.PM_ComboBox import PM_ComboBox [as 别名]
# 或者: from PM.PM_ComboBox.PM_ComboBox import addItem [as 别名]
#.........这里部分代码省略.........
# favorite file already exists!
_ext = ".txt"
ret = QMessageBox.warning(
self,
"Warning!",
'The favorite file "' + name + _ext + '"already exists.\n'
"Do you want to overwrite the existing file?",
"&Overwrite",
"&Cancel",
"",
0, # Enter == button 0
1,
) # Escape == button 1
if ret == 0:
# overwrite favorite file
ok2, text = writeProteinDisplayStyleSettingsToFavoritesFile(name)
indexOfDuplicateItem = self.favoritesComboBox.findText(name)
self.favoritesComboBox.removeItem(indexOfDuplicateItem)
print "Add Favorite: removed duplicate favorite item."
else:
env.history.message("Add Favorite: cancelled overwriting favorite item.")
return
else:
ok2, text = writeProteinDisplayStyleSettingsToFavoritesFile(name)
else:
# User cancelled.
return
if ok2:
self.favoritesComboBox.addItem(name)
_lastItem = self.favoritesComboBox.count()
self.favoritesComboBox.setCurrentIndex(_lastItem - 1)
msg = "New favorite [%s] added." % (text)
else:
msg = "Can't add favorite [%s]: %s" % (name, text) # text is reason why not
env.history.message(msg)
return
def deleteFavorite(self):
currentIndex = self.favoritesComboBox.currentIndex()
currentText = self.favoritesComboBox.currentText()
if currentIndex == 0:
msg = "Cannot delete '%s'." % currentText
else:
self.favoritesComboBox.removeItem(currentIndex)
# delete file from the disk
deleteFile = getFavoritePathFromBasename(currentText)
os.remove(deleteFile)
msg = "Deleted favorite named [%s].\n" "and the favorite file [%s.txt]." % (currentText, currentText)
env.history.message(msg)
return
def saveFavorite(self):
cmd = greenmsg("Save Favorite File: ")