Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/logic/storage/sqlite_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def _configure_logging(data_directory: Path) -> None:
LOGGER.exception("Unable to configure the SchedPlus storage log")
return

handler._schedplus_storage = True
handler.__dict__["_schedplus_storage"] = True
handler.setFormatter(
logging.Formatter("%(asctime)s %(levelname)s %(name)s: %(message)s")
)
Expand Down
5 changes: 3 additions & 2 deletions src/startup/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,12 @@ def _boot(forced_mode: StartupMode | None = None):
from .selector import StartupSelector

selector = StartupSelector()
mode = selector.show()
selected_mode = selector.show()

if mode is None:
if selected_mode is None:
print("Startup cancelled.")
return 0
mode = selected_mode

# 4. Route to correct UI
return _launch_mode(mode, arguments)
Expand Down
4 changes: 4 additions & 0 deletions src/startup/selector.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@
Bypass this with direct commands see modes.py
"""

from typing import Any

from schedplus.identity import get_application_identity

from .modes import StartupMode

tk: Any
ttk: Any
try:
import tkinter as tk
from tkinter import ttk
Expand Down
21 changes: 14 additions & 7 deletions src/ui/pyqt/calendar_view.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Native month, week, and day scheduling workspace."""

from collections import Counter, defaultdict
from datetime import time
from datetime import date, time

from PyQt6.QtCore import QDate, QPoint, Qt, QTime, pyqtSignal
from PyQt6.QtGui import QColor, QPainter
Expand Down Expand Up @@ -40,10 +40,17 @@ def set_tasks(self, tasks):
self.task_counts = Counter(task.date for task in tasks)
self.updateCells()

def paintCell(self, painter: QPainter, rect, calendar_date: QDate):
def paintCell(
self, painter: QPainter | None, rect, calendar_date: QDate | date
) -> None:
super().paintCell(painter, rect, calendar_date)
count = self.task_counts.get(calendar_date.toString("yyyy-MM-dd"), 0)
if not count:
date_key = (
calendar_date.toString("yyyy-MM-dd")
if isinstance(calendar_date, QDate)
else calendar_date.isoformat()
)
count = self.task_counts.get(date_key, 0)
if not count or painter is None:
return
painter.save()
painter.setPen(Qt.PenStyle.NoPen)
Expand Down Expand Up @@ -88,9 +95,9 @@ def configure(self, dates: list[str], times: list[str]):
]
)
self.setVerticalHeaderLabels(times)
self.horizontalHeader().setSectionResizeMode(
self.horizontalHeader().ResizeMode.Stretch
)
header = self.horizontalHeader()
if header is not None:
header.setSectionResizeMode(header.ResizeMode.Stretch)
for row in range(len(times)):
self.setRowHeight(row, 38)

Expand Down
4 changes: 2 additions & 2 deletions src/ui/pyqt/settings_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,10 +301,10 @@ def _build_data_tab(self) -> QWidget:
info_layout.addRow("Platform:", QLabel(platform.platform()))
info_layout.addRow("Python:", QLabel(platform.python_version()))
if self._scheduler is not None:
task_count = len(self._scheduler.get_tasks())
task_count = str(len(self._scheduler.get_tasks()))
else:
task_count = "—"
info_layout.addRow("Tasks:", QLabel(str(task_count)))
info_layout.addRow("Tasks:", QLabel(task_count))
layout.addWidget(info_group)

layout.addStretch()
Expand Down
19 changes: 13 additions & 6 deletions src/ui/pyqt/task_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,14 +189,19 @@ def __init__(self, scheduler, preferences: UiPreferences, parent=None):
self.table.setEditTriggers(QAbstractItemView.EditTrigger.NoEditTriggers)
self.table.setAlternatingRowColors(True)
self.table.setSortingEnabled(False)
self.table.verticalHeader().hide()
self.table.horizontalHeader().setStretchLastSection(False)
vertical_header = self.table.verticalHeader()
if vertical_header is not None:
vertical_header.hide()
horizontal_header = self.table.horizontalHeader()
if horizontal_header is not None:
horizontal_header.setStretchLastSection(False)
self.table.setColumnWidth(0, 120)
self.table.setColumnWidth(1, 90)
self.table.setColumnWidth(2, 460)
self.table.horizontalHeader().setSectionResizeMode(
2, self.table.horizontalHeader().ResizeMode.Stretch
)
if horizontal_header is not None:
horizontal_header.setSectionResizeMode(
2, horizontal_header.ResizeMode.Stretch
)
self.table.doubleClicked.connect(self._emit_edit)
self.table.setAccessibleName("Task list")
layout.addWidget(self.table, 1)
Expand Down Expand Up @@ -229,7 +234,9 @@ def __init__(self, scheduler, preferences: UiPreferences, parent=None):
self.edit_button.clicked.connect(self._emit_edit)
self.complete_button.clicked.connect(self._emit_complete)
self.delete_button.clicked.connect(self._emit_delete)
self.table.selectionModel().selectionChanged.connect(self._update_actions)
selection_model = self.table.selectionModel()
if selection_model is not None:
selection_model.selectionChanged.connect(self._update_actions)

self.apply_preferences(preferences)
self.refresh()
Expand Down
2 changes: 1 addition & 1 deletion src/ui/tkinter_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from pathlib import Path
from tkinter import filedialog, messagebox, ttk

from tkcalendar import Calendar
from tkcalendar import Calendar # type: ignore[import-untyped]

from logic import local_time
from logic.data_transfer import (
Expand Down