add recent files to gui.yaml for keeping track of recent files
This commit is contained in:
parent
6140ebfb59
commit
bdbf5fac61
2 changed files with 18 additions and 1 deletions
|
@ -158,3 +158,20 @@ class MenuAction:
|
||||||
def config_throughput(self):
|
def config_throughput(self):
|
||||||
dialog = ThroughputDialog(self.app, self.app)
|
dialog = ThroughputDialog(self.app, self.app)
|
||||||
dialog.show()
|
dialog.show()
|
||||||
|
|
||||||
|
def add_recent_file_to_gui_config(self, file_path):
|
||||||
|
recent_files = self.app.guiconfig["recentfiles"]
|
||||||
|
num_files = len(recent_files)
|
||||||
|
if num_files == 0:
|
||||||
|
recent_files.insert(0, file_path)
|
||||||
|
elif 0 < num_files <= 3:
|
||||||
|
if file_path in recent_files:
|
||||||
|
recent_files.remove(file_path)
|
||||||
|
recent_files.insert(0, file_path)
|
||||||
|
else:
|
||||||
|
if num_files == 3:
|
||||||
|
recent_files.pop()
|
||||||
|
recent_files.insert(0, file_path)
|
||||||
|
else:
|
||||||
|
logging.error("unexpected number of recent files")
|
||||||
|
self.app.save_config()
|
||||||
|
|
|
@ -409,7 +409,7 @@ class Menubar(tk.Menu):
|
||||||
menu.add_command(label="About", command=self.menuaction.show_about)
|
menu.add_command(label="About", command=self.menuaction.show_about)
|
||||||
self.add_cascade(label="Help", menu=menu)
|
self.add_cascade(label="Help", menu=menu)
|
||||||
|
|
||||||
def save(self):
|
def save(self, event=None):
|
||||||
xml_file = self.app.core.xml_file
|
xml_file = self.app.core.xml_file
|
||||||
if xml_file:
|
if xml_file:
|
||||||
self.app.core.save_xml(xml_file)
|
self.app.core.save_xml(xml_file)
|
||||||
|
|
Loading…
Add table
Reference in a new issue