Exemple #1
0
	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)
Exemple #2
0
    def refresh_plate_content(self):
        self.plate_widget.xtal_treewidget.clear()
        info_str_list = QtCore.QStringList()
        info_str_list.append(self.plate_content.Plate.Barcode)
        info_str_list.append(self.plate_content.Plate.PlateType)
        root_item = QtGui.QTreeWidgetItem(self.plate_widget.xtal_treewidget,
                                          info_str_list)
        root_item.setExpanded(True)
        for xtal in self.plate_content.Plate.xtal_list:
            xtal_address = "%s:%d" % (xtal.Row, xtal.Column + 1)
            cell_treewidget_item = None
            #cell_treewidget_item = self.plate_widget.xtal_treewidget.\
            #    findItems(xtal_address, QtCore.Qt.MatchExactly, 0)[0]
            if not cell_treewidget_item:
                cell_treewidget_item = root_item

            info_str_list = QtCore.QStringList()
            info_str_list.append(xtal.Sample)
            info_str_list.append(xtal.Label)
            info_str_list.append(xtal.Login)
            info_str_list.append(xtal.Row)  
            info_str_list.append(str(xtal.Column))
            if xtal.Comments:
                info_str_list.append(str(xtal.Comments))
            xtal_treewidget_item = QtGui.QTreeWidgetItem(\
                 cell_treewidget_item, info_str_list)
            #self.plate_widget.xtal_treewidget.ensureItemVisible(xtal_treewidget_item) 
            self.xtal_map[xtal_treewidget_item] = xtal

            self.plate_widget.sample_table.item(\
                 ord(xtal.Row.upper()) - ord('A'), xtal.Column - 1).\
                 setBackground(Qt4_widget_colors.LIGHT_GREEN)
Exemple #3
0
    def create_rules(self):
        super(XGobstonesHighlighter, self).create_rules()

        # keyword
        brush = QtGui.QBrush(QtGui.QColor("#3c78d8"), QtCore.Qt.SolidPattern)
        keyword_format = QtGui.QTextCharFormat()
        keyword_format.setForeground(brush)
        keyword_format.setFontWeight(QtGui.QFont.Bold)
        keywords = QtCore.QStringList(
            ["type", "record", "is", "field", "variant", "case"])

        self.highlightingRules.extend(
            gen_highlighting_rules(
                map_regexp(keywords) + ["<-"], keyword_format,
                HighlightingRegExpRule))

        #nativeExpressions
        brush = QtGui.QBrush(QtGui.QColor("#a61c00"), QtCore.Qt.SolidPattern)
        nativeExpression_format = QtGui.QTextCharFormat()
        nativeExpression_format.setForeground(brush)
        nativeExpressions = QtCore.QStringList(
            ["head", "tail", "init", "last", "concat", "isEmpty"])

        self.highlightingRules.extend(
            gen_highlighting_rules(
                map_regexp(nativeExpressions) + ["\+\+", "\[", "\]"],
                nativeExpression_format, HighlightingRegExpRule))
Exemple #4
0
 def data(self, index, role):
     if not role in (Qt.Qt.DisplayRole, Qt.Qt.EditRole):
         return None
     row = index.row()
     col = index.column()
     if role == Qt.Qt.DisplayRole:
         if row is 0:
             if self.perchannelmutes[col].selected():
                 return self.mutestates[1]
             else:
                 if self.globalmutes[col].selected():
                     return self.mutestates[0]
             return self.mutestates[2]
         if row is 1:
             if self.globaldims[col].selected():
                 return "Enabled"
             else:
                 return "Disabled"
         if row is 2:
             if self.globalvolumes[col].selected():
                 return "Global"
             else:
                 return self.perchannelvolumes[col].getvalue()
     if role == Qt.Qt.EditRole:
         if row is 0:
             return QtCore.QStringList(self.mutestates)
         if row is 1:
             return QtCore.QStringList(("Enabled","Disabled"))
         if row is 2:
             if self.globalvolumes[col].selected():
                 return 1
             return self.perchannelvolumes[col].getvalue()
     return "%i,%i" % (row,col)
