unit conversion per cell (and ini settings)

This commit is contained in:
Paul S 2021-07-11 10:41:42 +02:00
parent 6183acf307
commit a6e6370fd6
10 changed files with 1004 additions and 300 deletions

View file

@ -1,5 +1,14 @@
# Changelog GarageCalc1 # Changelog GarageCalc1
## [0.7] - 2021-07-09
## Added
- Einheiten können pro Zelle mit F3 eingegben/editiert/umgerechnet werden
- Menü erweitert
- Ini-Datei erweitert um Standard-Einheiten
## Changed
- Ini-Datei wird nun im Ordner der Applikation gespeichert/geladen, nicht mehr aus %LOCALAPPDATA%
## [0.6] - 2021-07-06 ## [0.6] - 2021-07-06
## Added ## Added
- Dezimalzahlen werden nun mit Dezimaltrennzeichen Komma (",") eingegeben statt Punkt (".") - Dezimalzahlen werden nun mit Dezimaltrennzeichen Komma (",") eingegeben statt Punkt (".")

Binary file not shown.

View file

@ -4,77 +4,77 @@
<context> <context>
<name>TableWidget</name> <name>TableWidget</name>
<message> <message>
<location filename="clsTableWidget.py" line="87"/> <location filename="clsTableWidget.py" line="96"/>
<source>Cut</source> <source>Cut</source>
<translation>Ausschneiden</translation> <translation>Ausschneiden</translation>
</message> </message>
<message> <message>
<location filename="clsTableWidget.py" line="88"/> <location filename="clsTableWidget.py" line="97"/>
<source>Copy</source> <source>Copy</source>
<translation>Kopieren</translation> <translation>Kopieren</translation>
</message> </message>
<message> <message>
<location filename="clsTableWidget.py" line="89"/> <location filename="clsTableWidget.py" line="98"/>
<source>Paste</source> <source>Paste</source>
<translation>Einfügen</translation> <translation>Einfügen</translation>
</message> </message>
<message> <message>
<location filename="clsTableWidget.py" line="258"/> <location filename="clsTableWidget.py" line="367"/>
<source>Delete</source> <source>Delete</source>
<translation>Löschen</translation> <translation>Löschen</translation>
</message> </message>
<message> <message>
<location filename="clsTableWidget.py" line="108"/> <location filename="clsTableWidget.py" line="115"/>
<source>Cut row</source> <source>Cut row</source>
<translation>Zeile ausschneiden</translation> <translation>Zeile ausschneiden</translation>
</message> </message>
<message> <message>
<location filename="clsTableWidget.py" line="109"/> <location filename="clsTableWidget.py" line="116"/>
<source>Copy row</source> <source>Copy row</source>
<translation>Zeile kopieren</translation> <translation>Zeile kopieren</translation>
</message> </message>
<message> <message>
<location filename="clsTableWidget.py" line="110"/> <location filename="clsTableWidget.py" line="117"/>
<source>Paste row</source> <source>Paste row</source>
<translation>Zeile einfügen</translation> <translation>Zeile einfügen</translation>
</message> </message>
<message> <message>
<location filename="clsTableWidget.py" line="112"/> <location filename="clsTableWidget.py" line="119"/>
<source>Insert row before</source> <source>Insert row before</source>
<translation>Zeile oberhalb einfügen</translation> <translation>Zeile oberhalb einfügen</translation>
</message> </message>
<message> <message>
<location filename="clsTableWidget.py" line="113"/> <location filename="clsTableWidget.py" line="120"/>
<source>Insert row after</source> <source>Insert row after</source>
<translation>Zeile unterhalb einfügen</translation> <translation>Zeile unterhalb einfügen</translation>
</message> </message>
<message> <message>
<location filename="clsTableWidget.py" line="115"/> <location filename="clsTableWidget.py" line="122"/>
<source>Remove row</source> <source>Remove row</source>
<translation>Zeile entfernen</translation> <translation>Zeile entfernen</translation>
</message> </message>
<message> <message>
<location filename="clsTableWidget.py" line="116"/> <location filename="clsTableWidget.py" line="123"/>
<source>Delete items</source> <source>Delete items</source>
<translation>Zellinhalte löschen</translation> <translation>Zellinhalte löschen</translation>
</message> </message>
<message> <message>
<location filename="clsTableWidget.py" line="151"/> <location filename="clsTableWidget.py" line="158"/>
<source>Row Nr.</source> <source>Row Nr.</source>
<translation>Zeile Nr.</translation> <translation>Zeile Nr.</translation>
</message> </message>
<message> <message>
<location filename="clsTableWidget.py" line="152"/> <location filename="clsTableWidget.py" line="159"/>
<source>to be removed?</source> <source>to be removed?</source>
<translation>entfernen?</translation> <translation>entfernen?</translation>
</message> </message>
<message> <message>
<location filename="clsTableWidget.py" line="152"/> <location filename="clsTableWidget.py" line="159"/>
<source>Remove</source> <source>Remove</source>
<translation>Entfernen</translation> <translation>Entfernen</translation>
</message> </message>
<message> <message>
<location filename="clsTableWidget.py" line="258"/> <location filename="clsTableWidget.py" line="367"/>
<source>Delete cell content?</source> <source>Delete cell content?</source>
<translation>Zellinhalt löschen?</translation> <translation>Zellinhalt löschen?</translation>
</message> </message>
@ -87,122 +87,122 @@
<translation type="obsolete">Hallo Welt</translation> <translation type="obsolete">Hallo Welt</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="178"/> <location filename="main.py" line="330"/>
<source>&amp;Settings</source> <source>&amp;Settings</source>
<translation>&amp;Einstellungen</translation> <translation>&amp;Einstellungen</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="179"/> <location filename="main.py" line="332"/>
<source>Language</source> <source>Language</source>
<translation>Sprache</translation> <translation>Sprache</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="193"/> <location filename="main.py" line="242"/>
<source>Stuff</source> <source>Stuff</source>
<translation>Gegenstand</translation> <translation>Gegenstand</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="595"/> <location filename="main.py" line="759"/>
<source>Length</source> <source>Length</source>
<translation>Länge</translation> <translation>Länge</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="596"/> <location filename="main.py" line="760"/>
<source>Width</source> <source>Width</source>
<translation>Breite</translation> <translation>Breite</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="597"/> <location filename="main.py" line="761"/>
<source>Height</source> <source>Height</source>
<translation>Höhe</translation> <translation>Höhe</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="598"/> <location filename="main.py" line="762"/>
<source>Weight</source> <source>Weight</source>
<translation>Gewicht</translation> <translation>Gewicht</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="553"/> <location filename="main.py" line="727"/>
<source>Dimension of the garage</source> <source>Dimension of the garage</source>
<translation>Dimension der Garage</translation> <translation>Dimension der Garage</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="592"/> <location filename="main.py" line="755"/>
<source>Dimensions of the objects to be stored</source> <source>Dimensions of the objects to be stored</source>
<translation>Dimensionen der zu verstauenden Gegenstände</translation> <translation>Dimensionen der zu verstauenden Gegenstände</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="652"/> <location filename="main.py" line="847"/>
<source>Result</source> <source>Result</source>
<translation>Ergebnis</translation> <translation>Ergebnis</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="655"/> <location filename="main.py" line="850"/>
<source>Volume of the garage</source> <source>Volume of the garage</source>
<translation>Volumen der Garage</translation> <translation>Volumen der Garage</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="659"/> <location filename="main.py" line="854"/>
<source>Volume of the items</source> <source>Volume of the items</source>
<translation>Volumen der Gegenstände</translation> <translation>Volumen der Gegenstände</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="663"/> <location filename="main.py" line="859"/>
<source>Free space in the garage</source> <source>Free space in the garage</source>
<translation>Freier Raum in der Garage</translation> <translation>Freier Raum in der Garage</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="667"/> <location filename="main.py" line="864"/>
<source>Total weight</source> <source>Total weight</source>
<translation>Gesamtgewicht</translation> <translation>Gesamtgewicht</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="212"/> <location filename="main.py" line="261"/>
<source>New (Ctrl+N)</source> <source>New (Ctrl+N)</source>
<translation>Neu (Strg+N)</translation> <translation>Neu (Strg+N)</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="213"/> <location filename="main.py" line="262"/>
<source>Open... (Ctrl+O)</source> <source>Open... (Ctrl+O)</source>
<translation>Öffnen... (Strg+O)</translation> <translation>Öffnen... (Strg+O)</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="214"/> <location filename="main.py" line="263"/>
<source>Save (Ctrl+S)</source> <source>Save (Ctrl+S)</source>
<translation>Speichern (Strg+S)</translation> <translation>Speichern (Strg+S)</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="215"/> <location filename="main.py" line="264"/>
<source>Export to EXCEL...</source> <source>Export to EXCEL...</source>
<translation>Export nach EXCEL...</translation> <translation>Export nach EXCEL...</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="216"/> <location filename="main.py" line="265"/>
<source>Information about the application</source> <source>Information about the application</source>
<translation>Informationen über das Programm</translation> <translation>Informationen über das Programm</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="217"/> <location filename="main.py" line="266"/>
<source>Quit the application (Strg+Q)</source> <source>Quit the application (Strg+Q)</source>
<translation>Programm beenden (Strg+Q)</translation> <translation>Programm beenden (Strg+Q)</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="408"/> <location filename="main.py" line="532"/>
<source>Garage</source> <source>Garage</source>
<translation>Garage</translation> <translation>Garage</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="336"/> <location filename="main.py" line="459"/>
<source>Quit</source> <source>Quit</source>
<translation>Beenden</translation> <translation>Beenden</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="345"/> <location filename="main.py" line="468"/>
<source>New</source> <source>New</source>
<translation>Neu</translation> <translation>Neu</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="362"/> <location filename="main.py" line="492"/>
<source>Save</source> <source>Save</source>
<translation>Speichern</translation> <translation>Speichern</translation>
</message> </message>
@ -212,27 +212,27 @@
<translation type="obsolete">CSV-Datei</translation> <translation type="obsolete">CSV-Datei</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="544"/> <location filename="main.py" line="718"/>
<source>All files</source> <source>All files</source>
<translation>Alle Dateien</translation> <translation>Alle Dateien</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="460"/> <location filename="main.py" line="597"/>
<source>file</source> <source>file</source>
<translation>Datei</translation> <translation>Datei</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="461"/> <location filename="main.py" line="598"/>
<source>saved</source> <source>saved</source>
<translation>gespeichert</translation> <translation>gespeichert</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="477"/> <location filename="main.py" line="614"/>
<source>Open</source> <source>Open</source>
<translation>Öffnen</translation> <translation>Öffnen</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="541"/> <location filename="main.py" line="715"/>
<source>Export</source> <source>Export</source>
<translation>Export</translation> <translation>Export</translation>
</message> </message>
@ -242,72 +242,127 @@
<translation type="obsolete">EXCEL-Datei</translation> <translation type="obsolete">EXCEL-Datei</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="724"/> <location filename="main.py" line="929"/>
<source>Error in the garage dimension</source> <source>Error in the garage dimension</source>
<translation>Fehler in der Garagen-Dimension</translation> <translation>Fehler in der Garagen-Dimension</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="777"/> <location filename="main.py" line="990"/>
<source>Error in the dimensions of the objects to be stored</source> <source>Error in the dimensions of the objects to be stored</source>
<translation>Fehler in den Dimensionen der zu verstauenden Gegenstände</translation> <translation>Fehler in den Dimensionen der zu verstauenden Gegenstände</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="671"/> <location filename="main.py" line="871"/>
<source>Successfully exported to EXCEL</source> <source>Successfully exported to EXCEL</source>
<translation>Erfolgreich nach EXCEL exportiert</translation> <translation>Erfolgreich nach EXCEL exportiert</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="478"/> <location filename="main.py" line="615"/>
<source>CSV-file</source> <source>CSV-file</source>
<translation>CSV-Datei</translation> <translation>CSV-Datei</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="542"/> <location filename="main.py" line="716"/>
<source>EXCEL-file</source> <source>EXCEL-file</source>
<translation>EXCEL-Datei</translation> <translation>EXCEL-Datei</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="73"/> <location filename="main.py" line="100"/>
<source>There are unsaved entries. Without saving, all changes are lost. Continue anyway?</source> <source>There are unsaved entries. Without saving, all changes are lost. Continue anyway?</source>
<translation>Es gibt ungespeicherte Einträge. Ohne zu speichern, gehen alle Änderungen verloren. Trotzdem fortfahren?</translation> <translation>Es gibt ungespeicherte Einträge. Ohne zu speichern, gehen alle Änderungen verloren. Trotzdem fortfahren?</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="147"/> <location filename="main.py" line="147"/>
<source>Garage Space Calculator</source> <source>Garage Space Calculator</source>
<translation>Garagenraum-Rechner</translation> <translation type="obsolete">Garagenraum-Rechner</translation>
</message> </message>
<message> <message>
<location filename="utils.py" line="40"/> <location filename="utils.py" line="45"/>
<source>Calculates available garage space</source> <source>Calculates available garage space</source>
<translation>Berechnet zur Verfügung stehenden Garagenraum</translation> <translation>Berechnet zur Verfügung stehenden Garagenraum</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="199"/> <location filename="main.py" line="763"/>
<source>Comment</source> <source>Comment</source>
<translation>Kommentar</translation> <translation>Kommentar</translation>
</message> </message>
<message>
<location filename="main.py" line="334"/>
<source>Unit of Measurements</source>
<translation>Maßeinheit</translation>
</message>
<message>
<location filename="main.py" line="335"/>
<source>Length units</source>
<translation>Längeneinheit</translation>
</message>
<message>
<location filename="main.py" line="336"/>
<source>Mass units</source>
<translation>Masseeinheit</translation>
</message>
<message>
<location filename="main.py" line="321"/>
<source>&amp;File</source>
<translation>&amp;Datei</translation>
</message>
<message>
<location filename="main.py" line="382"/>
<source>Help</source>
<translation>Hilfe</translation>
</message>
<message>
<location filename="main.py" line="1095"/>
<source>Do you want to convert all existing stuff of type length to the new unit of measurement (UOM)</source>
<translation>Möchten Sie alle vorhandenen Gegenstände vom Typ Länge auf die neue Maßeinheit umrechnen</translation>
</message>
<message>
<location filename="main.py" line="1127"/>
<source>UOM conversion</source>
<translation>Einheiten Umrechnung</translation>
</message>
<message>
<location filename="main.py" line="1126"/>
<source>Do you want to convert all existing stuff of type mass to the new unit of measurement (UOM)</source>
<translation>Möchten Sie alle vorhandenen Gegenstände vom Typ Gewicht auf die neue Maßeinheit umrechnen</translation>
</message>
</context> </context>
<context> <context>
<name>utils</name> <name>utils</name>
<message> <message>
<location filename="utils.py" line="41"/> <location filename="utils.py" line="46"/>
<source>Idea</source> <source>Idea</source>
<translation>Idee</translation> <translation>Idee</translation>
</message> </message>
<message> <message>
<location filename="utils.py" line="45"/> <location filename="utils.py" line="45"/>
<source>Used icons: Theme</source> <source>Used icons: Theme</source>
<translation>Verwendete Icons: Thema</translation> <translation type="obsolete">Verwendete Icons: Thema</translation>
</message> </message>
<message> <message>
<location filename="utils.py" line="45"/> <location filename="utils.py" line="50"/>
<source>from</source> <source>from</source>
<translation>von</translation> <translation>von</translation>
</message> </message>
<message> <message>
<location filename="utils.py" line="48"/> <location filename="utils.py" line="55"/>
<source>Version</source> <source>Version</source>
<translation>Version</translation> <translation>Version</translation>
</message> </message>
<message>
<location filename="utils.py" line="50"/>
<source>Used icons</source>
<translation>Verwendete Icons</translation>
</message>
<message>
<location filename="utils.py" line="51"/>
<source>Currently opened file</source>
<translation>Aktuell geöffnete Datei</translation>
</message>
<message>
<location filename="utils.py" line="52"/>
<source>Location of the Ini-file</source>
<translation>Dateipfad der Ini-Datei</translation>
</message>
</context> </context>
</TS> </TS>

