Skip to content

Commit

Permalink
fix[#23] detect failure and report to user
Browse files Browse the repository at this point in the history
- repurpose sideloaderinstalldone to display error
- remove fail UI
  • Loading branch information
jardon committed Dec 10, 2024
1 parent f687c2b commit 1bd6831
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 63 deletions.
21 changes: 0 additions & 21 deletions vanilla_sideload/gtk/view-fail.ui

This file was deleted.

1 change: 0 additions & 1 deletion vanilla_sideload/vanilla-sideload.gresource.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<gresources>
<gresource prefix="/org/vanillaos/Sideload">
<file preprocess="xml-stripblanks">gtk/window.ui</file>
<file preprocess="xml-stripblanks">gtk/view-fail.ui</file>
<file preprocess="xml-stripblanks">gtk/view-install-done.ui</file>
<file preprocess="xml-stripblanks">gtk/view-install.ui</file>
<file preprocess="xml-stripblanks">gtk/view-loading.ui</file>
Expand Down
31 changes: 0 additions & 31 deletions vanilla_sideload/views/fail.py

This file was deleted.

7 changes: 3 additions & 4 deletions vanilla_sideload/views/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
class SideloaderInstall(Adw.Bin):
# TODO: this and the uninstall view could be merged into one view
__gtype_name__: Text = "SideloaderInstall"
__gsignals__: Dict[Text, Tuple[GObject.SignalFlags, Any, Tuple[bool]]] = {
"done": (GObject.SignalFlags.RUN_FIRST, None, (bool,))
__gsignals__: Dict[Text, Tuple[GObject.SignalFlags, Any, Tuple[int]]] = {
"done": (GObject.SignalFlags.RUN_FIRST, None, (int,))
}

stack_main: Adw.ViewStack = Gtk.Template.Child()
Expand Down Expand Up @@ -161,8 +161,7 @@ def on_response(dialog: Adw.MessageDialog, response: Text) -> None:
def on_vte_child_exited(
self, console: Vte.Terminal, status: int, *args: Any
) -> None:
if not bool(status):
self.emit("done", True)
self.emit("done", status)

def __on_console_clicked(self, btn: Gtk.Button) -> None:
status: bool = not self.box_console_main.get_visible()
Expand Down
1 change: 0 additions & 1 deletion vanilla_sideload/views/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ viewsdir = join_paths(pkgdatadir, 'vanilla_sideload/views')

sources = [
'__init__.py',
'fail.py',
'install_done.py',
'install.py',
'loading.py',
Expand Down
10 changes: 5 additions & 5 deletions vanilla_sideload/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
from vanilla_sideload.backend.dpkg import DpkgResolver
from vanilla_sideload.backend.android import AndroidResolver
from vanilla_sideload.backend.types import ValidSideloadAction, DebPackage
from vanilla_sideload.views.fail import SideloaderFail
from vanilla_sideload.views.install_done import SideloaderInstallDone
from vanilla_sideload.views.install import SideloaderInstall
from vanilla_sideload.views.loading import SideloaderLoading
Expand Down Expand Up @@ -92,18 +91,19 @@ def __build_install_ui(self) -> None:
self.bin_main.set_child(self.view_install)

def __on_install_done(self, view_install: SideloaderInstall, *args: Any) -> None:
success = not bool(args[0])
view_install_done = SideloaderInstallDone(self.__pkg.name)
view_install_done.btn_logs.connect("clicked", self.__on_view_logs)
if not success:
view_install_done.status.set_title(_("Installation Failed"))
view_install_done.status.set_description(_("The package installation was unsuccessful"))
view_install_done.status.set_property("icon-name", "dialog-error-symbolic")
self.bin_main.set_child(view_install_done)

def __build_uninstall_ui(self) -> None:
view_uninstall = SideloaderUninstall(self.__pkg)
self.bin_main.set_child(view_uninstall)

def __build_error_ui(self, error_message: Text) -> None:
view_fail = SideloaderFail(error_message)
self.bin_main.set_child(view_fail)

def __read_package_info(self) -> None:
if self.__pkg_path.endswith(".apk"):
self.__pkg = self.__aresolver.extract_info()
Expand Down

0 comments on commit 1bd6831

Please sign in to comment.