Exemple #5
0
    def addDamageEntry(self):
        self.grid.removeWidget(self.moreButton)

        damageAmount = QtGui.QSpinBox(self.scrollAreaContents)
        self.grid.addWidget(damageAmount, self.row, 0)

        damageType = QtGui.QComboBox(self.scrollAreaContents)
        damageTypeList = QtCore.QStringList("Melee")
        damageTypeList.append("Firearms")
        damageTypeList.append("Explosives")
        damageTypeList.append("Zombie")
        damageType.addItems(damageTypeList)
        damageType.setEditable(False)
        damageType.setInsertPolicy(QtGui.QComboBox.NoInsert)
        self.grid.addWidget(damageType, self.row, 1)

        damageLocation = QtGui.QComboBox(self.scrollAreaContents)
        damageLocationList = QtCore.QStringList("Head")
        damageLocationList.append("Left Arm")
        damageLocationList.append("Right Arm")
        damageLocationList.append("Torso")
        damageLocationList.append("Left Leg")
        damageLocationList.append("Right Leg")
        damageLocation.addItems(damageLocationList)
        damageLocation.setEditable(False)
        damageLocation.setInsertPolicy(QtGui.QComboBox.NoInsert)
        self.grid.addWidget(damageLocation, self.row, 2)

        self.row = self.row + 1

        self.grid.addWidget(self.moreButton, self.row, 2)

        self.scrollAreaContents.setGeometry(0, 0, 500, self.grid.sizeHint().width())
    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)
    def createPortTable(self, has_inputs=True, has_outputs=True):
        if has_inputs:
            self.inputPortTable = QtGui.QTableWidget(1, 2, self)
            labels = QtCore.QStringList() << "Input Port Name" << "Type"
            self.inputPortTable.horizontalHeader().setResizeMode(
                QtGui.QHeaderView.Interactive)
            self.inputPortTable.horizontalHeader().setMovable(False)
            self.inputPortTable.horizontalHeader().setStretchLastSection(True)
            self.inputPortTable.setHorizontalHeaderLabels(labels)
            self.initializePorts(self.inputPortTable,
                                 self.module.input_port_specs)
            self.layout().addWidget(self.inputPortTable)
        if has_outputs:
            self.outputPortTable = QtGui.QTableWidget(1, 2, self)
            labels = QtCore.QStringList() << "Output Port Name" << "Type"
            self.outputPortTable.horizontalHeader().setResizeMode(
                QtGui.QHeaderView.Interactive)
            self.outputPortTable.horizontalHeader().setMovable(False)
            self.outputPortTable.horizontalHeader().setStretchLastSection(True)

            self.outputPortTable.setHorizontalHeaderLabels(labels)
            self.initializePorts(self.outputPortTable,
                                 self.module.output_port_specs, True)
            self.layout().addWidget(self.outputPortTable)
        if has_inputs and has_outputs:
            self.performPortConnection(self.connect)

        if has_inputs:
            self.fixTableGeometry(self.inputPortTable)
        if has_outputs:
            self.fixTableGeometry(self.outputPortTable)
Exemple #8
0
 def update_from_plot_registry(self):
     """ update_from_plot_registry() -> None
     Setup this tree widget to show modules currently inside plot registry
             
     """
     self.plotTree.setSortingEnabled(False)
     registry = get_plot_registry()
     for plot_package in registry.plots:
         baritem = self.addPlotBar(plot_package)
         if plot_package == "VCS":
             for plottype in registry.plots[plot_package]:
                 item = QtGui.QTreeWidgetItem(baritem, 
                                              QtCore.QStringList(plottype),
                                              self.VCS_CONTAINER_ITEM)
                 self.vcs_item_map[plottype] = item
                 item.setFlags(item.flags() & ~QtCore.Qt.ItemIsDragEnabled)
                 ## Special section here for VCS GMs they have one more layer
                 for plot in registry.plots[plot_package][plottype].itervalues():
                     item2 = PlotTreeWidgetItem(plottype, plot.name, 
                                                QtCore.QStringList(plot.name),
                                                self.VCS_ITEM, plot, item)
         else:
             for plot in registry.plots[plot_package].itervalues():
                 self.addCustomPlotType(plot_package, plot.name, plot)
     
     self.plotTree.sortByColumn(0, QtCore.Qt.AscendingOrder)
     self.plotTree.setSortingEnabled(True)