Binary file not shown.

View file

@ -1,80 +1,80 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS> <!DOCTYPE TS>
<TS version="2.1" language="de_DE"> <TS version="2.1" language="de_DE">
<context> <context>
<name>TableWidget</name> <name>TableWidget</name>
<message> <message>
<location filename="clsTableWidget.py" line="87"/> <location filename="clsTableWidget.py" line="96"/>
<source>Cut</source> <source>Cut</source>
<translation>kivágni</translation> <translation>kivágni</translation>
</message> </message>
<message> <message>
<location filename="clsTableWidget.py" line="88"/> <location filename="clsTableWidget.py" line="97"/>
<source>Copy</source> <source>Copy</source>
<translation>másolás</translation> <translation>másolás</translation>
</message> </message>
<message> <message>
<location filename="clsTableWidget.py" line="89"/> <location filename="clsTableWidget.py" line="98"/>
<source>Paste</source> <source>Paste</source>
<translation>Beillesztés</translation> <translation>Beillesztés</translation>
</message> </message>
<message> <message>
<location filename="clsTableWidget.py" line="258"/> <location filename="clsTableWidget.py" line="367"/>
<source>Delete</source> <source>Delete</source>
<translation>Törlés</translation> <translation>Törlés</translation>
</message> </message>
<message> <message>
<location filename="clsTableWidget.py" line="108"/> <location filename="clsTableWidget.py" line="115"/>
<source>Cut row</source> <source>Cut row</source>
<translation>Vágott vonal</translation> <translation>Vágott vonal</translation>
</message> </message>
<message> <message>
<location filename="clsTableWidget.py" line="109"/> <location filename="clsTableWidget.py" line="116"/>
<source>Copy row</source> <source>Copy row</source>
<translation>Vettem a szöveget</translation> <translation>Vettem a szöveget</translation>
</message> </message>
<message> <message>
<location filename="clsTableWidget.py" line="110"/> <location filename="clsTableWidget.py" line="117"/>
<source>Paste row</source> <source>Paste row</source>
<translation>Beilleszteni a sort</translation> <translation>Beilleszteni a sort</translation>
</message> </message>
<message> <message>
<location filename="clsTableWidget.py" line="112"/> <location filename="clsTableWidget.py" line="119"/>
<source>Insert row before</source> <source>Insert row before</source>
<translation>A fenti sort beilleszteni</translation> <translation>A fenti sort beilleszteni</translation>
</message> </message>
<message> <message>
<location filename="clsTableWidget.py" line="113"/> <location filename="clsTableWidget.py" line="120"/>
<source>Insert row after</source> <source>Insert row after</source>
<translation>Az alábbi sor beillesztése</translation> <translation>Az alábbi sor beillesztése</translation>
</message> </message>
<message> <message>
<location filename="clsTableWidget.py" line="115"/> <location filename="clsTableWidget.py" line="122"/>
<source>Remove row</source> <source>Remove row</source>
<translation>Távolítsa el a sort</translation> <translation>Távolítsa el a sort</translation>
</message> </message>
<message> <message>
<location filename="clsTableWidget.py" line="116"/> <location filename="clsTableWidget.py" line="123"/>
<source>Delete items</source> <source>Delete items</source>
<translation>Tartalom törlése</translation> <translation>Tartalom törlése</translation>
</message> </message>
<message> <message>
<location filename="clsTableWidget.py" line="151"/> <location filename="clsTableWidget.py" line="158"/>
<source>Row Nr.</source> <source>Row Nr.</source>
<translation>Vonalszám.</translation> <translation>Vonalszám.</translation>
</message> </message>
<message> <message>
<location filename="clsTableWidget.py" line="152"/> <location filename="clsTableWidget.py" line="159"/>
<source>to be removed?</source> <source>to be removed?</source>
<translation>eltávolítani?</translation> <translation>eltávolítani?</translation>
</message> </message>
<message> <message>
<location filename="clsTableWidget.py" line="152"/> <location filename="clsTableWidget.py" line="159"/>
<source>Remove</source> <source>Remove</source>
<translation>A eltávolítása</translation> <translation>A eltávolítása</translation>
</message> </message>
<message> <message>
<location filename="clsTableWidget.py" line="258"/> <location filename="clsTableWidget.py" line="367"/>
<source>Delete cell content?</source> <source>Delete cell content?</source>
<translation>Cellatartalom törlése?</translation> <translation>Cellatartalom törlése?</translation>
</message> </message>
@ -87,122 +87,122 @@
<translation type="obsolete">Hallo Welt</translation> <translation type="obsolete">Hallo Welt</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="178"/> <location filename="main.py" line="330"/>
<source>&amp;Settings</source> <source>&amp;Settings</source>
<translation>&amp;Beállítások</translation> <translation>&amp;Beállítások</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="179"/> <location filename="main.py" line="332"/>
<source>Language</source> <source>Language</source>
<translation>Nyelv</translation> <translation>Nyelv</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="193"/> <location filename="main.py" line="242"/>
<source>Stuff</source> <source>Stuff</source>
<translation>Tárgy</translation> <translation>Tárgy</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="595"/> <location filename="main.py" line="759"/>
<source>Length</source> <source>Length</source>
<translation>Hosszúság</translation> <translation>Hosszúság</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="596"/> <location filename="main.py" line="760"/>
<source>Width</source> <source>Width</source>
<translation>Szélesség</translation> <translation>Szélesség</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="597"/> <location filename="main.py" line="761"/>
<source>Height</source> <source>Height</source>
<translation>Magasság</translation> <translation>Magasság</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="598"/> <location filename="main.py" line="762"/>
<source>Weight</source> <source>Weight</source>
<translation>Súly</translation> <translation>Súly</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="553"/> <location filename="main.py" line="727"/>
<source>Dimension of the garage</source> <source>Dimension of the garage</source>
<translation>A garázs mérete</translation> <translation>A garázs mérete</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="592"/> <location filename="main.py" line="755"/>
<source>Dimensions of the objects to be stored</source> <source>Dimensions of the objects to be stored</source>
<translation>A tárolandó objektumok méretei</translation> <translation>A tárolandó objektumok méretei</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="652"/> <location filename="main.py" line="847"/>
<source>Result</source> <source>Result</source>
<translation>Eredmény</translation> <translation>Eredmény</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="655"/> <location filename="main.py" line="850"/>
<source>Volume of the garage</source> <source>Volume of the garage</source>
<translation>A garázs térfogata</translation> <translation>A garázs térfogata</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="659"/> <location filename="main.py" line="854"/>
<source>Volume of the items</source> <source>Volume of the items</source>
<translation>A tételek mennyisége</translation> <translation>A tételek mennyisége</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="663"/> <location filename="main.py" line="859"/>
<source>Free space in the garage</source> <source>Free space in the garage</source>
<translation>Szabad hely a garázsban</translation> <translation>Szabad hely a garázsban</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="667"/> <location filename="main.py" line="864"/>
<source>Total weight</source> <source>Total weight</source>
<translation>Teljes súly</translation> <translation>Teljes súly</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="212"/> <location filename="main.py" line="261"/>
<source>New (Ctrl+N)</source> <source>New (Ctrl+N)</source>
<translation>Új (Ctrl+N)</translation> <translation>Új (Ctrl+N)</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="213"/> <location filename="main.py" line="262"/>
<source>Open... (Ctrl+O)</source> <source>Open... (Ctrl+O)</source>
<translation>Nyissa ki (Ctrl+O)</translation> <translation>Nyissa ki (Ctrl+O)</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="214"/> <location filename="main.py" line="263"/>
<source>Save (Ctrl+S)</source> <source>Save (Ctrl+S)</source>
<translation>Mentés (Ctrl+S)</translation> <translation>Mentés (Ctrl+S)</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="215"/> <location filename="main.py" line="264"/>
<source>Export to EXCEL...</source> <source>Export to EXCEL...</source>
<translation>Exportálás EXCEL-be...</translation> <translation>Exportálás EXCEL-be...</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="216"/> <location filename="main.py" line="265"/>
<source>Information about the application</source> <source>Information about the application</source>
<translation>Az alkalmazással kapcsolatos információk</translation> <translation>Az alkalmazással kapcsolatos információk</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="217"/> <location filename="main.py" line="266"/>
<source>Quit the application (Strg+Q)</source> <source>Quit the application (Strg+Q)</source>
<translation>Az alkalmazás kilépése (Ctrl+Q)</translation> <translation>Az alkalmazás kilépése (Ctrl+Q)</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="408"/> <location filename="main.py" line="532"/>
<source>Garage</source> <source>Garage</source>
<translation>Garázs</translation> <translation>Garázs</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="336"/> <location filename="main.py" line="459"/>
<source>Quit</source> <source>Quit</source>
<translation>Kilépés</translation> <translation>Kilépés</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="345"/> <location filename="main.py" line="468"/>
<source>New</source> <source>New</source>
<translation>Új</translation> <translation>Új</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="362"/> <location filename="main.py" line="492"/>
<source>Save</source> <source>Save</source>
<translation>Mentés</translation> <translation>Mentés</translation>
</message> </message>
@ -212,27 +212,27 @@
<translation type="obsolete">CSV-fájl</translation> <translation type="obsolete">CSV-fájl</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="544"/> <location filename="main.py" line="718"/>
<source>All files</source> <source>All files</source>
<translation>Minden fájl</translation> <translation>Minden fájl</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="460"/> <location filename="main.py" line="597"/>
<source>file</source> <source>file</source>
<translation>fájl</translation> <translation>fájl</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="461"/> <location filename="main.py" line="598"/>
<source>saved</source> <source>saved</source>
<translation>mentett</translation> <translation>mentett</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="477"/> <location filename="main.py" line="614"/>
<source>Open</source> <source>Open</source>
<translation>Megnyitott</translation> <translation>Megnyitott</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="541"/> <location filename="main.py" line="715"/>
<source>Export</source> <source>Export</source>
<translation>Exportálás</translation> <translation>Exportálás</translation>
</message> </message>
@ -242,72 +242,127 @@
<translation type="obsolete">EXCEL-fájl</translation> <translation type="obsolete">EXCEL-fájl</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="724"/> <location filename="main.py" line="929"/>
<source>Error in the garage dimension</source> <source>Error in the garage dimension</source>
<translation>Hiba a garázs dimenziójában</translation> <translation>Hiba a garázs dimenziójában</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="777"/> <location filename="main.py" line="990"/>
<source>Error in the dimensions of the objects to be stored</source> <source>Error in the dimensions of the objects to be stored</source>
<translation>Hiba a tárolandó objektumok méreteiben</translation> <translation>Hiba a tárolandó objektumok méreteiben</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="671"/> <location filename="main.py" line="871"/>
<source>Successfully exported to EXCEL</source> <source>Successfully exported to EXCEL</source>
<translation>Sikeresen exportált EXCEL-be</translation> <translation>Sikeresen exportált EXCEL-be</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="478"/> <location filename="main.py" line="615"/>
<source>CSV-file</source> <source>CSV-file</source>
<translation>CSV-fájl</translation> <translation>CSV-fájl</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="542"/> <location filename="main.py" line="716"/>
<source>EXCEL-file</source> <source>EXCEL-file</source>
<translation>EXCEL-fájl</translation> <translation>EXCEL-fájl</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="73"/> <location filename="main.py" line="100"/>
<source>There are unsaved entries. Without saving, all changes are lost. Continue anyway?</source> <source>There are unsaved entries. Without saving, all changes are lost. Continue anyway?</source>
<translation>Vannak mentetlen bejegyzések. Mentés nélkül minden módosítás elveszik. Folytassa mégis?</translation> <translation>Vannak mentetlen bejegyzések. Mentés nélkül minden módosítás elveszik. Folytassa mégis?</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="147"/> <location filename="main.py" line="147"/>
<source>Garage Space Calculator</source> <source>Garage Space Calculator</source>
<translation>Garázs hely kalkulátor</translation> <translation type="obsolete">Garázs hely kalkulátor</translation>
</message> </message>
<message> <message>
<location filename="utils.py" line="40"/> <location filename="utils.py" line="45"/>
<source>Calculates available garage space</source> <source>Calculates available garage space</source>
<translation>Kiszámítja a rendelkezésre álló garázshelyet</translation> <translation>Kiszámítja a rendelkezésre álló garázshelyet</translation>
</message> </message>
<message> <message>
<location filename="main.py" line="199"/> <location filename="main.py" line="763"/>
<source>Comment</source> <source>Comment</source>
<translation>Megjegyzés</translation> <translation>Megjegyzés</translation>
</message> </message>
<message>
<location filename="main.py" line="334"/>
<source>Unit of Measurements</source>
<translation>Mérési egység</translation>
</message>
<message>
<location filename="main.py" line="335"/>
<source>Length units</source>
<translation>Hosszúsági egységek</translation>
</message>
<message>
<location filename="main.py" line="336"/>
<source>Mass units</source>
<translation>Tömegegységek</translation>
</message>
<message>
<location filename="main.py" line="321"/>
<source>&amp;File</source>
<translation>&amp;Fájl</translation>
</message>
<message>
<location filename="main.py" line="382"/>
<source>Help</source>
<translation>Segítség</translation>
</message>
<message>
<location filename="main.py" line="1095"/>
<source>Do you want to convert all existing stuff of type length to the new unit of measurement (UOM)</source>
<translation>Át akarja konvertálni az összes meglévő hosszúság típusú anyagot az új mértékegységre</translation>
</message>
<message>
<location filename="main.py" line="1127"/>
<source>UOM conversion</source>
<translation>Egység átváltás</translation>
</message>
<message>
<location filename="main.py" line="1126"/>
<source>Do you want to convert all existing stuff of type mass to the new unit of measurement (UOM)</source>
<translation>Át akarja konvertálni az összes meglévő tömeg típusú anyagot az új mértékegységre</translation>
</message>
</context> </context>
<context> <context>
<name>utils</name> <name>utils</name>
<message> <message>
<location filename="utils.py" line="41"/> <location filename="utils.py" line="46"/>
<source>Idea</source> <source>Idea</source>
<translation>Ötlet</translation> <translation>Ötlet</translation>
</message> </message>
<message> <message>
<location filename="utils.py" line="45"/> <location filename="utils.py" line="45"/>
<source>Used icons: Theme</source> <source>Used icons: Theme</source>
<translation>Használt ikonok: Téma</translation> <translation type="obsolete">Használt ikonok: Téma</translation>
</message> </message>
<message> <message>
<location filename="utils.py" line="45"/> <location filename="utils.py" line="50"/>
<source>from</source> <source>from</source>
<translation>a weboldalról</translation> <translation>a weboldalról</translation>
</message> </message>
<message> <message>
<location filename="utils.py" line="48"/> <location filename="utils.py" line="55"/>
<source>Version</source> <source>Version</source>
<translation>Verzió</translation> <translation>Verzió</translation>
</message> </message>
<message>
<location filename="utils.py" line="50"/>
<source>Used icons</source>
<translation>Használt ikonok</translation>
</message>
<message>
<location filename="utils.py" line="51"/>
<source>Currently opened file</source>
<translation>Jelenleg megnyitott fájl</translation>
</message>
<message>
<location filename="utils.py" line="52"/>
<source>Location of the Ini-file</source>
<translation>Az Ini-fájl helye</translation>
</message>
</context> </context>
</TS> </TS>

