Skip to content

Commit 56e4851

Browse files
POS-terminal: Switch to FreeSimpleGUI and fixes.
1 parent 727e817 commit 56e4851

File tree

3 files changed

+21
-10
lines changed

3 files changed

+21
-10
lines changed

django/credit_accounting/pos-terminal/depot8/depotpos.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@
1212
from datetime import datetime
1313
from signal import SIGINT, signal
1414

15-
import PySimpleGUI as sg
15+
import FreeSimpleGUI as sg
1616
import requests
1717
import settings
18-
from depot8_migration import import_accounts
1918

2019
PRODUCTION = False
2120

@@ -88,7 +87,7 @@ def ensure_unique_instance(self):
8887
fcntl.lockf(self.lock_file_pointer, fcntl.LOCK_EX | fcntl.LOCK_NB)
8988
except OSError:
9089
sg.theme("DarkBlue13")
91-
font = ("Helvetia", 20)
90+
font = ("Helvetica", 20)
9291
layout = [
9392
[
9493
sg.Text(
@@ -133,9 +132,12 @@ def admin_notify(self, text):
133132
msg["From"] = "admin@warmbaechli.ch"
134133
msg["To"] = "admin@warmbaechli.ch"
135134
msg["Date"] = email.utils.formatdate(localtime=True)
136-
s = smtplib.SMTP("mail.websource.ch")
137-
s.send_message(msg)
138-
s.quit()
135+
try:
136+
s = smtplib.SMTP(settings.POS_SETTINGS[SETTINGS_KEY]["SMTP_SERVER"])
137+
s.send_message(msg)
138+
s.quit()
139+
except Exception as e:
140+
logging.error(f"Could not send notification email: {e}. Please check SMTP settings.")
139141

140142
def sync_remote_data(self):
141143
logging.info("Sync with remote database.")
@@ -303,6 +305,8 @@ def create_account(self, name, pin, transactions=None):
303305
return None
304306

305307
def migrate_data(self):
308+
from depot8_migration import import_accounts
309+
306310
for account in import_accounts():
307311
import_transactions = []
308312
for deposit in account.deposits:
@@ -344,7 +348,7 @@ def migrate_data(self):
344348

345349
def init_ui(self):
346350
sg.theme("DarkBlue13")
347-
font = ("Helvetia", 20)
351+
font = ("Helvetica", 20)
348352

349353
col1 = [
350354
[sg.Text("Wohnungsnummer/PIN", font=font)],

django/credit_accounting/pos-terminal/depot8/settings_example.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
POS_SETTINGS = {
22
"PRODUCTION": {
33
"API_SECRET": "<SECRET>",
4-
"API_BASE_URL": "https://www.example.com/api/v1",
4+
"API_BASE_URL": "https://www.example.tld/api/v1",
5+
"SMTP_SERVER": "mail.example.tld",
56
"CACHEFILE": "/home/depot8/depot8.json",
67
"LOGFILE": "/home/depot8/depot8.log",
78
},
89
"TEST": {
910
"API_SECRET": "<SECRET>",
10-
"API_BASE_URL": "https://test.example.com/api/v1",
11+
"API_BASE_URL": "https://test.example.tld/api/v1",
12+
"SMTP_SERVER": "mail.example.tld",
1113
"CACHEFILE": "/tmp/depot8.json",
1214
"LOGFILE": "/tmp/depot8.log",
1315
},
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1-
PySimpleGUI==4.60.5
1+
certifi==2025.11.12
2+
charset-normalizer==3.4.4
3+
FreeSimpleGUI==5.2.0.post1
4+
idna==3.11
5+
requests==2.32.5
6+
urllib3==2.6.2

0 commit comments

Comments
 (0)