Exemple #9
0
    def refresh_plate_content(self):
        """
        Descript. :
        """
        self.plate_widget.xtal_treewidget.clear()
        info_str_list = QtCore.QStringList()
        info_str_list.append(self.plate_content.plate.barcode)
        info_str_list.append(self.plate_content.plate.plate_type)
        root_item = QtGui.QTreeWidgetItem(self.plate_widget.xtal_treewidget,
                                          info_str_list)
        root_item.setExpanded(True)
        for xtal in self.plate_content.plate.xtal_list:
            xtal_address = "%s:%d" % (xtal.row, xtal.column + 1)
            cell_treewidget_item = None
            #cell_treewidget_item = self.plate_widget.xtal_treewidget.\
            #    findItems(xtal_address, QtCore.Qt.MatchExactly, 0)[0]
            if not cell_treewidget_item:
                cell_treewidget_item = root_item

            info_str_list = QtCore.QStringList()
            info_str_list.append(xtal.sample)
            info_str_list.append(xtal.label)
            info_str_list.append(xtal.login)
            info_str_list.append(xtal.row)
            info_str_list.append(str(xtal.column))
            if xtal.comments:
                info_str_list.append(str(xtal.comments))
            xtal_treewidget_item = QtGui.QTreeWidgetItem(\
                 cell_treewidget_item, info_str_list)
            #self.plate_widget.xtal_treewidget.ensureItemVisible(xtal_treewidget_item)
            self.xtal_map[xtal_treewidget_item] = xtal
Exemple #10
0
 def add(num):
     item = QtGui.QTreeWidgetItem(self,
                                  QtCore.QStringList('Item(%i)' % num))
     for i in xrange(1, 4):
         QtGui.QTreeWidgetItem(
             item, QtCore.QStringList('Child(%i,%i)' % (num, i)))
     item.setExpanded(True)
Exemple #11
0
 def initTree(self):
     self.uvcdat_items={}
     for k in sorted(plotTypes.keys()):
         self.uvcdat_items[k]=QtGui.QTreeWidgetItem(None, QtCore.QStringList(k),3)
         self.templateTree.addTopLevelItem(self.uvcdat_items[k])
         for t in self.getMethods(self.uvcdat_items[k]):
             item = QtGui.QTreeWidgetItem(self.uvcdat_items[k], QtCore.QStringList(t),4)
     self.templateTree.expandAll()
Exemple #12
0
    def updateModule(self, module):
        """ updateModule(module: Module) -> None        
        Setup this tree widget to show functions of module
        
        """
        self.clear()

        if module and module.is_valid:
            registry = get_module_registry()
            try:
                descriptor = module.module_descriptor
            except ModuleRegistryException, e:
                # FIXME handle this the same way as
                # vistrail_controller:change_selected_version

                # FIXME add what we know and let the rest be blank
                # in other words, add the methods as base and the
                # set methods
                # probably want to disable adding methods!
                # need a "COPY values method FROM m1 to m2"
                raise
            moduleHierarchy = registry.get_module_hierarchy(descriptor)

            base_items = {}
            # Create the base widget item for each descriptor
            for descriptor in moduleHierarchy:
                baseName = descriptor.name
                base_package = descriptor.identifier
                baseItem = QMethodTreeWidgetItem(
                    None, None, self, (QtCore.QStringList() << baseName << ''))
                base_items[descriptor] = baseItem

            method_specs = {}
            # do this in reverse to ensure proper overloading
            # !!! NOTE: we have to use ***all*** input ports !!!
            # because a subclass can overload a port with a
            # type that isn't a method
            for descriptor in reversed(moduleHierarchy):
                method_specs.update((name, (descriptor, spec))
                                    for name, spec in \
                                        registry.module_ports('input',
                                                              descriptor))

            # add local registry last so that it takes precedence
            method_specs.update((spec.name, (descriptor, spec))
                                for spec in module.port_spec_list
                                if spec.type == 'input')

            for _, (desc, method_spec) in sorted(method_specs.iteritems()):
                if registry.is_method(method_spec):
                    baseItem = base_items[desc]
                    sig = method_spec.short_sigstring
                    QMethodTreeWidgetItem(
                        module, method_spec, baseItem,
                        (QtCore.QStringList() << method_spec.name << sig))

            self.expandAll()
            self.resizeColumnToContents(0)
Exemple #13
0
 def __init__(self):
     QtGui.QTreeWidget.__init__(self)
     self.header().setResizeMode(QtGui.QHeaderView.Stretch)
     self.setHeaderLabels(['Title', 'Type'])
     a = lxmlTreeWidgetItem(None, QtCore.QStringList(["1", "2", "3"]))
     self.insertTopLevelItem(0, a)
     b = lxmlTreeWidgetItem(None, QtCore.QStringList(["a", "b", "c"]))
     a.addChild(b)
     self.insertTopLevelItem(
         1, lxmlTreeWidgetItem(None, QtCore.QStringList(["x", "y", "z"])))
    def refreshISOList(self):
        print "[refreshISOList]"
        nameList = self.__vmInfoDB.getAllISOnames()
        self.listview.clear()
        for item in nameList:
            qStringList = QtCore.QStringList([str(item)])
            #twItem = QtGui.QTreeWidgetItem(qStringList)
            twItem = QtGui.QTreeWidgetItem(QtCore.QStringList(item))
            self.listview.addTopLevelItem(twItem)

        self.isoPathLineEdit.setReadOnly(True)
Exemple #15
0
    def saveWidgetState(self, widget):
        writer = self.writer
        classname = widget.metaObject().className()
        writer.writeStartElement(classname)
        writer.writeAttribute('name', widget.objectName())

        currentIndex = widget.property('currentIndex')
        if currentIndex.isValid():
            writer.writeAttribute('currentIndex', currentIndex.toString())

        if widget.inherits('QMainWindow'):
            if widget.windowState() and QtCore.Qt.WindowMaximized:
                writer.writeAttribute('maximized', '1')
            else:
                l = QtCore.QStringList()
                for num in (widget.geometry().left(), widget.geometry().top(),
                            widget.geometry().width(),
                            widget.geometry().height()):
                    l.append(QtCore.QString.number(num))
                writer.writeAttribute('geometry', l.join(","))

        if widget.inherits('QDockWidget'):
            if not widget.isVisible():
                writer.writeAttribute('visible', '0')
            area = widget.parent().dockWidgetArea(widget)
            writer.writeAttribute('area', QtCore.QString.number(area))

        if widget.inherits('QSplitter'):
            l = QtCore.QStringList()
            for size in widget.sizes():
                l.append(QtCore.QString.number(size))
            writer.writeAttribute('sizes', l.join(","))

        if widget.inherits('QTableView'):
            l = QtCore.QStringList()
            header = widget.horizontalHeader()
            for index in range(header.count()):
                l.append(QtCore.QString.number(header.sectionSize(index)))
            writer.writeAttribute('headerSections', l.join(","))
            l.clear()
            for index in range(header.count()):
                l.append(QtCore.QString.number(header.visualIndex(index)))
            writer.writeAttribute('visualOrder', l.join(","))

        if widget.inherits('QToolBar'):
            if not widget.isVisible():
                writer.writeAttribute('visible', '0')

        for child in widget.children():
            if child.isWidgetType() and not child.objectName().isEmpty() \
                                    and not child.objectName().startsWith("qt_"):
                self.saveWidgetState(child)

        writer.writeEndElement()