BIN
img/qt_logo_small.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 565 B

View file

@ -14,13 +14,22 @@ import os
# Third party imports # Third party imports
from PySide2.QtWidgets import QApplication, QTableWidget, QAbstractItemView, QTableWidgetItem, QMenu, \ from PySide2.QtWidgets import QApplication, QTableWidget, QAbstractItemView, QTableWidgetItem, QMenu, \
QMainWindow, QMessageBox QMainWindow, QMessageBox, QComboBox, QDialog
from PySide2.QtCore import Qt, QItemSelectionModel, QCoreApplication from PySide2.QtCore import Qt, QFile, QItemSelectionModel, QCoreApplication, Slot
from PySide2.QtGui import QIcon from PySide2.QtGui import QIcon, QColor, QPalette
from PySide2.QtUiTools import QUiLoader
# local imports
from utils import resource_path, convert_uom_to_length, convert_uom_to_mass
# local globals # local globals
SCRIPT_PATH = os.path.abspath(os.path.dirname(__file__)) SCRIPT_PATH = os.path.abspath(os.path.dirname(__file__))
DEFAULT_UOM_LENGTH = None
DEFAULT_UOM_MASS = None
UI_DLG_UOM = "./ui/dlg_uom.ui"
ICON_CLEAR = SCRIPT_PATH + "./img/icons8-clear-symbol-16.png" ICON_CLEAR = SCRIPT_PATH + "./img/icons8-clear-symbol-16.png"
ICON_COPY = SCRIPT_PATH + "./img/icons8-copy-16.png" ICON_COPY = SCRIPT_PATH + "./img/icons8-copy-16.png"
ICON_ERASER = SCRIPT_PATH + "/img/icons8-eraser-16.png" ICON_ERASER = SCRIPT_PATH + "/img/icons8-eraser-16.png"
@ -43,11 +52,14 @@ ICON_DEL = SCRIPT_PATH + "/img/icons8-delete-16.png"
# return os.path.join(base_path, relative_path) # return os.path.join(base_path, relative_path)
class TableWidget(QTableWidget): class TableWidget(QTableWidget):
def __init__(self, parent=None): def __init__(self, parent=None, uom_length=DEFAULT_UOM_LENGTH, uom_mass=DEFAULT_UOM_MASS):
super().__init__() super().__init__()
self.parent = parent self.parent = parent
self.default_uom_length = uom_length
self.default_uom_mass = uom_mass
# self.setSelectionMode(QAbstractItemView.ContiguousSelection) # self.setSelectionMode(QAbstractItemView.ContiguousSelection)
self.setSelectionMode(QAbstractItemView.SingleSelection) self.setSelectionMode(QAbstractItemView.SingleSelection)
@ -70,8 +82,6 @@ class TableWidget(QTableWidget):
self.vertHeader.setSelectionMode(QAbstractItemView.SingleSelection) self.vertHeader.setSelectionMode(QAbstractItemView.SingleSelection)
self.vertHeader.sectionClicked.connect(self.select_row) self.vertHeader.sectionClicked.connect(self.select_row)
self.vertHeader.setSectionsMovable(True) self.vertHeader.setSectionsMovable(True)
# optimize row height
self.resizeRowsToContents()
self.row_selected = False self.row_selected = False
@ -87,8 +97,6 @@ class TableWidget(QTableWidget):
item_copy = menu.addAction(QIcon(ICON_COPY), QCoreApplication.translate("TableWidget", "Copy") + "\tCtrl+C") item_copy = menu.addAction(QIcon(ICON_COPY), QCoreApplication.translate("TableWidget", "Copy") + "\tCtrl+C")
item_paste = menu.addAction(QIcon(ICON_PASTE), QCoreApplication.translate("TableWidget", "Paste") + "\tCtrl+V") item_paste = menu.addAction(QIcon(ICON_PASTE), QCoreApplication.translate("TableWidget", "Paste") + "\tCtrl+V")
menu.addSeparator() menu.addSeparator()
print(ICON_ERASER)
item_delete = menu.addAction(QIcon(ICON_ERASER), QCoreApplication.translate("TableWidget", "Delete") + "\tDel") item_delete = menu.addAction(QIcon(ICON_ERASER), QCoreApplication.translate("TableWidget", "Delete") + "\tDel")
ac = menu.exec_(self.mapToGlobal(position)) ac = menu.exec_(self.mapToGlobal(position))
@ -183,41 +191,144 @@ class TableWidget(QTableWidget):
if key == Qt.Key_Delete: if key == Qt.Key_Delete:
self.item_del() self.item_del()
elif key == Qt.Key_F3:
item = self.item(self.currentRow(), self.currentColumn())
try:
self.parent.cols_with_uom_length
self.parent.cols_with_uom_mass
except:
return False
else:
if self.currentColumn() in self.parent.cols_with_uom_length:
self.f3_pressed(item, "UOM_TYPE_LENGTH")
elif self.currentColumn() in self.parent.cols_with_uom_mass:
self.f3_pressed(item, "UOM_TYPE_MASS")
elif key == Qt.Key_Escape: elif key == Qt.Key_Escape:
self.clearSelection() self.clearSelection()
def item_paste(self): def f3_pressed(self, item, uom_type) -> bool:
cur_row = self.currentRow() if item:
cur_col = self.currentColumn() try:
# ask_confirmation = True float(item.text().replace(",", "."))
except ValueError:
return False # we've got an existing text here
if self.row_selected: loader = QUiLoader()
cur_col = 0 path = os.path.join(os.path.dirname(__file__), resource_path(UI_DLG_UOM))
ui_file = QFile(path)
ui_file.open(QFile.ReadOnly)
self.dlg = loader.load(ui_file, self)
ui_file.close()
col = 0 self.dlg.uom_type = uom_type
if len(self.clipboard_data) == 1: if uom_type == "UOM_TYPE_MASS":
data = self.clipboard_data[0] self.dlg.cmbUOM.addItems(["kg", "g"])
item = QTableWidgetItem(data) else: # anticipate uom type length
self.dlg.cmbUOM.addItems(["m", "cm", "mm"])
self.setItem(cur_row, cur_col, item) if item:
item.setSelected(True) self.dlg.efValue.setText(item.text())
print("UOM of the cell:", item.data(Qt.UserRole))
self.dlg.cmbUOM.setCurrentText(item.data(Qt.UserRole))
if item.data(Qt.UserRole):
self.old_uom = item.data(Qt.UserRole)
else:
if uom_type == "UOM_TYPE_MASS":
self.old_uom = self.default_uom_mass
else:
self.old_uom = self.default_uom_length
self.dlg.cmbUOM.currentIndexChanged.connect(self.on_cmbUOM_itemChanged)
if self.dlg.exec() == QDialog.Accepted:
if not item:
item = QTableWidgetItem("Dummy")
self.setItem(self.currentRow(), self.currentColumn(), item)
item.setText(self.dlg.efValue.text())
#item.setStyleSheet("border: 1px solid yellow;")
item.setData(Qt.UserRole, self.dlg.cmbUOM.currentText()) ## store UOM-Text at UserRole
item.setData(Qt.UserRole+1, self.dlg.cmbUOM.currentText()) ## store UOM-Type at UserRole+1 (1==UOM_LENGTH, 2==UOM_MASS)
if self.dlg.cmbUOM.currentText() not in (self.default_uom_length, self.default_uom_mass):
item.setData(Qt.BackgroundRole, QColor(Qt.yellow))
item.setToolTip("[" + item.data(Qt.UserRole) + "]")
else:
item.setData(Qt.BackgroundRole, None)
item.setToolTip(None)
return True
@Slot(int)
def on_cmbUOM_itemChanged(self, index):
try:
old_val = float(self.dlg.efValue.text().replace(",", "."))
except ValueError:
# special case: edit field is emppty because user changes UOM first.
self.old_uom = self.dlg.cmbUOM.currentText()
pass
else: else:
for data in self.clipboard_data: new_uom = self.dlg.cmbUOM.currentText()
if self.dlg.uom_type == "UOM_TYPE_LENGTH":
new_val = convert_uom_to_length(old_val, self.old_uom, new_uom)
elif self.dlg.uom_type == "UOM_TYPE_MASS":
new_val = convert_uom_to_mass(old_val, self.old_uom, new_uom)
self.dlg.efValue.setText(str(new_val).replace(".", ","))
self.old_uom = new_uom
# def setUOM(self, item, uom):
# if uom not in (DEFAULT_UOM_LENGTH, DEFAULT_UOM_MASS):
# item.setData(Qt.UserRole, uom)
# item.setData(Qt.BackgroundRole, QColor(Qt.yellow))
# item.setToolTip(f"[{uom}]")
# else:
# item.setData(Qt.BackgroundRole, None)
# item.setToolTip(None)
def setUOM(self, item, uom):
item.setData(Qt.UserRole, uom)
if uom not in (self.default_uom_length, self.default_uom_mass):
item.setData(Qt.BackgroundRole, QColor(Qt.yellow))
item.setToolTip(f"[{uom}]")
else:
item.setData(Qt.BackgroundRole, None)
item.setToolTip(None)
def item_paste(self):
if self.clipboard_data:
cur_row = self.currentRow()
cur_col = self.currentColumn()
# ask_confirmation = True
if self.row_selected:
cur_col = 0
col = 0
if len(self.clipboard_data) == 1:
data = self.clipboard_data[0]
item = QTableWidgetItem(data) item = QTableWidgetItem(data)
# if item:
# if len(item.text()) >0:
# if ask_confirmation:
# msg = QCoreApplication.translate("TableWidget", "Zelle enthält bereits Daten. Überschreiben?")
# reply = QMessageBox.question(self, QCoreApplication.translate("TableWidget", "Überschreiben"), msg, \
# QMessageBox.Yes | QMessageBox.No, QMessageBox.Yes)
# if reply == QMessageBox.No:
# return False
# ask_confirmation = False self.setItem(cur_row, cur_col, item)
self.setItem(cur_row, col, item)
item.setSelected(True) item.setSelected(True)
else:
for data in self.clipboard_data:
item = QTableWidgetItem(data)
# if item:
# if len(item.text()) >0:
# if ask_confirmation:
# msg = QCoreApplication.translate("TableWidget", "Zelle enthält bereits Daten. Überschreiben?")
# reply = QMessageBox.question(self, QCoreApplication.translate("TableWidget", "Überschreiben"), msg, \
# QMessageBox.Yes | QMessageBox.No, QMessageBox.Yes)
# if reply == QMessageBox.No:
# return False
col += 1 # ask_confirmation = False
self.setItem(cur_row, col, item)
item.setSelected(True)
col += 1
def item_cut(self): def item_cut(self):
self.item_copy() self.item_copy()
@ -259,7 +370,10 @@ class TableWidget(QTableWidget):
return False return False
ask_cofirmation = False ask_cofirmation = False
item.setData(Qt.DisplayRole, None) item.setData(Qt.DisplayRole, None) # remove text
item.setData(Qt.BackgroundRole, None) # remove cell background color
item.setData(Qt.UserRole, None) # remove UOM
item.setToolTip(None) # remove tooltip
if len(sel_idx) == self.columnCount() * self.rowCount(): if len(sel_idx) == self.columnCount() * self.rowCount():
try: try:

