Exemplo n.º 1
0
    def populate_versions(self, files):
        """Loads available firmware versions into versionbox widget"""

        for fname in files:
            item = QtGui.QStandardItem(fname[0] + " (" + fname[1] + ")")
            item.setData(fname[2], ROLE_DEVICE)
            self.versionBox.model().appendRow(item)

        self.statusbar.clearMessage()
Exemplo n.º 2
0
    def populate_boards(self, ports):
        """Populates board selection combobox from list of pyserial
        ListPortInfo objects"""

        self.boardBox.clear()

        prefered, others = self.group_ports(ports)

        for b in prefered:
            item = QtGui.QStandardItem(
                '{0.description} ({0.device})'.format(b))
            item.setData(b.device, ROLE_DEVICE)
            self.boardBox.model().appendRow(item)

        if not prefered:
            sep = QtGui.QStandardItem(self.tr('No boards found'))
            sep.setEnabled(False)
            self.boardBox.model().appendRow(sep)

            # No prefered boards has been found so far and there is a
            # suggested driver download URL available
            if not self.boards_detected and DRIVERS_URL:
                self.show_global_message(
                    self.tr('No boards found'),
                    self.tr(
                        'Have you installed <a href="{drivers_url}">'
                        'the drivers</a>?').format(drivers_url=DRIVERS_URL))
        else:
            self.globalMessage.hide()
            self.boards_detected = True

        if others:
            sep = QtGui.QStandardItem(self.tr('Others...'))
            sep.setEnabled(False)
            self.boardBox.model().appendRow(sep)

        for b in others:
            item = QtGui.QStandardItem(
                '{0.description} ({0.device})'.format(b))
            item.setData(b.device, ROLE_DEVICE)
            self.boardBox.model().appendRow(item)
Exemplo n.º 3
0
    def populate_versions(self, files):
        """Loads available firmware versions into versionbox widget"""

        for fname in files:
            if not fname.endswith('.bin'):
                continue

            item = QtGui.QStandardItem(fname)
            item.setData(UPDATE_REPOSITORY + fname, ROLE_DEVICE)
            self.versionBox.model().appendRow(item)

        self.statusbar.clearMessage()
Exemplo n.º 4
0
 def on_fileopenButton_clicked(self):
     options = QFileDialog.Options()
     options |= QFileDialog.DontUseNativeDialog
     fileName, _ = QFileDialog.getOpenFileName(
         self,
         "QFileDialog.getOpenFileName()",
         "",
         "Fimrware (*.bin *.ly32);;ESP8266 Firmware (*.bin);;ESP32 Firmware (*.ly32);;All Files (*)",
         options=options)
     if fileName:
         item = QtGui.QStandardItem("File: " + fileName)
         item.setData(fileName, ROLE_DEVICE)
         self.versionBox.model().insertRow(0, item)
         self.versionBox.setCurrentIndex(0)
Exemplo n.º 5
0
 def populate_languages(self, languages):
     for language in languages:
         item = QtGui.QStandardItem(language)
         #item.setData(UPDATE_REPOSITORY + fname, ROLE_DEVICE)
         self.languageBox.model().appendRow(item)
Exemplo n.º 6
0
 def populate_sensors2(self, sensors):
     for sensor in sensors:
         item = QtGui.QStandardItem(sensor)
         #item.setData(UPDATE_REPOSITORY + fname, ROLE_DEVICE)
         self.sensor2Box.model().appendRow(item)