mirror of
https://github.com/morgan9e/warehouse
synced 2026-04-14 16:24:20 +09:00
Don't show success toast after cancelling a package installation
This commit is contained in:
@@ -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):
|
||||||
|
|||||||
@@ -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:
|
||||||
|
|||||||
Reference in New Issue
Block a user