本文整理汇总了Python中PyQt4.QtCore.QStringList方法的典型用法代码示例。如果您正苦于以下问题:Python QtCore.QStringList方法的具体用法?Python QtCore.QStringList怎么用?Python QtCore.QStringList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtCore
的用法示例。
在下文中一共展示了QtCore.QStringList方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: selectImage
# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QStringList [as 别名]
def selectImage(self):
if not self.images:
return
dlgTitle = "Select image to load"
self.statusBar().showMessage(dlgTitle)
items = QtCore.QStringList( [ "{}: {}".format(num,os.path.basename(i)) for (num,i) in enumerate(self.images) ] )
(item, ok) = QtGui.QInputDialog.getItem(self, dlgTitle, "Image", items, self.idx, False)
if (ok and item):
idx = items.indexOf(item)
if idx != self.idx and self.checkAndSave():
self.idx = idx
self.imageChanged()
else:
# Restore the message
self.statusBar().showMessage( self.defaultStatusbar )
# Save labels
示例2: selectImage
# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QStringList [as 别名]
def selectImage(self):
if not self.images:
return
dlgTitle = "Select image to load"
self.statusBar().showMessage(dlgTitle)
items = QtCore.QStringList( [ os.path.basename(i) for i in self.images ] )
(item, ok) = QtGui.QInputDialog.getItem(self, dlgTitle, "Image", items, self.idx, False)
if (ok and item):
idx = items.indexOf(item)
if idx != self.idx:
self.idx = idx
self.imageChanged()
else:
# Restore the message
self.statusBar().showMessage( self.defaultStatusbar )
# Toggle zoom
示例3: updateXSS
# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QStringList [as 别名]
def updateXSS(self,list):
if not list:
return
for i in list:
target=QtCore.QStringList()
target.append(i[0])
targetTree=QtGui.QTreeWidgetItem(target)
self.treeXss.addTopLevelItem(targetTree)
for j in i[1]:
target2=QtCore.QStringList()
target2.append("")
target2.append(j[2])
target2.append(j[1])
str=""
for l in j[3]:
str+=l+"\r\n"
target2.append(str)
targetTree2=QtGui.QTreeWidgetItem(target2)
targetTree.addChild(targetTree2)
示例4: updateSQLResults
# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QStringList [as 别名]
def updateSQLResults(self,list):
if not list:
return
for i in list:
target=QtCore.QStringList()
target.append(i[0])
targetTree=QtGui.QTreeWidgetItem(target)
self.treeSql.addTopLevelItem(targetTree)
for j in i[1]:
target2=QtCore.QStringList()
target2.append("")
for k in j:
if k:
target2.append(k)
else:
target2.append("")
targetTree2=QtGui.QTreeWidgetItem(target2)
targetTree.addChild(targetTree2)
pass
示例5: getLabelFromUser
# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QStringList [as 别名]
def getLabelFromUser(self, defaultLabel = "", objID = -1):
# Reset the status bar to this message when leaving
restoreMessage = self.statusBar().currentMessage()
# Update defaultLabel
if not defaultLabel:
defaultLabel = self.defaultLabel
# List of possible labels
items = QtCore.QStringList(name2label.keys())
items.sort()
default = items.indexOf(defaultLabel)
if default < 0:
self.statusBar().showMessage( 'The selected label is missing in the internal color map.' )
return
# Specify title
dlgTitle = "Select label"
message = dlgTitle
question = dlgTitle
if objID >= 0:
message = "Select new label for object {0} with current label {1}".format( objID, defaultLabel )
question = "Label for object {0}".format(objID)
self.statusBar().showMessage(message)
# Create and wait for dialog
(item, ok) = QtGui.QInputDialog.getItem(self, dlgTitle, question, items, default, False)
# Process the answer a bit
item = str(item)
# Restore message
self.statusBar().showMessage( restoreMessage )
# Return
return (item, ok)
# Add a point to the drawn polygon
示例6: updateVarStatsTree
# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QStringList [as 别名]
def updateVarStatsTree(self):
self.varStatsTreeWidget.clear()
self.varStatsTreeWidget.headerItem().setText(0,QtGui.QApplication.translate("MainWindow", "Variable", None, QtGui.QApplication.UnicodeUTF8))
self.varStatsTreeWidget.headerItem().setText(1,QtGui.QApplication.translate("MainWindow", "Values", None, QtGui.QApplication.UnicodeUTF8))
variableStats=self.controller.getVariableStats()
sort1=variableStats.keys()
sort1.sort()
for tg in sort1:
target=QtCore.QStringList()
target.append(tg)
targetTree=QtGui.QTreeWidgetItem(target)
self.varStatsTreeWidget.addTopLevelItem(targetTree)
sort2=variableStats[tg].keys()
sort2.sort()
for pt in sort2:
path=QtCore.QStringList()
path.append(pt)
pathTree=QtGui.QTreeWidgetItem(path)
pathTree.setTextColor(0,QtGui.QColor(0,0,200))
font=pathTree.font(0)
font.setBold(True)
pathTree.setFont(0,font)
targetTree.addChild(pathTree)
sort3=variableStats[tg][pt].keys()
sort3.sort()
for vr in sort3:
variable=QtCore.QStringList()
variable.append(vr)
values=""
for vls in variableStats[tg][pt][vr].keys():
values+=urllib.unquote(vls)+"\n"
variable.append(values)
variableTree=QtGui.QTreeWidgetItem(variable)
pathTree.addChild(variableTree)
示例7: updateReqStatsTree
# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QStringList [as 别名]
def updateReqStatsTree(self):
self.reqStatsTreeWidget.clear()
self.reqStatsTreeWidget.headerItem().setText(0,QtGui.QApplication.translate("MainWindow", "Request", None, QtGui.QApplication.UnicodeUTF8))
self.reqStatsTreeWidget.headerItem().setText(1,QtGui.QApplication.translate("MainWindow", "Variable set", None, QtGui.QApplication.UnicodeUTF8))
reqStats=self.controller.getReqStats()
sort1=reqStats.keys()
sort1.sort()
for tg in sort1:
target=QtCore.QStringList()
target.append(tg)
targetTree=QtGui.QTreeWidgetItem(target)
self.reqStatsTreeWidget.addTopLevelItem(targetTree)
sort2=reqStats[tg].items()
sort2.sort()
for k,l in sort2:
path=QtCore.QStringList()
path.append(k)
sets=""
for set in l:
sets+=join(set[0],',')+'\n'
path.append(sets)
pathTree=QtGui.QTreeWidgetItem(path)
pathTree.setTextColor(0,QtGui.QColor(0,0,200))
font=pathTree.font(0)
font.setBold(True)
pathTree.setFont(0,font)
targetTree.addChild(pathTree)
示例8: file_dialog
# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QStringList [as 别名]
def file_dialog(self, title):
dialog = qg.QFileDialog()
dialog.setWindowTitle(title)
dialog.setFileMode(qg.QFileDialog.AnyFile)
filenames = qc.QStringList()
if dialog.exec_():
filenames = dialog.selectedFiles()
return filenames[0]
raise Exception('Failed to open dialog')