♻️ refactor(ui): improve panel and launcher functionality and appearance
This commit is contained in:
14 files changed
+164
-607
No files matched your search
@@ -1,14 +1,13 @@
|
||||
from fabric.bluetooth import BluetoothClient
|
||||
from fabric.widgets.box import Box
|
||||
from fabric.widgets.button import Button
|
||||
from fabric.widgets.label import Label
|
||||
from fabric.utils import get_relative_path
|
||||
from fabric.widgets.svg import Svg
|
||||
from gi.repository import GLib
|
||||
|
||||
import utils.icons as icons
|
||||
from services.network import NetworkClient
|
||||
from gi.repository import GLib
|
||||
from fabric.bluetooth import BluetoothClient
|
||||
from fabric.utils import get_relative_path
|
||||
from fabric.widgets.box import Box
|
||||
from fabric.widgets.button import Button
|
||||
from fabric.widgets.svg import Svg
|
||||
from services.battery import Battery as BatteryService
|
||||
from services.network import NetworkClient
|
||||
|
||||
|
||||
class WifiIndicator(Button):
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
import subprocess
|
||||
import time
|
||||
|
||||
from gi.repository import GLib
|
||||
|
||||
from fabric.utils import get_relative_path
|
||||
from fabric.widgets.box import Box
|
||||
from fabric.widgets.button import Button
|
||||
from fabric.widgets.label import Label
|
||||
import time
|
||||
import subprocess
|
||||
from fabric.widgets.box import Box
|
||||
from gi.repository import GLib
|
||||
from fabric.utils import get_relative_path
|
||||
from fabric.widgets.svg import Svg
|
||||
|
||||
|
||||
@@ -20,12 +22,18 @@ class RecordingIndicator(Button):
|
||||
size=24,
|
||||
svg_file=get_relative_path("../../../config/assets/icons/media-record.svg"),
|
||||
)
|
||||
self.time_label = Label(name="recording-time-label", markup="00:00")
|
||||
self.time_label = Label(
|
||||
name="recording-time-label",
|
||||
markup="00:00",
|
||||
max_width_chars=5,
|
||||
ellipsize="none"
|
||||
)
|
||||
|
||||
self.recording_box = Box(
|
||||
orientation="h",
|
||||
spacing=2,
|
||||
children=self.recording_icon,
|
||||
children=[self.recording_icon, self.time_label],
|
||||
size=(80, -1),
|
||||
)
|
||||
|
||||
self.add(self.recording_box)
|
||||
@@ -75,3 +83,25 @@ class RecordingIndicator(Button):
|
||||
self.recording_start_time = None
|
||||
|
||||
return True # Continue the timeout
|
||||
|
||||
def get_recording_start_time(self):
|
||||
"""Get the recording start time from the file"""
|
||||
try:
|
||||
with open("/tmp/recording_start_time.txt", "r") as f:
|
||||
return float(f.read().strip())
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
def on_stop_recording(self, *args):
|
||||
try:
|
||||
subprocess.Popen([self.script_path, "record", "stop"])
|
||||
except Exception as e:
|
||||
print(f"Error stopping recording: {e}")
|
||||
|
||||
def _delayed_init(self):
|
||||
try:
|
||||
self.check_recording_status()
|
||||
self.timeout_id = GLib.timeout_add(5000, self.check_recording_status)
|
||||
except Exception as e:
|
||||
print(f"[DEBUG] Error in delayed recording indicator init: {e}")
|
||||
return False # Don't repeat this timeout
|
||||
@@ -9,11 +9,10 @@ from fabric.widgets.revealer import Revealer
|
||||
from fabric.widgets.svg import Svg
|
||||
from utils.wayland import WaylandWindow as Window
|
||||
|
||||
from modules.panel.components.enhanced_system_tray import (
|
||||
apply_enhanced_system_tray,
|
||||
) # ignore
|
||||
from modules.panel.components.enhanced_system_tray import apply_enhanced_system_tray
|
||||
from modules.panel.components.indicators import Indicators
|
||||
from modules.panel.components.menubar import MenuBar
|
||||
from modules.panel.components.recording_indicator import RecordingIndicator
|
||||
|
||||
# Apply enhanced system tray icon handling
|
||||
apply_enhanced_system_tray()
|
||||
@@ -89,6 +88,7 @@ class Panel(Window):
|
||||
),
|
||||
),
|
||||
)
|
||||
self.recording_indicator = RecordingIndicator()
|
||||
|
||||
self.children = CenterBox(
|
||||
name="panel",
|
||||
@@ -108,6 +108,7 @@ class Panel(Window):
|
||||
spacing=4,
|
||||
orientation="h",
|
||||
children=[
|
||||
self.recording_indicator,
|
||||
self.tray_revealer,
|
||||
self.chevron_button,
|
||||
self.indicators,
|
||||
|
||||
Reference in new issue
Block a user