From 4269d16d31b98d3b2688494fc9fbba9f6aae634b Mon Sep 17 00:00:00 2001 From: DYefremov Date: Thu, 17 Dec 2020 14:00:14 +0300 Subject: [PATCH] added ftp client to main window --- app/ui/ftp.glade | 1 - app/ui/main_app_window.py | 33 +++++++-- app/ui/main_window.glade | 142 +++++++++++++++++++++++++------------- 3 files changed, 122 insertions(+), 54 deletions(-) diff --git a/app/ui/ftp.glade b/app/ui/ftp.glade index 66ff5f98..80edb785 100644 --- a/app/ui/ftp.glade +++ b/app/ui/ftp.glade @@ -46,7 +46,6 @@ False 1 1 - 1 1 0 in diff --git a/app/ui/main_app_window.py b/app/ui/main_app_window.py index d13af160..12dd5fdf 100644 --- a/app/ui/main_app_window.py +++ b/app/ui/main_app_window.py @@ -157,6 +157,7 @@ class Application(Gtk.Application): "on_full_screen": self.on_full_screen, "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_record": self.on_record, "on_remove_all_unavailable": self.on_remove_all_unavailable, "on_new_bouquet": self.on_new_bouquet, @@ -198,6 +199,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 @@ -232,6 +234,7 @@ class Application(Gtk.Application): self._app_info_box.bind_property("visible", builder.get_object("toolbar_extra_box"), "visible", 4) self._app_info_box.bind_property("visible", builder.get_object("toolbar_tools_box"), "visible", 4) self._app_info_box.bind_property("visible", builder.get_object("save_tool_button"), "visible", 4) + self._app_info_box.bind_property("visible", builder.get_object("add_bouquet_tool_button"), "visible", 4) # Status bar self._profile_combo_box = builder.get_object("profile_combo_box") self._receiver_info_box = builder.get_object("receiver_info_box") @@ -256,7 +259,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 @@ -309,9 +317,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): @@ -1857,11 +1865,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() @@ -2710,6 +2722,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 800b7b29..f2c43fd8 100644 --- a/app/ui/main_window.glade +++ b/app/ui/main_window.glade @@ -33,13 +33,6 @@ Author: Dmitriy Yefremov - - True - False - 5 - bookmark-new-symbolic - 1 - True False @@ -341,33 +334,33 @@ Author: Dmitriy Yefremov True False - app.on_iptv Add IPTV or stream service + True False - app.on_import_yt_list Import YouTube playlist + True False - app.on_import_m3u Import m3u True + True False - app.on_export_to_m3u Export to m3u + @@ -380,8 +373,8 @@ Author: Dmitriy Yefremov True False - app.on_epg_list_configuration EPG configuration + @@ -394,8 +387,8 @@ Author: Dmitriy Yefremov True False - app.on_iptv_list_configuration List configuration + @@ -408,8 +401,8 @@ Author: Dmitriy Yefremov True False - app.on_remove_all_unavailable Remove all unavailable + @@ -968,14 +961,14 @@ Author: Dmitriy Yefremov True False + 10 True False center center - 15 - 5 + 10 10 10 10 @@ -1273,26 +1266,6 @@ Author: Dmitriy Yefremov 5 - - - - True - False - True - Create bouquet - start - start - add_bouquet_image - True - - - - False - True - 5 - True - - False @@ -1308,27 +1281,86 @@ Author: Dmitriy Yefremov - - True - True - center + + True + False center - 15 - app.on_remote + 10 + True + expand - - True + + 32 + False False - input-gaming-symbolic + True + Create bouquet + True + + + + True + False + bookmark-new-symbolic + 1 + + + + False + True + 0 + + + + + 32 + True + True + app.on_remote + + + True + False + input-gaming-symbolic + + + + + + False + True + 1 + + + + + 32 + True + True + True + True + + + True + False + FTP client + network-server-symbolic + + + + + True + True + 2 + - False True end - 1 + 2 @@ -3042,6 +3074,22 @@ Author: Dmitriy Yefremov 1 + + + False + crossfade + True + + + + + + + False + True + 2 + + True