mirror of
https://github.com/DYefremov/DemonEditor.git
synced 2026-01-20 22:43:23 +01:00
little improvements for rename
This commit is contained in:
@@ -1465,8 +1465,8 @@ class MainAppWindow:
|
||||
data = model[paths][:]
|
||||
cur_name, srv_type, fav_id = data[2], data[5], data[7]
|
||||
|
||||
if srv_type == BqServiceType.IPTV.name:
|
||||
show_dialog(DialogType.ERROR, self._main_window, "This item is not allowed to edit!")
|
||||
if srv_type == BqServiceType.IPTV.name or srv_type == BqServiceType.MARKER.name:
|
||||
show_dialog(DialogType.ERROR, self._main_window, "This action is not allowed in current context!")
|
||||
return
|
||||
|
||||
response = show_dialog(DialogType.INPUT, self._main_window, cur_name)
|
||||
|
||||
@@ -161,8 +161,10 @@ def rename(view, parent_window, target, fav_view=None, service_view=None, servic
|
||||
old_srv = services.get(f_id, None)
|
||||
if old_srv:
|
||||
if srv_type == BqServiceType.IPTV.name or srv_type == BqServiceType.MARKER.name:
|
||||
old_name = old_srv.service
|
||||
new_fav_id = f_id.replace(old_name.strip(), srv_name.strip(), 2)
|
||||
l, sep, r = f_id.partition("#DESCRIPTION")
|
||||
old_name = old_srv.service.strip()
|
||||
new_name = srv_name.strip()
|
||||
new_fav_id = "".join((new_name.join(l.rsplit(old_name, 1)), sep, new_name.join(r.rsplit(old_name, 1))))
|
||||
services[f_id] = old_srv._replace(service=srv_name, fav_id=new_fav_id)
|
||||
else:
|
||||
services[f_id] = old_srv._replace(service=srv_name)
|
||||
|
||||
Reference in New Issue
Block a user