diff --git a/changelog.md b/changelog.md
index 7a4d7e0..61f827e 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,10 +1,12 @@
# Changelog GarageCalc1
-## [0.4.2] - 2021-07-01
+## [0.5] - 2021-07-02
## Added
- Tabelle "Gegenstände": Zeilen sind sortierbar (-> Klick auf Spaltenköpfe)
- Tabelle "Gegenstände": Spalten sind anordenbar
- Beide Tabellen: Rechte Spalte wächst dynamisch ans Ende
+- Beide Tabellen: Zusätzliche Spalte "Kommentar" am Ende der Tabelle
+- Horizontales Splitter-Control zwischen Tabelle "Garage" und "Gegenstände"
## [0.4.1] - 2021-07-01
## Added
diff --git a/i18n/de_DE.qm b/i18n/de_DE.qm
index d8fb6a9..a3d31e6 100644
Binary files a/i18n/de_DE.qm and b/i18n/de_DE.qm differ
diff --git a/i18n/de_DE.ts b/i18n/de_DE.ts
index bf35da5..ed1c39c 100644
--- a/i18n/de_DE.ts
+++ b/i18n/de_DE.ts
@@ -4,77 +4,77 @@
TableWidget
-
+
Ausschneiden
-
+
Kopieren
-
+
Einfügen
-
+
Löschen
-
+
Zeile ausschneiden
-
+
Zeile kopieren
-
+
Zeile einfügen
-
+
Zeile oberhalb einfügen
-
+
Zeile unterhalb einfügen
-
+
Zeile entfernen
-
+
Zellinhalte löschen
-
+
Zeile Nr.
-
+
entfernen?
-
+
Entfernen
-
+
Zellinhalt löschen?
@@ -87,122 +87,122 @@
Hallo Welt
-
+
&Einstellungen
-
+
Sprache
-
+
Gegenstand
-
+
Länge
-
+
Breite
-
+
Höhe
-
+
Gewicht
-
+
Dimension der Garage
-
+
Dimensionen der zu verstauenden Gegenstände
-
+
Ergebnis
-
+
Volumen der Garage
-
+
Volumen der Gegenstände
-
+
Freier Raum in der Garage
-
+
Gesamtgewicht
-
+
Neu (Strg+N)
-
+
Öffnen... (Strg+O)
-
+
Speichern (Strg+S)
-
+
Export nach EXCEL...
-
+
Informationen über das Programm
-
+
Programm beenden (Strg+Q)
-
+
Garage
-
+
Beenden
-
+
Neu
-
+
Speichern
@@ -212,27 +212,27 @@
CSV-Datei
-
+
Alle Dateien
-
+
Datei
-
+
gespeichert
-
+
Öffnen
-
+
Export
@@ -242,45 +242,50 @@
EXCEL-Datei
-
+
Fehler in der Garagen-Dimension
-
+
Fehler in den Dimensionen der zu verstauenden Gegenstände
-
+
Erfolgreich nach EXCEL exportiert
-
+
CSV-Datei
-
+
EXCEL-Datei
-
+
Es gibt ungespeicherte Einträge. Ohne zu speichern, gehen alle Änderungen verloren. Trotzdem fortfahren?
-
+
Garagenraum-Rechner
-
+
Berechnet zur Verfügung stehenden Garagenraum
+
+
+
+ Kommentar
+
utils
diff --git a/i18n/hu_HU.qm b/i18n/hu_HU.qm
index 5bbd152..04280b2 100644
Binary files a/i18n/hu_HU.qm and b/i18n/hu_HU.qm differ
diff --git a/i18n/hu_HU.ts b/i18n/hu_HU.ts
index 70dd26d..d29237c 100644
--- a/i18n/hu_HU.ts
+++ b/i18n/hu_HU.ts
@@ -4,77 +4,77 @@
TableWidget
-
+
Vágd ki
-
+
Vettem
-
+
Beillesztés
-
+
Törölje
-
+
Vágott vonal
-
+
Vettem a szöveget
-
+
Beilleszteni a sort
-
+
A fenti sort beilleszteni
-
+
Az alábbi sor beillesztése
-
+
Távolítsa el a sort
-
+
Tartalom törlése
-
+
Vonalszám.
-
+
eltávolítani?
-
+
A eltávolítása
-
+
Cellatartalom törlése?
@@ -87,122 +87,122 @@
Hallo Welt
-
+
&Beállítások
-
+
Nyelv
-
+
Tárgy
-
+
Hosszúság
-
+
Szélesség
-
+
Magasság
-
+
Súly
-
+
A garázs mérete
-
+
A tárolandó objektumok méretei
-
+
Eredmény
-
+
A garázs térfogata
-
+
A tételek mennyisége
-
+
Szabad hely a garázsban
-
+
Teljes súly
-
+
Új (Ctrl+N)
-
+
Nyissa ki (Ctrl+O)
-
+
Mentés (Ctrl+S)
-
+
Exportálás EXCEL-be...
-
+
Az alkalmazással kapcsolatos információk
-
+
Az alkalmazás kilépése (Ctrl+Q)
-
+
Garázs
-
+
Kilépés
-
+
Új
-
+
Mentés
@@ -212,27 +212,27 @@
CSV-fájl
-
+
Minden fájl
-
+
fájl
-
+
mentett
-
+
Megnyitott
-
+
Exportálás
@@ -242,45 +242,50 @@
EXCEL-fájl
-
+
Hiba a garázs dimenziójában
-
+
Hiba a tárolandó objektumok méreteiben
-
+
Sikeresen exportált EXCEL-be
-
+
CSV-fájl
-
+
EXCEL-fájl
-
+
Vannak mentetlen bejegyzések. Mentés nélkül minden módosítás elveszik. Folytassa mégis?
-
+
Garázs hely kalkulátor
-
+
Kiszámítja a rendelkezésre álló garázshelyet
+
+
+
+ Megjegyzés
+
utils
diff --git a/scripts/pyinstaller.cmd b/scripts/pyinstaller.cmd
index 58f1c86..5892f60 100644
--- a/scripts/pyinstaller.cmd
+++ b/scripts/pyinstaller.cmd
@@ -1,36 +1,36 @@
@ECHO OFF
:: --------------------------------------------------------------------------------------------------------------------------------------
-:: project: GarageCalc1 Window-Exe Generator
-:: summary: create a GarageCalc1-executable for Windows (version with no-console-windows as well as version with console windows for traces)
+:: project: GarageCalc Window-Exe Generator
+:: summary: create a GarageCalc-executable for Windows (version with no-console-windows as well as version with console windows for traces)
:: file: pyinstaller.cmd
:: date: version author
:: 2021-06-27 1 paul salajean
:: --------------------------------------------------------------------------------------------------------------------------------------
-SET version="v0.1"
+SET version="v0.4"
SET release_dir="D:\Temp\Prog\ownCloud\profp@uberspace\transfer"
SET prev_dir=%cd%
-SET reinstall_venv="true"
+SET reinstall_venv="false"
SET do_zip="false"
CD ..
-ECHO Creating GarageCalc1 Windows.exe-version in folder %cd%\dist
+ECHO Creating GarageCalc Windows.exe-version in folder %cd%\dist
PAUSE
REM pyinstaller --noconfirm --log-level=ERROR ^
REM --onedir --nowindow ^
REM --add-data="README;." ^
REM --add-data="image1.png;img" ^
REM --add-data="img;doc;ui" ^
-REM --add-data="LICENSE.txt;changelog.md;GarageCalc1.bat" ^
+REM --add-data="LICENSE.txt;changelog.md;GarageCalc.bat" ^
REM --add-binary="libfoo.so;lib" ^
REM --hidden-import=secret1 ^
REM --hidden-import=secret2 ^
-REM --icon=.\img\GarageCalc1.ico ^
+REM --icon=.\img\GarageCalc.ico ^
REM --debug=imports ^
REM --key=N0T1me40pp0ssum5
REM --paths=.\src ^
-REM GarageCalc1.spec
+REM GarageCalc.spec
REM The key-string is a string of 16 characters which is used to encrypt each file of Python byte-code before it is stored in the archive inside the executable file.
REM This feature uses the "tinyaes" module internally for the encryption.
REM
@@ -55,21 +55,21 @@ python -m pip install -r requirements.txt
:PYINSTALL
IF %reinstall_venv%=="false" CALL .\env2\Scripts\activate.bat
ECHO Running "pyinstaller"...
-REM pyinstaller .\main.py --name=GarageCalc1 --noconfirm --console --clean --onedir --log-level=ERROR --hidden-import=PySide2.QtXml --icon=.\img\GarageCalc1.ico --add-data="LICENSE;." --add-data="README.md;." --add-data="changelog.md;." --add-data="*.ui;." --add-data="img;.\img"
-pyinstaller .\src\main.py --name=GarageCalc1 --noconfirm --windowed --clean --onefile --log-level=ERROR --hidden-import=PySide2.QtXml ^
+REM pyinstaller .\main.py --name=GarageCalc --noconfirm --console --clean --onedir --log-level=ERROR --hidden-import=PySide2.QtXml --icon=.\img\GarageCalc.ico --add-data="LICENSE;." --add-data="README.md;." --add-data="changelog.md;." --add-data="*.ui;." --add-data="img;.\img"
+REM --windowed
+pyinstaller .\src\main.py --name=GarageCalc --noconfirm --windowed --clean --onefile --log-level=ERROR --hidden-import=PySide2.QtXml ^
--icon=.\img\icons8-garage-32.ico ^
- --add-data="LICENSE.txt;." ^
- --add-data="README.md;." ^
- --add-data="changelog.md;." ^
- --add-data="requirements.txt;." ^
- --add-data=".\src\*.ui;." ^
+ --add-data="*.txt;." ^
+ --add-data="*.md;." ^
+ --add-data="ui;.\ui" ^
+ --add-data="i18n;.\i18n" ^
--add-data="img;.\img"
-::MOVE .\dist\GarageCalc1\*.md .\dist\
-::MOVE .\dist\GarageCalc1\LICENSE .\dist\
+::MOVE .\dist\GarageCalc\*.md .\dist\
+::MOVE .\dist\GarageCalc\LICENSE .\dist\
::clean-up img-folder
-::MOVE .\dist\GarageCalc1\img .\dist\img>NUL
+::MOVE .\dist\GarageCalc\img .\dist\img>NUL
::Remove temp dir and files
DEL /Q *.spec>NUL
@@ -83,7 +83,7 @@ IF %do_zip%=="false" GOTO END
::-mx5 = This is default (compression is normal).
::-mx7 = Maximum compression.
::-mx9 = Ultra compression.
-"C:\Program Files\7-zip\7z.exe" a %release_dir%\GarageCalc1_%version%_portable.exe -mx9 -sfx7z.sfx .\dist\*
+"C:\Program Files\7-zip\7z.exe" a %release_dir%\GarageCalc_%version%_portable.exe -mx9 -sfx7z.sfx .\dist\*
::Disable Virtual env
CALL .\env2\Scripts\deactivate.bat
diff --git a/scripts/pyinstaller_v2.cmd b/scripts/pyinstaller_v2.cmd
deleted file mode 100644
index 5892f60..0000000
--- a/scripts/pyinstaller_v2.cmd
+++ /dev/null
@@ -1,97 +0,0 @@
-@ECHO OFF
-:: --------------------------------------------------------------------------------------------------------------------------------------
-:: project: GarageCalc Window-Exe Generator
-:: summary: create a GarageCalc-executable for Windows (version with no-console-windows as well as version with console windows for traces)
-:: file: pyinstaller.cmd
-:: date: version author
-:: 2021-06-27 1 paul salajean
-:: --------------------------------------------------------------------------------------------------------------------------------------
-SET version="v0.4"
-SET release_dir="D:\Temp\Prog\ownCloud\profp@uberspace\transfer"
-
-SET prev_dir=%cd%
-SET reinstall_venv="false"
-SET do_zip="false"
-
-CD ..
-
-ECHO Creating GarageCalc Windows.exe-version in folder %cd%\dist
-PAUSE
-REM pyinstaller --noconfirm --log-level=ERROR ^
-REM --onedir --nowindow ^
-REM --add-data="README;." ^
-REM --add-data="image1.png;img" ^
-REM --add-data="img;doc;ui" ^
-REM --add-data="LICENSE.txt;changelog.md;GarageCalc.bat" ^
-REM --add-binary="libfoo.so;lib" ^
-REM --hidden-import=secret1 ^
-REM --hidden-import=secret2 ^
-REM --icon=.\img\GarageCalc.ico ^
-REM --debug=imports ^
-REM --key=N0T1me40pp0ssum5
-REM --paths=.\src ^
-REM GarageCalc.spec
-REM The key-string is a string of 16 characters which is used to encrypt each file of Python byte-code before it is stored in the archive inside the executable file.
-REM This feature uses the "tinyaes" module internally for the encryption.
-REM
-
-::one dir:
-ECHO ...Running...
-
-RMDIR /S /Q .\dist>nul
-RMDIR /S /Q .\build>nul
-
-::Use Virtual env
-IF %reinstall_venv%=="false" GOTO PYINSTALL
-ECHO Installing virtual env as ".\env2"...
-RMDIR /S /Q .\env2>NUL
-python -m venv env2
-CALL .\env2\Scripts\activate.bat
-
-ECHO Installing necessary python packages...
-python -m pip install --upgrade pip
-python -m pip install -r requirements.txt
-
-:PYINSTALL
-IF %reinstall_venv%=="false" CALL .\env2\Scripts\activate.bat
-ECHO Running "pyinstaller"...
-REM pyinstaller .\main.py --name=GarageCalc --noconfirm --console --clean --onedir --log-level=ERROR --hidden-import=PySide2.QtXml --icon=.\img\GarageCalc.ico --add-data="LICENSE;." --add-data="README.md;." --add-data="changelog.md;." --add-data="*.ui;." --add-data="img;.\img"
-REM --windowed
-pyinstaller .\src\main.py --name=GarageCalc --noconfirm --windowed --clean --onefile --log-level=ERROR --hidden-import=PySide2.QtXml ^
- --icon=.\img\icons8-garage-32.ico ^
- --add-data="*.txt;." ^
- --add-data="*.md;." ^
- --add-data="ui;.\ui" ^
- --add-data="i18n;.\i18n" ^
- --add-data="img;.\img"
-
-::MOVE .\dist\GarageCalc\*.md .\dist\
-::MOVE .\dist\GarageCalc\LICENSE .\dist\
-
-::clean-up img-folder
-::MOVE .\dist\GarageCalc\img .\dist\img>NUL
-
-::Remove temp dir and files
-DEL /Q *.spec>NUL
-RMDIR /S /Q .\build
-
-::Create self extracting archive
-IF %do_zip%=="false" GOTO END
-::-mx0 = Don't compress at all - just copy the contents to archive.
-::-mx1 = Consumes least time, but compression is low.
-::-mx3 = Better than -mx1.
-::-mx5 = This is default (compression is normal).
-::-mx7 = Maximum compression.
-::-mx9 = Ultra compression.
-"C:\Program Files\7-zip\7z.exe" a %release_dir%\GarageCalc_%version%_portable.exe -mx9 -sfx7z.sfx .\dist\*
-
-::Disable Virtual env
-CALL .\env2\Scripts\deactivate.bat
-
-:END
-CD %prev_dir%
-
-ECHO Done. Check %prev_dir%\..\dist
-IF %do_zip%=="true" ECHO Done. Check %release_dir%
-
-PAUSE
diff --git a/src/clsTableWidget.py b/src/clsTableWidget.py
index 9d9b686..15f362f 100644
--- a/src/clsTableWidget.py
+++ b/src/clsTableWidget.py
@@ -65,12 +65,14 @@ class TableWidget(QTableWidget):
# self.setEditTriggers(QAbstractItemView.DoubleClicked | QAbstractItemView.EditKeyPressed | QAbstractItemView.AnyKeyPressed)
- self.headers = self.verticalHeader()
- self.headers.setContextMenuPolicy(Qt.CustomContextMenu)
- self.headers.customContextMenuRequested.connect(self.on_rowheadercontext_menu)
- self.headers.setSelectionMode(QAbstractItemView.SingleSelection)
- self.headers.sectionClicked.connect(self.select_row)
- self.headers.setSectionsMovable(True)
+ self.vertHeader = self.verticalHeader()
+ self.vertHeader.setContextMenuPolicy(Qt.CustomContextMenu)
+ self.vertHeader.customContextMenuRequested.connect(self.on_rowheadercontext_menu)
+ self.vertHeader.setSelectionMode(QAbstractItemView.SingleSelection)
+ self.vertHeader.sectionClicked.connect(self.select_row)
+ self.vertHeader.setSectionsMovable(True)
+ # optimize row height
+ self.resizeRowsToContents()
self.row_selected = False
@@ -114,7 +116,7 @@ class TableWidget(QTableWidget):
row_delete_items = menu.addAction(QIcon(ICON_ERASER), QCoreApplication.translate("TableWidget", "Delete items"))
ac = menu.exec_(self.mapToGlobal(position))
- row = self.headers.logicalIndexAt(position)
+ row = self.vertHeader.logicalIndexAt(position)
if ac == row_cut:
self.item_cut()
diff --git a/src/main.py b/src/main.py
index 0f22d8f..2d86660 100644
--- a/src/main.py
+++ b/src/main.py
@@ -15,7 +15,7 @@ import configparser
# Third party imports
from PySide2.QtWidgets import QApplication, QMainWindow, QTableWidgetItem, QStatusBar, QFileDialog, \
- QAbstractItemView, QMenu, QMessageBox, QHBoxLayout, QVBoxLayout, QAction, QActionGroup
+ QAbstractItemView, QMenu, QMessageBox, QHBoxLayout, QVBoxLayout, QAction, QActionGroup, QSizePolicy
from PySide2.QtGui import QIcon
from PySide2.QtCore import QFile, QSize, Qt, QCoreApplication, QTranslator
from PySide2.QtUiTools import QUiLoader
@@ -28,7 +28,7 @@ from utils import show_about, resource_path
from clsTableWidget import TableWidget
# Local globals
-APP_VERSION = "v0.4.2"
+APP_VERSION = "v0.5"
DIR_APPDATA = os.getenv('LOCALAPPDATA')
@@ -56,20 +56,25 @@ COL_LENGTH = 1
COL_WIDTH = 2
COL_HEIGHT = 3
COL_WEIGHT = 4
+COL_COMMENT = 5
DEFAULT_GARAGE_LENGTH = "6"
DEFAULT_GARAGE_WIDTH = "2.5"
DEFAULT_GARAGE_HEIGHT = "2.5"
-TBL_STUFF_COL_COUNT = 5
+TBL_STUFF_COL_COUNT = 6
TBL_STUFF_ROW_COUNT = 50
+WIN_WIDTH = 700
+WIN_HEIGHT = 640
+
TXT_UNSAVED_CHANGES = QCoreApplication.translate("main", "There are unsaved entries. Without saving, all changes are lost. Continue anyway?")
####################################################################
def main():
qApp = QApplication(sys.argv)
+ global APP_NAME
qApp.setApplicationName(APP_NAME)
qApp.setApplicationDisplayName(APP_DISPNAME)
qApp.setApplicationVersion(APP_VERSION)
@@ -108,19 +113,39 @@ def main():
qApp.installTranslator(translator)
+ app_name = qApp.translate("main", APP_NAME)
+ qApp.setApplicationName(app_name)
+
winMain = MainWindow(language)
- if qApp.primaryScreen().size().width() <= 700:
+ if qApp.primaryScreen().size().width() <= 800:
winMain.showMaximized()
else:
- winMain.resize(610, 640)
-
- winMain.show()
+ winMain.resize(WIN_WIDTH, WIN_HEIGHT)
+ winMain.show()
sys.exit(qApp.exec_())
####################################################################
+def create_examples(table):
+ from random import randint, choice
+ from string import ascii_letters, punctuation, digits
+ min = 12
+ max = 15
+ string_format = ascii_letters
+
+ for row in range(table.rowCount()):
+ generated_string1 = "".join(choice(string_format) for x in range(randint(min, max)))
+ generated_string2 = "".join(choice(string_format) for x in range(randint(min, max)))
+
+ table.setItem(row, 0, QTableWidgetItem(generated_string1))
+ table.setItem(row, 1, QTableWidgetItem(str(randint(1, 10))))
+ table.setItem(row, 2, QTableWidgetItem(str(randint(1, 10))))
+ table.setItem(row, 3, QTableWidgetItem(str(randint(1, 10))))
+ table.setItem(row, 4, QTableWidgetItem(str(randint(20, 100))))
+ table.setItem(row, 5, QTableWidgetItem(generated_string2))
+
####################################################################
class MainWindow(QMainWindow):
def __init__(self, language):
@@ -140,15 +165,16 @@ class MainWindow(QMainWindow):
self.create_toolbar()
self.create_statusbar()
- global APP_NAME
- APP_NAME = qApp.setApplicationName(qApp.translate("main", "Garage Space Calculator"))
-
- self.statusBar.showMessage(f"{APP_NAME} {APP_VERSION} - {APP_AUTHOR}", 5000)
+ self.statusBar.showMessage(f"{APP_DISPNAME} {APP_VERSION} - {APP_AUTHOR}", 5000)
self.calc_voluminae()
self.ui.efWeight.setText(str("0"))
self.retranslateUi()
self.ui.tableStuff.setFocus()
+ # TODO: disable for PROD!
+ create_examples(self.ui.tableStuff)
+ self.ui.tableGarage.setItem(0, 3, QTableWidgetItem("Garázs az udvaron"))
+
def create_menu(self, language=None):
menuMain = self.menuBar()
self.menuSettings = menuMain.addMenu(QCoreApplication.translate("main", "&Settings"))
@@ -176,18 +202,24 @@ class MainWindow(QMainWindow):
self.menuLanguage.setTitle(QCoreApplication.translate("main", "Language"))
# tables
- self.ui.tableGarage.setVerticalHeaderLabels([QCoreApplication.translate("main","Garage")])
+ self.ui.tableGarage.setVerticalHeaderLabels([
+ QCoreApplication.translate("main","Garage")])
+
self.ui.tableGarage.setHorizontalHeaderLabels([
QCoreApplication.translate("main","Length") + " [m]",
QCoreApplication.translate("main","Width") + " [m]",
- QCoreApplication.translate("main","Height") + " [m]"
+ QCoreApplication.translate("main","Height") + " [m]",
+ QCoreApplication.translate("main","Comment")
])
- self.ui.tableStuff.setHorizontalHeaderLabels([QCoreApplication.translate("main","Stuff"),
+ self.ui.tableStuff.setHorizontalHeaderLabels([
+ QCoreApplication.translate("main","Stuff"),
QCoreApplication.translate("main","Length") + " [m]",
QCoreApplication.translate("main","Width") + " [m]",
QCoreApplication.translate("main","Height") + " [m]",
- QCoreApplication.translate("main","Weight") + " [m]"])
+ QCoreApplication.translate("main","Weight") + " [m]",
+ QCoreApplication.translate("main","Comment")
+ ])
# labels
self.ui.gbGarage.setTitle(QCoreApplication.translate("main","Dimension of the garage"))
@@ -220,8 +252,13 @@ class MainWindow(QMainWindow):
self.ui.tableStuff = TableWidget()
self.ui.tableStuff.setColumnCount(TBL_STUFF_COL_COUNT)
self.ui.tableStuff.setRowCount(TBL_STUFF_ROW_COUNT)
+ self.ui.tableStuff.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
+
+ self.ui.splitter.setStretchFactor(1, 10)
+
layoutGb.addWidget(self.ui.tableStuff)
+
def create_actions(self):
self.actionNew = QAction()
self.actionNew.setIcon(QIcon(resource_path(ICON_NEW)))
@@ -310,7 +347,7 @@ class MainWindow(QMainWindow):
if self.opened_file:
self.setWindowTitle(self.opened_file)
else:
- self.setWindowTitle(f"{APP_NAME} {APP_VERSION} by {APP_AUTHOR}")
+ self.setWindowTitle(f"{qApp.applicationName()} {APP_VERSION} - {APP_AUTHOR}")
self.ui.efVol_Free.setStyleSheet("")
self.is_modified = False
@@ -358,10 +395,12 @@ class MainWindow(QMainWindow):
garage_length = 0
garage_width = 0
garage_height = 0
+ garage_comment = ""
item_length = tblGarage.item(0, 0)
item_width = tblGarage.item(0, 1)
item_height = tblGarage.item(0, 2)
+ item_comment = tblGarage.item(0, 3)
# loop over table Garage
for row in range(tblGarage.rowCount()):
@@ -389,8 +428,12 @@ class MainWindow(QMainWindow):
except ValueError:
garage_height = 0.0
+ # get garage comment
+ if item_comment:
+ garage_comment = item_comment.text()
+
if garage_length or garage_width or garage_height:
- writer.writerow([QCoreApplication.translate("main","Garage"), garage_length, garage_width, garage_height])
+ writer.writerow([QCoreApplication.translate("main","Garage"), garage_length, garage_width, garage_height, garage_comment])
# loop over table Stuff
for row in range(tblStuff.rowCount()):
@@ -399,12 +442,14 @@ class MainWindow(QMainWindow):
width = None
height = None
weight = None
+ comment = None
item_stuff = tblStuff.item(row, COL_STUFF)
item_length = tblStuff.item(row, COL_LENGTH)
item_width = tblStuff.item(row, COL_WIDTH)
item_height = tblStuff.item(row, COL_HEIGHT)
item_weight = tblStuff.item(row, COL_WEIGHT)
+ item_comment = tblStuff.item(row, COL_COMMENT)
if item_stuff:
stuff_text = item_stuff.text()
@@ -433,8 +478,11 @@ class MainWindow(QMainWindow):
except ValueError:
weight = None
+ if item_comment:
+ comment = item_comment.text()
+
if item_stuff or item_length or item_width or item_height or item_weight:
- writer.writerow([stuff_text, length, width, height, weight])
+ writer.writerow([stuff_text, length, width, height, weight, comment])
is_file_saved = True
self.opened_file = os.path.basename(fileName)
@@ -478,10 +526,12 @@ class MainWindow(QMainWindow):
garage_length = row[1]
garage_width = row[2]
garage_height = row[3]
+ garage_comment = row[4]
tblGarage.setItem(0, COL_LENGTH-1, QTableWidgetItem(str(garage_length)))
tblGarage.setItem(0, COL_WIDTH-1, QTableWidgetItem(str(garage_width)))
tblGarage.setItem(0, COL_HEIGHT-1, QTableWidgetItem(str(garage_height)))
+ tblGarage.setItem(0, COL_COMMENT-1, QTableWidgetItem(garage_comment))
except IndexError as ex:
pass
@@ -493,12 +543,14 @@ class MainWindow(QMainWindow):
stuff_width = row[2]
stuff_height = row[3]
stuff_weight = row[4]
+ stuff_comment = row[5]
tblStuff.setItem(row_idx - 1, COL_STUFF, QTableWidgetItem(stuff))
tblStuff.setItem(row_idx - 1, COL_LENGTH, QTableWidgetItem(str(stuff_length)))
tblStuff.setItem(row_idx - 1, COL_WIDTH, QTableWidgetItem(str(stuff_width)))
tblStuff.setItem(row_idx - 1, COL_HEIGHT, QTableWidgetItem(str(stuff_height)))
tblStuff.setItem(row_idx - 1, COL_WEIGHT, QTableWidgetItem(str(stuff_weight)))
+ tblStuff.setItem(row_idx - 1, COL_COMMENT, QTableWidgetItem(stuff_comment))
except IndexError as ex:
pass
@@ -506,6 +558,8 @@ class MainWindow(QMainWindow):
row_idx += 1
tblStuff.setRowCount(TBL_STUFF_ROW_COUNT)
+ # optimize row height
+ tblStuff.resizeRowsToContents()
self.is_modified = False
self.opened_file = os.path.basename(fileName)
@@ -513,7 +567,7 @@ class MainWindow(QMainWindow):
if fileName:
self.setWindowTitle(self.opened_file)
else:
- self.setWindowTitle(f"{APP_NAME} {APP_VERSION} by {APP_AUTHOR}")
+ self.setWindowTitle(f"{qApp.applicationName()} {APP_VERSION} - {APP_AUTHOR}")
def file_export(self):
tblGarage = self.ui.tableGarage
@@ -540,8 +594,10 @@ class MainWindow(QMainWindow):
worksheet.write(start_row, COL_LENGTH, QCoreApplication.translate("main","Length") + " [m]")
worksheet.write(start_row, COL_WIDTH, QCoreApplication.translate("main","Width") + " [m]")
worksheet.write(start_row, COL_HEIGHT, QCoreApplication.translate("main","Height") + " [m]")
+ worksheet.write(start_row, COL_COMMENT, QCoreApplication.translate("main","Comment"))
worksheet.set_column(0, 0, 25)
worksheet.set_column(1, 3, 10)
+ worksheet.set_column(4, 5, 20)
start_row = 2
# loop over table Garage
@@ -567,9 +623,13 @@ class MainWindow(QMainWindow):
except ValueError:
garage_height = 0.0
+ # get garage comment
+ garage_comment = tblGarage.item(0, 3).text()
+
worksheet.write(start_row + row, COL_LENGTH, garage_length)
worksheet.write(start_row + row, COL_WIDTH, garage_width)
worksheet.write(start_row + row, COL_HEIGHT, garage_height)
+ worksheet.write(start_row + row, COL_COMMENT, garage_comment)
start_row = 4
worksheet.write(start_row, 0, QCoreApplication.translate("main", "Dimensions of the objects to be stored"))
@@ -579,6 +639,7 @@ class MainWindow(QMainWindow):
worksheet.write(start_row, COL_WIDTH, QCoreApplication.translate("main","Width") + " [m]")
worksheet.write(start_row, COL_HEIGHT, QCoreApplication.translate("main","Height") + " [m]")
worksheet.write(start_row, COL_WEIGHT, QCoreApplication.translate("main","Weight") + " [kg]")
+ worksheet.write(start_row, COL_COMMENT, QCoreApplication.translate("main","Comment") )
start_row = 6
# loop over table Stuff
@@ -589,6 +650,7 @@ class MainWindow(QMainWindow):
item_width = tblStuff.item(row, COL_WIDTH)
item_height = tblStuff.item(row, COL_HEIGHT)
item_weight = tblStuff.item(row, COL_WEIGHT)
+ item_comment = tblStuff.item(row, COL_COMMENT)
if item_stuff:
stuff_text = item_stuff.text()
@@ -627,6 +689,11 @@ class MainWindow(QMainWindow):
except ValueError:
pass
+ if item_comment:
+ comment = item_comment.text()
+ if len(comment)>0:
+ worksheet.write(start_row + row, COL_COMMENT, comment)
+
if item_stuff or item_length or item_width or item_height or item_weight:
row_idx += 1
diff --git a/ui/main.ui b/ui/main.ui
index 60cf484..c4c02e8 100644
--- a/ui/main.ui
+++ b/ui/main.ui
@@ -6,96 +6,134 @@
0
0
- 604
- 596
+ 605
+ 595
Form
-
+
-
-
-
-
- 0
- 91
-
+
+
+ QFrame::NoFrame
-
-
- 16777215
- 91
-
+
+ QFrame::Plain
-
- Dimension der Garage
+
+ 1
-
+
+ 0
+
+
+ Qt::Vertical
+
+
true
-
-
-
-
-
-
- 0
- 0
-
-
-
-
- 0
- 58
-
-
-
-
- 16777215
- 58
-
-
-
- true
-
-
-
- Garage
-
-
-
-
- Länge [m]
-
-
-
-
- Breite [m]
-
-
-
-
- Höhe [m]
-
-
-
-
-
-
-
- -
-
-
- Dimensionen der zu verstauenden Gegenstände
+
+ 5
-
+
true
-
+
+
+
+ 0
+ 100
+
+
+
+ Dimension der Garage
+
+
+ true
+
+
+
-
+
+
+ 1
+
+
+ 4
+
+
+ true
+
+
+ true
+
+
+
+ Garage
+
+
+
+
+ Länge [m]
+
+
+
+
+ Breite [m]
+
+
+
+
+ Höhe [m]
+
+
+
+
+ Kommentar
+
+
+
+
+
+
+
+
+
+ 0
+ 0
+
+
+
+
+ 0
+ 350
+
+
+
+ Dimensionen der zu verstauenden Gegenstände
+
+
+ true
+
+
+
-
+
+
+ 0
+ 0
+
+
+
+
+ 0
+ 0
+
+
Ergebnis
@@ -230,13 +268,6 @@
-
- tableGarage
- efVol_Garage
- efVol_Stuff
- efVol_Free
- efWeight
-