pygui: added simple error dialog call to app, also added blocking option for some error dialogs when needed
This commit is contained in:
parent
2387812a76
commit
b163b06596
4 changed files with 37 additions and 21 deletions
|
@ -13,9 +13,11 @@ if TYPE_CHECKING:
|
|||
|
||||
|
||||
class ErrorDialog(Dialog):
|
||||
def __init__(self, app: "Application", title: str, details: str) -> None:
|
||||
super().__init__(app, "CORE Exception")
|
||||
self.title: str = title
|
||||
def __init__(
|
||||
self, app: "Application", title: str, message: str, details: str
|
||||
) -> None:
|
||||
super().__init__(app, title)
|
||||
self.message: str = message
|
||||
self.details: str = details
|
||||
self.error_message: Optional[CodeText] = None
|
||||
self.draw()
|
||||
|
@ -25,13 +27,13 @@ class ErrorDialog(Dialog):
|
|||
self.top.rowconfigure(1, weight=1)
|
||||
image = images.from_enum(ImageEnum.ERROR, width=images.ERROR_SIZE)
|
||||
label = ttk.Label(
|
||||
self.top, text=self.title, image=image, compound=tk.LEFT, anchor=tk.CENTER
|
||||
self.top, text=self.message, image=image, compound=tk.LEFT, anchor=tk.CENTER
|
||||
)
|
||||
label.image = image
|
||||
label.grid(sticky=tk.EW, pady=PADY)
|
||||
label.grid(sticky=tk.W, pady=PADY)
|
||||
self.error_message = CodeText(self.top)
|
||||
self.error_message.text.insert("1.0", self.details)
|
||||
self.error_message.text.config(state=tk.DISABLED)
|
||||
self.error_message.grid(sticky=tk.NSEW, pady=PADY)
|
||||
self.error_message.grid(sticky=tk.EW, pady=PADY)
|
||||
button = ttk.Button(self.top, text="Close", command=lambda: self.destroy())
|
||||
button.grid(sticky=tk.EW)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue