mirror of
https://github.com/DYefremov/DemonEditor.git
synced 2026-01-22 15:33:35 +01:00
Dynamic activation of toolbar elements
This commit is contained in:
@@ -32,9 +32,6 @@ def download_data(*, properties):
|
||||
with open(save_path + xml_file, 'wb') as f:
|
||||
ftp.retrbinary('RETR ' + xml_file, f.write)
|
||||
|
||||
for name in os.listdir(save_path):
|
||||
print(name)
|
||||
|
||||
return ftp.voidcmd("NOOP")
|
||||
|
||||
|
||||
|
||||
@@ -101,4 +101,388 @@ dmitry.v.yefremov@gmail.com
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkDialog" id="settings_dialog">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="title" translatable="yes">Options</property>
|
||||
<property name="resizable">False</property>
|
||||
<property name="modal">True</property>
|
||||
<property name="icon_name">preferences-desktop</property>
|
||||
<property name="type_hint">dialog</property>
|
||||
<child internal-child="vbox">
|
||||
<object class="GtkBox" id="dialog-vbox3">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_top">5</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">2</property>
|
||||
<child internal-child="action_area">
|
||||
<object class="GtkButtonBox" id="dialog-action_area3">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="layout_style">end</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="cancel_button">
|
||||
<property name="label">gtk-undo</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="ok_button">
|
||||
<property name="label">gtk-ok</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkGrid" id="grid1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="column_homogeneous">True</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Host:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="host_field">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="text" translatable="yes">127.0.0.1</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label3">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Login:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label4">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Password:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="port_field">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="text" translatable="yes">21</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Port:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="login_field">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="text" translatable="yes">root</property>
|
||||
<property name="primary_icon_name">emblem-personal</property>
|
||||
<property name="primary_icon_activatable">False</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="password_field">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="visibility">False</property>
|
||||
<property name="invisible_char">●</property>
|
||||
<property name="text" translatable="yes">root</property>
|
||||
<property name="primary_icon_name">emblem-nowrite</property>
|
||||
<property name="primary_icon_activatable">False</property>
|
||||
<property name="input_purpose">password</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparator" id="separator1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_top">2</property>
|
||||
<property name="margin_bottom">2</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkGrid" id="grid2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="column_homogeneous">True</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label5">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Services and Bouquets files:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="services_field">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="text" translatable="yes">/etc/enigma2/</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label6">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">User bouquet files:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="user_bouquet_field">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="text" translatable="yes">/etc/enigma2/</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label7">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Satellites.xml file:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="satellites_xml_field">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="text" translatable="yes">/etc/tuxbox/</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">5</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparator" id="separator2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_top">2</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkGrid" id="grid3">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="column_homogeneous">True</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label8">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Data directory:</property>
|
||||
<property name="lines">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="data_dir_field">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="text" translatable="yes">/data</property>
|
||||
<property name="secondary_icon_stock">gtk-open</property>
|
||||
<property name="primary_icon_activatable">False</property>
|
||||
<property name="secondary_icon_tooltip_text" translatable="yes">Select</property>
|
||||
<property name="secondary_icon_tooltip_markup" translatable="yes">Select</property>
|
||||
<signal name="icon-press" handler="on_data_dir_field_icon_press" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">5</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparator" id="separator3">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="padding">2</property>
|
||||
<property name="position">6</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<action-widgets>
|
||||
<action-widget response="-6">cancel_button</action-widget>
|
||||
<action-widget response="-5">ok_button</action-widget>
|
||||
</action-widgets>
|
||||
</object>
|
||||
<object class="GtkFileChooserDialog" id="path_chooser_dialog">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="title" translatable="yes"> </property>
|
||||
<property name="icon_name">document-open</property>
|
||||
<property name="type_hint">dialog</property>
|
||||
<property name="transient_for">settings_dialog</property>
|
||||
<property name="action">save</property>
|
||||
<child internal-child="vbox">
|
||||
<object class="GtkBox" id="filechooserdialog-vbox3">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">2</property>
|
||||
<child internal-child="action_area">
|
||||
<object class="GtkButtonBox" id="filechooserdialog-action_area3">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="layout_style">end</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="button2">
|
||||
<property name="label">gtk-undo</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="button1">
|
||||
<property name="label">gtk-ok</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="yalign">0.55000001192092896</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<action-widgets>
|
||||
<action-widget response="-6">button2</action-widget>
|
||||
<action-widget response="-12">button1</action-widget>
|
||||
</action-widgets>
|
||||
</object>
|
||||
</interface>
|
||||
|
||||
@@ -27,6 +27,8 @@ __bouquets_view = None
|
||||
__rows_buffer = []
|
||||
__channels = {}
|
||||
__bouquets = {}
|
||||
# dynamically active elements depending on the selected view
|
||||
__tool_elements = None
|
||||
|
||||
|
||||
def on_about_app(item):
|
||||
@@ -58,7 +60,8 @@ def get_handlers():
|
||||
"on_services_tree_view_drag_data_get": on_services_tree_view_drag_data_get,
|
||||
"on_fav_tree_view_drag_data_get": on_fav_tree_view_drag_data_get,
|
||||
"on_fav_tree_view_drag_data_received": on_fav_tree_view_drag_data_received,
|
||||
"on_view_popup_menu": on_view_popup_menu
|
||||
"on_view_popup_menu": on_view_popup_menu,
|
||||
"on_view_focus": on_view_focus
|
||||
}
|
||||
|
||||
|
||||
@@ -282,28 +285,35 @@ def on_satellite_editor_show(model):
|
||||
|
||||
@run_task
|
||||
def on_data_open(model):
|
||||
if show_dialog("path_chooser_dialog") == Gtk.ResponseType.CANCEL:
|
||||
return
|
||||
|
||||
open_data()
|
||||
|
||||
|
||||
def open_data():
|
||||
""" Opening data and fill views. """
|
||||
try:
|
||||
model.clear()
|
||||
__bouquets_model.clear()
|
||||
__fav_model.clear()
|
||||
model_name = model.get_name()
|
||||
data_path = get_config()["data_dir_path"]
|
||||
__services_model.clear()
|
||||
data_path = __options["data_dir_path"]
|
||||
|
||||
if model_name == SERVICE_LIST_NAME:
|
||||
for ch in get_channels(data_path + "lamedb"):
|
||||
# adding channels to dict with fav_id as keys
|
||||
__channels[ch.fav_id] = ch
|
||||
model.append(ch)
|
||||
for ch in get_channels(data_path + "lamedb"):
|
||||
# adding channels to dict with fav_id as keys
|
||||
__channels[ch.fav_id] = ch
|
||||
__services_model.append(ch)
|
||||
|
||||
if model_name == BOUQUETS_LIST_NAME:
|
||||
bouquets = get_bouquets(data_path)
|
||||
for bouquet in bouquets:
|
||||
parent = model.append(None, [bouquet.name, bouquet.type])
|
||||
for bt in bouquet.bouquets:
|
||||
name, bt_type = bt.name, bt.type
|
||||
model.append(parent, [name, bt_type])
|
||||
__bouquets["{}:{}".format(name, bt_type)] = bt.services
|
||||
bouquets = get_bouquets(data_path)
|
||||
for bouquet in bouquets:
|
||||
parent = __bouquets_model.append(None, [bouquet.name, bouquet.type])
|
||||
for bt in bouquet.bouquets:
|
||||
name, bt_type = bt.name, bt.type
|
||||
__bouquets_model.append(parent, [name, bt_type])
|
||||
__bouquets["{}:{}".format(name, bt_type)] = bt.services
|
||||
except Exception as e:
|
||||
__status_bar.push(1, getattr(e, "message", repr(e)))
|
||||
raise e # temp for debug
|
||||
|
||||
|
||||
@run_task
|
||||
@@ -394,6 +404,8 @@ def show_dialog(dialog_name, text=None):
|
||||
dialog.set_transient_for(__main_window)
|
||||
if text:
|
||||
dialog.set_markup(text)
|
||||
if dialog_name == "path_chooser_dialog":
|
||||
dialog.set_current_folder(__options["data_dir_path"])
|
||||
response = dialog.run()
|
||||
dialog.destroy()
|
||||
|
||||
@@ -432,18 +444,48 @@ def on_tree_view_key_release(view, event):
|
||||
on_paste(view)
|
||||
|
||||
|
||||
@run_task
|
||||
def on_upload(item):
|
||||
connect(__options, False)
|
||||
|
||||
|
||||
@run_task
|
||||
def on_download(item):
|
||||
connect(__options)
|
||||
open_data()
|
||||
|
||||
|
||||
def on_reload(item):
|
||||
pass
|
||||
|
||||
|
||||
def on_view_focus(view, focus_event):
|
||||
model = view.get_model()
|
||||
model_name = model.get_name()
|
||||
|
||||
empty = len(model) == 0 # if > 0 model has items
|
||||
|
||||
if empty:
|
||||
return
|
||||
|
||||
fav_elements = ("up_tool_button", "down_tool_button", "cut_tool_button", "paste_tool_button")
|
||||
service_elements = ("copy_tool_button", "to_fav_tool_button")
|
||||
|
||||
if model_name == BOUQUETS_LIST_NAME:
|
||||
for elem in __tool_elements:
|
||||
__tool_elements[elem].set_sensitive(False)
|
||||
__tool_elements["new_tool_button"].set_sensitive(True)
|
||||
else:
|
||||
is_service = model_name == SERVICE_LIST_NAME
|
||||
for elem in fav_elements:
|
||||
__tool_elements[elem].set_sensitive(not is_service)
|
||||
for elem in service_elements:
|
||||
__tool_elements[elem].set_sensitive(is_service)
|
||||
__tool_elements["new_tool_button"].set_sensitive(False)
|
||||
|
||||
__tool_elements["remove_tool_button"].set_sensitive(not empty)
|
||||
|
||||
|
||||
def connect(properties, download=True):
|
||||
try:
|
||||
res = download_data(properties=properties) if download else upload_data(properties=properties)
|
||||
@@ -470,8 +512,18 @@ def init_ui():
|
||||
__bouquets_view = builder.get_object("bouquets_tree_view")
|
||||
global __fav_model
|
||||
__fav_model = builder.get_object("fav_list_store")
|
||||
global __services_model
|
||||
__services_model = builder.get_object("services_list_store")
|
||||
global __bouquets_model
|
||||
__bouquets_model = builder.get_object("bouquets_tree_store")
|
||||
global __status_bar
|
||||
__status_bar = builder.get_object("status_bar")
|
||||
# dynamically active elements depending on the selected view
|
||||
global __tool_elements
|
||||
__tool_elements = {k: builder.get_object(k) for k in ("up_tool_button", "down_tool_button",
|
||||
"cut_tool_button", "copy_tool_button",
|
||||
"paste_tool_button", "to_fav_tool_button",
|
||||
"new_tool_button", "remove_tool_button")}
|
||||
builder.connect_signals(get_handlers())
|
||||
init_drag_and_drop() # drag and drop
|
||||
__main_window.show_all()
|
||||
|
||||
@@ -364,8 +364,7 @@
|
||||
<property name="label" translatable="yes">Open</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="stock_id">gtk-open</property>
|
||||
<signal name="clicked" handler="on_data_open" object="bouquets_tree_store" swapped="no"/>
|
||||
<signal name="clicked" handler="on_data_open" object="services_list_store" swapped="no"/>
|
||||
<signal name="clicked" handler="on_data_open" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
@@ -448,6 +447,7 @@
|
||||
<child>
|
||||
<object class="GtkToolButton" id="to_fav_tool_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Move</property>
|
||||
<property name="use_underline">True</property>
|
||||
@@ -472,6 +472,7 @@
|
||||
<child>
|
||||
<object class="GtkToolButton" id="up_tool_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Up</property>
|
||||
<property name="use_underline">True</property>
|
||||
@@ -486,6 +487,7 @@
|
||||
<child>
|
||||
<object class="GtkToolButton" id="down_tool_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Down</property>
|
||||
<property name="use_underline">True</property>
|
||||
@@ -500,6 +502,7 @@
|
||||
<child>
|
||||
<object class="GtkToolButton" id="cut_tool_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Cut</property>
|
||||
<property name="use_underline">True</property>
|
||||
@@ -514,6 +517,7 @@
|
||||
<child>
|
||||
<object class="GtkToolButton" id="copy_tool_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Copy</property>
|
||||
<property name="use_underline">True</property>
|
||||
@@ -528,6 +532,7 @@
|
||||
<child>
|
||||
<object class="GtkToolButton" id="paste_tool_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Paste</property>
|
||||
<property name="use_underline">True</property>
|
||||
@@ -539,9 +544,34 @@
|
||||
<property name="homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparatorToolItem" id="separatortoolitem3">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolButton" id="new_tool_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">New</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="stock_id">gtk-new</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolButton" id="remove_tool_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Remove</property>
|
||||
<property name="use_underline">True</property>
|
||||
@@ -658,6 +688,7 @@
|
||||
<property name="activate_on_single_click">True</property>
|
||||
<signal name="button-press-event" handler="on_view_popup_menu" object="services_popup_menu" swapped="no"/>
|
||||
<signal name="drag-data-get" handler="on_services_tree_view_drag_data_get" swapped="no"/>
|
||||
<signal name="focus-in-event" handler="on_view_focus" swapped="no"/>
|
||||
<signal name="key-release-event" handler="on_tree_view_key_release" swapped="no"/>
|
||||
<signal name="row-activated" handler="on_services_selection" object="services_list_store" swapped="no"/>
|
||||
<child internal-child="selection">
|
||||
@@ -933,6 +964,8 @@
|
||||
<signal name="button-press-event" handler="on_view_popup_menu" object="fav_popup_menu" swapped="no"/>
|
||||
<signal name="drag-data-get" handler="on_fav_tree_view_drag_data_get" swapped="no"/>
|
||||
<signal name="drag-data-received" handler="on_fav_tree_view_drag_data_received" swapped="no"/>
|
||||
<signal name="focus" handler="on_view_focus" swapped="no"/>
|
||||
<signal name="focus-in-event" handler="on_view_focus" swapped="no"/>
|
||||
<signal name="key-release-event" handler="on_tree_view_key_release" swapped="no"/>
|
||||
<signal name="row-activated" handler="on_fav_selection" object="fav_list_store" swapped="no"/>
|
||||
<child internal-child="selection">
|
||||
@@ -1030,6 +1063,7 @@
|
||||
<property name="enable_search">False</property>
|
||||
<property name="activate_on_single_click">True</property>
|
||||
<signal name="button-press-event" handler="on_view_popup_menu" object="bouquets_popup_menu" swapped="no"/>
|
||||
<signal name="focus-in-event" handler="on_view_focus" swapped="no"/>
|
||||
<signal name="row-activated" handler="on_bouquets_selection" object="bouquets_tree_store" swapped="no"/>
|
||||
<child internal-child="selection">
|
||||
<object class="GtkTreeSelection" id="bouquets_selection"/>
|
||||
|
||||
@@ -1,388 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.18.3 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.12"/>
|
||||
<object class="GtkDialog" id="settings_dialog">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="title" translatable="yes">Options</property>
|
||||
<property name="resizable">False</property>
|
||||
<property name="modal">True</property>
|
||||
<property name="icon_name">preferences-desktop</property>
|
||||
<property name="type_hint">dialog</property>
|
||||
<child internal-child="vbox">
|
||||
<object class="GtkBox" id="dialog-vbox">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_top">5</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">2</property>
|
||||
<child internal-child="action_area">
|
||||
<object class="GtkButtonBox" id="dialog-action_area">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="layout_style">end</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="cancel_button">
|
||||
<property name="label">gtk-undo</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="ok_button">
|
||||
<property name="label">gtk-ok</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkGrid" id="grid1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="column_homogeneous">True</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Host:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="host_field">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="text" translatable="yes">127.0.0.1</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label3">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Login:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label4">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Password:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="port_field">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="text" translatable="yes">21</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Port:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="login_field">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="text" translatable="yes">root</property>
|
||||
<property name="primary_icon_name">emblem-personal</property>
|
||||
<property name="primary_icon_activatable">False</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="password_field">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="visibility">False</property>
|
||||
<property name="invisible_char">●</property>
|
||||
<property name="text" translatable="yes">root</property>
|
||||
<property name="primary_icon_name">emblem-nowrite</property>
|
||||
<property name="primary_icon_activatable">False</property>
|
||||
<property name="input_purpose">password</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparator" id="separator1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_top">2</property>
|
||||
<property name="margin_bottom">2</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkGrid" id="grid2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="column_homogeneous">True</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label5">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Services and Bouquets files:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="services_field">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="text" translatable="yes">/etc/enigma2/</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label6">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">User bouquet files:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="user_bouquet_field">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="text" translatable="yes">/etc/enigma2/</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label7">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Satellites.xml file:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="satellites_xml_field">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="text" translatable="yes">/etc/tuxbox/</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">5</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparator" id="separator2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_top">2</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkGrid" id="grid3">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="column_homogeneous">True</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label8">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Data directory:</property>
|
||||
<property name="lines">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="data_dir_field">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="text" translatable="yes">/data</property>
|
||||
<property name="secondary_icon_stock">gtk-open</property>
|
||||
<property name="primary_icon_activatable">False</property>
|
||||
<property name="secondary_icon_tooltip_text" translatable="yes">Select</property>
|
||||
<property name="secondary_icon_tooltip_markup" translatable="yes">Select</property>
|
||||
<signal name="icon-press" handler="on_data_dir_field_icon_press" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">5</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparator" id="separator3">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="padding">2</property>
|
||||
<property name="position">6</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<action-widgets>
|
||||
<action-widget response="-6">cancel_button</action-widget>
|
||||
<action-widget response="-5">ok_button</action-widget>
|
||||
</action-widgets>
|
||||
</object>
|
||||
<object class="GtkFileChooserDialog" id="path_chooser_dialog">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="title" translatable="yes"> </property>
|
||||
<property name="type_hint">dialog</property>
|
||||
<property name="transient_for">settings_dialog</property>
|
||||
<property name="action">save</property>
|
||||
<child internal-child="vbox">
|
||||
<object class="GtkBox" id="filechooserdialog-vbox">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">2</property>
|
||||
<child internal-child="action_area">
|
||||
<object class="GtkButtonBox" id="filechooserdialog-action_area">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="layout_style">end</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="button2">
|
||||
<property name="label">gtk-undo</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="button1">
|
||||
<property name="label">gtk-ok</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="yalign">0.55000001192092896</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<action-widgets>
|
||||
<action-widget response="-6">button2</action-widget>
|
||||
<action-widget response="-12">button1</action-widget>
|
||||
</action-widgets>
|
||||
</object>
|
||||
</interface>
|
||||
@@ -7,7 +7,7 @@ __current_data_path = ""
|
||||
def show_settings_dialog(transient, options):
|
||||
handlers = {"on_data_dir_field_icon_press": on_data_dir_field_icon_press}
|
||||
builder = Gtk.Builder()
|
||||
builder.add_from_file("ui/settings_dialog.glade")
|
||||
builder.add_from_file("ui/dialogs.glade")
|
||||
builder.connect_signals(handlers)
|
||||
dialog = builder.get_object("settings_dialog")
|
||||
dialog.set_transient_for(transient)
|
||||
@@ -43,14 +43,14 @@ def show_settings_dialog(transient, options):
|
||||
dialog.destroy()
|
||||
|
||||
|
||||
def on_data_dir_field_icon_press(*args):
|
||||
def on_data_dir_field_icon_press(entry, icon, event_button):
|
||||
builder = Gtk.Builder()
|
||||
builder.add_from_file("ui/settings_dialog.glade")
|
||||
builder.add_from_file("ui/dialogs.glade")
|
||||
dialog = builder.get_object("path_chooser_dialog")
|
||||
dialog.set_current_folder(__current_data_path)
|
||||
response = dialog.run()
|
||||
if response == -12: # for fix assertion 'gtk_widget_get_can_default (widget)' failed
|
||||
args[0].set_text(dialog.get_filename())
|
||||
if response == -12: # -12 for fix assertion 'gtk_widget_get_can_default (widget)' failed
|
||||
entry.set_text(dialog.get_filename() if dialog.get_filename() else __current_data_path)
|
||||
dialog.destroy()
|
||||
|
||||
return response
|
||||
|
||||
Reference in New Issue
Block a user