pygui: added type hinting to class variables for core.gui.dialogs
This commit is contained in:
parent
11be40bc90
commit
527d34e374
37 changed files with 664 additions and 613 deletions
|
@ -1,9 +1,10 @@
|
|||
import logging
|
||||
from tkinter import ttk
|
||||
from typing import TYPE_CHECKING
|
||||
from typing import TYPE_CHECKING, Dict, Optional
|
||||
|
||||
import grpc
|
||||
|
||||
from core.api.grpc.common_pb2 import ConfigOption
|
||||
from core.gui.dialogs.dialog import Dialog
|
||||
from core.gui.themes import PADX, PADY
|
||||
from core.gui.widgets import ConfigFrame
|
||||
|
@ -13,15 +14,15 @@ if TYPE_CHECKING:
|
|||
|
||||
|
||||
class SessionOptionsDialog(Dialog):
|
||||
def __init__(self, app: "Application"):
|
||||
def __init__(self, app: "Application") -> None:
|
||||
super().__init__(app, "Session Options")
|
||||
self.config_frame = None
|
||||
self.has_error = False
|
||||
self.config = self.get_config()
|
||||
self.config_frame: Optional[ConfigFrame] = None
|
||||
self.has_error: bool = False
|
||||
self.config: Dict[str, ConfigOption] = self.get_config()
|
||||
if not self.has_error:
|
||||
self.draw()
|
||||
|
||||
def get_config(self):
|
||||
def get_config(self) -> Dict[str, ConfigOption]:
|
||||
try:
|
||||
session_id = self.app.core.session_id
|
||||
response = self.app.core.client.get_session_options(session_id)
|
||||
|
@ -31,7 +32,7 @@ class SessionOptionsDialog(Dialog):
|
|||
self.has_error = True
|
||||
self.destroy()
|
||||
|
||||
def draw(self):
|
||||
def draw(self) -> None:
|
||||
self.top.columnconfigure(0, weight=1)
|
||||
self.top.rowconfigure(0, weight=1)
|
||||
|
||||
|
@ -48,7 +49,7 @@ class SessionOptionsDialog(Dialog):
|
|||
button = ttk.Button(frame, text="Cancel", command=self.destroy)
|
||||
button.grid(row=0, column=1, sticky="ew")
|
||||
|
||||
def save(self):
|
||||
def save(self) -> None:
|
||||
config = self.config_frame.parse_config()
|
||||
try:
|
||||
session_id = self.app.core.session_id
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue