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
## [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
## Added
- Dezimalzahlen werden nun mit Dezimaltrennzeichen Komma (",") eingegeben statt Punkt (".")

Binary file not shown.

View file

@ -4,77 +4,77 @@
<context>
<name>TableWidget</name>
<message>
<location filename="clsTableWidget.py" line="87"/>
<location filename="clsTableWidget.py" line="96"/>
<source>Cut</source>
<translation>Ausschneiden</translation>
</message>
<message>
<location filename="clsTableWidget.py" line="88"/>
<location filename="clsTableWidget.py" line="97"/>
<source>Copy</source>
<translation>Kopieren</translation>
</message>
<message>
<location filename="clsTableWidget.py" line="89"/>
<location filename="clsTableWidget.py" line="98"/>
<source>Paste</source>
<translation>Einfügen</translation>
</message>
<message>
<location filename="clsTableWidget.py" line="258"/>
<location filename="clsTableWidget.py" line="367"/>
<source>Delete</source>
<translation>Löschen</translation>
</message>
<message>
<location filename="clsTableWidget.py" line="108"/>
<location filename="clsTableWidget.py" line="115"/>
<source>Cut row</source>
<translation>Zeile ausschneiden</translation>
</message>
<message>
<location filename="clsTableWidget.py" line="109"/>
<location filename="clsTableWidget.py" line="116"/>
<source>Copy row</source>
<translation>Zeile kopieren</translation>
</message>
<message>
<location filename="clsTableWidget.py" line="110"/>
<location filename="clsTableWidget.py" line="117"/>
<source>Paste row</source>
<translation>Zeile einfügen</translation>
</message>
<message>
<location filename="clsTableWidget.py" line="112"/>
<location filename="clsTableWidget.py" line="119"/>
<source>Insert row before</source>
<translation>Zeile oberhalb einfügen</translation>
</message>
<message>
<location filename="clsTableWidget.py" line="113"/>
<location filename="clsTableWidget.py" line="120"/>
<source>Insert row after</source>
<translation>Zeile unterhalb einfügen</translation>
</message>
<message>
<location filename="clsTableWidget.py" line="115"/>
<location filename="clsTableWidget.py" line="122"/>
<source>Remove row</source>
<translation>Zeile entfernen</translation>
</message>
<message>
<location filename="clsTableWidget.py" line="116"/>
<location filename="clsTableWidget.py" line="123"/>
<source>Delete items</source>
<translation>Zellinhalte löschen</translation>
</message>
<message>
<location filename="clsTableWidget.py" line="151"/>
<location filename="clsTableWidget.py" line="158"/>
<source>Row Nr.</source>
<translation>Zeile Nr.</translation>
</message>
<message>
<location filename="clsTableWidget.py" line="152"/>
<location filename="clsTableWidget.py" line="159"/>
<source>to be removed?</source>
<translation>entfernen?</translation>
</message>
<message>
<location filename="clsTableWidget.py" line="152"/>
<location filename="clsTableWidget.py" line="159"/>
<source>Remove</source>
<translation>Entfernen</translation>
</message>
<message>
<location filename="clsTableWidget.py" line="258"/>
<location filename="clsTableWidget.py" line="367"/>
<source>Delete cell content?</source>
<translation>Zellinhalt löschen?</translation>
</message>
@ -87,122 +87,122 @@
<translation type="obsolete">Hallo Welt</translation>
</message>
<message>
<location filename="main.py" line="178"/>
<location filename="main.py" line="330"/>
<source>&amp;Settings</source>
<translation>&amp;Einstellungen</translation>
</message>
<message>
<location filename="main.py" line="179"/>
<location filename="main.py" line="332"/>
<source>Language</source>
<translation>Sprache</translation>
</message>
<message>
<location filename="main.py" line="193"/>
<location filename="main.py" line="242"/>
<source>Stuff</source>
<translation>Gegenstand</translation>
</message>
<message>
<location filename="main.py" line="595"/>
<location filename="main.py" line="759"/>
<source>Length</source>
<translation>Länge</translation>
</message>
<message>
<location filename="main.py" line="596"/>
<location filename="main.py" line="760"/>
<source>Width</source>
<translation>Breite</translation>
</message>
<message>
<location filename="main.py" line="597"/>
<location filename="main.py" line="761"/>
<source>Height</source>
<translation>Höhe</translation>
</message>
<message>
<location filename="main.py" line="598"/>
<location filename="main.py" line="762"/>
<source>Weight</source>
<translation>Gewicht</translation>
</message>
<message>
<location filename="main.py" line="553"/>
<location filename="main.py" line="727"/>
<source>Dimension of the garage</source>
<translation>Dimension der Garage</translation>
</message>
<message>
<location filename="main.py" line="592"/>
<location filename="main.py" line="755"/>
<source>Dimensions of the objects to be stored</source>
<translation>Dimensionen der zu verstauenden Gegenstände</translation>
</message>
<message>
<location filename="main.py" line="652"/>
<location filename="main.py" line="847"/>
<source>Result</source>
<translation>Ergebnis</translation>
</message>
<message>
<location filename="main.py" line="655"/>
<location filename="main.py" line="850"/>
<source>Volume of the garage</source>
<translation>Volumen der Garage</translation>
</message>
<message>
<location filename="main.py" line="659"/>
<location filename="main.py" line="854"/>
<source>Volume of the items</source>
<translation>Volumen der Gegenstände</translation>
</message>
<message>
<location filename="main.py" line="663"/>
<location filename="main.py" line="859"/>
<source>Free space in the garage</source>
<translation>Freier Raum in der Garage</translation>
</message>
<message>
<location filename="main.py" line="667"/>
<location filename="main.py" line="864"/>
<source>Total weight</source>
<translation>Gesamtgewicht</translation>
</message>
<message>
<location filename="main.py" line="212"/>
<location filename="main.py" line="261"/>
<source>New (Ctrl+N)</source>
<translation>Neu (Strg+N)</translation>
</message>
<message>
<location filename="main.py" line="213"/>
<location filename="main.py" line="262"/>
<source>Open... (Ctrl+O)</source>
<translation>Öffnen... (Strg+O)</translation>
</message>
<message>
<location filename="main.py" line="214"/>
<location filename="main.py" line="263"/>
<source>Save (Ctrl+S)</source>
<translation>Speichern (Strg+S)</translation>
</message>
<message>
<location filename="main.py" line="215"/>
<location filename="main.py" line="264"/>
<source>Export to EXCEL...</source>
<translation>Export nach EXCEL...</translation>
</message>
<message>
<location filename="main.py" line="216"/>
<location filename="main.py" line="265"/>
<source>Information about the application</source>
<translation>Informationen über das Programm</translation>
</message>
<message>
<location filename="main.py" line="217"/>
<location filename="main.py" line="266"/>
<source>Quit the application (Strg+Q)</source>
<translation>Programm beenden (Strg+Q)</translation>
</message>
<message>
<location filename="main.py" line="408"/>
<location filename="main.py" line="532"/>
<source>Garage</source>
<translation>Garage</translation>
</message>
<message>
<location filename="main.py" line="336"/>
<location filename="main.py" line="459"/>
<source>Quit</source>
<translation>Beenden</translation>
</message>
<message>
<location filename="main.py" line="345"/>
<location filename="main.py" line="468"/>
<source>New</source>
<translation>Neu</translation>
</message>
<message>
<location filename="main.py" line="362"/>
<location filename="main.py" line="492"/>
<source>Save</source>
<translation>Speichern</translation>
</message>
@ -212,27 +212,27 @@
<translation type="obsolete">CSV-Datei</translation>
</message>
<message>
<location filename="main.py" line="544"/>
<location filename="main.py" line="718"/>
<source>All files</source>
<translation>Alle Dateien</translation>
</message>
<message>
<location filename="main.py" line="460"/>
<location filename="main.py" line="597"/>
<source>file</source>
<translation>Datei</translation>
</message>
<message>
<location filename="main.py" line="461"/>
<location filename="main.py" line="598"/>
<source>saved</source>
<translation>gespeichert</translation>
</message>
<message>
<location filename="main.py" line="477"/>
<location filename="main.py" line="614"/>
<source>Open</source>
<translation>Öffnen</translation>
</message>
<message>
<location filename="main.py" line="541"/>
<location filename="main.py" line="715"/>
<source>Export</source>
<translation>Export</translation>
</message>
@ -242,72 +242,127 @@
<translation type="obsolete">EXCEL-Datei</translation>
</message>
<message>
<location filename="main.py" line="724"/>
<location filename="main.py" line="929"/>
<source>Error in the garage dimension</source>
<translation>Fehler in der Garagen-Dimension</translation>
</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>
<translation>Fehler in den Dimensionen der zu verstauenden Gegenstände</translation>
</message>
<message>
<location filename="main.py" line="671"/>
<location filename="main.py" line="871"/>
<source>Successfully exported to EXCEL</source>
<translation>Erfolgreich nach EXCEL exportiert</translation>
</message>
<message>
<location filename="main.py" line="478"/>
<location filename="main.py" line="615"/>
<source>CSV-file</source>
<translation>CSV-Datei</translation>
</message>
<message>
<location filename="main.py" line="542"/>
<location filename="main.py" line="716"/>
<source>EXCEL-file</source>
<translation>EXCEL-Datei</translation>
</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>
<translation>Es gibt ungespeicherte Einträge. Ohne zu speichern, gehen alle Änderungen verloren. Trotzdem fortfahren?</translation>
</message>
<message>
<location filename="main.py" line="147"/>
<source>Garage Space Calculator</source>
<translation>Garagenraum-Rechner</translation>
<translation type="obsolete">Garagenraum-Rechner</translation>
</message>
<message>
<location filename="utils.py" line="40"/>
<location filename="utils.py" line="45"/>
<source>Calculates available garage space</source>
<translation>Berechnet zur Verfügung stehenden Garagenraum</translation>
</message>
<message>
<location filename="main.py" line="199"/>
<location filename="main.py" line="763"/>
<source>Comment</source>
<translation>Kommentar</translation>
</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>
<name>utils</name>
<message>
<location filename="utils.py" line="41"/>
<location filename="utils.py" line="46"/>
<source>Idea</source>
<translation>Idee</translation>
</message>
<message>
<location filename="utils.py" line="45"/>
<source>Used icons: Theme</source>
<translation>Verwendete Icons: Thema</translation>
<translation type="obsolete">Verwendete Icons: Thema</translation>
</message>
<message>
<location filename="utils.py" line="45"/>
<location filename="utils.py" line="50"/>
<source>from</source>
<translation>von</translation>
</message>
<message>
<location filename="utils.py" line="48"/>
<location filename="utils.py" line="55"/>
<source>Version</source>
<translation>Version</translation>
</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>
</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>
<TS version="2.1" language="de_DE">
<context>
<name>TableWidget</name>
<message>
<location filename="clsTableWidget.py" line="87"/>
<location filename="clsTableWidget.py" line="96"/>
<source>Cut</source>
<translation>kivágni</translation>
</message>
<message>
<location filename="clsTableWidget.py" line="88"/>
<location filename="clsTableWidget.py" line="97"/>
<source>Copy</source>
<translation>másolás</translation>
</message>
<message>
<location filename="clsTableWidget.py" line="89"/>
<location filename="clsTableWidget.py" line="98"/>
<source>Paste</source>
<translation>Beillesztés</translation>
</message>
<message>
<location filename="clsTableWidget.py" line="258"/>
<location filename="clsTableWidget.py" line="367"/>
<source>Delete</source>
<translation>Törlés</translation>
</message>
<message>
<location filename="clsTableWidget.py" line="108"/>
<location filename="clsTableWidget.py" line="115"/>
<source>Cut row</source>
<translation>Vágott vonal</translation>
</message>
<message>
<location filename="clsTableWidget.py" line="109"/>
<location filename="clsTableWidget.py" line="116"/>
<source>Copy row</source>
<translation>Vettem a szöveget</translation>
</message>
<message>
<location filename="clsTableWidget.py" line="110"/>
<location filename="clsTableWidget.py" line="117"/>
<source>Paste row</source>
<translation>Beilleszteni a sort</translation>
</message>
<message>
<location filename="clsTableWidget.py" line="112"/>
<location filename="clsTableWidget.py" line="119"/>
<source>Insert row before</source>
<translation>A fenti sort beilleszteni</translation>
</message>
<message>
<location filename="clsTableWidget.py" line="113"/>
<location filename="clsTableWidget.py" line="120"/>
<source>Insert row after</source>
<translation>Az alábbi sor beillesztése</translation>
</message>
<message>
<location filename="clsTableWidget.py" line="115"/>
<location filename="clsTableWidget.py" line="122"/>
<source>Remove row</source>
<translation>Távolítsa el a sort</translation>
</message>
<message>
<location filename="clsTableWidget.py" line="116"/>
<location filename="clsTableWidget.py" line="123"/>
<source>Delete items</source>
<translation>Tartalom törlése</translation>
</message>
<message>
<location filename="clsTableWidget.py" line="151"/>
<location filename="clsTableWidget.py" line="158"/>
<source>Row Nr.</source>
<translation>Vonalszám.</translation>
</message>
<message>
<location filename="clsTableWidget.py" line="152"/>
<location filename="clsTableWidget.py" line="159"/>
<source>to be removed?</source>
<translation>eltávolítani?</translation>
</message>
<message>
<location filename="clsTableWidget.py" line="152"/>
<location filename="clsTableWidget.py" line="159"/>
<source>Remove</source>
<translation>A eltávolítása</translation>
</message>
<message>
<location filename="clsTableWidget.py" line="258"/>
<location filename="clsTableWidget.py" line="367"/>
<source>Delete cell content?</source>
<translation>Cellatartalom törlése?</translation>
</message>
@ -87,122 +87,122 @@
<translation type="obsolete">Hallo Welt</translation>
</message>
<message>
<location filename="main.py" line="178"/>
<location filename="main.py" line="330"/>
<source>&amp;Settings</source>
<translation>&amp;Beállítások</translation>
</message>
<message>
<location filename="main.py" line="179"/>
<location filename="main.py" line="332"/>
<source>Language</source>
<translation>Nyelv</translation>
</message>
<message>
<location filename="main.py" line="193"/>
<location filename="main.py" line="242"/>
<source>Stuff</source>
<translation>Tárgy</translation>
</message>
<message>
<location filename="main.py" line="595"/>
<location filename="main.py" line="759"/>
<source>Length</source>
<translation>Hosszúság</translation>
</message>
<message>
<location filename="main.py" line="596"/>
<location filename="main.py" line="760"/>
<source>Width</source>
<translation>Szélesség</translation>
</message>
<message>
<location filename="main.py" line="597"/>
<location filename="main.py" line="761"/>
<source>Height</source>
<translation>Magasság</translation>
</message>
<message>
<location filename="main.py" line="598"/>
<location filename="main.py" line="762"/>
<source>Weight</source>
<translation>Súly</translation>
</message>
<message>
<location filename="main.py" line="553"/>
<location filename="main.py" line="727"/>
<source>Dimension of the garage</source>
<translation>A garázs mérete</translation>
</message>
<message>
<location filename="main.py" line="592"/>
<location filename="main.py" line="755"/>
<source>Dimensions of the objects to be stored</source>
<translation>A tárolandó objektumok méretei</translation>
</message>
<message>
<location filename="main.py" line="652"/>
<location filename="main.py" line="847"/>
<source>Result</source>
<translation>Eredmény</translation>
</message>
<message>
<location filename="main.py" line="655"/>
<location filename="main.py" line="850"/>
<source>Volume of the garage</source>
<translation>A garázs térfogata</translation>
</message>
<message>
<location filename="main.py" line="659"/>
<location filename="main.py" line="854"/>
<source>Volume of the items</source>
<translation>A tételek mennyisége</translation>
</message>
<message>
<location filename="main.py" line="663"/>
<location filename="main.py" line="859"/>
<source>Free space in the garage</source>
<translation>Szabad hely a garázsban</translation>
</message>
<message>
<location filename="main.py" line="667"/>
<location filename="main.py" line="864"/>
<source>Total weight</source>
<translation>Teljes súly</translation>
</message>
<message>
<location filename="main.py" line="212"/>
<location filename="main.py" line="261"/>
<source>New (Ctrl+N)</source>
<translation>Új (Ctrl+N)</translation>
</message>
<message>
<location filename="main.py" line="213"/>
<location filename="main.py" line="262"/>
<source>Open... (Ctrl+O)</source>
<translation>Nyissa ki (Ctrl+O)</translation>
</message>
<message>
<location filename="main.py" line="214"/>
<location filename="main.py" line="263"/>
<source>Save (Ctrl+S)</source>
<translation>Mentés (Ctrl+S)</translation>
</message>
<message>
<location filename="main.py" line="215"/>
<location filename="main.py" line="264"/>
<source>Export to EXCEL...</source>
<translation>Exportálás EXCEL-be...</translation>
</message>
<message>
<location filename="main.py" line="216"/>
<location filename="main.py" line="265"/>
<source>Information about the application</source>
<translation>Az alkalmazással kapcsolatos információk</translation>
</message>
<message>
<location filename="main.py" line="217"/>
<location filename="main.py" line="266"/>
<source>Quit the application (Strg+Q)</source>
<translation>Az alkalmazás kilépése (Ctrl+Q)</translation>
</message>
<message>
<location filename="main.py" line="408"/>
<location filename="main.py" line="532"/>
<source>Garage</source>
<translation>Garázs</translation>
</message>
<message>
<location filename="main.py" line="336"/>
<location filename="main.py" line="459"/>
<source>Quit</source>
<translation>Kilépés</translation>
</message>
<message>
<location filename="main.py" line="345"/>
<location filename="main.py" line="468"/>
<source>New</source>
<translation>Új</translation>
</message>
<message>
<location filename="main.py" line="362"/>
<location filename="main.py" line="492"/>
<source>Save</source>
<translation>Mentés</translation>
</message>
@ -212,27 +212,27 @@
<translation type="obsolete">CSV-fájl</translation>
</message>
<message>
<location filename="main.py" line="544"/>
<location filename="main.py" line="718"/>
<source>All files</source>
<translation>Minden fájl</translation>
</message>
<message>
<location filename="main.py" line="460"/>
<location filename="main.py" line="597"/>
<source>file</source>
<translation>fájl</translation>
</message>
<message>
<location filename="main.py" line="461"/>
<location filename="main.py" line="598"/>
<source>saved</source>
<translation>mentett</translation>
</message>
<message>
<location filename="main.py" line="477"/>
<location filename="main.py" line="614"/>
<source>Open</source>
<translation>Megnyitott</translation>
</message>
<message>
<location filename="main.py" line="541"/>
<location filename="main.py" line="715"/>
<source>Export</source>
<translation>Exportálás</translation>
</message>
@ -242,72 +242,127 @@
<translation type="obsolete">EXCEL-fájl</translation>
</message>
<message>
<location filename="main.py" line="724"/>
<location filename="main.py" line="929"/>
<source>Error in the garage dimension</source>
<translation>Hiba a garázs dimenziójában</translation>
</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>
<translation>Hiba a tárolandó objektumok méreteiben</translation>
</message>
<message>
<location filename="main.py" line="671"/>
<location filename="main.py" line="871"/>
<source>Successfully exported to EXCEL</source>
<translation>Sikeresen exportált EXCEL-be</translation>
</message>
<message>
<location filename="main.py" line="478"/>
<location filename="main.py" line="615"/>
<source>CSV-file</source>
<translation>CSV-fájl</translation>
</message>
<message>
<location filename="main.py" line="542"/>
<location filename="main.py" line="716"/>
<source>EXCEL-file</source>
<translation>EXCEL-fájl</translation>
</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>
<translation>Vannak mentetlen bejegyzések. Mentés nélkül minden módosítás elveszik. Folytassa mégis?</translation>
</message>
<message>
<location filename="main.py" line="147"/>
<source>Garage Space Calculator</source>
<translation>Garázs hely kalkulátor</translation>
<translation type="obsolete">Garázs hely kalkulátor</translation>
</message>
<message>
<location filename="utils.py" line="40"/>
<location filename="utils.py" line="45"/>
<source>Calculates available garage space</source>
<translation>Kiszámítja a rendelkezésre álló garázshelyet</translation>
</message>
<message>
<location filename="main.py" line="199"/>
<location filename="main.py" line="763"/>
<source>Comment</source>
<translation>Megjegyzés</translation>
</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>
<name>utils</name>
<message>
<location filename="utils.py" line="41"/>
<location filename="utils.py" line="46"/>
<source>Idea</source>
<translation>Ötlet</translation>
</message>
<message>
<location filename="utils.py" line="45"/>
<source>Used icons: Theme</source>
<translation>Használt ikonok: Téma</translation>
<translation type="obsolete">Használt ikonok: Téma</translation>
</message>
<message>
<location filename="utils.py" line="45"/>
<location filename="utils.py" line="50"/>
<source>from</source>
<translation>a weboldalról</translation>
</message>
<message>
<location filename="utils.py" line="48"/>
<location filename="utils.py" line="55"/>
<source>Version</source>
<translation>Verzió</translation>
</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>
</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
from PySide2.QtWidgets import QApplication, QTableWidget, QAbstractItemView, QTableWidgetItem, QMenu, \
QMainWindow, QMessageBox
from PySide2.QtCore import Qt, QItemSelectionModel, QCoreApplication
from PySide2.QtGui import QIcon
QMainWindow, QMessageBox, QComboBox, QDialog
from PySide2.QtCore import Qt, QFile, QItemSelectionModel, QCoreApplication, Slot
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
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_COPY = SCRIPT_PATH + "./img/icons8-copy-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)
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__()
self.parent = parent
self.default_uom_length = uom_length
self.default_uom_mass = uom_mass
# self.setSelectionMode(QAbstractItemView.ContiguousSelection)
self.setSelectionMode(QAbstractItemView.SingleSelection)
@ -70,8 +82,6 @@ class TableWidget(QTableWidget):
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
@ -87,8 +97,6 @@ class TableWidget(QTableWidget):
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")
menu.addSeparator()
print(ICON_ERASER)
item_delete = menu.addAction(QIcon(ICON_ERASER), QCoreApplication.translate("TableWidget", "Delete") + "\tDel")
ac = menu.exec_(self.mapToGlobal(position))
@ -183,10 +191,113 @@ class TableWidget(QTableWidget):
if key == Qt.Key_Delete:
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:
self.clearSelection()
def f3_pressed(self, item, uom_type) -> bool:
if item:
try:
float(item.text().replace(",", "."))
except ValueError:
return False # we've got an existing text here
loader = QUiLoader()
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()
self.dlg.uom_type = uom_type
if uom_type == "UOM_TYPE_MASS":
self.dlg.cmbUOM.addItems(["kg", "g"])
else: # anticipate uom type length
self.dlg.cmbUOM.addItems(["m", "cm", "mm"])
if item:
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:
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
@ -259,7 +370,10 @@ class TableWidget(QTableWidget):
return 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():
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)
def show_about():
def show_about(ini_file="", opened_file=""):
if not opened_file:
opened_file = ""
qApp = QApplication.instance()
msg = QMessageBox()
msg.setIconPixmap(QPixmap(resource_path(APP_ICON)))
@ -44,7 +47,9 @@ def show_about():
"<br>" + qApp.copyright + "<br>" \
"<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 + "<br>" + f"{sys.executable}" + "<br>"
text = text + "<br>Qt " + qApp.translate("utils", "Version") + ": " + f"{QtCore.__version__}"
@ -129,3 +134,25 @@ def fit_col_widths(table, worksheet):
if col_width > STD_COL_WIDTH: # anticipated default size
worksheet.set_column(col_ind, col_ind, col_width*1.25)
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>