1
0
Fork 0

Make themes optional

This commit is contained in:
Daniele Tricoli 2023-02-23 20:13:54 +01:00
parent 262fae3cef
commit 59f29e493b
3 changed files with 64 additions and 43 deletions

81
poetry.lock generated
View file

@ -138,40 +138,40 @@ cron = ["capturer (>=2.4)"]
[[package]]
name = "dbus-fast"
version = "1.84.0"
version = "1.84.2"
description = "A faster version of dbus-next"
category = "main"
optional = false
python-versions = ">=3.7,<4.0"
files = [
{file = "dbus_fast-1.84.0-cp310-cp310-manylinux_2_17_i686.manylinux_2_5_i686.manylinux1_i686.manylinux2014_i686.whl", hash = "sha256:4c067d48a3c6cd974ee908022b6a375244a388009d42f0216520626a90d972a8"},
{file = "dbus_fast-1.84.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:918a83c66ff252a793dc079126d8508761ff23b68595f8de93e0b621b7472ee5"},
{file = "dbus_fast-1.84.0-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:9b3b22db8108fb917f12c847ab5c3899f990e202ad6d8c9c08aeade4ad993e08"},
{file = "dbus_fast-1.84.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:2745a491022d29d80aa605e888fd807a4f93dd03dae797d00d753e8a92eb37e8"},
{file = "dbus_fast-1.84.0-cp311-cp311-manylinux_2_17_i686.manylinux_2_5_i686.manylinux1_i686.manylinux2014_i686.whl", hash = "sha256:156c44ba4c0fa7ee5f8a59f66ba1c6fce75992d477de34cd6ed0350e8a496450"},
{file = "dbus_fast-1.84.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5fc03d61d1f85353bcc29d954c6c0d0c3c62f418714c667204fd301ab26b1b7e"},
{file = "dbus_fast-1.84.0-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:f3d0d5e58782b8ccbf422b48257b32439c3938fc99776f90f11834c8b0e6be04"},
{file = "dbus_fast-1.84.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:ac5f4ee0cba5f5c326c1f24b5ffae21138384dfec156f32e0105e78349b7f558"},
{file = "dbus_fast-1.84.0-cp37-cp37m-manylinux_2_17_i686.manylinux_2_5_i686.manylinux1_i686.manylinux2014_i686.whl", hash = "sha256:883cdb93a44586e3eaf9e5623eaec6af2ba80789c2b2665c83f2f97683971f0c"},
{file = "dbus_fast-1.84.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bb96aaea2f043b201add04db3616eb716557ecc87274389b6f366a9486355f74"},
{file = "dbus_fast-1.84.0-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:b7b26edec3635c69d2f84ac8cd68d4b2208d45675409bdaaf03d05255c469088"},
{file = "dbus_fast-1.84.0-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:f7524af1b8158e2fa315297a1254221b6d0f56ace9ba919553841f338209f02a"},
{file = "dbus_fast-1.84.0-cp38-cp38-manylinux_2_17_i686.manylinux_2_5_i686.manylinux1_i686.manylinux2014_i686.whl", hash = "sha256:e84cfc5b257e632d277d34d049137cae8baf734cc959a99507976920c42d1462"},
{file = "dbus_fast-1.84.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c620bb0210586f1ea06a5c755bb12b8ccc5a2fc7e192f4edcca570f18f4ce284"},
{file = "dbus_fast-1.84.0-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:1613af6d4cf8e046bec30b8955163cb2cb8e6143aac4eff033c43f83f88d2c59"},
{file = "dbus_fast-1.84.0-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:fbd85e487143248bb296f089feaf9b4ac859aa821839f35c85298d334ad12af3"},
{file = "dbus_fast-1.84.0-cp39-cp39-manylinux_2_17_i686.manylinux_2_5_i686.manylinux1_i686.manylinux2014_i686.whl", hash = "sha256:54cdf4223e6698e9e2264fbcafac7a6f6bab5831b8dd6e722542f0fbb5faf132"},
{file = "dbus_fast-1.84.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:82b7f59e2d70465ac9295f90e3ee5e731d0524f3f683c7c3e11eb7cb7a6d05b4"},
{file = "dbus_fast-1.84.0-cp39-cp39-manylinux_2_31_x86_64.whl", hash = "sha256:09fb7c0ee3454f0c696d89a3a567ad184cbe8fbea0db35c1b30876e93b08abec"},
{file = "dbus_fast-1.84.0-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:4f58f544beea53044dd0233ea867a256a8be76bfd6252128eb2a7b6dda77298e"},
{file = "dbus_fast-1.84.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:571083ad74447618b173472fef95289eb915c2a6f69355b97dbad660ef51637f"},
{file = "dbus_fast-1.84.0-pp37-pypy37_pp73-manylinux_2_17_i686.manylinux_2_5_i686.manylinux1_i686.manylinux2014_i686.whl", hash = "sha256:7a624cc2b40152ac18e6e38a9f0e65c4573ba76da4e5cc368cde3b4fd46f5ba1"},
{file = "dbus_fast-1.84.0-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:747b61d1b3b5a32702ac2ba5b8544775cdb1503f6c922950d19e8aa1ddb577c1"},
{file = "dbus_fast-1.84.0-pp38-pypy38_pp73-manylinux_2_17_i686.manylinux_2_5_i686.manylinux1_i686.manylinux2014_i686.whl", hash = "sha256:7c2033552309b9929f7f109e176a1786c30b532af63ab14c32711ee39ec5a78f"},
{file = "dbus_fast-1.84.0-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:543f15d25abab42d4ebe39e7f955ea8d457f9cc8b0b8bf4a3dbe0f648aee029d"},
{file = "dbus_fast-1.84.0-pp39-pypy39_pp73-manylinux_2_17_i686.manylinux_2_5_i686.manylinux1_i686.manylinux2014_i686.whl", hash = "sha256:d7cb4a7b8a3e60f7aa1959d487c6423e4d6387762cc1f08ab2a8ad1203719c8e"},
{file = "dbus_fast-1.84.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:16d60d00ed31522e0a663845c69173d815d501b4272b8fdf685b3a376a49c20d"},
{file = "dbus_fast-1.84.0.tar.gz", hash = "sha256:d64f1b68c1c81268e846471caeb9264a9306a6c6ad356c30d5cdf7d1ecc251a1"},
{file = "dbus_fast-1.84.2-cp310-cp310-manylinux_2_17_i686.manylinux_2_5_i686.manylinux1_i686.manylinux2014_i686.whl", hash = "sha256:0e5fdb1c4841080b9087a10eed6472d485d44cbe04c4e37eb4c660c34d1e3ea2"},
{file = "dbus_fast-1.84.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:29e9c25f8e99c1d9c15372161a8a3e1cec4b46c56689aa2f7bb6378de4137873"},
{file = "dbus_fast-1.84.2-cp310-cp310-manylinux_2_31_x86_64.whl", hash = "sha256:13995e9d3503be3c4c31abeb95bc38ac6f8277f5a376f4aaefdc4a6d72aae151"},
{file = "dbus_fast-1.84.2-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:1f13eefd103c02711f76276fe2f7265ccb0cedaf943bc0a51ebd2524c031b7cb"},
{file = "dbus_fast-1.84.2-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:a9714560f1a89b1e0015d69db00796fa9c83e599f35e7d5113270a3991cec93f"},
{file = "dbus_fast-1.84.2-cp311-cp311-manylinux_2_17_i686.manylinux_2_5_i686.manylinux1_i686.manylinux2014_i686.whl", hash = "sha256:dc9d02c13a0c46762b27ffa2ecd7500e5b78ccdf91889ddd5539c6e944edb4a4"},
{file = "dbus_fast-1.84.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:65a1ffa691e4457b25eb29c5a8e8d2394927d1f3dce44d9b84952d7d5b94920f"},
{file = "dbus_fast-1.84.2-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:7fe9d9017b17e993360605541842e05bd10cf51856e39302b517c8f16da38cf1"},
{file = "dbus_fast-1.84.2-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:f7eb6c7b416e3d728e2e7232925edb2775694925c0c0d25c8d5f26a5726a6f69"},
{file = "dbus_fast-1.84.2-cp37-cp37m-manylinux_2_17_i686.manylinux_2_5_i686.manylinux1_i686.manylinux2014_i686.whl", hash = "sha256:bf4c19554a27c5cd1485c0a97afa71e352c5f0e511e4a209cbd85ed25104f828"},
{file = "dbus_fast-1.84.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:106e0fb2470169a669da5aaf38cc2442708f1e8dac67a9cf772f5d87977201ba"},
{file = "dbus_fast-1.84.2-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:c332486374f029c69810ca98c92c55ae2030a51cd1d5b3c04eb3ecee5d31e1f0"},
{file = "dbus_fast-1.84.2-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:bba1b3aa1f5f87d20982e5479567d623627241399a33d2fd4882184fa762b85b"},
{file = "dbus_fast-1.84.2-cp38-cp38-manylinux_2_17_i686.manylinux_2_5_i686.manylinux1_i686.manylinux2014_i686.whl", hash = "sha256:1a5391eefdd69ba0f09e95848f1a1ecb269cfda81404d3b3fe76952a37845c4c"},
{file = "dbus_fast-1.84.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e638af8a0176ee668eb55668817990d696a3f7b31135f1222f80ac36f6eef56a"},
{file = "dbus_fast-1.84.2-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:3e1f504db2f29cc2c3602bbb972eacfffd4307faf4d3a7e881bf9c4b13742723"},
{file = "dbus_fast-1.84.2-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:1affd246014e79d4007066f5953cc6e45f25cf990255eaab4298ec88ce07b153"},
{file = "dbus_fast-1.84.2-cp39-cp39-manylinux_2_17_i686.manylinux_2_5_i686.manylinux1_i686.manylinux2014_i686.whl", hash = "sha256:43fca5a6608de9b75f0e110e335a264ca94336b9a74ca61f1bc98e49f2eaaaee"},
{file = "dbus_fast-1.84.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2c0b9064cd1de80c6ca89fe2431a6ab34030e0d4dc1d79f8dc1f3fe5dc52483b"},
{file = "dbus_fast-1.84.2-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:9a1b4a1f30a73b24a23a261c18ddead63687e077e4c98d6ba7228d13e541fb43"},
{file = "dbus_fast-1.84.2-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:bd0ba12abc443ded3284b6a399cad6f18a1660ed5b20813510835b2363c7f585"},
{file = "dbus_fast-1.84.2-pp37-pypy37_pp73-manylinux_2_17_i686.manylinux_2_5_i686.manylinux1_i686.manylinux2014_i686.whl", hash = "sha256:0b0a9e109e1a4f8fc3ad23579b7fd5d60ade459fa82eeb26e3d70c57ca4ae658"},
{file = "dbus_fast-1.84.2-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3c31817c62d58de8ad53a6fcde92ad146a7e47c3f9e395f0c60b71305d5d3d2c"},
{file = "dbus_fast-1.84.2-pp38-pypy38_pp73-manylinux_2_17_i686.manylinux_2_5_i686.manylinux1_i686.manylinux2014_i686.whl", hash = "sha256:48068eadf1613c2263b5babe3feacc52be3fcd26823b623ba6a5ad7787e0fe52"},
{file = "dbus_fast-1.84.2-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:57280df4ddd820d513cdc9c3aa0ecd9c897686cc7b374f6d774462869ae55bb8"},
{file = "dbus_fast-1.84.2-pp39-pypy39_pp73-manylinux_2_17_i686.manylinux_2_5_i686.manylinux1_i686.manylinux2014_i686.whl", hash = "sha256:1803462a53365de05f5a6df74c74cae19d5743d60213344823baf9f50aa7ad5d"},
{file = "dbus_fast-1.84.2-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b7b16fe43bfdf049a00024ed45d119ad39f3f8bcb85066e2a7d4f06a6d074878"},
{file = "dbus_fast-1.84.2.tar.gz", hash = "sha256:62b00b85c5835bff1d7ab5b12d494e588d92612bedbd7ca86176861729b8e4bc"},
]
[package.dependencies]
@ -208,8 +208,8 @@ files = [
name = "pillow"
version = "9.4.0"
description = "Python Imaging Library (Fork)"
category = "main"
optional = false
category = "dev"
optional = true
python-versions = ">=3.7"
files = [
{file = "Pillow-9.4.0-1-cp310-cp310-macosx_10_10_x86_64.whl", hash = "sha256:1b4b4e9dda4f4e4c4e6896f93e84a8f0bcca3b059de9ddf67dac3c334b1195e1"},
@ -297,14 +297,14 @@ tests = ["check-manifest", "coverage", "defusedxml", "markdown2", "olefile", "pa
[[package]]
name = "prompt-toolkit"
version = "3.0.36"
version = "3.0.37"
description = "Library for building powerful interactive command lines in Python"
category = "main"
optional = false
python-versions = ">=3.6.2"
python-versions = ">=3.7.0"
files = [
{file = "prompt_toolkit-3.0.36-py3-none-any.whl", hash = "sha256:aa64ad242a462c5ff0363a7b9cfe696c20d55d9fc60c11fd8e632d064804d305"},
{file = "prompt_toolkit-3.0.36.tar.gz", hash = "sha256:3e163f254bef5a03b146397d7c1963bd3e2812f0964bb9a24e6ec761fd28db63"},
{file = "prompt_toolkit-3.0.37-py3-none-any.whl", hash = "sha256:6a2948ec427dfcc7c983027b1044b355db6aaa8be374f54ad2015471f7d81c5b"},
{file = "prompt_toolkit-3.0.37.tar.gz", hash = "sha256:d5d73d4b5eb1a92ba884a88962b157f49b71e06c4348b417dd622b25cdd3800b"},
]
[package.dependencies]
@ -431,8 +431,8 @@ files = [
name = "ttkthemes"
version = "3.2.2"
description = "A group of themes for the ttk extensions of Tkinter with a Tkinter.Tk wrapper"
category = "main"
optional = false
category = "dev"
optional = true
python-versions = ">=3.5"
files = [
{file = "ttkthemes-3.2.2.tar.gz", hash = "sha256:01daed001f2ff0e4f32832a0d9ea48176c0c505203b030756bdde3bd1bcb21d2"},
@ -453,7 +453,10 @@ files = [
{file = "wcwidth-0.2.6.tar.gz", hash = "sha256:a5220780a404dbe3353789870978e472cfe477761f06ee55077256e509b156d0"},
]
[extras]
themes = []
[metadata]
lock-version = "2.0"
python-versions = "^3.9"
content-hash = "3915d617df242047b6b2db3ea943479017fc52c8f1d9e37cd5fc973d601af117"
python-versions = "^3.8"
content-hash = "c7359c8eeea68b593da9a3433c6316e61f0b2e106e81b3763abaf8e68d13d954"

View file

@ -21,11 +21,15 @@ ble-serial = "^2.7.0"
prompt-toolkit = "^3.0.36"
asyncclick = "^8.1.3.4"
anyio = "^3.6.2"
ttkthemes = "^3.2.2"
[tool.poetry.scripts]
freakble = "freakble.__main__:run"
[tool.poetry.extras]
themes = ["ttkthemes"]
[tool.poetry.group.extras.dependencies]
ttkthemes = {version = "^3.2.2", optional = true}
[build-system]
requires = ["poetry-core"]

View file

@ -8,7 +8,12 @@ import tkinter as tk
from datetime import datetime
from tkinter import ttk
from ttkthemes import ThemedTk
try:
from ttkthemes import ThemedTk
ARE_THEMES_AVAILABLE = True
except ImportError:
ARE_THEMES_AVAILABLE = False
from .ble import BLE_interface
from .ble import connect as ble_connect
@ -25,11 +30,20 @@ class App:
self.loop = asyncio.get_event_loop()
async def run(self):
self.window = MainWindow(self, theme="breeze")
if ARE_THEMES_AVAILABLE:
self.window = MainWindow(self, theme="breeze")
else:
self.window = MainWindow(self)
await self.window.show()
class MainWindow(ThemedTk):
if ARE_THEMES_AVAILABLE:
BaseWindow = type("BaseWindow", (ThemedTk,), {})
else:
BaseWindow = type("BaseWindow", (tk.Tk,), {})
class MainWindow(BaseWindow):
def __init__(self, app, *args, **kwargs) -> None:
super().__init__(*args, **kwargs)
self.title("freakble")