Skip to content

Commit

Permalink
Show last update in title bar (#520)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bouni authored Aug 8, 2024
1 parent 684a018 commit 3bc706c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
8 changes: 8 additions & 0 deletions library.py
Original file line number Diff line number Diff line change
Expand Up @@ -631,3 +631,11 @@ def migrate_mappings(self):
self.logger.debug("Droped mappings table from parts database.")
except sqlite3.OperationalError:
return

def get_last_update(self) -> str:
"""Get last update from meta table."""
with contextlib.closing(sqlite3.connect(self.partsdb_file)) as con, con as cur:
last_update = cur.execute("SELECT last_update FROM meta").fetchone()
if last_update:
return last_update[0]
return ""
5 changes: 5 additions & 0 deletions mainwindow.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Contains the main window of the plugin."""

from datetime import datetime as dt
import json
import logging
import os
Expand Down Expand Up @@ -496,6 +497,10 @@ def quit_dialog(self, *_):
def init_library(self):
"""Initialize the parts library."""
self.library = Library(self)
last_update = self.library.get_last_update()
if last_update:
last_update = dt.fromisoformat(last_update).strftime("%Y-%m-%d %H:%M")
self.SetTitle(f"JLCPCB Tools [ {getVersion()} ] | Last database update: {last_update}",)

def init_store(self):
"""Initialize the store of part assignments."""
Expand Down

0 comments on commit 3bc706c

Please sign in to comment.