mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-07 06:32:08 +08:00
fix updater UI repaints
old-commit-hash: 56d682831b857e1893769659e00461e801706bd6
This commit is contained in:
@@ -150,7 +150,8 @@ def flash_partition(target_slot_number: int, partition: dict, cloudlog):
|
||||
for chunk in unsparsify(downloader):
|
||||
raw_hash.update(chunk)
|
||||
out.write(chunk)
|
||||
print(f"Installing {partition['name']}: {out.tell() / partition_size * 100}", file=sys.stderr)
|
||||
p = int(out.tell() / partition_size * 100)
|
||||
print(f"Installing {partition['name']}: {p}")
|
||||
|
||||
if raw_hash.hexdigest().lower() != partition['hash_raw'].lower():
|
||||
raise Exception(f"Unsparse hash mismatch '{raw_hash.hexdigest().lower()}'")
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:a242a48497a398be53dee2cbe7f1f11f37c0b3ad28c5bee51b5ab16ef0de1019
|
||||
size 7820552
|
||||
oid sha256:5a3feb8ff998745e6a25ded05fcd310453948d4d7bc525eba95ce05d6e2fb809
|
||||
size 7829896
|
||||
|
||||
@@ -136,24 +136,24 @@ Updater::Updater(const QString &updater_path, const QString &manifest_path, QWid
|
||||
|
||||
void Updater::installUpdate() {
|
||||
setCurrentWidget(progress);
|
||||
QObject::connect(&proc, &QProcess::readyReadStandardError, this, &Updater::readProgress);
|
||||
QObject::connect(&proc, &QProcess::readyReadStandardOutput, this, &Updater::readProgress);
|
||||
QObject::connect(&proc, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), this, &Updater::updateFinished);
|
||||
proc.setProcessChannelMode(QProcess::ForwardedOutputChannel);
|
||||
proc.setProcessChannelMode(QProcess::ForwardedErrorChannel);
|
||||
proc.start(updater, {"--swap", manifest});
|
||||
}
|
||||
|
||||
void Updater::readProgress() {
|
||||
auto lines = QString(proc.readAllStandardError());
|
||||
auto lines = QString(proc.readAllStandardOutput());
|
||||
for (const QString &line : lines.trimmed().split("\n")) {
|
||||
auto parts = line.split(":");
|
||||
if (parts.size() == 2) {
|
||||
text->setText(parts[0]);
|
||||
bar->setValue((int)parts[1].toDouble());
|
||||
repaint();
|
||||
} else {
|
||||
qDebug() << line;
|
||||
}
|
||||
}
|
||||
update();
|
||||
}
|
||||
|
||||
void Updater::updateFinished(int exitCode, QProcess::ExitStatus exitStatus) {
|
||||
|
||||
Reference in New Issue
Block a user