Skip to content

Commit

Permalink
A few More Files to TTK
Browse files Browse the repository at this point in the history
  • Loading branch information
Rixxan committed Dec 24, 2023
1 parent 616df33 commit a1e6392
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
10 changes: 5 additions & 5 deletions plug.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand All @@ -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.
Expand Down
6 changes: 4 additions & 2 deletions stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
Licensed under the GNU General Public License.
See LICENSE file.
"""
from __future__ import annotations

import csv
import json
import sys
Expand Down Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions ttkHyperlinkLabel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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)
Expand Down

0 comments on commit a1e6392

Please sign in to comment.