Python PyQt4.QtCore.QStringList() Examples

The following are 17 code examples of PyQt4.QtCore.QStringList(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module PyQt4.QtCore , or try the search function .
Example #1
Source File: cityscapesViewer.py    From fcn8s_tensorflow with GNU General Public License v3.0 6 votes vote down vote up
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 
Example #2
Source File: cityscapesViewer.py    From rec-attend-public with MIT License 6 votes vote down vote up
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 
Example #3
Source File: cityscapesLabelTool.py    From LightNet with MIT License 6 votes vote down vote up
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 
Example #4
Source File: mainform.py    From darkc0de-old-stuff with GNU General Public License v3.0 6 votes vote down vote up
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 
Example #5
Source File: cityscapesViewer.py    From LightNet with MIT License 6 votes vote down vote up
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 
Example #6
Source File: cityscapesLabelTool.py    From TFSegmentation with Apache License 2.0 6 votes vote down vote up
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 
Example #7
Source File: cityscapesLabelTool.py    From fcn8s_tensorflow with GNU General Public License v3.0 6 votes vote down vote up
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 
Example #8
Source File: cityscapesViewer.py    From TFSegmentation with Apache License 2.0 6 votes vote down vote up
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 
Example #9
Source File: cityscapesLabelTool.py    From Detectron-PYTORCH with Apache License 2.0 6 votes vote down vote up
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 
Example #10
Source File: mainform.py    From darkc0de-old-stuff with GNU General Public License v3.0 6 votes vote down vote up
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) 
Example #11
Source File: cityscapesLabelTool.py    From TFSegmentation with Apache License 2.0 5 votes vote down vote up
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 
Example #12
Source File: dialog_service.py    From ropa with GNU General Public License v3.0 5 votes vote down vote up
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') 
Example #13
Source File: mainform.py    From darkc0de-old-stuff with GNU General Public License v3.0 5 votes vote down vote up
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) 
Example #14
Source File: mainform.py    From darkc0de-old-stuff with GNU General Public License v3.0 5 votes vote down vote up
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) 
Example #15
Source File: cityscapesLabelTool.py    From Detectron-PYTORCH with Apache License 2.0 5 votes vote down vote up
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 
Example #16
Source File: cityscapesLabelTool.py    From LightNet with MIT License 5 votes vote down vote up
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 
Example #17
Source File: cityscapesLabelTool.py    From fcn8s_tensorflow with GNU General Public License v3.0 5 votes vote down vote up
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