mirror of
https://github.com/DYefremov/DemonEditor.git
synced 2026-05-07 15:57:00 +02:00
toolbar changes
This commit is contained in:
@@ -77,7 +77,6 @@ class Application(Gtk.Application):
|
||||
"on_profile_changed": self.on_profile_changed,
|
||||
"on_download": self.on_download,
|
||||
"on_data_open": self.on_data_open,
|
||||
"on_data_save": self.on_data_save,
|
||||
"on_new_configuration": self.on_new_configuration,
|
||||
"on_tree_view_key_press": self.on_tree_view_key_press,
|
||||
"on_tree_view_key_release": self.on_tree_view_key_release,
|
||||
@@ -207,6 +206,8 @@ class Application(Gtk.Application):
|
||||
self._app_info_box.bind_property("visible", self._status_bar_box, "visible", 4)
|
||||
self._app_info_box.bind_property("visible", builder.get_object("main_paned"), "visible", 4)
|
||||
self._app_info_box.bind_property("visible", builder.get_object("toolbar_extra_item"), "visible", 4)
|
||||
self._app_info_box.bind_property("visible", builder.get_object("toolbar_tools_item"), "visible", 4)
|
||||
self._app_info_box.bind_property("visible", builder.get_object("save_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")
|
||||
@@ -282,8 +283,31 @@ class Application(Gtk.Application):
|
||||
|
||||
def do_startup(self):
|
||||
Gtk.Application.do_startup(self)
|
||||
# Init app menu bar handlers
|
||||
main_handlers = ("on_new_configuration", "on_data_open", "on_data_save", "on_download", "on_settings",
|
||||
|
||||
self.init_keys()
|
||||
self.set_accels()
|
||||
|
||||
builder = Gtk.Builder()
|
||||
builder.set_translation_domain("demon-editor")
|
||||
builder.add_from_file(UI_RESOURCES_PATH + "app_menu_bar.ui")
|
||||
self.set_menubar(builder.get_object("menu_bar"))
|
||||
self.set_app_menu(builder.get_object("app-menu"))
|
||||
|
||||
self.update_profile_label()
|
||||
self.init_drag_and_drop()
|
||||
self.init_colors()
|
||||
if self._settings.load_last_config:
|
||||
config = self._settings.get("last_config") or {}
|
||||
self.init_profiles(config.get("last_profile", None))
|
||||
last_bouquet = config.get("last_bouquet", None)
|
||||
self.open_data(callback=lambda: self.open_bouquet(last_bouquet))
|
||||
else:
|
||||
self.init_profiles()
|
||||
gen = self.init_http_api()
|
||||
GLib.idle_add(lambda: next(gen, False), priority=GLib.PRIORITY_LOW)
|
||||
|
||||
def init_keys(self):
|
||||
main_handlers = ("on_new_configuration", "on_data_open", "on_download", "on_settings",
|
||||
"on_close_app", "on_import_bouquet", "on_import_bouquets", "on_satellite_editor_show",
|
||||
"on_picons_loader_show", "on_backup_tool_show", "on_about_app")
|
||||
iptv_handlers = ("on_iptv", "on_import_yt_list", "on_import_m3u", "on_export_to_m3u",
|
||||
@@ -308,13 +332,17 @@ class Application(Gtk.Application):
|
||||
# Search, Filter
|
||||
search_action = Gio.SimpleAction.new_stateful("search", None, GLib.Variant.new_boolean(False))
|
||||
search_action.connect("change-state", self.on_search_toggled)
|
||||
search_action.set_enabled(False)
|
||||
self._app_info_box.bind_property("visible", search_action, "enabled", 4)
|
||||
self._main_window.add_action(search_action) # For "win.*" actions!
|
||||
filter_action = Gio.SimpleAction.new_stateful("filter", None, GLib.Variant.new_boolean(False))
|
||||
filter_action.connect("change-state", self.on_filter_toggled)
|
||||
filter_action.set_enabled(False)
|
||||
self._app_info_box.bind_property("visible", filter_action, "enabled", 4)
|
||||
self._main_window.add_action(filter_action)
|
||||
# Lock, Hide
|
||||
set_action("on_hide", self.on_hide)
|
||||
set_action("on_locked", self.on_locked)
|
||||
self._app_info_box.bind_property("visible", set_action("on_hide", self.on_hide, False), "enabled", 4)
|
||||
self._app_info_box.bind_property("visible", set_action("on_locked", self.on_locked, False), "enabled", 4)
|
||||
# Open and download/upload data
|
||||
set_action("open_data", lambda a, v: self.open_data())
|
||||
set_action("on_download_data", self.on_download_data)
|
||||
@@ -322,26 +350,8 @@ class Application(Gtk.Application):
|
||||
set_action("upload_bouquets", lambda a, v: self.on_upload_data(DownloadType.BOUQUETS))
|
||||
# Edit
|
||||
set_action("on_edit", self.on_edit)
|
||||
|
||||
builder = Gtk.Builder()
|
||||
builder.set_translation_domain("demon-editor")
|
||||
builder.add_from_file(UI_RESOURCES_PATH + "app_menu_bar.ui")
|
||||
self.set_menubar(builder.get_object("menu_bar"))
|
||||
self.set_app_menu(builder.get_object("app-menu"))
|
||||
self.set_accels()
|
||||
|
||||
self.update_profile_label()
|
||||
self.init_drag_and_drop()
|
||||
self.init_colors()
|
||||
if self._settings.load_last_config:
|
||||
config = self._settings.get("last_config") or {}
|
||||
self.init_profiles(config.get("last_profile", None))
|
||||
last_bouquet = config.get("last_bouquet", None)
|
||||
self.open_data(callback=lambda: self.open_bouquet(last_bouquet))
|
||||
else:
|
||||
self.init_profiles()
|
||||
gen = self.init_http_api()
|
||||
GLib.idle_add(lambda: next(gen, False), priority=GLib.PRIORITY_LOW)
|
||||
# Save
|
||||
self._app_info_box.bind_property("visible", set_action("on_data_save", self.on_data_save, False), "enabled", 4)
|
||||
|
||||
def set_accels(self):
|
||||
""" Setting accelerators for the actions. """
|
||||
@@ -1103,6 +1113,9 @@ class Application(Gtk.Application):
|
||||
yield True
|
||||
|
||||
def on_data_save(self, *args):
|
||||
if self._app_info_box.get_visible():
|
||||
return
|
||||
|
||||
if len(self._bouquets_model) == 0:
|
||||
self.show_error_dialog("No data to save!")
|
||||
return
|
||||
|
||||
@@ -691,15 +691,16 @@ Author: Dmitriy Yefremov
|
||||
<object class="GtkToolbar" id="top_toolbar">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="margin_left">5</property>
|
||||
<property name="margin_right">5</property>
|
||||
<child>
|
||||
<object class="GtkToolItem">
|
||||
<object class="GtkToolItem" id="toolbar_main_item">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_right">10</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<object class="GtkBox" id="toolbar_main_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">2</property>
|
||||
@@ -719,6 +720,23 @@ Author: Dmitriy Yefremov
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBoxText" id="profile_combo_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="focus_on_click">False</property>
|
||||
<property name="tooltip_text" translatable="yes">Profile</property>
|
||||
<property name="margin_left">2</property>
|
||||
<property name="margin_right">2</property>
|
||||
<property name="active">0</property>
|
||||
<signal name="changed" handler="on_profile_changed" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolButton" id="download_tool_button">
|
||||
<property name="visible">True</property>
|
||||
@@ -729,21 +747,6 @@ Author: Dmitriy Yefremov
|
||||
<property name="use_underline">True</property>
|
||||
<property name="stock_id">gtk-connect</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBoxText" id="profile_combo_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="focus_on_click">False</property>
|
||||
<property name="tooltip_text" translatable="yes">Profile</property>
|
||||
<property name="active">0</property>
|
||||
<signal name="changed" handler="on_profile_changed" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
@@ -752,7 +755,6 @@ Author: Dmitriy Yefremov
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolButton" id="save_tool_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="tooltip_text" translatable="yes">Save</property>
|
||||
<property name="action_name">app.on_data_save</property>
|
||||
@@ -792,6 +794,8 @@ Author: Dmitriy Yefremov
|
||||
<child>
|
||||
<object class="GtkToolItem" id="toolbar_extra_item">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_left">10</property>
|
||||
<property name="margin_right">10</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="toolbar_extra_box">
|
||||
<property name="visible">True</property>
|
||||
@@ -871,6 +875,106 @@ Author: Dmitriy Yefremov
|
||||
<property name="homogeneous">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolItem" id="toolbar_tools_item">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_left">10</property>
|
||||
<property name="margin_right">10</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="toolbar_tools_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">2</property>
|
||||
<child>
|
||||
<object class="GtkToolButton" id="sat_editor_tool_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="tooltip_text" translatable="yes">Satellites editor</property>
|
||||
<property name="action_name">app.on_satellite_editor_show</property>
|
||||
<property name="label" translatable="yes">Satellites</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="stock_id">gtk-select-all</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolButton" id="picons_downloader_tool_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="tooltip_text" translatable="yes">Picons downloader</property>
|
||||
<property name="margin_right">5</property>
|
||||
<property name="action_name">app.on_picons_loader_show</property>
|
||||
<property name="label" translatable="yes">Picons</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="icon_name">insert-image</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolButton" id="import_m3u_tool_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="tooltip_text" translatable="yes">Import m3u file</property>
|
||||
<property name="margin_left">5</property>
|
||||
<property name="action_name">app.on_import_m3u</property>
|
||||
<property name="label" translatable="yes">Import m3u</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="icon_name">insert-link</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolButton" id="export_to_m3u_tool_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="tooltip_text" translatable="yes">Export to m3u</property>
|
||||
<property name="action_name">app.on_export_to_m3u</property>
|
||||
<property name="label" translatable="yes">Export to m3u</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="stock_id">gtk-save-as</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolButton" id="epg_config_tool_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="tooltip_text" translatable="yes">EPG configuration</property>
|
||||
<property name="action_name">app.on_epg_list_configuration</property>
|
||||
<property name="label" translatable="yes">EPG configuration</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="stock_id">gtk-index</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
|
||||
Reference in New Issue
Block a user