-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
paste-into-file@anaximeno: Version 1.4.0 (#374)
* Update AUI to Version 0.5
- Loading branch information
Showing
2 changed files
with
57 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
"""Action UI - Basic GTK Based UI Toolkit for Nemo Actions. | ||
@Author: Anaxímeno Brito <[email protected]> | ||
@Url: https://github.com/anaximeno/aui | ||
@Version: 0.4 | ||
@Version: 0.5 | ||
@License: BSD 3-Clause License | ||
Copyright (c) 2024, Anaxímeno Brito | ||
|
@@ -46,7 +46,7 @@ | |
ICON_FILENAME = "icon.png" | ||
|
||
|
||
def get_action_icon_path(uuid: str, use_dev_icon_if_found = None) -> str: | ||
def get_action_icon_path(uuid: str, use_dev_icon_if_found=None) -> str: | ||
"""Returns the path of the `icon.png` file of the action. | ||
#### Params: | ||
|
@@ -92,14 +92,37 @@ def __init__( | |
title: str = None, | ||
width: int, | ||
height: int, | ||
expander_label: str = "", | ||
expanded_text: str = "", | ||
**kwargs, | ||
) -> None: | ||
super().__init__(*args, title=title, **kwargs) | ||
self.add_buttons(Gtk.STOCK_OK, Gtk.ResponseType.OK) | ||
self._box = Gtk.VBox() | ||
self.label = Gtk.Label() | ||
self.label.set_margin_top(10) | ||
self.label.set_margin_bottom(10) | ||
self.label.set_margin_start(10) | ||
self.label.set_margin_end(10) | ||
self.label.set_halign(Gtk.Align.CENTER) | ||
self.label.set_valign(Gtk.Align.CENTER) | ||
self.label.set_markup(message) | ||
|
||
self._box.pack_start(self.label, True, True, 0) | ||
|
||
self.expander_label = None | ||
self.expanded_text = None | ||
|
||
if expander_label: | ||
self.expander = Gtk.Expander(label=expander_label) | ||
self.expanded_text_label = Gtk.Label() | ||
self.expanded_text_label.set_markup(expanded_text) | ||
self.expanded_text_label.set_halign(Gtk.Align.START) | ||
self.expanded_text_label.set_margin_top(5) | ||
self.expanded_text_label.set_margin_start(10) | ||
self.expander.add(self.expanded_text_label) | ||
self._box.pack_start(self.expander, True, True, 10) | ||
|
||
self._content_area = self.get_content_area() | ||
self._content_area.add(self._box) | ||
self.set_default_size(width, height) | ||
|
@@ -114,6 +137,8 @@ def __init__( | |
window_icon_path: str = None, | ||
width: int = 360, | ||
height: int = 120, | ||
expander_label: str = "", | ||
expanded_text: str = "", | ||
) -> None: | ||
super().__init__(title=title, icon_path=window_icon_path) | ||
self.dialog = _InfoDialog( | ||
|
@@ -123,6 +148,8 @@ def __init__( | |
message=message, | ||
width=width, | ||
height=height, | ||
expander_label=expander_label, | ||
expanded_text=expanded_text, | ||
) | ||
|
||
|
||
|
@@ -180,10 +207,16 @@ def __init__( | |
|
||
if label is not None: | ||
self._label = Gtk.Label(xalign=0) | ||
self._label.set_margin_top(2) | ||
self._label.set_margin_start(5) | ||
self._label.set_margin_end(5) | ||
self._label.set_markup(label) | ||
self._box.pack_start(self._label, False, False, 5) | ||
|
||
self.entry = Gtk.Entry(text=default_text) | ||
self.entry.set_margin_bottom(2) | ||
self.entry.set_margin_start(5) | ||
self.entry.set_margin_end(5) | ||
self._box.pack_start(self.entry, True, True, 0) | ||
|
||
self._content_area = self.get_content_area() | ||
|
@@ -230,8 +263,8 @@ def __init__( | |
self, | ||
title: str = None, | ||
message: str = None, | ||
expander_label: str = None, | ||
expanded_text: str = None, | ||
expander_label: str = "", | ||
expanded_text: str = "", | ||
width: int = 360, | ||
height: int = 120, | ||
**kwargs, | ||
|
@@ -240,17 +273,28 @@ def __init__( | |
self.add_buttons(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL) | ||
self.box = Gtk.VBox(spacing=15) | ||
self.progressbar = Gtk.ProgressBar() | ||
self.progressbar.set_margin_top(10) | ||
self.progressbar.set_margin_start(5) | ||
self.progressbar.set_margin_end(5) | ||
|
||
if message: | ||
self.progressbar.set_text(message) | ||
self.progressbar.set_show_text(True) | ||
|
||
self.box.pack_start(self.progressbar, True, True, 0) | ||
|
||
self.expander = None | ||
self.expanded_text_label = None | ||
if expander_label: | ||
self.expander = Gtk.Expander(label=expander_label) | ||
self.expanded_text = Gtk.Label(label=expanded_text) | ||
self.expander.add(self.expanded_text) | ||
self.expander.set_margin_start(5) | ||
self.expander.set_margin_end(5) | ||
self.expanded_text_label = Gtk.Label() | ||
self.expanded_text_label.set_markup(expanded_text) | ||
self.expanded_text_label.set_halign(Gtk.Align.START) | ||
self.expanded_text_label.set_margin_top(5) | ||
self.expanded_text_label.set_margin_start(10) | ||
self.expander.add(self.expanded_text_label) | ||
self.box.pack_start(self.expander, True, True, 0) | ||
|
||
self._content_area = self.get_content_area() | ||
|
@@ -266,8 +310,8 @@ def __init__( | |
timeout_ms: int = 50, | ||
title: str = None, | ||
message: str = None, | ||
expander_label: str = None, | ||
expanded_text: str = None, | ||
expander_label: str = "", | ||
expanded_text: str = "", | ||
window_icon_path: str = None, | ||
width: int = 360, | ||
height: int = 120, | ||
|
@@ -317,6 +361,10 @@ def destroy(self): | |
self.stop() | ||
super().destroy() | ||
|
||
def set_expanded_text(self, text: str): | ||
if self.dialog.expanded_text_label is not None: | ||
self.dialog.expanded_text_label.set_markup(text) | ||
|
||
|
||
class RadioChoiceButton: | ||
def __init__(self, id: str, label: str, on_toggled_cb: Callable = None) -> None: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters