From 9aa2ec191e047ba7edc8e23314201228637f1a9b Mon Sep 17 00:00:00 2001 From: DYefremov Date: Wed, 16 Dec 2020 23:28:00 +0300 Subject: [PATCH] added ftp client to main window --- app/ui/main_app_window.py | 32 +++++++++++--- app/ui/main_window.glade | 93 +++++++++++++++++++++++++++++---------- 2 files changed, 95 insertions(+), 30 deletions(-) diff --git a/app/ui/main_app_window.py b/app/ui/main_app_window.py index c4acdc61..2452a212 100644 --- a/app/ui/main_app_window.py +++ b/app/ui/main_app_window.py @@ -157,6 +157,7 @@ class Application(Gtk.Application): "on_http_status_visible": self.on_http_status_visible, "on_drawing_area_realize": self.on_drawing_area_realize, "on_player_drawing_area_draw": self.on_player_drawing_area_draw, + "on_ftp_realize": self.on_ftp_realize, "on_main_window_state": self.on_main_window_state, "on_record": self.on_record, "on_remove_all_unavailable": self.on_remove_all_unavailable, @@ -199,6 +200,7 @@ class Application(Gtk.Application): self._fav_click_mode = None self._links_transmitter = None self._control_box = None + self._ftp_client = None # Colors self._use_colors = False self._NEW_COLOR = None # Color for new services in the main list @@ -256,7 +258,12 @@ class Application(Gtk.Application): self._control_button = builder.get_object("control_button") self._receiver_info_box.bind_property("visible", self._control_button, "visible") self._control_revealer = builder.get_object("control_revealer") - # Force ctrl press event for view. Multiple selections in lists only with Space key(as in file managers)!!! + # FTP client + self._ftp_button = builder.get_object("ftp_button") + self._ftp_revealer = builder.get_object("ftp_revealer") + self._ftp_button.bind_property("active", self._ftp_revealer, "visible") + self._ftp_button.set_visible(self._settings.is_enable_experimental) + # Force Ctrl press event for view. Multiple selections in lists only with Space key(as in file managers)!!! self._services_view.connect("key-press-event", self.force_ctrl) self._fav_view.connect("key-press-event", self.force_ctrl) # Clipboard @@ -312,9 +319,9 @@ class Application(Gtk.Application): self._FAV_ENIGMA_ELEMENTS, self._FAV_IPTV_ELEMENTS, self._LOCK_HIDE_ELEMENTS) self._tool_elements = {k: builder.get_object(k) for k in set(chain.from_iterable(d_elements))} # Style - self._style_provider = Gtk.CssProvider() - self._style_provider.load_from_path(UI_RESOURCES_PATH + "style.css") - self._status_bar_box.get_style_context().add_provider_for_screen(Gdk.Screen.get_default(), self._style_provider, + style_provider = Gtk.CssProvider() + style_provider.load_from_path(UI_RESOURCES_PATH + "style.css") + self._status_bar_box.get_style_context().add_provider_for_screen(Gdk.Screen.get_default(), style_provider, Gtk.STYLE_PROVIDER_PRIORITY_USER) def do_startup(self): @@ -1788,11 +1795,15 @@ class Application(Gtk.Application): if active in self._settings.profiles: self.set_profile(active) + gen = self.init_http_api() + GLib.idle_add(lambda: next(gen, False), priority=GLib.PRIORITY_LOW) + + if self._ftp_button.get_active() and self._ftp_client: + self._ftp_client.init_ftp() + if self._app_info_box.get_visible(): return - gen = self.init_http_api() - GLib.idle_add(lambda: next(gen, False), priority=GLib.PRIORITY_LOW) if changed: self.open_data() @@ -2637,6 +2648,15 @@ class Application(Gtk.Application): def on_http_status_visible(self, img): self._control_button.set_active(False) + # ****************** FTP client ********************* # + + def on_ftp_realize(self, revealer): + if not self._ftp_client: + from app.ui.ftp import FtpClientBox + revealer.set_visible(True) + self._ftp_client = FtpClientBox(self, self._settings) + revealer.add(self._ftp_client) + # ***************** Filter and search ********************* # def on_filter_toggled(self, action, value): diff --git a/app/ui/main_window.glade b/app/ui/main_window.glade index 958a5300..fd8fdf5f 100644 --- a/app/ui/main_window.glade +++ b/app/ui/main_window.glade @@ -181,6 +181,11 @@ Author: Dmitriy Yefremov False gtk-find + + True + False + network-server + True False @@ -1038,7 +1043,7 @@ Author: Dmitriy Yefremov 1 - 2 + 1 @@ -1052,7 +1057,7 @@ Author: Dmitriy Yefremov - 3 + 2 @@ -1138,7 +1143,7 @@ Author: Dmitriy Yefremov - 4 + 3 @@ -1262,6 +1267,49 @@ Author: Dmitriy Yefremov + 4 + + + + + True + False + 5 + expand + + + True + False + True + Control + app.on_remote + control_image + True + + + + False + False + 0 + + + + + True + True + True + FTP client + ftp_image + + + True + True + 1 + + + + + end 6 @@ -1416,7 +1464,7 @@ Author: Dmitriy Yefremov end - 1 + 6 @@ -2967,26 +3015,6 @@ Author: Dmitriy Yefremov 0 - - - status-bar-button - True - False - True - Control - center - center - app.on_remote - control_image - True - - - - False - False - 3 - - False @@ -3148,6 +3176,23 @@ Author: Dmitriy Yefremov 1 + + + False + end + crossfade + True + + + + + + + False + True + 2 + +