Boy I wished, that customtkinter would be correctly typed :/
This commit is contained in:
parent
cb00e62143
commit
159a08f824
8 changed files with 9 additions and 71 deletions
|
@ -1,10 +1,12 @@
|
||||||
image: python:3-alpine
|
image: python:3-alpine
|
||||||
|
|
||||||
|
variables:
|
||||||
|
MYPYPATH: "stubs/"
|
||||||
|
|
||||||
mypy:
|
mypy:
|
||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
- pip install mypy --quiet
|
- pip install mypy types-Pillow types-PyYAML --quiet
|
||||||
- mypy --install-types
|
|
||||||
- mypy syng --strict
|
- mypy syng --strict
|
||||||
|
|
||||||
ruff:
|
ruff:
|
||||||
|
|
|
@ -1,66 +0,0 @@
|
||||||
from tkinter import Tk
|
|
||||||
from typing import Any, Callable, Optional
|
|
||||||
|
|
||||||
from PIL.Image import Image
|
|
||||||
|
|
||||||
class CTk(Tk):
|
|
||||||
def __init__(self, parent: Optional[Tk] = None, className: str = "Tk") -> None:
|
|
||||||
pass
|
|
||||||
def pack(
|
|
||||||
self,
|
|
||||||
expand: bool = False,
|
|
||||||
fill: str = "",
|
|
||||||
side: str = "",
|
|
||||||
padx: int = 0,
|
|
||||||
pady: int = 0,
|
|
||||||
ipadx: int = 0,
|
|
||||||
ipady: int = 0,
|
|
||||||
anchor: str = "",
|
|
||||||
) -> None: ...
|
|
||||||
def grid(
|
|
||||||
self, column: int, row: int, padx: int = 0, pady: int = 0, sticky: str = ""
|
|
||||||
) -> None: ...
|
|
||||||
def configure(self, **kwargs: Any) -> None: ...
|
|
||||||
|
|
||||||
class CTkToplevel(CTk): ...
|
|
||||||
class CTkFrame(CTk): ...
|
|
||||||
|
|
||||||
class CTkImage:
|
|
||||||
def __init__(self, light_image: Image, size: tuple[int, int]) -> None: ...
|
|
||||||
|
|
||||||
class CTkTabview(CTk):
|
|
||||||
def __init__(self, parent: Tk, width: int, height: int) -> None: ...
|
|
||||||
def add(self, name: str) -> None: ...
|
|
||||||
def set(self, name: str) -> None: ...
|
|
||||||
def tab(self, name: str) -> CTkFrame: ...
|
|
||||||
|
|
||||||
class CTkOptionMenu(CTk):
|
|
||||||
def __init__(self, parent: Tk, values: list[str]) -> None: ...
|
|
||||||
def set(self, value: str) -> None: ...
|
|
||||||
def get(self) -> str: ...
|
|
||||||
|
|
||||||
class CTkCheckBox(CTk):
|
|
||||||
def __init__(self, parent: Tk, text: str, onvalue: Any, offvalue: Any) -> None: ...
|
|
||||||
def select(self) -> None: ...
|
|
||||||
def deselect(self) -> None: ...
|
|
||||||
def get(self) -> Any: ...
|
|
||||||
|
|
||||||
class CTkLabel(CTk):
|
|
||||||
def __init__(self, parent: Tk, text: str, justify: str = "") -> None: ...
|
|
||||||
|
|
||||||
class CTkTextbox(CTk):
|
|
||||||
def __init__(self, parent: Tk, wrap: str = "none", height: int = 1) -> None: ...
|
|
||||||
def get(self, start: str, end: str) -> str: ...
|
|
||||||
def delete(self, start: str, end: str) -> None: ...
|
|
||||||
def insert(self, start: str, value: str) -> None: ...
|
|
||||||
|
|
||||||
class CTkScrollableFrame(CTk): ...
|
|
||||||
|
|
||||||
class CTkButton(CTk):
|
|
||||||
def __init__(
|
|
||||||
self,
|
|
||||||
parent: Tk,
|
|
||||||
text: str,
|
|
||||||
command: Callable[..., None],
|
|
||||||
width: Optional[int] = None,
|
|
||||||
) -> None: ...
|
|
|
@ -56,6 +56,8 @@ module = [
|
||||||
"qrcode",
|
"qrcode",
|
||||||
"engineio",
|
"engineio",
|
||||||
"tkcalendar",
|
"tkcalendar",
|
||||||
|
"customtkinter",
|
||||||
|
"aiohttp",
|
||||||
"tktimepicker"
|
"tktimepicker"
|
||||||
]
|
]
|
||||||
ignore_missing_imports = true
|
ignore_missing_imports = true
|
||||||
|
|
|
@ -24,7 +24,7 @@ from .sources import available_sources
|
||||||
from .server import main as server_main
|
from .server import main as server_main
|
||||||
|
|
||||||
|
|
||||||
class DateAndTimePickerWindow(customtkinter.CTkToplevel):
|
class DateAndTimePickerWindow(customtkinter.CTkToplevel): # type: ignore
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
parent: customtkinter.CTkFrame | customtkinter.CTkScrollableFrame,
|
parent: customtkinter.CTkFrame | customtkinter.CTkScrollableFrame,
|
||||||
|
@ -76,7 +76,7 @@ class DateAndTimePickerWindow(customtkinter.CTkToplevel):
|
||||||
self.destroy()
|
self.destroy()
|
||||||
|
|
||||||
|
|
||||||
class OptionFrame(customtkinter.CTkScrollableFrame):
|
class OptionFrame(customtkinter.CTkScrollableFrame): # type:ignore
|
||||||
def add_option_label(self, text: str) -> None:
|
def add_option_label(self, text: str) -> None:
|
||||||
customtkinter.CTkLabel(self, text=text, justify="left").grid(
|
customtkinter.CTkLabel(self, text=text, justify="left").grid(
|
||||||
column=0, row=self.number_of_options, padx=5, pady=5, sticky="ne"
|
column=0, row=self.number_of_options, padx=5, pady=5, sticky="ne"
|
||||||
|
@ -296,7 +296,7 @@ class GeneralConfig(OptionFrame):
|
||||||
return config
|
return config
|
||||||
|
|
||||||
|
|
||||||
class SyngGui(customtkinter.CTk):
|
class SyngGui(customtkinter.CTk): # type:ignore
|
||||||
def on_close(self) -> None:
|
def on_close(self) -> None:
|
||||||
if self.syng_server is not None:
|
if self.syng_server is not None:
|
||||||
self.syng_server.kill()
|
self.syng_server.kill()
|
||||||
|
|
Loading…
Add table
Reference in a new issue