mirror of
https://github.com/DYefremov/DemonEditor.git
synced 2026-01-20 22:43:23 +01:00
added ftp client to main window
This commit is contained in:
@@ -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):
|
||||
|
||||
@@ -181,6 +181,11 @@ Author: Dmitriy Yefremov
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-find</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="ftp_image">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="icon_name">network-server</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="import_bouquet_image">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
@@ -1038,7 +1043,7 @@ Author: Dmitriy Yefremov
|
||||
<property name="margin_right">1</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">2</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@@ -1052,7 +1057,7 @@ Author: Dmitriy Yefremov
|
||||
<signal name="changed" handler="on_profile_changed" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">3</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@@ -1138,7 +1143,7 @@ Author: Dmitriy Yefremov
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">4</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@@ -1262,6 +1267,49 @@ Author: Dmitriy Yefremov
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButtonBox" id="tools_button_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_right">5</property>
|
||||
<property name="layout_style">expand</property>
|
||||
<child>
|
||||
<object class="GtkToggleButton" id="control_button">
|
||||
<property name="can_focus">True</property>
|
||||
<property name="focus_on_click">False</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="tooltip_text" translatable="yes">Control</property>
|
||||
<property name="action_name">app.on_remote</property>
|
||||
<property name="image">control_image</property>
|
||||
<property name="always_show_image">True</property>
|
||||
<accelerator key="t" signal="clicked" modifiers="GDK_CONTROL_MASK"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleButton" id="ftp_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="tooltip_text" translatable="yes">FTP client</property>
|
||||
<property name="image">ftp_image</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">6</property>
|
||||
</packing>
|
||||
</child>
|
||||
@@ -1416,7 +1464,7 @@ Author: Dmitriy Yefremov
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">1</property>
|
||||
<property name="position">6</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
@@ -2967,26 +3015,6 @@ Author: Dmitriy Yefremov
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child type="center">
|
||||
<object class="GtkToggleButton" id="control_button">
|
||||
<property name="name">status-bar-button</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="focus_on_click">False</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="tooltip_text" translatable="yes">Control</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="action_name">app.on_remote</property>
|
||||
<property name="image">control_image</property>
|
||||
<property name="always_show_image">True</property>
|
||||
<accelerator key="i" signal="clicked" modifiers="GDK_CONTROL_MASK"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImage" id="http_status_image">
|
||||
<property name="can_focus">False</property>
|
||||
@@ -3148,6 +3176,23 @@ Author: Dmitriy Yefremov
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRevealer" id="ftp_revealer">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="transition_type">crossfade</property>
|
||||
<property name="reveal_child">True</property>
|
||||
<signal name="realize" handler="on_ftp_realize" swapped="no"/>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
||||
Reference in New Issue
Block a user