Skip to content

Commit

Permalink
details: Remove DetailsView
Browse files Browse the repository at this point in the history
  • Loading branch information
TheEvilSkeleton committed Jan 10, 2025
1 parent a5ef294 commit d011316
Show file tree
Hide file tree
Showing 8 changed files with 286 additions and 447 deletions.
514 changes: 273 additions & 241 deletions bottles/frontend/ui/bottle-details-page.blp

Large diffs are not rendered by default.

34 changes: 0 additions & 34 deletions bottles/frontend/ui/details.blp

This file was deleted.

1 change: 0 additions & 1 deletion bottles/frontend/ui/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ blueprints = custom_target('blueprints',
'details-installers.blp',
'details-taskmanager.blp',
'details-versioning.blp',
'details.blp',
'dialog-bottle-picker.blp',
'dialog-crash-report.blp',
'dialog-deps-check.blp',
Expand Down
35 changes: 10 additions & 25 deletions bottles/frontend/views/bottle_details_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@


@Gtk.Template(resource_path="/com/usebottles/bottles/bottle-details-page.ui")
class BottlesBottleDetailsPage(Adw.PreferencesPage):
class BottlesBottleDetailsPage(Adw.NavigationPage):
__gtype_name__ = "BottlesBottleDetailsPage"
__registry = []

Expand Down Expand Up @@ -94,20 +94,23 @@ class BottlesBottleDetailsPage(Adw.PreferencesPage):
row_no_programs = Gtk.Template.Child()
bottom_bar = Gtk.Template.Child()
drop_overlay = Gtk.Template.Child()
default_actions = Gtk.Template.Child()
list_tasks = Gtk.Template.Child()
pop_tasks = Gtk.Template.Child()
# endregion

content = Gdk.ContentFormats.new_for_gtype(Gdk.FileList)
target = Gtk.DropTarget(formats=content, actions=Gdk.DragAction.COPY)

style_provider = Gtk.CssProvider()

def __init__(self, details, config, **kwargs):
def __init__(self, window, config: Optional[BottleConfig] = None, **kwargs):
super().__init__(**kwargs)

# common variables and references
self.window = details.window
self.manager = details.window.manager
self.details = details
if config is None:
config = BottleConfig()

self.window = window
self.manager = window.manager
self.config = config
self.show_hidden = False

Expand All @@ -117,13 +120,8 @@ def __init__(self, details, config, **kwargs):
self.target.connect("leave", self.on_leave)

self.add_shortcuts.connect("clicked", self.add)
self.install_programs.connect("clicked", self.__change_page, "installers")
self.btn_execute.connect("clicked", self.run_executable)
self.popover_exec_settings.connect("closed", self.__run_executable_with_args)
self.row_preferences.connect("activated", self.__change_page, "preferences")
self.row_dependencies.connect("activated", self.__change_page, "dependencies")
self.row_snapshots.connect("activated", self.__change_page, "versioning")
self.row_taskmanager.connect("activated", self.__change_page, "taskmanager")
self.row_winecfg.connect("activated", self.run_winecfg)
self.row_debug.connect("activated", self.run_debug)
self.row_explorer.connect("activated", self.run_explorer)
Expand All @@ -147,19 +145,6 @@ def __init__(self, details, config, **kwargs):
"clicked", open_doc_url, "flatpak/black-screen-or-silent-crash"
)

def __change_page(self, _widget, page_name):
"""
This function try to change the page based on user choice, if
the page is not available, it will show the "bottle" page.
"""
if page_name == "taskmanager":
self.details.view_taskmanager.update(config=self.config)
try:
self.stack_bottle.set_visible_child_name(page_name)
self.leaflet.navigate(Adw.NavigationDirection.FORWARD)
except: # pylint: disable=bare-except
pass

def on_drop(self, drop_target, value: Gdk.FileList, x, y, user_data=None):
self.drop_overlay.set_visible(False)
files: List[Gio.File] = value.get_files()
Expand Down
142 changes: 0 additions & 142 deletions bottles/frontend/views/details.py

This file was deleted.

1 change: 0 additions & 1 deletion bottles/frontend/views/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ bottles_sources = [
'new_bottle_dialog.py',
'overview_list_page.py',
'library.py',
'details.py',
'preferences.py',
'import_page.py',
'loading.py',
Expand Down
2 changes: 1 addition & 1 deletion bottles/frontend/views/overview_list_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def set_path(_dialog, response):
def show_details(self, widget=None, config=None):
if config is None:
config = self.config
self.window.page_details.view_preferences.update_combo_components()
# self.window.page_details.view_preferences.update_combo_components()
self.window.show_details_view(config=config)

def disable(self):
Expand Down
4 changes: 2 additions & 2 deletions bottles/frontend/windows/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
from bottles.frontend.operation import TaskSyncer
from bottles.frontend.params import APP_ID, BASE_ID, PROFILE
from bottles.frontend.utils.gtk import GtkUtils
from bottles.frontend.views.details import DetailsView
from bottles.frontend.views.import_page import BottlesImportPage
from bottles.frontend.views.library import LibraryView
from bottles.frontend.views.overview_list_page import BottlesOverviewListPage
Expand All @@ -46,6 +45,7 @@
from bottles.frontend.windows.crash import CrashReportDialog
from bottles.frontend.windows.depscheck import DependenciesCheckDialog
from bottles.frontend.windows.onboard import OnboardDialog
from bottles.frontend.views.bottle_details_page import BottlesBottleDetailsPage

logging = Logger()

Expand Down Expand Up @@ -221,7 +221,7 @@ def set_manager(result: Manager, error=None):
self.show_onboard_view()

# Pages
self.page_details = DetailsView(self)
self.page_details = BottlesBottleDetailsPage(self)
self.page_list = BottlesOverviewListPage(self, arg_bottle=self.arg_bottle)
self.page_importer = BottlesImportPage(self)
self.page_library = LibraryView(self)
Expand Down

0 comments on commit d011316

Please sign in to comment.