mirror of
https://github.com/DYefremov/DemonEditor.git
synced 2026-05-07 19:07:02 +02:00
added space [hidden marker] support
This commit is contained in:
@@ -122,6 +122,7 @@ class Application(Gtk.Application):
|
||||
"on_import_bouquets": self.on_import_bouquets,
|
||||
"on_backup_tool_show": self.on_backup_tool_show,
|
||||
"on_insert_marker": self.on_insert_marker,
|
||||
"on_insert_space": self.on_insert_space,
|
||||
"on_fav_press": self.on_fav_press,
|
||||
"on_locate_in_services": self.on_locate_in_services,
|
||||
"on_picons_manager_show": self.on_picons_manager_show,
|
||||
@@ -1220,7 +1221,7 @@ class Application(Gtk.Application):
|
||||
fav_id = srv.data
|
||||
# IPTV and MARKER services
|
||||
s_type = srv.type
|
||||
if s_type is BqServiceType.MARKER or s_type is BqServiceType.IPTV:
|
||||
if s_type in (BqServiceType.MARKER, BqServiceType.IPTV, BqServiceType.SPACE):
|
||||
icon = None
|
||||
picon_id = None
|
||||
if s_type is BqServiceType.IPTV:
|
||||
@@ -1692,11 +1693,14 @@ class Application(Gtk.Application):
|
||||
self._radio_count_label.set_text(str(radio_count))
|
||||
self._data_count_label.set_text(str(data_count))
|
||||
|
||||
def on_insert_marker(self, view):
|
||||
def on_insert_marker(self, view, m_type=BqServiceType.MARKER):
|
||||
""" Inserts marker into bouquet services list. """
|
||||
insert_marker(view, self._bouquets, self._bq_selected, self._services, self._main_window)
|
||||
insert_marker(view, self._bouquets, self._bq_selected, self._services, self._main_window, m_type)
|
||||
self.update_fav_num_column(self._fav_model)
|
||||
|
||||
def on_insert_space(self, view):
|
||||
self.on_insert_marker(view, BqServiceType.SPACE)
|
||||
|
||||
def on_fav_press(self, menu, event):
|
||||
if event.get_event_type() == Gdk.EventType.DOUBLE_BUTTON_PRESS:
|
||||
if self._fav_click_mode is FavClickMode.DISABLED:
|
||||
|
||||
@@ -16,23 +16,28 @@ from .uicommons import ViewTarget, BqGenType, Gtk, Gdk, HIDE_ICON, LOCKED_ICON,
|
||||
|
||||
# ***************** Markers *******************#
|
||||
|
||||
def insert_marker(view, bouquets, selected_bouquet, services, parent_window):
|
||||
def insert_marker(view, bouquets, selected_bouquet, services, parent_window, m_type=BqServiceType.MARKER):
|
||||
"""" Inserts marker into bouquet services list. """
|
||||
response = show_dialog(DialogType.INPUT, parent_window)
|
||||
if response == Gtk.ResponseType.CANCEL:
|
||||
return
|
||||
fav_id, text = "1:832:D:0:0:0:0:0:0:0:\n", None
|
||||
|
||||
if not response.strip():
|
||||
show_dialog(DialogType.ERROR, parent_window, "The text of marker is empty, please try again!")
|
||||
return
|
||||
if m_type is BqServiceType.MARKER:
|
||||
response = show_dialog(DialogType.INPUT, parent_window)
|
||||
if response == Gtk.ResponseType.CANCEL:
|
||||
return
|
||||
|
||||
fav_id = "1:64:0:0:0:0:0:0:0:0::{}\n#DESCRIPTION {}\n".format(response, response)
|
||||
s_type = BqServiceType.MARKER.name
|
||||
if not response.strip():
|
||||
show_dialog(DialogType.ERROR, parent_window, "The text of marker is empty, please try again!")
|
||||
return
|
||||
|
||||
fav_id = "1:64:0:0:0:0:0:0:0:0::{}\n#DESCRIPTION {}\n".format(response, response)
|
||||
text = response
|
||||
|
||||
s_type = m_type.name
|
||||
model, paths = view.get_selection().get_selected_rows()
|
||||
marker = (None, None, response, None, None, s_type, None, fav_id, None, None, None)
|
||||
marker = (None, None, text, None, None, s_type, None, fav_id, None, None, None)
|
||||
itr = model.insert_before(model.get_iter(paths[0]), marker) if paths else model.insert(0, marker)
|
||||
bouquets[selected_bouquet].insert(model.get_path(itr)[0], fav_id)
|
||||
services[fav_id] = Service(None, None, None, response, None, None, None, s_type, *[None] * 9, 0, fav_id, None)
|
||||
services[fav_id] = Service(None, None, None, text, None, None, None, s_type, *[None] * 9, 0, fav_id, None)
|
||||
|
||||
|
||||
# ***************** Movement *******************#
|
||||
|
||||
Reference in New Issue
Block a user