Skip to content

Commit e274c41

Browse files
committed
Update to GTK4
1 parent 3263c96 commit e274c41

13 files changed

Lines changed: 296 additions & 89 deletions

File tree

biglinux-livecd/usr/share/biglinux/livecd/application.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@
44
gi.require_version("Adw", "1")
55
from gi.repository import Adw, Gio, Gtk, Gdk
66
from ui.app_window import AppWindow
7+
from logging_config import get_logger
78
import os
89

10+
logger = get_logger()
11+
912

1013
class Application(Adw.Application):
1114
def __init__(self, system_service, **kwargs):
@@ -28,7 +31,7 @@ def do_startup(self):
2831
if os.path.isdir(flags_dir):
2932
icon_theme.add_search_path(flags_dir)
3033
else:
31-
print(f"Warning: System flag icon directory not found at {flags_dir}")
34+
logger.warning(f"System flag icon directory not found at {flags_dir}")
3235

3336
style_manager = Adw.StyleManager.get_default()
3437
style_manager.set_color_scheme(Adw.ColorScheme.FORCE_DARK)
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
"""
2+
Centralized logging configuration for BigLinux LiveCD.
3+
"""
4+
5+
import logging
6+
import sys
7+
8+
# Create logger
9+
logger = logging.getLogger("biglinux-livecd")
10+
11+
def setup_logging(level: int = logging.INFO) -> logging.Logger:
12+
"""
13+
Configure the application logger.
14+
15+
Args:
16+
level: Logging level (default: INFO)
17+
18+
Returns:
19+
Configured logger instance
20+
"""
21+
logger.setLevel(level)
22+
23+
# Avoid duplicate handlers if called multiple times
24+
if logger.handlers:
25+
return logger
26+
27+
# Console handler
28+
console_handler = logging.StreamHandler(sys.stdout)
29+
console_handler.setLevel(level)
30+
31+
# Format: timestamp - level - message
32+
formatter = logging.Formatter(
33+
fmt="%(asctime)s - %(levelname)s - %(message)s",
34+
datefmt="%Y-%m-%d %H:%M:%S"
35+
)
36+
console_handler.setFormatter(formatter)
37+
38+
logger.addHandler(console_handler)
39+
40+
return logger
41+
42+
43+
def get_logger() -> logging.Logger:
44+
"""
45+
Get the application logger instance.
46+
47+
Returns:
48+
Logger instance
49+
"""
50+
return logger

biglinux-livecd/usr/share/biglinux/livecd/main.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import sys
22
import argparse
3+
import logging
4+
from logging_config import setup_logging
35
from application import Application
46
from services import SystemService
57

@@ -11,8 +13,17 @@ def main():
1113
action="store_true",
1214
help="Run in test mode without applying any system changes.",
1315
)
16+
parser.add_argument(
17+
"--debug",
18+
action="store_true",
19+
help="Enable debug logging.",
20+
)
1421
args, remaining_argv = parser.parse_known_args()
1522

23+
# Setup logging
24+
log_level = logging.DEBUG if args.debug else logging.INFO
25+
setup_logging(level=log_level)
26+
1627
# Initialize the service layer with the test mode state
1728
system_service = SystemService(test_mode=args.test_mode)
1829

biglinux-livecd/usr/share/biglinux/livecd/script/icc_disable.sh

Lines changed: 0 additions & 16 deletions
This file was deleted.

biglinux-livecd/usr/share/biglinux/livecd/script/icc_enable.sh

Lines changed: 0 additions & 16 deletions
This file was deleted.
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#!/bin/bash
2+
#
3+
# ICC Profile Configuration Script
4+
# Enables or disables ICC color profile in KWin output configuration
5+
#
6+
# Usage: icc_profile.sh enable|disable
7+
#
8+
# Requires: jaq (JSON processor)
9+
#
10+
11+
CONFIG_FILE="$HOME/.config/kwinoutputconfig.json"
12+
ICC_PROFILE_PATH="/usr/share/color/icc/colord/ECI-RGBv1.icc"
13+
14+
show_usage() {
15+
echo "Usage: $0 enable|disable"
16+
echo " enable - Set colorProfileSource to ICC (use color profile)"
17+
echo " disable - Set colorProfileSource to sRGB (standard RGB)"
18+
exit 1
19+
}
20+
21+
# Check for jaq
22+
if ! command -v jaq &> /dev/null; then
23+
echo "Error: jaq is required but not installed"
24+
exit 1
25+
fi
26+
27+
# Check if config file exists
28+
if [ ! -f "$CONFIG_FILE" ]; then
29+
echo "Error: KWin output config not found at $CONFIG_FILE"
30+
exit 1
31+
fi
32+
33+
# Parse argument
34+
case "$1" in
35+
enable)
36+
COLOR_SOURCE="ICC"
37+
;;
38+
disable)
39+
COLOR_SOURCE="sRGB"
40+
;;
41+
*)
42+
show_usage
43+
;;
44+
esac
45+
46+
# Apply configuration
47+
jaq -i "map(
48+
if .data then
49+
.data |= map(
50+
if has(\"edidHash\") then
51+
.iccProfilePath = \"$ICC_PROFILE_PATH\"
52+
| .colorProfileSource = \"$COLOR_SOURCE\"
53+
else
54+
.
55+
end
56+
)
57+
else
58+
.
59+
end
60+
)" "$CONFIG_FILE"
61+
62+
echo "ICC profile $1d successfully"

0 commit comments

Comments
 (0)