allow other plugins to open files
This commit is contained in:
4
main.py
4
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/logs_2018-09-06_2018-09-06.csv")
|
||||||
# window.open_file("/home/andi/ws/performanceDb/data/production/vapbdcom.csv")
|
# window.open_file("/home/andi/ws/performanceDb/data/production/vapbdcom.csv")
|
||||||
# window.open_file("/var/log/syslog")
|
# 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")
|
# window.open_file("C:\\Users\\andi\\ws\\some.log")
|
||||||
|
|
||||||
signal.signal(signal.SIGINT, stop_signal)
|
signal.signal(signal.SIGINT, stop_signal)
|
||||||
|
|||||||
@@ -50,9 +50,9 @@ class OpenFilePlugin(PluginBase):
|
|||||||
directory=directory
|
directory=directory
|
||||||
)
|
)
|
||||||
if selected_file:
|
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)
|
tab = PluginRegistry.execute_single("create_tab", selected_file)
|
||||||
if tab:
|
if tab:
|
||||||
PluginRegistry.execute_single("add_tab", tab)
|
PluginRegistry.execute_single("add_tab", tab)
|
||||||
@@ -71,7 +71,7 @@ class OpenFilePlugin(PluginBase):
|
|||||||
files = self._get_recent_files()
|
files = self._get_recent_files()
|
||||||
for file in files:
|
for file in files:
|
||||||
action = RAction(os.path.basename(file))
|
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)
|
self._menu_recent_files.add_action(action)
|
||||||
|
|
||||||
def _remember_recent_file(self, file: str):
|
def _remember_recent_file(self, file: str):
|
||||||
|
|||||||
Reference in New Issue
Block a user