reopen the files that were open the last time
This commit is contained in:
@@ -82,3 +82,17 @@ class OpenFilePlugin(PluginBase):
|
||||
|
||||
def after_open_file(self, file: str):
|
||||
self._remember_recent_file(file)
|
||||
|
||||
def after_start(self):
|
||||
open_files_as_string = self.settings.get_session('general', 'open_files', fallback='')
|
||||
files = open_files_as_string.split(os.pathsep)
|
||||
if "" in files:
|
||||
files.remove("")
|
||||
for file in files:
|
||||
self.open_file(file)
|
||||
|
||||
def before_shutdown(self):
|
||||
open_files = PluginRegistry.execute_single("get_open_files")
|
||||
if open_files:
|
||||
open_files_as_string = os.pathsep.join(open_files)
|
||||
self.settings.set_session('general', 'open_files', open_files_as_string)
|
||||
|
||||
@@ -5,6 +5,7 @@ from PySide6.QtCore import Qt
|
||||
from PySide6.QtWidgets import QDockWidget, QMessageBox
|
||||
|
||||
import constants
|
||||
from raven.pluginregistry import PluginRegistry
|
||||
from raven.plugins.ravenlog.aboutdialog import AboutDialog
|
||||
from raven.mainwindow import MainWindow
|
||||
from raven.pluginbase import PluginBase
|
||||
@@ -75,6 +76,9 @@ class RavenLogPlugin(PluginBase):
|
||||
def current_file(self) -> Optional[str]:
|
||||
return self.main_window.tabs.current_file()
|
||||
|
||||
def get_open_files(self) -> [str]:
|
||||
return self.main_window.tabs.open_files();
|
||||
|
||||
def update_window_title(self, title: str):
|
||||
if len(title) > 0:
|
||||
self.main_window.setWindowTitle(_("{0} - RavenLog").format(title))
|
||||
|
||||
Reference in New Issue
Block a user