Skip to content

Commit 1184032

Browse files
Merge pull request #18 from Retro-I/boost-startup
Boost startup
2 parents 82756cd + 5713644 commit 1184032

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

.flake8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[flake8]
22
exclude = .venv build
33
max-line-length = 120
4-
per-file-ignores = */main.py: F401
4+
per-file-ignores = */Theme.py: F401

helper/BluetoothHelper.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
class BluetoothHelper:
1212
discovery_on = False
1313

14-
def __init__(self):
15-
self.turn_on()
14+
def on_startup(self):
1615
self.bluetooth_discovery_off()
1716
self.turn_off()
1817

@@ -32,7 +31,7 @@ def turn_on(self):
3231
os.system("rfkill unblock 0")
3332

3433
def turn_off(self):
35-
os.system("rfkill block 0")
34+
subprocess.run(["rfkill", "block", "0"], stdout=subprocess.DEVNULL)
3635

3736
def is_bluetooth_on(self):
3837
status = subprocess.run(["hciconfig"], stdout=subprocess.PIPE).stdout.decode("utf-8")

main.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,11 @@
3434

3535

3636
def main(page: ft.Page):
37+
start = time.time()
3738
PageState.page = page
3839

40+
bluetooth_helper.on_startup()
41+
3942
strip = Strip()
4043
taskbar = Taskbar()
4144
theme = Theme(taskbar, strip.run_color)
@@ -68,6 +71,9 @@ def main(page: ft.Page):
6871
audio_effects.start()
6972
audio_helper.startup_sound()
7073

74+
end = time.time()
75+
print(f"Startup took: {end-start}")
76+
7177
def background_processes():
7278
while True:
7379
taskbar.update()

0 commit comments

Comments
 (0)