Exemple #16
0
 def initVCSTree(self):
     for k in sorted(plotTypes.keys()):
         kitem = self.addPlotBar(k)
         for plot in plotTypes[k]:
             item = QtGui.QTreeWidgetItem(kitem, QtCore.QStringList(plot),
                                          self.VCS_CONTAINER_ITEM)
             item.setFlags(item.flags() & ~QtCore.Qt.ItemIsDragEnabled)
             ## Special section here for VCS GMs they have one more layer
             for m in self.plotTree.getMethods(item):
                 item2 = PlotTreeWidgetItem(plot, m, QtCore.QStringList(m),
                                            self.VCS_ITEM, None, item)
Exemple #17
0
    def test_focus_mode(self):
        if not hasattr(self.beamline_test_hwobj, "get_focus_mode"):
            self.test_focus_page.setEnabled(False)
            return

        active_mode, beam_size = self.beamline_test_hwobj.get_focus_mode()

        if active_mode is None:
            self.beamline_test_widget.focus_mode_label.setText(\
                 "<font color='red'>No focusing mode detected<font>")
        else:
            self.beamline_test_widget.focus_mode_label.setText(\
                 "<font color='black'>%s mode detected<font>" % active_mode)
        focus_modes = self.beamline_test_hwobj.get_focus_mode_names()
        focus_modes_table = self.beamline_test_widget.focus_modes_table
        focus_modes_combo = self.beamline_test_widget.focus_modes_combo

        if focus_modes:
            focus_modes_table.setColumnCount(len(focus_modes))
            focus_modes_combo.clear()
            hor_labels = QtCore.QStringList(focus_modes)
            focus_modes_table.setHorizontalHeaderLabels(hor_labels)
            for col, mode in enumerate(focus_modes):
                focus_modes_combo.addItem(mode)
        if active_mode:
            focus_modes_combo.setCurrentIndex(\
                 focus_modes_combo.findText(active_mode))
        else:
            focus_modes_combo.setCurrentIndex(-1)

        focus_motors_list = self.beamline_test_hwobj.get_focus_motors()
        if focus_motors_list:
            ver_labels = QtCore.QStringList()
            focus_modes_table.setRowCount(len(focus_motors_list))
            for row, motor in enumerate(focus_motors_list):
                ver_labels.append(motor['motorName'])
                for col, mode in enumerate(focus_modes):
                    item_text = "%.3f/%.3f" % (motor['focusingModes'][mode],
                                               motor['position'])
                    res = (mode in motor['focMode'])
                    if res:
                        temp_table_item = QtGui.QTableWidgetItem(item_text)
                        temp_table_item.setBackground(
                            Qt4_widget_colors.LIGHT_GREEN)
                    else:
                        temp_table_item = QtGui.QTableWidgetItem(item_text)
                        temp_table_item.setBackground(
                            Qt4_widget_colors.LIGHT_RED)
                    focus_modes_table.setItem(row, col, temp_table_item)
            focus_modes_table.setVerticalHeaderLabels(ver_labels)
