From 6e6029f6a247ff5fc978686574dc23620628f08f Mon Sep 17 00:00:00 2001 From: Andreas Huber Date: Fri, 10 Dec 2021 15:51:32 +0100 Subject: [PATCH] allow other plugins to open files --- main.py | 4 +++- raven/plugins/openfileplugin.py | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index e039d94..0c9323f 100644 --- a/main.py +++ b/main.py @@ -61,7 +61,9 @@ if __name__ == "__main__": # window.open_file("/home/andi/ws/performanceDb/data/production/logs_2018-09-06_2018-09-06.csv") # window.open_file("/home/andi/ws/performanceDb/data/production/vapbdcom.csv") # window.open_file("/var/log/syslog") - # window.open_file("/home/andi/ws/ravenlog/example.log") + # PluginRegistry.execute("open_file", "/home/andi/ws/ravenlog/example.log") + PluginRegistry.execute("open_file", + "/home/andi/ws/performanceDb/data/production/lt_axc_21.4_133.02_maxInstance/lt_axc_21.4_133.02_maxInstance/app/axcng-service_i-0a69bd43d3624a5bc_172_28_60_222_VADPERFO01AA001_2021-09-21_091717/service/service.log"); # window.open_file("C:\\Users\\andi\\ws\\some.log") signal.signal(signal.SIGINT, stop_signal) diff --git a/raven/plugins/openfileplugin.py b/raven/plugins/openfileplugin.py index 71738c0..15d5856 100644 --- a/raven/plugins/openfileplugin.py +++ b/raven/plugins/openfileplugin.py @@ -50,9 +50,9 @@ class OpenFilePlugin(PluginBase): directory=directory ) if selected_file: - self._open_file(selected_file) + self.open_file(selected_file) - def _open_file(self, selected_file: str): + def open_file(self, selected_file: str): tab = PluginRegistry.execute_single("create_tab", selected_file) if tab: PluginRegistry.execute_single("add_tab", tab) @@ -71,7 +71,7 @@ class OpenFilePlugin(PluginBase): files = self._get_recent_files() for file in files: action = RAction(os.path.basename(file)) - action.set_action(lambda x, f=file: self._open_file(f)) + action.set_action(lambda x, f=file: self.open_file(f)) self._menu_recent_files.add_action(action) def _remember_recent_file(self, file: str):