Improve Statistics widget height, improve SaveDialog widget width

This commit is contained in:
Miguel Jacq 2025-11-21 08:18:44 +11:00
parent cff5f864e4
commit f9ee150a23
Signed by: mig5
GPG key ID: 59B3F0C24135C6A9
3 changed files with 21 additions and 2 deletions

View file

@ -1,3 +1,8 @@
# 0.4.2
* Improve Statistics widget height
* Improve SaveDialog widget width
# 0.4.1
* Allow time log entries to be edited directly in their table cells

View file

@ -2,6 +2,8 @@ from __future__ import annotations
import datetime
from PySide6.QtGui import QFontMetrics
from PySide6.QtCore import QSize
from PySide6.QtWidgets import (
QDialog,
QVBoxLayout,
@ -22,13 +24,24 @@ class SaveDialog(QDialog):
Used for explicitly saving a new version of a page.
"""
super().__init__(parent)
self.setWindowTitle(strings._("enter_a_name_for_this_version"))
v = QVBoxLayout(self)
v.addWidget(QLabel(strings._("enter_a_name_for_this_version")))
self.note = QLineEdit()
now = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
self.note.setText(strings._("new_version_i_saved_at") + f" {now}")
text = strings._("new_version_i_saved_at") + f" {now}"
self.note.setText(text)
v.addWidget(self.note)
# make dialog wide enough for the line edit text
fm = QFontMetrics(self.note.font())
text_width = fm.horizontalAdvance(text) + 20
self.note.setMinimumWidth(text_width)
self.adjustSize()
bb = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
bb.accepted.connect(self.accept)
bb.rejected.connect(self.reject)

View file

@ -98,7 +98,7 @@ class DateHeatmap(QWidget):
def minimumSizeHint(self) -> QSize:
sz = self.sizeHint()
return QSize(min(300, sz.width()), sz.height())
return QSize(min(350, sz.width()), sz.height())
def paintEvent(self, event):
super().paintEvent(event)
@ -249,6 +249,7 @@ class StatisticsDialog(QDialog):
self.setWindowTitle(strings._("statistics"))
self.setMinimumWidth(600)
self.setMinimumHeight(350)
root = QVBoxLayout(self)
(