Improve Statistics widget height, improve SaveDialog widget width
This commit is contained in:
parent
cff5f864e4
commit
f9ee150a23
3 changed files with 21 additions and 2 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue