type hint some files
This commit is contained in:
parent
0e74212c43
commit
a8a0255624
13 changed files with 643 additions and 62 deletions
|
@ -3,8 +3,10 @@ The actions taken when each menubar option is clicked
|
|||
"""
|
||||
|
||||
import logging
|
||||
import tkinter as tk
|
||||
import webbrowser
|
||||
from tkinter import filedialog, messagebox
|
||||
from typing import Optional
|
||||
|
||||
from core.gui.appconfig import XMLS_PATH
|
||||
from core.gui.dialogs.about import AboutDialog
|
||||
|
@ -30,14 +32,14 @@ class MenuAction:
|
|||
self.app = app
|
||||
self.canvas = app.canvas
|
||||
|
||||
def cleanup_old_session(self, quitapp=False):
|
||||
def cleanup_old_session(self, quitapp: bool = False):
|
||||
logging.info("cleaning up old session")
|
||||
self.app.core.stop_session()
|
||||
self.app.core.delete_session()
|
||||
# if quitapp:
|
||||
# self.app.quit()
|
||||
|
||||
def prompt_save_running_session(self, quitapp=False):
|
||||
def prompt_save_running_session(self, quitapp: bool = False):
|
||||
"""
|
||||
Prompt use to stop running session before application is closed
|
||||
|
||||
|
@ -56,7 +58,7 @@ class MenuAction:
|
|||
elif quitapp:
|
||||
self.app.quit()
|
||||
|
||||
def on_quit(self, event=None):
|
||||
def on_quit(self, event: Optional[tk.Event] = None):
|
||||
"""
|
||||
Prompt user whether so save running session, and then close the application
|
||||
|
||||
|
@ -64,7 +66,7 @@ class MenuAction:
|
|||
"""
|
||||
self.prompt_save_running_session(quitapp=True)
|
||||
|
||||
def file_save_as_xml(self, event=None):
|
||||
def file_save_as_xml(self, event: Optional[tk.Event] = None):
|
||||
logging.info("menuaction.py file_save_as_xml()")
|
||||
file_path = filedialog.asksaveasfilename(
|
||||
initialdir=str(XMLS_PATH),
|
||||
|
@ -75,7 +77,7 @@ class MenuAction:
|
|||
if file_path:
|
||||
self.app.core.save_xml(file_path)
|
||||
|
||||
def file_open_xml(self, event=None):
|
||||
def file_open_xml(self, event: Optional[tk.Event] = None):
|
||||
logging.info("menuaction.py file_open_xml()")
|
||||
file_path = filedialog.askopenfilename(
|
||||
initialdir=str(XMLS_PATH),
|
||||
|
@ -141,11 +143,11 @@ class MenuAction:
|
|||
else:
|
||||
self.app.core.cancel_throughputs()
|
||||
|
||||
def copy(self, event=None):
|
||||
def copy(self, event: Optional[tk.Event] = None):
|
||||
logging.debug("copy")
|
||||
self.app.canvas.copy()
|
||||
|
||||
def paste(self, event=None):
|
||||
def paste(self, event: Optional[tk.Event] = None):
|
||||
logging.debug("paste")
|
||||
self.app.canvas.paste()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue