mirror of
https://github.com/aclist/dztui.git
synced 2026-10-30 22:52:42 +01:00
change: always show shortcuts page
Mirror to Codeberg / mirror-to-codeberg (push) Has been cancelled
Mirror to Codeberg / mirror-to-codeberg (push) Has been cancelled
The expected shortcut path is already parsed by dzgui.config.xdg, which invokes is_writeable(); it will use a writeable fallback path for XDG_DATA_HOME. There is no need for a conditional check here. Even if the launcher itself is installed to a non-writeable system location, the shortcut can still copy from that.
This commit is contained in:
1 parent
687c5ac168
commit
07cbf7a36a
1 file changed
+8
-16
@@ -1,4 +1,3 @@
|
|||||||
import os
|
|
||||||
import textwrap
|
import textwrap
|
||||||
|
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
@@ -435,9 +434,7 @@ class Assistant(Gtk.Assistant):
|
|||||||
else:
|
else:
|
||||||
self.set_default_size(1500, 900)
|
self.set_default_size(1500, 900)
|
||||||
|
|
||||||
self.is_binary = False if os.getenv("PYAPP") is None else True
|
|
||||||
self.config_path = XDG.config
|
self.config_path = XDG.config
|
||||||
|
|
||||||
self.config_values: dict[str, Any] = config_boilerplate
|
self.config_values: dict[str, Any] = config_boilerplate
|
||||||
|
|
||||||
self.setup_complete = False
|
self.setup_complete = False
|
||||||
@@ -456,6 +453,8 @@ class Assistant(Gtk.Assistant):
|
|||||||
EMITTER.connect("step_pending", self._mark_page_incomplete)
|
EMITTER.connect("step_pending", self._mark_page_incomplete)
|
||||||
EMITTER.connect("config", self._set_config_state)
|
EMITTER.connect("config", self._set_config_state)
|
||||||
|
|
||||||
|
self.pages: dict[EnumeratedWizardPage, int] = {}
|
||||||
|
|
||||||
legacy_path = Path.home().joinpath(LEGACY_CONFIG_PATH)
|
legacy_path = Path.home().joinpath(LEGACY_CONFIG_PATH)
|
||||||
self.has_legacy_config = legacy_path.is_file()
|
self.has_legacy_config = legacy_path.is_file()
|
||||||
for page in (
|
for page in (
|
||||||
@@ -473,10 +472,8 @@ class Assistant(Gtk.Assistant):
|
|||||||
and self.has_legacy_config is False
|
and self.has_legacy_config is False
|
||||||
):
|
):
|
||||||
continue
|
continue
|
||||||
# NOTE: disabled for now on system-provided packages
|
ind = self._add_page(page, page.get_page_type())
|
||||||
if isinstance(page, ShortcutCreationPage) and not self.is_binary:
|
self.pages[page] = ind
|
||||||
continue
|
|
||||||
self._add_page(page, page.get_page_type())
|
|
||||||
|
|
||||||
self.connect("prepare", self._on_page_prepare)
|
self.connect("prepare", self._on_page_prepare)
|
||||||
self.connect("cancel", self.destroy_and_quit)
|
self.connect("cancel", self.destroy_and_quit)
|
||||||
@@ -488,13 +485,7 @@ class Assistant(Gtk.Assistant):
|
|||||||
write_json(config, self.config_path)
|
write_json(config, self.config_path)
|
||||||
|
|
||||||
def get_final_page(self) -> int:
|
def get_final_page(self) -> int:
|
||||||
pages = self.get_n_pages()
|
return self.pages[self.page_shortcuts]
|
||||||
# TODO: might be better to check if path is writeable
|
|
||||||
# and selectively block certain shortcut options
|
|
||||||
if self.is_binary:
|
|
||||||
return pages - 2
|
|
||||||
else:
|
|
||||||
return pages - 1
|
|
||||||
|
|
||||||
def _advance_page(self, index: int) -> int:
|
def _advance_page(self, index: int) -> int:
|
||||||
page = self.get_nth_page(index)
|
page = self.get_nth_page(index)
|
||||||
@@ -552,11 +543,12 @@ class Assistant(Gtk.Assistant):
|
|||||||
|
|
||||||
def _add_page(
|
def _add_page(
|
||||||
self, page: EnumeratedWizardPage, ptype: Gtk.AssistantPageType
|
self, page: EnumeratedWizardPage, ptype: Gtk.AssistantPageType
|
||||||
) -> None:
|
) -> int:
|
||||||
self.append_page(page)
|
ind = self.append_page(page)
|
||||||
self.set_page_type(page, ptype)
|
self.set_page_type(page, ptype)
|
||||||
self.set_page_title(page, page.get_title())
|
self.set_page_title(page, page.get_title())
|
||||||
self.set_page_complete(page, True)
|
self.set_page_complete(page, True)
|
||||||
|
return ind
|
||||||
|
|
||||||
def _set_config_state(self, emitter: "Emitter", state: bool) -> None:
|
def _set_config_state(self, emitter: "Emitter", state: bool) -> None:
|
||||||
self.config = state
|
self.config = state
|
||||||
|
|||||||
Reference in new issue
Block a user