7 Commits

7 changed files with 39 additions and 14 deletions

View File

@@ -1,4 +1,7 @@
#!/usr/bin/env bash
set -e
if [ "$VIRTUAL_ENV" == "" ]
then
source venv/bin/activate
@@ -15,6 +18,7 @@ sed -i "s/VERSION = '[0-9]\.[0-9].[0-9]\w'/VERSION = '$(cat version.txt)'/g" src
sed -i "s/Version: [0-9]\.[0-9].[0-9]\w/Version: $(cat version.txt)/g" deb-package/brovski-adressetiketten/DEBIAN/control
pyinstaller --clean --onefile src/brovski-adress-etiketten-verwaltung.py
mkdir -p deb-package/brovski-adressetiketten/usr/local/bin
cp dist/brovski-adress-etiketten-verwaltung deb-package/brovski-adressetiketten/usr/local/bin/brovski-adressetiketten
dpkg-deb --build deb-package/brovski-adressetiketten
mv deb-package/brovski-adressetiketten.deb ./

View File

@@ -1,5 +1,5 @@
Package: brovski-adressetiketten
Version: 0.1.1b
Version: 0.2.1b
Maintainer: Ovski
Architecture: all
Description: manage csv files for glables address labels

View File

@@ -8,18 +8,19 @@ from tkinter import ttk
from config import Config
from model import Model
from src.connector import JSONConnector
from connector import JSONConnector
from windows import SettingsWindow, EditRecord, show_error
class Application:
def __init__(self):
os.chdir(os.getcwd())
# tkinter settings
x_offset = 700
y_offset = 200
width = 1050
height = 700
VERSION = '0.1.1b'
VERSION = '0.2.1b'
title = f"Brovski Adress-Etiketten Verwaltung {VERSION}"
self.root = tk.Tk(className="BrovskiAdressEtiketten")
@@ -262,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",

View File

@@ -2,7 +2,6 @@ import json
import os
from abc import ABC, abstractmethod
import config
from config import Config

View File

@@ -1,4 +1,4 @@
from src.connector import Connector
from connector import Connector
class Model:

View File

@@ -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):

View File

@@ -1 +1 @@
0.1.1b
0.2.1b