Compare commits
4 Commits
f993220ad6
...
beta-0.2.1
| Author | SHA1 | Date | |
|---|---|---|---|
| 3299584924 | |||
| 0869bb96f8 | |||
| 89a86ca271 | |||
| 6410853d3c |
@@ -1,4 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
if [ "$VIRTUAL_ENV" == "" ]
|
||||
then
|
||||
source venv/bin/activate
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
Package: brovski-adressetiketten
|
||||
Version: 0.2.0b
|
||||
Version: 0.2.1b
|
||||
Maintainer: Ovski
|
||||
Architecture: all
|
||||
Description: manage csv files for glables address labels
|
||||
|
||||
@@ -20,7 +20,7 @@ class Application:
|
||||
y_offset = 200
|
||||
width = 1050
|
||||
height = 700
|
||||
VERSION = '0.2.0b'
|
||||
VERSION = '0.2.1b'
|
||||
title = f"Brovski Adress-Etiketten Verwaltung {VERSION}"
|
||||
|
||||
self.root = tk.Tk(className="BrovskiAdressEtiketten")
|
||||
@@ -263,10 +263,8 @@ class Application:
|
||||
writer.writerow(line)
|
||||
# todo: add "absender" to config parameters
|
||||
line = []
|
||||
line.append("Absender:")
|
||||
line.append("Matthias Braun")
|
||||
line.append("Wolfacherweg 1")
|
||||
line.append("5724 Dürrenäsch")
|
||||
for idx in range(4):
|
||||
line.append(self.config.get("absender", f"{idx}"))
|
||||
writer.writerow(line)
|
||||
except FileNotFoundError:
|
||||
show_error(message_title="Unexpected error",
|
||||
|
||||
@@ -93,18 +93,23 @@ class EditRecord(Window):
|
||||
class SettingsWindow(Window):
|
||||
def __init__(self, parent, root: tk.Tk, config: Config):
|
||||
super().__init__(parent, root)
|
||||
self.geometry(f"500x330+{self.root.winfo_x() + 20}+{self.root.winfo_y() + 20}")
|
||||
width = 500
|
||||
height = 630
|
||||
self.geometry(f"{width}x{height}+{self.root.winfo_x() + 20}+{self.root.winfo_y() + 20}")
|
||||
self.config = config
|
||||
self.json_file = tk.StringVar()
|
||||
self.csv_file = tk.StringVar()
|
||||
self.absender_line = [tk.StringVar() for idx in range(4)]
|
||||
|
||||
title = font.Font(family='Ubuntu Mono', size=20, weight=font.BOLD)
|
||||
tk.Label(self, text="Einstellungen", font=title).pack(pady=20)
|
||||
|
||||
path_frame = tk.Frame(self)
|
||||
path_frame.pack(pady=(10, 40))
|
||||
|
||||
tk.Label(path_frame, text="Datenpfad JSON Datei").grid(row=0, column=0)
|
||||
tk.Label(self, text="Datenpfad JSON Datei").pack()
|
||||
|
||||
path_frame = tk.Frame(self)
|
||||
path_frame.pack(pady=(10, 10))
|
||||
|
||||
tk.Entry(path_frame, textvariable=self.json_file, width=50).grid(row=1, column=0)
|
||||
tk.Button(path_frame, text="Pfad", command=lambda: self.set_json_path(self.json_file.get())).grid(row=1,
|
||||
column=1)
|
||||
@@ -113,6 +118,13 @@ class SettingsWindow(Window):
|
||||
tk.Entry(path_frame, textvariable=self.csv_file, width=50).grid(row=3, column=0)
|
||||
tk.Button(path_frame, text="Pfad", command=lambda: self.set_csv_path(self.csv_file.get())).grid(row=3, column=1)
|
||||
|
||||
absender_frame = tk.Frame(self)
|
||||
absender_frame.pack(pady=(10, 40))
|
||||
|
||||
tk.Label(absender_frame, text="Absender").pack(side=tk.TOP)
|
||||
for idx in range(4):
|
||||
tk.Entry(absender_frame, textvariable=self.absender_line[idx], width=50).pack(side=tk.TOP)
|
||||
|
||||
bottom_frame = tk.Frame(self)
|
||||
bottom_frame.pack()
|
||||
tk.Button(bottom_frame, text="Ok", command=self.ok).pack(side=tk.LEFT)
|
||||
@@ -149,6 +161,15 @@ class SettingsWindow(Window):
|
||||
except NoOptionError:
|
||||
self.config.set("csv", "path", "")
|
||||
|
||||
for idx in range(4):
|
||||
try:
|
||||
self.absender_line[idx].set(self.config.get(f"absender", f"{idx}"))
|
||||
except NoSectionError:
|
||||
self.config.add_section(f"line")
|
||||
self.config.set("line", f"{idx}", "")
|
||||
except NoOptionError:
|
||||
self.config.set("line", f"{idx}", "")
|
||||
|
||||
def ok(self):
|
||||
if self.json_file.get() == "" or self.csv_file.get() == "":
|
||||
show_error(message_title="Fehlerhafte Konfiguration",
|
||||
@@ -157,6 +178,8 @@ class SettingsWindow(Window):
|
||||
return
|
||||
self.config.set("json", "path", self.json_file.get())
|
||||
self.config.set("csv", "path", self.csv_file.get())
|
||||
for i in range(4):
|
||||
self.config.set("absender", f"{i}", f"{self.absender_line[i].get()}")
|
||||
self.close_window()
|
||||
|
||||
def cancel(self):
|
||||
|
||||
@@ -1 +1 @@
|
||||
0.2.0b
|
||||
0.2.1b
|
||||
|
||||
Reference in New Issue
Block a user