Python PyQt4.QtCore 模块,QStringList() 实例源码

我们从Python开源项目中,提取了以下16个代码示例,用于说明如何使用PyQt4.QtCore.QStringList()

项目:darkc0de-old-stuff    作者:tuwid    | 项目源码 | 文件源码
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)
项目:darkc0de-old-stuff    作者:tuwid    | 项目源码 | 文件源码
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
项目:rec-attend-public    作者:renmengye    | 项目源码 | 文件源码
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
项目:cityscapes-api    作者:renmengye    | 项目源码 | 文件源码
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
项目:cityscapesScripts    作者:mcordts    | 项目源码 | 文件源码
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
项目:cityscapesScripts    作者:mcordts    | 项目源码 | 文件源码
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
项目:Bigglesworth    作者:MaurizioB    | 项目源码 | 文件源码
def __init__(self, text, parent):
        BaseTextWidget.__init__(self, text, parent)
        self.main = parent
        self.font = QtGui.QFont('Fira Sans', 22)
        self.font_metrics = QtGui.QFontMetrics(self.font)
        self.setMinimumSize(self.font_metrics.width(self.text), self.font_metrics.height())
        self.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Maximum)
        while len(self.text) < 16:
            self.text += ' '
        self.text = QtCore.QString.fromUtf8(self.text)
        self.text_list = QtCore.QStringList([l for l in self.text])
        self.cursor = TextCursorWidget(self, self.font_metrics.ascent())
        self.cursor.hide()
        self.cursor_timer = QtCore.QTimer()
        self.cursor_timer.setInterval(500)
        self.cursor_timer.timeout.connect(lambda: self.cursor.setVisible(False if self.cursor.isVisible() else True))
        self._editing = False
项目:quartz-browser    作者:ksharindam    | 项目源码 | 文件源码
def urlsuggestions(self, text):
        """ Creates the list of url suggestions for URL box """
        suggestions = []
        if not webkit.find_mode_on:
            for [title, url] in self.history:
                if text in url:
                    suggestions.insert(0, url)
            for [title, address] in self.bookmarks:
                if str(text) in address:
                    suggestions.insert(0, address)
        self.listmodel.setStringList( QStringList(suggestions) )
项目:darkc0de-old-stuff    作者:tuwid    | 项目源码 | 文件源码
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)
项目:darkc0de-old-stuff    作者:tuwid    | 项目源码 | 文件源码
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)
项目:webkit-crawler    作者:dozymoe    | 项目源码 | 文件源码
def extension(self, extension, option, output):
        self.log_event.emit(DEBUG, 'MultipleFileUpload')

        if extension == self.ChooseMultipleFilesExtension and \
                self.upload_files is not None:

            files = self.upload_files
            self.upload_files = None
            output.fileNames = QStringList(files)
            return True

        return super(WebPage, self).extension(extension, option, output)
项目:uah_driveset_reader    作者:Eromera    | 项目源码 | 文件源码
def selectDataFolder(self):
      global dataFolderName
      dataFolderNameQ = QtWidgets.QFileDialog.getExistingDirectory(self, 'Select Data Folder')
      dataFolderName = str(dataFolderNameQ)
      self.buttonSelectDataFolder.setText('Select data folder [' + dataFolderName.split('/')[-1] + ']')

      #filterList = QtCore.QStringList("*.mp4")
      filterList = ['*.mp4']
      directory = QtCore.QDir(dataFolderNameQ)
      listvideos = directory.entryList(filterList)
      print (listvideos)
      if (len(listvideos)==0):
         print ('0 videos, searching MOV, AVI, MKV')
         filterList = ['*.mp4', '*.MOV', '.MP4', '.AVI', '.mov', '.avi', '.mkv', '.MKV']
         listvideos = directory.entryList(filterList)
         print (listvideos)

      global videoName
      global videoCorrect
      if (len(listvideos) == 0):
         videoCorrect = False
         self.frameNumber = 0
         videoName = ''
         self.showMessage('Video not found in folder', 3)
      else:
         videoName = dataFolderName + '/' + listvideos[0]
         self.loadVideo()

      self.loadScoresData()
      self.loadDataPlots()

      if (dataCorrect and videoCorrect):
         self.updateDatesInfo()
项目:cityscapesScripts    作者:mcordts    | 项目源码 | 文件源码
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
项目:cryptoluggage    作者:miguelinux314    | 项目源码 | 文件源码
def mimeTypes(self):
        return QtCore.QStringList([
            'text/uri-list',
        ])
项目:neural-turkish-morphological-disambiguator    作者:onurgu    | 项目源码 | 文件源码
def calculate_ambiguity(self):
                single_line_free_text_sentence = str(self.plainTextEdit.toPlainText())
                ambiguity_score, single_lined_morph_analyzes_output, counts = calculate_ambiguity_score_of_a_sentence(single_line_free_text_sentence)

                self.label.setText("%lf" % ambiguity_score)
                self.plainTextEdit_2.setPlainText(single_lined_morph_analyzes_output)
                from PyQt4.QtCore import QStringList
                self.listWidget.clear()
                self.listWidget.addItems(QStringList([" ".join(x) for x in zip(["N/A"] + [str(y) for y in counts[:-1]] + ["N/A"],
                                                                               single_lined_morph_analyzes_output.split("\n")[:-1])]))
项目:Bigglesworth    作者:MaurizioB    | 项目源码 | 文件源码
def __init__(self, settings, name=None):
        self._settings = settings
        self._group = settings.group()
        for k in settings.childKeys():
            value = settings.value(k).toPyObject()
            if isinstance(value, QtCore.QStringList):
                _value = []
                for v in value:
                    try:
                        v = str(v)
                        if v.isdigit():
                            v = int(v)
                        elif v == 'true':
                            v = True
                        elif v == 'false':
                            v = False
                        else:
                            v = float(v)
                    except Exception as e:
                        print e
                    _value.append(v)
                value = _value
            elif isinstance(value, QtCore.QString):
                value = str(value)
                if value == 'true':
                    value = True
                elif value == 'false':
                    value = False
                elif self._is_int(value):
                    value = int(value)
                else:
                    try:
                        value = float(value)
                    except:
                        pass
            setattr(self, self._decode(str(k)), value)
        if len(self._group):
            for g in settings.childGroups():
                settings.beginGroup(g)
                setattr(self, 'g{}'.format(self._decode(g)), SettingsGroup(settings))
                settings.endGroup()
        self._done = True