示例#1
0
 def iconChooser(self):
     ' Choose a Icon and copy it to clipboard '
     #
     from .std_icon_naming import std_icon_naming as a
     #
     prv = QDialog(self.dock)
     prv.setWindowFlags(Qt.FramelessWindowHint)
     prv.setAutoFillBackground(True)
     prv.setGeometry(self.fileView.geometry())
     table = QTableWidget(prv)
     table.setColumnCount(1)
     table.setRowCount(len(a))
     table.verticalHeader().setVisible(True)
     table.horizontalHeader().setVisible(False)
     table.setShowGrid(True)
     table.setIconSize(QSize(128, 128))
     for index, icon in enumerate(a):
         item = QTableWidgetItem(QIcon.fromTheme(icon), '')
         # item.setData(Qt.UserRole, '')
         item.setToolTip(icon)
         table.setItem(index, 0, item)
     table.clicked.connect(lambda: QApplication.clipboard().setText(
       'QtGui.QIcon.fromTheme("{}")'.format(table.currentItem().toolTip())))
     table.doubleClicked.connect(prv.close)
     table.resizeColumnsToContents()
     table.resizeRowsToContents()
     QLabel('<h3> <br> 1 Click Copy, 2 Clicks Close </h3>', table)
     table.resize(prv.size())
     prv.exec_()
示例#2
0
 def viewTableUpdate(self, id):
   write = int(str(self.gtable.cellWidget(id, 0).currentText()), 16) 
   t = self.tables.tablesIdWriteMap[id][write]
   l = t.blockList
   for x in xrange(0, len(t.blockList[0])):
     block = t.blockList[0][x]
     c = ((x) % 20) 
     r = ((x) / 20) 
     item = QTableWidgetItem(QString(hex(block))) 
     tipBlock = (id * 960) + x
     item.setToolTip(QString(hex(tipBlock)))
     item.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
     self.vtable.setItem(r ,c,  item)
示例#3
0
文件: K800iRecover.py 项目: kzwkt/dff
 def viewTableUpdate(self, id):
     write = int(str(self.gtable.cellWidget(id, 0).currentText()), 16)
     t = self.tables.tablesIdWriteMap[id][write]
     l = t.blockList
     for x in xrange(0, len(t.blockList[0])):
         block = t.blockList[0][x]
         c = ((x) % 20)
         r = ((x) / 20)
         item = QTableWidgetItem(QString(hex(block)))
         tipBlock = (id * 960) + x
         item.setToolTip(QString(hex(tipBlock)))
         item.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
         self.vtable.setItem(r, c, item)
示例#4
0
    def servoDataUpdate(self, servoId, addressOffset, servoData):
        if not self.servos.has_key(servoId):
            self.servoAdd(servoId)
        columnNumber = self.servos[servoId]['columnNumber']
        self.updating = True
        servoDataString = ('%c' * len(servoData)) % tuple(
            chr(c) for c in servoData)
        index = 0
        while index < len(servoDataString):
            fieldInfo = self.serialProtocol.memoryInfo[addressOffset + index]

            if fieldInfo['numElements'] != 1:
                self.log(
                    0,
                    'ERROR: MainWindow.servoDataUpdate(): numElements != 1 -> Arrays are not supported, yet...'
                )

            value = self.converter.fromString(servoDataString[index:],
                                              fieldInfo['type'])
            index += fieldInfo['size']

            # check if the item is being plotted
            subscribeId = '[%d].%s' % (servoId, fieldInfo['name'])
            if self.subscribedData.has_key(subscribeId):
                self.dataPlot.updateValue(subscribeId, float(value))

            # check for existing item, or create a new one
            dataItem = self.tableServoData.item(fieldInfo['index'],
                                                columnNumber)
            if not dataItem:
                dataItem = QTableWidgetItem()
                if fieldInfo['writable']:
                    dataItem.setFlags(Qt.ItemIsEnabled | Qt.ItemIsEditable
                                      | Qt.ItemIsSelectable)
                else:
                    dataItem.setFlags(Qt.ItemFlag())
                self.tableServoData.setItem(fieldInfo['index'], columnNumber,
                                            dataItem)

            if type(value) == float:
                valueString = ('%.7f' % value).rstrip('0')
            else:
                valueString = str(value)
            dataItem.setText(valueString)  # update item text
            dataItem.setToolTip(
                fieldInfo['makeToolTip'](value))  # update item tool tip

        self.tableServoData.resizeColumnToContents(columnNumber)
        self.updating = False