Exemple #18
0
 def __initWidgets(self):
     self.strList = QtCore.QStringList()
     self.strList<<QtCore.QString(QtGui.QApplication.translate('DDA_JointSet','dip')) \
         <<QtCore.QString(QtGui.QApplication.translate('DDA_JointSet','dip direction')) \
         <<QtCore.QString('')
 
     self.label1 = QtGui.QLabel(QtGui.QApplication.translate('DDA_JointSet','Slope'))
     self.slopeDataTable = DataTable(1,2,self.strList , False , False)
     self.table1 = self.slopeDataTable.table
     self.table1.setColumnWidth(2 , 50)
     self.table1.setFixedSize(220,60)
     self.table1.setHorizontalHeaderLabels(self.strList)
     self.layout1 = QtGui.QVBoxLayout()
     self.layout1.addWidget(self.label1)
     self.layout1.addWidget(self.table1)
     self.__table1Valid = False
     
     self.strList2 = QtCore.QStringList()
     self.strList2<<QtCore.QString(QtGui.QApplication.translate('DDA_JointSet','dip')) \
         <<QtCore.QString(QtGui.QApplication.translate('DDA_JointSet','dip direction')) \
         <<QtCore.QString(QtGui.QApplication.translate('DDA_JointSet','spacing')) \
         <<QtCore.QString(QtGui.QApplication.translate('DDA_JointSet','length')) \
         <<QtCore.QString(QtGui.QApplication.translate('DDA_JointSet','bridge')) \
         <<QtCore.QString(QtGui.QApplication.translate('DDA_JointSet','random')) \
         <<QtCore.QString('')
     self.label2 = QtGui.QLabel(QtGui.QApplication.translate('DDA_JointSet','JointSet'))
     self.dataTable = DataTable(1 , self.__columnNum ,self.strList2)
     self.table2 = self.dataTable.table
     self.table2.setColumnWidth(6 , 50)
     self.table2.setFixedSize(690,130)
     self.__table2Valid = False
     
     self.layout2 = QtGui.QVBoxLayout()
     self.layout2.addWidget(self.label2)
     self.layout2.addWidget(self.table2)
     
     self.layout3 = QtGui.QHBoxLayout()
     self.addButton = QtGui.QPushButton(QtGui.QApplication.translate('DDA_JointSet','Add JointSet'))
     self.viewButton = QtGui.QPushButton(QtGui.QApplication.translate('DDA_JointSet','ViewResult'))
     self.viewButton.setEnabled(False)
     self.layout3.addWidget(self.addButton)
     self.layout3.addWidget(self.viewButton)
     
     self.layout4 = QtGui.QVBoxLayout()
     self.layout4.addLayout(self.layout1)
     self.layout4.addLayout(self.layout2)
     self.layout4.addLayout(self.layout3)
     
     self.mainWidget = QtGui.QWidget()
     self.mainWidget.setLayout(self.layout4)
Exemple #19
0
 def initTree(self):
     '''
     获得所有的组名,并显示在grouptree上
     '''        
     grouplist = self.userInfo['groupList'].split(',')
     for g in grouplist :
         group1 =   QtGui.QTreeWidgetItem(self.ui.groupTree, QtCore.QStringList(QtCore.QString(g.strip())))
         group1.setIcon(0, QtGui.QIcon("res/group.png"))
         group1_1 = QtGui.QTreeWidgetItem(group1, QtCore.QStringList(QtCore.QString('members')))
         group1_1.setIcon(0, QtGui.QIcon("res/member.png"))
         group1.addChild(group1_1)   
         group1_2 = QtGui.QTreeWidgetItem(group1, QtCore.QStringList(QtCore.QString('resources')))
         group1_2.setIcon(0, QtGui.QIcon("res/resource.png"))
         group1.addChild(group1_2)      
Exemple #20
0
 def _get_project_item(self, project):
     if project.context:
         item = QtGui.QTreeWidgetItem(
             QtCore.QStringList([project.name, project.context.name]))
         item.setBackgroundColor(
             1, QtGui.QColor(styles[project.context.color]["background"]))
         item.setTextColor(
             1, QtGui.QColor(styles[project.context.color]["text"]))
         if project.context.icon:
             item.setIcon(1,
                          QtGui.QIcon(contexticons[project.context.icon]))
     else:
         item = QtGui.QTreeWidgetItem(QtCore.QStringList([project.name,
                                                          ""]))
     return item
 def run(self, filedir, filename, arg_string):
     self.running = True
     self.clear()
     if os.name != "posix":
         filename = filename.replace("./", "\\")
         arg_string = filedir + filename + " " + arg_string
         args = shlex.split(arg_string)
         self.process.start(QtCore.QString("WScript.Shell"),
                            QtCore.QStringList(args))
         #self.writeDataToProcess(arg_string)
     else:
         args = shlex.split(arg_string)
         self.process.setWorkingDirectory(filedir)
         self.process.start(QtCore.QString(filename),
                            QtCore.QStringList(args))
