Skip to content

Commit afdfa61

Browse files
committed
Code cleanup and appimage fix
1 parent a501247 commit afdfa61

File tree

4 files changed

+13
-53
lines changed

4 files changed

+13
-53
lines changed

.github/workflows/linux-appimage.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
python3-gi \
2929
libgtksourceview-5-dev libgtk-4-dev libadwaita-1-dev libglib2.0-dev libpango1.0-dev pkg-config gobject-introspection
3030
python -m pip install --upgrade pip
31-
python -m pip install --user "appimage-builder==0.8.2"
31+
python -m pip install --user --upgrade "appimage-builder>=1.1.0"
3232
echo "$HOME/.local/bin" >> $GITHUB_PATH
3333
3434
- name: Build and install blueprint-compiler (v0.18.0)
@@ -56,8 +56,6 @@ jobs:
5656
5757
- name: Build AppImage
5858
run: |
59-
export PATH="/usr/bin:$PATH"
60-
export PYTHON="/usr/bin/python3"
6159
export ARCH=x86_64
6260
appimage-builder --recipe AppImageBuilder.yml --skip-test
6361

src/main.py

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717

1818
import gi
1919
import logging
20-
from gettext import gettext as _
2120
import gettext
21+
from gettext import gettext as _
2222

2323
import threading
2424

@@ -182,7 +182,6 @@ def do_startup(self):
182182
)
183183
except Exception:
184184
pass
185-
self._add_actions()
186185

187186
self.parser = SSHConfigParser()
188187
GLib.idle_add(self._parse_config_async)
@@ -219,31 +218,6 @@ def update_ui():
219218
t.start()
220219
return False
221220

222-
def _add_actions(self):
223-
search_action = Gio.SimpleAction.new("search", None)
224-
search_action.connect("activate", self._on_search_action)
225-
self.add_action(search_action)
226-
227-
add_host_action = Gio.SimpleAction.new("add-host", None)
228-
add_host_action.connect("activate", self._on_add_host_action)
229-
self.add_action(add_host_action)
230-
231-
reload_action = Gio.SimpleAction.new("reload", None)
232-
reload_action.connect("activate", self._on_reload_action)
233-
self.add_action(reload_action)
234-
235-
def _on_search_action(self, action, param):
236-
if self.main_window:
237-
self.main_window._toggle_search()
238-
239-
def _on_add_host_action(self, action, param):
240-
if self.main_window and self.main_window.host_list:
241-
self.main_window.host_list.add_host()
242-
243-
def _on_reload_action(self, action, param):
244-
if self.main_window:
245-
self.main_window.reload_config()
246-
247221
def _load_css_styles(self):
248222
css_provider = Gtk.CssProvider()
249223

src/ui/host_editor.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -914,13 +914,13 @@ def _parse_and_validate_raw_text(self, current_lines: list[str]):
914914
line.strip() and not line.strip().startswith("#")
915915
for line in current_lines
916916
):
917-
self.app._show_error(
917+
self.app.show_toast(
918918
"SSH host configuration must start with 'Host' declaration"
919919
)
920920
else:
921-
self.app._show_error(f"Invalid raw host configuration: {e}")
921+
self.app.show_toast(f"Invalid raw host configuration: {e}")
922922
except Exception as e:
923-
self.app._show_error(f"Error parsing raw host config: {e}")
923+
self.app.show_toast(f"Error parsing raw host config: {e}")
924924

925925
def _update_host_from_fields(self):
926926
"""Updates the current host object based on GUI field values.
@@ -1603,7 +1603,7 @@ def _on_save_clicked(self, button):
16031603
parser.write(backup=True)
16041604
except Exception as e:
16051605
try:
1606-
self.app._show_error(
1606+
self.app.show_toast(
16071607
_(f"Failed to save {parser.config_path}: {e}")
16081608
)
16091609
except Exception:
@@ -1625,7 +1625,7 @@ def _on_save_clicked(self, button):
16251625
verify = None
16261626
if verify != expected_content:
16271627
try:
1628-
self.app._show_error(
1628+
self.app.show_toast(
16291629
_(
16301630
f"Failed to persist changes to {parser.config_path}. Check permissions / sandbox."
16311631
)

src/ui/main_window.py

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ def _load_config(self):
355355
if hasattr(self.app, "_parse_config_async"):
356356
self.app._parse_config_async()
357357
except Exception as e:
358-
self._show_error(f"Failed to trigger config reload: {e}")
358+
self.show_toast(f"Failed to trigger config reload: {e}")
359359

360360
def _reselect_current_host(self):
361361
try:
@@ -493,9 +493,9 @@ def _on_save_clicked(self, button):
493493
self.host_list.set_undo_enabled(False)
494494
except Exception:
495495
pass
496-
self._update_status(_("Configuration saved successfully"))
496+
self.show_toast(_("Configuration saved successfully"))
497497
except Exception as e:
498-
self._show_error(f"Failed to save configuration: {e}")
498+
self.show_toast(f"Failed to save configuration: {e}")
499499

500500
def _write_and_reload(self, show_status: bool = False):
501501
"""Write the config to disk and reload UI without showing validation dialogs."""
@@ -511,9 +511,9 @@ def _write_and_reload(self, show_status: bool = False):
511511
except Exception:
512512
pass
513513
if show_status:
514-
self._update_status(_("Configuration saved"))
514+
self.show_toast(_("Configuration saved"))
515515
except Exception as e:
516-
self._show_error(f"Failed to save configuration: {e}")
516+
self.show_toast(f"Failed to save configuration: {e}")
517517

518518
def _on_host_selected(self, host_list, host):
519519
"""Handle host selection from the list."""
@@ -811,7 +811,7 @@ def on_close_request(dlg):
811811
pass
812812
if self.parser:
813813
self._load_config()
814-
self._update_status(_("Preferences saved"))
814+
self.show_toast(_("Preferences saved"))
815815
return False
816816

817817
dialog.connect("close-attempt", on_close_request)
@@ -860,18 +860,6 @@ def _on_about(self, action, param):
860860

861861
about_window.present()
862862

863-
def _update_status(self, message: str):
864-
"""Update the status bar with a message."""
865-
self.show_toast(message)
866-
867-
def _hide_status(self):
868-
"""Hide the status bar."""
869-
return False
870-
871-
def _show_error(self, message: str):
872-
"""Show an error message in the status bar."""
873-
self.show_toast(message)
874-
875863
def _show_warning(self, title: str, message: str):
876864
"""Show a warning dialog."""
877865
dialog = Gtk.MessageDialog(

0 commit comments

Comments
 (0)