示例#5
0
    def servoDataUpdate(self, servoId, addressOffset, servoData):
        if not self.servos.has_key(servoId):
            self.servoAdd(servoId)
        columnNumber = self.servos[servoId]['columnNumber']
        self.updating = True
        servoDataString = ('%c' * len(servoData)) % tuple(chr(c) for c in servoData)
        index = 0
        while index < len(servoDataString):
            fieldInfo = self.serialProtocol.memoryInfo[addressOffset + index]

            if fieldInfo['numElements'] != 1:
                self.log(0, 'ERROR: MainWindow.servoDataUpdate(): numElements != 1 -> Arrays are not supported, yet...')

            value = self.converter.fromString(servoDataString[index:], fieldInfo['type'])
            index += fieldInfo['size']

            # check if the item is being plotted
            subscribeId = '[%d].%s' % (servoId, fieldInfo['name'])
            if self.subscribedData.has_key(subscribeId):
                self.dataPlot.updateValue(subscribeId, float(value))

            # check for existing item, or create a new one
            dataItem = self.tableServoData.item(fieldInfo['index'], columnNumber)
            if not dataItem:
                dataItem = QTableWidgetItem()
                if fieldInfo['writable']:
                    dataItem.setFlags(Qt.ItemIsEnabled | Qt.ItemIsEditable | Qt.ItemIsSelectable)
                else:
                    dataItem.setFlags(Qt.ItemFlag())
                self.tableServoData.setItem(fieldInfo['index'], columnNumber, dataItem)

            if type(value) == float:
                valueString = ('%.7f' % value).rstrip('0')
            else:
                valueString = str(value)
            dataItem.setText(valueString) # update item text
            dataItem.setToolTip(fieldInfo['makeToolTip'](value)) # update item tool tip

        self.tableServoData.resizeColumnToContents(columnNumber)
        self.updating = False
    def handleInfo(self):
        reply = self.sender()
        error = reply.error()
        if error != QNetworkReply.NoError:
            self.iface.messageBar().pushMessage(reply.errorString(), level=QgsMessageBar.WARNING)
            reply.deleteLater()
            reply = None
        else:
            response_text = reply.readAll().data()
            data = json.loads(response_text)
            count = data['totalFeatures']
            if (count == 0):
                self.tableWidget.clear()
                self.tableWidget.setColumnCount(1);
                self.tableWidget.setRowCount(1);
                text = QTableWidgetItem('Geen documenten gevonden')
                self.tableWidget.setItem(0,0,text)
                self.tableWidget.resizeColumnToContents(0)
            else:    
                self.tableWidget.clear()
                self.tableWidget.setColumnCount(3);
                self.tableWidget.setRowCount(count);
                features = data['features']
                for idx, feature in enumerate(features):
                    text1 = QTableWidgetItem(feature['properties']['dossier'])
                    text1.setToolTip(feature['properties']['verseonlink'])

                    text2 = QTableWidgetItem(feature['properties']['zaakomschrijving'])
                    text2.setToolTip(feature['properties']['zaakomschrijving'])
                    
                    value = QTableWidgetItem(feature['properties']['verseonlink'])
                    self.tableWidget.setItem(idx,0,text1)
                    self.tableWidget.setItem(idx,1,text2)
                    self.tableWidget.setItem(idx,2,value)
                
                self.tableWidget.setColumnHidden(2, True)
                self.tableWidget.resizeColumnToContents(0)
                self.tableWidget.resizeColumnToContents(1)
 def addItem(r, c, text, tip = None):
     item = QTableWidgetItem(text)
     if tip:
         item.setToolTip(tip)
     item.setData(ACTION_ROLE, QVariant(r))
     self._settingsTable.setItem(r, c, item)
