fix load file sequence

This commit is contained in:
buenosairesam
2025-10-10 20:17:17 -03:00
parent 71752c7d76
commit a854f6c21d
3 changed files with 15 additions and 10 deletions

2
.gitignore vendored
View File

@@ -5,3 +5,5 @@ dm.out
dm.err dm.err
sample_task_file sample_task_file
dmfnt dmfnt
def
config.json

View File

@@ -1,9 +1,9 @@
{ {
"work_desktop_tasks": { "work_desktop_tasks": {
"2": null, "2": "686a7bd2",
"5": null, "5": "ac6b4a54",
"6": null, "6": "ba63b454",
"7": null "7": "ffbe198e"
}, },
"timezone": "America/Argentina/Buenos_Aires", "timezone": "America/Argentina/Buenos_Aires",
"task_file": "/home/mariano/LETRAS/adm/task/main" "task_file": "/home/mariano/LETRAS/adm/task/main"

View File

@@ -40,7 +40,7 @@ def now():
def handle_task_file_changes(current_task): def handle_task_file_changes(current_task):
"""Check if task file changed and update task if needed""" """Check if task file changed and update task if needed. Returns (new_task, file_changed)"""
current_mtime = state.retrieve("current").get("filetime") current_mtime = state.retrieve("current").get("filetime")
file_mtime = task.get_file_mtime(None) file_mtime = task.get_file_mtime(None)
@@ -52,7 +52,9 @@ def handle_task_file_changes(current_task):
state.save("current", task=task_id) state.save("current", task=task_id)
current_task = task_id current_task = task_id
return current_task return current_task, True # File changed
return current_task, False # No change
def update_workspace_state(): def update_workspace_state():
@@ -120,7 +122,7 @@ def desktop(workspace_index):
task.read_and_extract(None) task.read_and_extract(None)
task.file_to_db(None)
current_workspace = active_workspace() current_workspace = active_workspace()
current_task = state.retrieve("current").get("task") current_task = state.retrieve("current").get("task")
@@ -143,14 +145,15 @@ while True:
work_desktop_tasks = state.retrieve_desktop_state() work_desktop_tasks = state.retrieve_desktop_state()
# Handle task file changes # Handle task file changes
current_task = handle_task_file_changes(current_task) current_task, file_changed = handle_task_file_changes(current_task)
# Update current task and workspace # Update current task and workspace
current_task = state.retrieve("current").get("task") current_task = state.retrieve("current").get("task")
current_workspace = update_workspace_state() current_workspace = update_workspace_state()
# Enforce desktop task assignments # Enforce desktop task assignments (but skip if file just changed - user's manual change takes priority)
current_task = enforce_desktop_task(current_workspace, work_desktop_tasks, current_task) if not file_changed:
current_task = enforce_desktop_task(current_workspace, work_desktop_tasks, current_task)
# Track workspace switches # Track workspace switches
last_switch_time = track_workspace_switch(current_workspace, current_task, last_switch_time) last_switch_time = track_workspace_switch(current_workspace, current_task, last_switch_time)