Exemple #22
0
 def _get_context_item(self, context):
     item = QtGui.QTreeWidgetItem(QtCore.QStringList(context.name))
     item.setBackgroundColor(0, QtGui.QColor(styles[context.color]["background"]))
     item.setTextColor(0, QtGui.QColor(styles[context.color]["text"]))
     item.setIcon(0, QtGui.QIcon(contexticons.get(context.icon, "")))
     item.setData(0, QtCore.Qt.UserRole, QtCore.QVariant(context))
     return item
	def __init__(self, padre, lista_procesos = []):
		self.m = QtGui.QStandardItemModel(0, 5, padre)
		encabezados = QtCore.QStringList()
		encabezados << "Nodo (ID)" << "Proceso (ID)" << "Carga" << "Código" << "Estado"
		self.m.setHorizontalHeaderLabels(encabezados)
		self.lista_procesos = lista_procesos
		self.actualizar_lista(self.lista_procesos)
Exemple #24
0
 def setWidgetFromProperty(self, row, prop):
     """
     Descript. :
     """
     if prop.getType() == 'boolean':
         newPropertyItem = QtGui.QTableWidgetItem(QtCore.QString(""))
         self.setItem(row, 1, newPropertyItem)
         if prop.getUserValue():
             self.item(row, 1).setCheckState(QtCore.Qt.Checked)
         else:
             self.item(row, 1).setCheckState(QtCore.Qt.Unchecked)
     elif prop.getType() == 'combo':
         choicesList = QtCore.QStringList()
         choices = prop.getChoices()
         for choice in choices:
             choicesList.append(choice)
         newPropertyItem = ComboBoxTableItem(self, row, 1, choicesList)
         newPropertyItem.setCurrentIndex(
             newPropertyItem.findText(prop.getUserValue()))
         self.setCellWidget(row, 1, newPropertyItem)
     elif prop.getType() == 'file':
         newPropertyItem = FileTableItem(self, row, 1, prop.getUserValue(),
                                         prop.getFilter())
         self.setCellWidget(row, 1, newPropertyItem)
     elif prop.getType() == 'color':
         newPropertyItem = ColorTableItem(self, row, 1, prop.getUserValue())
         self.setCellWidget(row, 1, newPropertyItem)
     else:
         if prop.getUserValue() is None:
             tempTableItem = QtGui.QTableWidgetItem("")
         else:
             tempTableItem = QtGui.QTableWidgetItem(str(
                 prop.getUserValue()))
         self.setItem(row, 1, tempTableItem)
Exemple #25
0
    def data(self, index, role):
        if not index.isValid():
            return QtCore.QVariant()

        if role != QtCore.Qt.DisplayRole:
            return QtCore.QVariant()

        item = index.internalPointer()

        node = item.node()
        attributes = QtCore.QStringList()
        attributeMap = node.attributes()

        if index.column() == 0:
            return QtCore.QVariant(node.nodeName())

        elif index.column() == 1:
            for i in range(0, attributeMap.count()):
                attribute = attributeMap.item(i)
                attributes.append(attribute.nodeName() + "=\"" + \
                                  attribute.nodeValue() + "\"")

            return QtCore.QVariant(attributes.join(" "))
        elif index.column() == 2:
            return QtCore.QVariant(node.nodeValue().split("\n").join(" "))
        else:
            return QtCore.QVariant()
Exemple #26
0
    def setupParameterTable(self):

        self.parameterTable.clear()

        headerLabels = QtCore.QStringList(['Parameter', 'Value'])
        self.parameterTable.setHorizontalHeaderLabels(headerLabels)
        self.parameterTable.horizontalHeader().setStretchLastSection(True)

        params = [
            'B Field', 'Line Center', 'Mode 1 Freq', 'Orders1', 'Mode 2 Freq',
            'Orders2', 'Mode 3 Freq', 'Orders3', 'Micromotion',
            'Drive Frequency'
        ]
        self.parameterTable.setRowCount(len(params))
        for i, p in enumerate(params):

            label = QtGui.QLabel(p)
            value = QtGui.QDoubleSpinBox()

            self.value_dict[p] = ParamInfo(value)

            value.setDecimals(3)
            value.setRange(-100, 100)
            value.setValue(0)

            self.parameterTable.setCellWidget(i, 0, label)
            self.parameterTable.setCellWidget(i, 1, value)
def writeShape(theMemoryLayer, theFileName):
    myFileName = os.path.join(str(QtCore.QDir.tempPath()), theFileName)
    print myFileName
    # Explicitly giving all options, not really needed but nice for clarity
    myErrorMessage = QtCore.QString()
    myOptions = QtCore.QStringList()
    myLayerOptions = QtCore.QStringList()
    mySelectedOnlyFlag = False
    mySkipAttributesFlag = False
    myGeoCrs = QgsCoordinateReferenceSystem()
    myGeoCrs.createFromId(4326, QgsCoordinateReferenceSystem.EpsgCrsId)
    myResult = QgsVectorFileWriter.writeAsVectorFormat(
        theMemoryLayer, myFileName, 'utf-8', myGeoCrs, 'ESRI Shapefile',
        mySelectedOnlyFlag, myErrorMessage, myOptions, myLayerOptions,
        mySkipAttributesFlag)
    assert myResult == QgsVectorFileWriter.NoError
Exemple #28
0
 def mimeTypes(self):
     types = QtCore.QStringList()
     types << struct.DocLink.MIME_TYPE
     types << struct.RevLink.MIME_TYPE
     types << 'application/x-hotchpotch-linklist'
     types << "text/uri-list"
     return types
    def checkAll(self, check=False):
        """ Function to set all the items as checked or unchecked based on
            the argument.

            Args:
                check(bool): Check State.

            Returns:
                (list) : list of items Checked or UnChecked based 
                        on the status.
        """
        itemList = QtCore.QStringList()
        searchState = QtCore.Qt.Checked
        assignState = QtCore.Qt.Unchecked
        if check:
            searchState = QtCore.Qt.Unchecked
            assignState = QtCore.Qt.Checked
        if self._model:
            modelIndex = self._model.index(0,
                                            self.modelColumn(),
                                            self.rootModelIndex())
            modelIndexList = self._model.match(modelIndex,
                                            QtCore.Qt.CheckStateRole,
                                            searchState,
                                            -1,
                                            QtCore.Qt.MatchExactly)
            for mIndex in modelIndexList:
                self.setItemData(mIndex.row(),
                                assignState,
                                QtCore.Qt.CheckStateRole)
        return itemList
Exemple #30
0
    def loadWorkspace(self, event):
        if str(event.text()) == 'New Workspace':
            self.parent.workspaceNew()
        elif str(event.text()) == 'Save Workspace':
            self.parent.workspaceSave()
        elif str(event.text()) == 'Close Current Workspace':
            self.parent.workspaceClose(askSave=1, openStart=1)
        elif str(event.text()) == 'Delete Workspace':
            if os.path.exists(self.parent.settingPath + '/workspaces'):
                resp, ok = QtGui.QInputDialog.getItem(
                    self.parent,
                    'Delete Workspace',
                    'Select the workspace to delete',
                    QtCore.QStringList(
                        sorted(
                            os.listdir(self.parent.settingPath +
                                       '/workspaces'))),
                    editable=0)

                if ok:
                    wksp = str(resp)
                    if wksp in self.parent.workspaces:
                        self.parent.workspaceClose(wksp)
                    os.remove(self.parent.settingPath + '/workspaces/' +
                              str(resp))
                    self.loadMenu()
            else:
                QtGui.QMessageBox.warning(self, 'No Workspaces',
                                          'There are no workspaces to delete')
        elif str(event.text()) == 'Rename Workspace':
            self.parent.workspaceRename()
        else:
            self.parent.workspaceOpen(str(event.text()))
            self.saveWact.setDisabled(0)
            self.closeWact.setDisabled(0)