示例#8
0
  def addSearchOptions(self, changed):
    clause = {}
    clause_box = BuildSearchClause()
    ret = clause_box.exec_()
    if ret:
      idx = self.typeName.currentIndex()
      data_type = self.typeName.itemData(idx)
      
      for i in range(0, clause_box.advancedOptions.count()):
        widget = clause_box.advancedOptions.itemAt(i).widget()
        if not len(widget.edit.text()):
          continue
        try:
          if len(clause[widget.edit.field]):
            clause[widget.edit.field] += (widget.edit.operator() + " " + widget.edit.field)
            clause[widget.edit.field] += (widget.edit.text())
        except KeyError:
          clause[widget.edit.field] = (widget.edit.text())

      table_clause_widget = SearchClause(self)
      table_clause_widget.clause_widget.insertColumn(0)
      table_clause_widget.clause_widget.insertColumn(1)
      table_clause_widget.clause_widget.horizontalHeader().setStretchLastSection(True)
      table_clause_widget.clause_widget.horizontalHeader().setFixedHeight(5)

      if QtCore.PYQT_VERSION_STR >= "4.5.0":
        table_clause_widget.clause_widget.itemChanged.connect(self.editing_clause)
      else:
        QtCore.QObject.connect(self.table_clause_widget.clause_widget,\
                                 SIGNAL("itemChanged(QTableWidgetItem)"), self.editing_clause)
      nb_line = 0
      text = ""
      if not self.nameContain.text().isEmpty():
        text += ("(name (\"" + self.nameContain.text() + ")\"")
        if not self.caseSensitiveName.isChecked():
          text += ",i)"
        else:
          text += ")"
        text += ")"
        if len(self.clause_list):
          text += " or "

      for i in clause:
        table_clause_widget.clause_widget.insertRow(table_clause_widget.clause_widget.rowCount())
	item = QTableWidgetItem(i)
	item.setFlags(Qt.ItemFlags(Qt.ItemIsUserCheckable | Qt.ItemIsEnabled))
	item.setToolTip(self.fieldText)
        table_clause_widget.clause_widget.setItem(table_clause_widget.clause_widget.rowCount() - 1, \
                                                    0, item)
	item = QTableWidgetItem(clause[i])
	item.setFlags(Qt.ItemFlags(Qt.ItemIsUserCheckable | Qt.ItemIsEnabled))
	item.setToolTip(self.clauseText)
        table_clause_widget.clause_widget.setItem(table_clause_widget.clause_widget.rowCount() - 1, 1,\
                                                   item)
        table_clause_widget.clause_widget.resizeRowToContents(table_clause_widget.clause_widget.rowCount() - 1)
        if nb_line == 0:
          text += ("(" + i + " " + clause[i] + ")")
        else:
          text += (" or (" + i + " " +  clause[i] + ")")
        nb_line = nb_line + 1
      text += ")"

      if nb_line:
        if len(self.clause_list) != 0:
          if QtCore.PYQT_VERSION_STR >= "4.5.0":
            table_clause_widget.and_clause.clicked.connect(self.rebuildQuery)
            table_clause_widget.or_clause.clicked.connect(self.rebuildQuery)
          else:
            QtCore.QObject.connect( table_clause_widget.and_clause, SIGNAL("clicked(bool)"), \
                                      self.rebuildQuery)
            QtCore.QObject.connect( table_clause_widget.or_clause, SIGNAL("clicked(bool)"), \
                                      self.rebuildQuery)
        else:
          table_clause_widget.or_clause.hide()
          table_clause_widget.and_clause.hide()
          table_clause_widget.bool_operator.deleteLater()
         
