Use GUI locale date formats on GUI and dialogs

This commit is contained in:
Veronica Berglyd Olsen
2024-03-12 22:01:54 +01:00
parent dc2c6d2a0d
commit 7d9040005e
5 changed files with 6 additions and 6 deletions
+1 -1
View File
@@ -57,7 +57,7 @@ class VersionInfoWidget(QWidget):
# Labels
self._lblInfo = QLabel("{0} {1} \u2013 {2} {3} \u2013 {4}".format(
self.tr("Version"), formatVersion(__version__),
self.tr("Released on"), datetime.strptime(__date__, "%Y-%m-%d").strftime("%x"),
self.tr("Released on"), CONFIG.localDate(datetime.strptime(__date__, "%Y-%m-%d")),
"<a href='#notes'>{0}</a>".format(self.tr("Release Notes")),
), self)
self._lblInfo.linkActivated.connect(self._processLink)
+1 -1
View File
@@ -457,7 +457,7 @@ class GuiMain(QMainWindow):
"'{0}' ({1} {2}), last active on {3}."
).format(
lockStatus[0], lockStatus[1], lockStatus[2],
datetime.fromtimestamp(int(lockStatus[3])).strftime("%x %X")
CONFIG.localDateTime(datetime.fromtimestamp(int(lockStatus[3])))
)
except Exception:
lockDetails = ""
+1 -1
View File
@@ -829,7 +829,7 @@ class _PreviewWidget(QTextBrowser):
"""Update the build time and the fuzzy age."""
if self._docTime > 0:
strBuildTime = "%s (%s)" % (
datetime.fromtimestamp(self._docTime).strftime("%x %X"),
CONFIG.localDateTime(datetime.fromtimestamp(self._docTime)),
fuzzyTime(int(time()) - self._docTime)
)
else:
+1 -1
View File
@@ -456,7 +456,7 @@ class _ProjectListModel(QAbstractListModel):
opened = self.tr("Last Opened")
records = sorted(CONFIG.recentProjects.listEntries(), key=lambda x: x[3], reverse=True)
for path, title, count, time in records:
when = datetime.fromtimestamp(time).strftime("%x")
when = CONFIG.localDate(datetime.fromtimestamp(time))
data.append((title, path, f"{opened}: {when}, {words}: {formatInt(count)}"))
self._data = data
return
+2 -2
View File
@@ -75,8 +75,8 @@ def testToolWelcome_Open(qtbot: QtBot, monkeypatch, nwGUI, fncPath):
CONFIG.recentProjects.update("/stuff/project_one", "Project One", 12345, 1690000000)
CONFIG.recentProjects.update("/stuff/project_two", "Project Two", 54321, 1700000000)
dateOne = datetime.fromtimestamp(1700000000).strftime("%x")
dateTwo = datetime.fromtimestamp(1690000000).strftime("%x")
dateOne = CONFIG.localDate(datetime.fromtimestamp(1700000000))
dateTwo = CONFIG.localDate(datetime.fromtimestamp(1690000000))
welcome = GuiWelcome(nwGUI)
with qtbot.waitExposed(welcome):