本文整理汇总了Python中PM.PM_ComboBox.PM_ComboBox.findText方法的典型用法代码示例。如果您正苦于以下问题:Python PM_ComboBox.findText方法的具体用法?Python PM_ComboBox.findText怎么用?Python PM_ComboBox.findText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PM.PM_ComboBox.PM_ComboBox
的用法示例。
在下文中一共展示了PM_ComboBox.findText方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ColorScheme_PropertyManager
# 需要导入模块: from PM.PM_ComboBox import PM_ComboBox [as 别名]
# 或者: from PM.PM_ComboBox.PM_ComboBox import findText [as 别名]
#.........这里部分代码省略.........
# Existence of a favorite with the same name is checked in the above
# mentioned location and if a duplicate exists, then the user can either
# overwrite and provide a new name.
# Prompt user for a favorite name to add.
from widgets.simple_dialogs import grab_text_line_using_dialog
ok1, name = \
grab_text_line_using_dialog(
title = "Add new favorite",
label = "favorite name:",
iconPath = "ui/actions/Properties Manager/AddFavorite.png",
default = "" )
if ok1:
# check for duplicate files in the
# $HOME/Nanorex/Favorites/ColorScheme/ 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 = writeColorSchemeToFavoritesFile(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 = writeColorSchemeToFavoritesFile(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()
示例2: LightingScheme_PropertyManager
# 需要导入模块: from PM.PM_ComboBox import PM_ComboBox [as 别名]
# 或者: from PM.PM_ComboBox.PM_ComboBox import findText [as 别名]
#.........这里部分代码省略.........
# Existence of a favorite with the same name is checked in the above
# mentioned location and if a duplicate exists, then the user can either
# overwrite and provide a new name.
# Prompt user for a favorite name to add.
from widgets.simple_dialogs import grab_text_line_using_dialog
ok1, name = \
grab_text_line_using_dialog(
title = "Add new favorite",
label = "favorite name:",
iconPath = "ui/actions/Properties Manager/AddFavorite.png",
default = "" )
if ok1:
# 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()
示例3: DnaDisplayStyle_PropertyManager
# 需要导入模块: from PM.PM_ComboBox import PM_ComboBox [as 别名]
# 或者: from PM.PM_ComboBox.PM_ComboBox import findText [as 别名]
#.........这里部分代码省略.........
# overwrite and provide a new name.
# Prompt user for a favorite name to add.
from widgets.simple_dialogs import grab_text_line_using_dialog
ok1, name = \
grab_text_line_using_dialog(
title = "Add new favorite",
label = "favorite name:",
iconPath = "ui/actions/Properties Manager/AddFavorite.png",
default = "" )
if ok1:
# 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()
示例4: ProteinDisplayStyle_PropertyManager
# 需要导入模块: from PM.PM_ComboBox import PM_ComboBox [as 别名]
# 或者: from PM.PM_ComboBox.PM_ComboBox import findText [as 别名]
#.........这里部分代码省略.........
from widgets.simple_dialogs import grab_text_line_using_dialog
ok1, name = grab_text_line_using_dialog(
title="Add new favorite",
label="favorite name:",
iconPath="ui/actions/Properties Manager/AddFavorite.png",
default="",
)
if ok1:
# 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 = 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)