diff --git a/plug.py b/plug.py index aa34ce77c..5d75f5b2b 100644 --- a/plug.py +++ b/plug.py @@ -94,7 +94,7 @@ def _get_func(self, funcname: str): """ return getattr(self.module, funcname, None) - def get_app(self, parent: tk.Frame) -> tk.Frame | None: + def get_app(self, parent: ttk.Frame) -> ttk.Frame | None: """ If the plugin provides mainwindow content create and return it. @@ -111,12 +111,12 @@ def get_app(self, parent: tk.Frame) -> tk.Frame | None: if isinstance(appitem, tuple): if ( len(appitem) != 2 - or not isinstance(appitem[0], tk.Widget) - or not isinstance(appitem[1], tk.Widget) + or not isinstance(appitem[0], (ttk.Widget, tk.Widget)) + or not isinstance(appitem[1], (ttk.Widget, tk.Widget)) ): raise AssertionError - elif not isinstance(appitem, tk.Widget): + elif not isinstance(appitem, (ttk.Widget, tk.Widget)): raise AssertionError return appitem @@ -126,7 +126,7 @@ def get_app(self, parent: tk.Frame) -> tk.Frame | None: return None - def get_prefs(self, parent: ttk.Notebook, cmdr: str | None, is_beta: bool) -> tk.Frame | None: + def get_prefs(self, parent: ttk.Notebook, cmdr: str | None, is_beta: bool) -> ttk.Frame | None: """ If the plugin provides a prefs frame, create and return it. diff --git a/stats.py b/stats.py index 041e47f36..498d11278 100644 --- a/stats.py +++ b/stats.py @@ -5,6 +5,8 @@ Licensed under the GNU General Public License. See LICENSE file. """ +from __future__ import annotations + import csv import json import sys @@ -303,10 +305,10 @@ def export_ships(companion_data: dict[str, Any], filename: AnyStr) -> None: h.writerow(list(thing)) -class StatsDialog(): +class StatsDialog: """Status dialog containing all of the current cmdr's stats.""" - def __init__(self, parent: tk.Tk, status: tk.Label) -> None: + def __init__(self, parent: tk.Tk, status: ttk.Label) -> None: self.parent: tk.Tk = parent self.status = status self.showstats() diff --git a/ttkHyperlinkLabel.py b/ttkHyperlinkLabel.py index 24470a937..8eba9c66e 100644 --- a/ttkHyperlinkLabel.py +++ b/ttkHyperlinkLabel.py @@ -35,7 +35,7 @@ def _(x: str) -> str: ... class HyperlinkLabel(sys.platform == 'darwin' and tk.Label or ttk.Label): # type: ignore """Clickable label for HTTP links.""" - def __init__(self, master: tk.Frame | None = None, **kw: Any) -> None: + def __init__(self, master: ttk.Frame | None = None, **kw: Any) -> None: """ Initialize the HyperlinkLabel. @@ -55,7 +55,7 @@ def __init__(self, master: tk.Frame | None = None, **kw: Any) -> None: # Use tk.Label 'cos can't set ttk.Label background - http://www.tkdocs.com/tutorial/styles.html#whydifficult kw['background'] = kw.pop('background', 'systemDialogBackgroundActive') kw['anchor'] = kw.pop('anchor', tk.W) # like ttk.Label - tk.Label.__init__(self, master, **kw) + ttk.Label.__init__(self, master, **kw) else: ttk.Label.__init__(self, master, **kw)