# Set height to : (rows amount * row size) + margin + header height, visible to have resize available
        table_clause_widget.clause_widget.setMaximumHeight((table_clause_widget.clause_widget.rowCount() *    \
                                                           table_clause_widget.clause_widget.rowHeight(0)) + \
							   4 + 5)
        self.completeClause.setText(text)
        self.advancedOptions.addWidget(table_clause_widget, self.advancedOptions.rowCount(), 0, Qt.AlignTop)
        self.clause_list.append(table_clause_widget)
    self.rebuildQuery()
    def __init__(self):
        QMainWindow.__init__(self)

        self.settings = QSettings("greyltc", "batch-iv-analysis")

        self.rows = 0 #keep track of how many rows there are in the table

        self.cols = OrderedDict()

        thisKey = 'plotBtn'
        self.cols[thisKey] = col()
        self.cols[thisKey].header = 'Draw Plot'
        self.cols[thisKey].tooltip = 'Click this button to draw a plot for that row'        

        thisKey = 'exportBtn'
        self.cols[thisKey] = col()
        self.cols[thisKey].header = 'Export'
        self.cols[thisKey].tooltip = 'Click this button to export\ninterpolated data points from fits'        

        thisKey = 'file'
        self.cols[thisKey] = col()
        self.cols[thisKey].header = 'File'
        self.cols[thisKey].tooltip = 'File name\nHover to see header from data file'

        thisKey = 'pce'
        self.cols[thisKey] = col()
        self.cols[thisKey].header = 'PCE\n[%]'
        self.cols[thisKey].tooltip = 'Power conversion efficiency as found from spline fit\nHover for value from characteristic equation fit'

        thisKey = 'pmax'
        self.cols[thisKey] = col()
        self.cols[thisKey].header = 'P_max\n[mW/cm^2]'
        self.cols[thisKey].tooltip = 'Maximum power density as found from spline fit\nHover for value from characteristic equation fit'

        thisKey = 'jsc'
        self.cols[thisKey] = col()
        self.cols[thisKey].header = 'J_sc\n[mA/cm^2]'
        self.cols[thisKey].tooltip = 'Short-circuit current density as found from spline fit\nHover for value from characteristic equation fit'

        thisKey = 'voc'
        self.cols[thisKey] = col()
        self.cols[thisKey].header = 'V_oc\n[mV]'
        self.cols[thisKey].tooltip = 'Open-circuit voltage as found from spline fit\nHover for value from characteristic equation fit'

        thisKey = 'ff'
        self.cols[thisKey] = col()
        self.cols[thisKey].header = 'FF'
        self.cols[thisKey].tooltip = 'Fill factor as found from spline fit\nHover for value from characteristic equation fit'

        thisKey = 'rs'
        self.cols[thisKey] = col()
        self.cols[thisKey].header = 'R_s\n[ohm*cm^2]'
        self.cols[thisKey].tooltip = 'Specific series resistance as found from characteristic equation fit\nHover for 95% confidence interval'

        thisKey = 'rsh'
        self.cols[thisKey] = col()
        self.cols[thisKey].header = 'R_sh\n[ohm*cm^2]'
        self.cols[thisKey].tooltip = 'Specific shunt resistance as found from characteristic equation fit\nHover for 95% confidence interval'

        thisKey = 'jph'
        self.cols[thisKey] = col()
        self.cols[thisKey].header = 'J_ph\n[mA/cm^2]'
        self.cols[thisKey].tooltip = 'Photogenerated current density as found from characteristic equation fit\nHover for 95% confidence interval'

        thisKey = 'j0'
        self.cols[thisKey] = col()
        self.cols[thisKey].header = 'J_0\n[nA/cm^2]'
        self.cols[thisKey].tooltip = 'Reverse saturation current density as found from characteristic equation fit\nHover for 95% confidence interval'

        thisKey = 'n'
        self.cols[thisKey] = col()
        self.cols[thisKey].header = 'n'
        self.cols[thisKey].tooltip = 'Diode ideality factor as found from characteristic equation fit\nHover for 95% confidence interval'

        thisKey = 'Vmax'
        self.cols[thisKey] = col()
        self.cols[thisKey].header = 'V_max\n[mV]'
        self.cols[thisKey].tooltip = 'Voltage at maximum power point as found from spline fit\nHover for value from characteristic equation fit'

        thisKey = 'area'
        self.cols[thisKey] = col()
        self.cols[thisKey].header = 'Area\n[cm^2]'
        self.cols[thisKey].tooltip = 'Device area'

        thisKey = 'pmax2'
        self.cols[thisKey] = col()
        self.cols[thisKey].header = 'P_max\n[mW]'
        self.cols[thisKey].tooltip = 'Maximum power as found from spline fit\nHover for value from characteristic equation fit'

        thisKey = 'isc'
        self.cols[thisKey] = col()
        self.cols[thisKey].header = 'I_sc\n[mA]'
        self.cols[thisKey].tooltip = 'Short-circuit current as found from characteristic equation fit\nHover for 95% confidence interval'

        thisKey = 'iph'
        self.cols[thisKey] = col()
        self.cols[thisKey].header = 'I_ph\n[mA]'
        self.cols[thisKey].tooltip = 'Photogenerated current as found from characteristic equation fit\nHover for 95% confidence interval'

        thisKey = 'i0'
        self.cols[thisKey] = col()
        self.cols[thisKey].header = 'I_0\n[nA]'
        self.cols[thisKey].tooltip = 'Reverse saturation current as found from characteristic equation fit\nHover for 95% confidence interval'

        thisKey = 'rs2'
        self.cols[thisKey] = col()
        self.cols[thisKey].header = 'R_s\n[ohm]'
        self.cols[thisKey].tooltip = 'Series resistance as found from characteristic equation fit\nHover for 95% confidence interval'

        thisKey = 'rsh2'
        self.cols[thisKey] = col()
        self.cols[thisKey].header = 'R_sh\n[ohm]'
        self.cols[thisKey].tooltip = 'Shunt resistance as found from characteristic equation fit\nHover for 95% confidence interval'		


        #how long status messages show for
        self.messageDuration = 2500#ms

        # Set up the user interface from Designer.
        self.ui = Ui_batch_iv_analysis()
        self.ui.setupUi(self)

        #insert cols
        for item in self.cols:
            blankItem = QTableWidgetItem()
            thisCol = self.cols.keys().index(item)
            self.ui.tableWidget.insertColumn(thisCol)
            blankItem.setToolTip(self.cols[item].tooltip)
            blankItem.setText(self.cols[item].header)
            self.ui.tableWidget.setHorizontalHeaderItem(thisCol,blankItem)
        
        #file system watcher
        self.watcher = QFileSystemWatcher(self)
        self.watcher.directoryChanged.connect(self.handleWatchUpdate)

        #connect signals generated by gui elements to proper functions 
        self.ui.actionOpen.triggered.connect(self.openCall)
        self.ui.actionEnable_Watching.triggered.connect(self.watchCall)
        self.ui.actionSave.triggered.connect(self.handleSave)
        self.ui.actionWatch_2.triggered.connect(self.handleWatchAction)
        

        self.ui.actionClear_Table.triggered.connect(self.clearTableCall)