-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.py
More file actions
55 lines (44 loc) · 1.52 KB
/
config.py
File metadata and controls
55 lines (44 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import os
import sys
# Get the directory containing this script, compatible with both script and exe
def get_base_dir():
if getattr(sys, 'frozen', False):
# Running in a PyInstaller bundle
return os.path.dirname(sys.executable)
else:
# Running in a normal Python environment
return os.path.dirname(os.path.abspath(__file__))
BASE_DIR = get_base_dir()
# Path configurations
START_TIME_FILE = os.path.join(BASE_DIR, "start_time.txt")
LOG_FILE = os.path.join(BASE_DIR, "app.log")
ICON_FILE = os.path.join(BASE_DIR, "images", "icon.png")
# Image configurations
DEFAULT_TIMER_IMAGE = os.path.join(BASE_DIR, "images", "timer1.png")
IMAGE_DIRECTORY = os.path.join(BASE_DIR, "images", "timers")
# Create directories if they don't exist
os.makedirs(os.path.dirname(DEFAULT_TIMER_IMAGE), exist_ok=True)
os.makedirs(IMAGE_DIRECTORY, exist_ok=True)
# Window settings
WINDOW_POSITION_X = 1650
WINDOW_POSITION_Y = 30
WINDOW_SIZE_WIDTH = 200
WINDOW_SIZE_HEIGHT = 200
# Dialog settings
DIALOG_POSITION_X = 700
DIALOG_POSITION_Y = 500
DIALOG_SIZE_WIDTH = 750
DIALOG_SIZE_HEIGHT = 550
# Dialog settings for job record and checkin
JOB_DIALOG_SIZE_WIDTH = 900
JOB_DIALOG_SIZE_HEIGHT = 700
# Application settings
FLEXIBLE_MODE_FILE = os.path.join(BASE_DIR, "flexible_mode.txt")
# Read flexible mode from file
def read_flexible_mode():
try:
with open(FLEXIBLE_MODE_FILE, "r") as f:
return f.read().strip().lower() == "true"
except FileNotFoundError:
return False
isFLEXIBLE = read_flexible_mode()