File diff suppressed because it is too large Load diff

View file

@ -31,7 +31,10 @@ def resource_path(relative_path):
return os.path.join(base_path, relative_path) return os.path.join(base_path, relative_path)
def show_about(): def show_about(ini_file="", opened_file=""):
if not opened_file:
opened_file = ""
qApp = QApplication.instance() qApp = QApplication.instance()
msg = QMessageBox() msg = QMessageBox()
msg.setIconPixmap(QPixmap(resource_path(APP_ICON))) msg.setIconPixmap(QPixmap(resource_path(APP_ICON)))
@ -44,7 +47,9 @@ def show_about():
"<br>" + qApp.copyright + "<br>" \ "<br>" + qApp.copyright + "<br>" \
"<br> <a href='" + qApp.website + "'>" + qApp.website + "</a></p>" "<br> <a href='" + qApp.website + "'>" + qApp.website + "</a></p>"
text = text + "<p align='center'>" + qApp.translate("utils", "Used icons: Theme") + " 'Cute Color' " + qApp.translate("utils", "from") + " <a href='https://icons8.com/'>Icons8</a></p>" text = text + "<p align='center'>" + qApp.translate("utils", "Used icons") + ": 'Cute Color' " + qApp.translate("utils", "from") + " <a href='https://icons8.com/'>Icons8</a></p>"
text = text + "<p align='center'>" + qApp.translate("utils", "Currently opened file") + ": <br>" + opened_file + " </p>"
text = text + "<p align='center'>" + qApp.translate("utils", "Location of the Ini-file") + ": <br>" + ini_file + " </p>"
text = text + "<p align='center'>Python " + qApp.translate("utils", "Version") + ": " + f"{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro} {sys.version_info.releaselevel}" text = text + "<p align='center'>Python " + qApp.translate("utils", "Version") + ": " + f"{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro} {sys.version_info.releaselevel}"
text = text + "<br>" + f"{sys.executable}" + "<br>" text = text + "<br>" + f"{sys.executable}" + "<br>"
text = text + "<br>Qt " + qApp.translate("utils", "Version") + ": " + f"{QtCore.__version__}" text = text + "<br>Qt " + qApp.translate("utils", "Version") + ": " + f"{QtCore.__version__}"
@ -84,7 +89,7 @@ def fit_col_widths(table, worksheet):
sel_rows = [] sel_rows = []
for sel_index in sel_rows_idx: for sel_index in sel_rows_idx:
sel_rows.append(sel_index.row()) sel_rows.append(sel_index.row())
for col_ind in range(model.columnCount()): for col_ind in range(model.columnCount()):
cur_item_length = 0 cur_item_length = 0
lengths = [] lengths = []
@ -95,7 +100,7 @@ def fit_col_widths(table, worksheet):
if not table.isColumnHidden(col_ind): # export only visible column headers if not table.isColumnHidden(col_ind): # export only visible column headers
cur_item_length = len(col_header_text) cur_item_length = len(col_header_text)
lengths.append(cur_item_length) lengths.append(cur_item_length)
# get columns data lengths # get columns data lengths
row = 1 row = 1
# iterate over all rows # iterate over all rows
@ -129,3 +134,25 @@ def fit_col_widths(table, worksheet):
if col_width > STD_COL_WIDTH: # anticipated default size if col_width > STD_COL_WIDTH: # anticipated default size
worksheet.set_column(col_ind, col_ind, col_width*1.25) worksheet.set_column(col_ind, col_ind, col_width*1.25)
col_ind += 1 col_ind += 1
def convert_uom_to_length(val, unit_in, unit_out):
SI = {'mm':0.001, 'cm':0.01, 'm':1.0}
return val*SI[unit_in]/SI[unit_out]
def convert_uom_to_mass(val, unit_in, unit_out):
SI = {'g':0.001, 'kg':1.0}
return val*SI[unit_in]/SI[unit_out]
def optimizeTableLayout(table):
for col in range(table.columnCount()): # optimize column width
table.resizeColumnToContents(col)
table.resizeRowsToContents() # optimize row height
def table_has_items(tablewidget):
for row in range(tablewidget.rowCount()):
for col in range(tablewidget.columnCount()):
item = tablewidget.item(row, col)
if item:
return True
return False

92
ui/dlg_uom.ui Normal file
View file

@ -0,0 +1,92 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Dialog</class>
<widget class="QDialog" name="Dialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>222</width>
<height>100</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Value:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="efValue">
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_2">
<property name="text">
<string>UOM:</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QComboBox" name="cmbUOM"/>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>Dialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>Dialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>