Don't show success toast after cancelling a package installation

This commit is contained in:
Heliguy
2025-03-11 15:32:18 -04:00
parent 5b5c08e905
commit 807b01c915
2 changed files with 5 additions and 6 deletions

View File

@@ -51,7 +51,9 @@ class InstallPage(Adw.BreakpointBin):
def install_callback(self): def install_callback(self):
HostInfo.main_window.refresh_handler() HostInfo.main_window.refresh_handler()
if not self.did_error: if self.did_error:
return
if not PackageInstallWorker.cancelled:
HostInfo.main_window.toast_overlay.add_toast(Adw.Toast(title=_("Installed Packages"))) HostInfo.main_window.toast_overlay.add_toast(Adw.Toast(title=_("Installed Packages")))
def install_error_callback(self, user_facing_label, error_message): def install_error_callback(self, user_facing_label, error_message):

View File

@@ -34,10 +34,6 @@ class PackageInstallWorker:
group_ratio = (package_ratio + complete) / (total or 1) group_ratio = (package_ratio + complete) / (total or 1)
final_ratio = (group_ratio + index) / (this.total_groups or 1) final_ratio = (group_ratio + index) / (this.total_groups or 1)
print(f"gr: {(package_ratio + complete) / (total or 1):.2f}, fr: {((package_ratio + complete) / (total or 1) + index) / (this.total_groups or 1):.2f}")
print("i:", index, ", g:", this.total_groups, ", r:", package_ratio, ", c:", complete, ", t:", total)
print("=======================================")
if not this.loading_status is None: if not this.loading_status is None:
GLib.idle_add(lambda *_: this.loading_status.progress_bar.set_fraction(final_ratio)) GLib.idle_add(lambda *_: this.loading_status.progress_bar.set_fraction(final_ratio))
@@ -110,7 +106,6 @@ class PackageInstallWorker:
@classmethod @classmethod
def on_done(this, *args): def on_done(this, *args):
this.process = None this.process = None
this.cancelled = False
HostInfo.main_window.remove_refresh_lockout("installing packages") HostInfo.main_window.remove_refresh_lockout("installing packages")
if not this.loading_status is None: if not this.loading_status is None:
this.loading_status.progress_bar.set_fraction(0.0) this.loading_status.progress_bar.set_fraction(0.0)
@@ -118,6 +113,8 @@ class PackageInstallWorker:
if not this.callback is None: if not this.callback is None:
this.callback() this.callback()
this.cancelled = False
@classmethod @classmethod
def on_error(this, user_facing_label, error_message): def on_error(this, user_facing_label, error_message):
if not this.error_callback is None: if not this.error_callback is None: