Buffer list updates preview path; cleanup

This commit is contained in:
itdominator 2024-02-17 00:00:19 -06:00
parent 6e34078099
commit 070d94abc1
2 changed files with 20 additions and 1 deletions

View File

@ -54,6 +54,12 @@ class BridgeController:
event_system.emit(f"handle_file_event_{event.originator}", (event,)) event_system.emit(f"handle_file_event_{event.originator}", (event,))
case "open_file": case "open_file":
event_system.emit(f"handle_file_event_{event.originator}", (event,)) event_system.emit(f"handle_file_event_{event.originator}", (event,))
case "tggl_search_replace":
event_system.emit(f"tggl_search_replace")
case "find_entry":
event_system.emit(f"find_entry_{event.originator}")
case "replace_entry":
event_system.emit(f"replace_entry_{event.originator}")
case "tggl_top_main_menubar": case "tggl_top_main_menubar":
event_system.emit("tggl_top_main_menubar") event_system.emit("tggl_top_main_menubar")
case "set_info_labels": case "set_info_labels":

View File

@ -53,7 +53,8 @@ class AceEditor(WebKit2.WebView):
event_system.subscribe(f"keyboard_scale_up_text_{self.INDEX}", self.keyboard_scale_up_text) event_system.subscribe(f"keyboard_scale_up_text_{self.INDEX}", self.keyboard_scale_up_text)
event_system.subscribe(f"keyboard_scale_down_text_{self.INDEX}", self.keyboard_scale_down_text) event_system.subscribe(f"keyboard_scale_down_text_{self.INDEX}", self.keyboard_scale_down_text)
event_system.subscribe(f"toggle_highlight_line_{self.INDEX}", self.toggle_highlight_line) event_system.subscribe(f"toggle_highlight_line_{self.INDEX}", self.toggle_highlight_line)
event_system.subscribe(f"find_entry_{self.INDEX}", self.find_entry)
event_system.subscribe(f"replace_entry_{self.INDEX}", self.replace_entry)
event_system.subscribe(f"ui_message_{self.INDEX}", self.ui_message) event_system.subscribe(f"ui_message_{self.INDEX}", self.ui_message)
def _load_settings(self): def _load_settings(self):
@ -125,6 +126,18 @@ class AceEditor(WebKit2.WebView):
command = f"displayMessage('{message}', '{mtype}', '3')" command = f"displayMessage('{message}', '{mtype}', '3')"
self.run_javascript(command, None, None) self.run_javascript(command, None, None)
def find_entry(self, query):
command = f"findEntry('{query}')"
self.run_javascript(command, None, None)
def replace_entry(self, fromStr, toStr):
command = f"replaceEntry('{fromStr}', '{toStr}')"
self.run_javascript(command, None, None)
def replace_all(self, fromStr, toStr):
command = f"replaceAll('{fromStr}', '{toStr}')"
self.run_javascript(command, None, None)
def run_javascript(self, script, cancellable, callback): def run_javascript(self, script, cancellable, callback):
logger.debug(script) logger.debug(script)
super().run_javascript(script, cancellable, callback) super().run_javascript(script, cancellable, callback)