def _launchUpdate(self): self.setTitle(_('Updating')) self.setSubTitle(_('Update in progress...')) self.wizard().button(self.wizard().CancelButton).setEnabled(False) self.wizard().button(self.wizard().BackButton).setEnabled(False) self._process = QtCore.QProcess(self) self._process.errorOccurred.connect(self._onError) self._process.finished.connect(self._onFinished) self._process.readyReadStandardError.connect(self._onStderr) self._process.readyReadStandardOutput.connect(self._onStdout) manifest = Meta.manifest() filename = os.path.join( Meta.dataPath('images'), manifest['leonardo']['firmware']['current']['name']) args = [ '-patmega32u4', '-cavr109', '-P%s' % self._devname, '-b57600', '-D', '-Uflash:w:%s:i' % filename, ] if platform.system() != 'Windows': args.insert(0, '-C%s' % Meta.avrdudeConf()) self._process.start(Settings().avrdude(), args)
def initializePage(self): self.setTitle(_('Image copy')) self.setSubTitle(_('Copying image file')) manifest = Meta.manifest() name = manifest['rpi0w-v2']['image']['current']['name'] self._src = os.path.join(Meta.dataPath('images'), name) self._dst = os.path.join( QtCore.QStandardPaths.writableLocation( QtCore.QStandardPaths.DownloadLocation), '%s.img' % os.path.splitext(name)[0]) ssid, password = self.wizard().wifi() self._thread = ImageCopyThread(self._src, self._dst, ssid, password, self.wizard().ssh()) self._thread.progress.connect(self._onProgress) self._thread.finished.connect(self._onFinished) self._thread.error.connect(self._onError) self._thread.start()
def __init__(self, parent, *, path, **kwargs): super().__init__(parent, **kwargs) self._path = path self._state = self.STATE_MANIFEST self._manifest = Meta.manifest() self._downloader = None self._msg = QtWidgets.QLabel(self) self._progress = QtWidgets.QProgressBar(self) bld = LayoutBuilder(self) with bld.vbox() as vbox: vbox.setContentsMargins(5, 5, 5, 5) vbox.addWidget(self._msg) vbox.addWidget(self._progress) with bld.hbox() as hbox: self._btn = QtWidgets.QPushButton(_('Cancel'), self) hbox.addStretch(1) hbox.addWidget(self._btn) self._btn.clicked.connect(self._cancel)