Results rounded to two digits
This commit is contained in:
parent
03424815c3
commit
90afe07406
2 changed files with 13 additions and 9 deletions
|
@ -1,8 +1,9 @@
|
||||||
# Changelog GarageCalc1
|
# Changelog GarageCalc1
|
||||||
|
|
||||||
## [0.2] - 2021-06-27
|
## [0.3] - 2021-06-29
|
||||||
### Added
|
### Added
|
||||||
- Warnt beim Beenden falls ungespeicherte Einträge vorhanden sind
|
- Warnt beim Beenden falls ungespeicherte Einträge vorhanden sind
|
||||||
|
- Alle Ergebnisse aufrunden auf 2 Nachkommastellen
|
||||||
|
|
||||||
## [0.2] - 2021-06-27
|
## [0.2] - 2021-06-27
|
||||||
### Added
|
### Added
|
||||||
|
|
19
src/main.py
19
src/main.py
|
@ -23,9 +23,10 @@ from PySide2.QtUiTools import QUiLoader
|
||||||
from utils import show_about, resource_path
|
from utils import show_about, resource_path
|
||||||
|
|
||||||
# Local globals
|
# Local globals
|
||||||
|
APP_VERSION = "v0.3.1"
|
||||||
|
|
||||||
APP_NAME = "Garagenraum-Rechner"
|
APP_NAME = "Garagenraum-Rechner"
|
||||||
APP_DISPNAME = "GarageCalc"
|
APP_DISPNAME = "GarageCalc"
|
||||||
APP_VERSION = "v0.3"
|
|
||||||
APP_AUTHOR = "Paul Salajean"
|
APP_AUTHOR = "Paul Salajean"
|
||||||
APP_DESCR = "Berechnet zur Verfügung stehenden Garagenraum"
|
APP_DESCR = "Berechnet zur Verfügung stehenden Garagenraum"
|
||||||
APP_COPYRIGHT = "(c) Paul Salajean 2021"
|
APP_COPYRIGHT = "(c) Paul Salajean 2021"
|
||||||
|
@ -667,7 +668,7 @@ class MyMainWindow(QMainWindow):
|
||||||
is_error = True
|
is_error = True
|
||||||
|
|
||||||
if not is_error:
|
if not is_error:
|
||||||
garage_vol = garage_length * float(garage_width) * float(garage_height)
|
garage_vol = round(float(garage_length) * float(garage_width) * float(garage_height), 2)
|
||||||
else:
|
else:
|
||||||
garage_vol = 0.0
|
garage_vol = 0.0
|
||||||
self.statusBar.showMessage("Fehler in der Garagen-Dimension. :-(", 5000)
|
self.statusBar.showMessage("Fehler in der Garagen-Dimension. :-(", 5000)
|
||||||
|
@ -716,7 +717,7 @@ class MyMainWindow(QMainWindow):
|
||||||
height = 0
|
height = 0
|
||||||
is_error = True
|
is_error = True
|
||||||
|
|
||||||
vol = length * width * height
|
vol = round(length * width * height, 2)
|
||||||
|
|
||||||
stuff_vol = stuff_vol + vol
|
stuff_vol = stuff_vol + vol
|
||||||
|
|
||||||
|
@ -731,14 +732,16 @@ class MyMainWindow(QMainWindow):
|
||||||
|
|
||||||
# get garage vol
|
# get garage vol
|
||||||
garage_vol = self.get_garage_vol()
|
garage_vol = self.get_garage_vol()
|
||||||
|
print("garage_vol", garage_vol)
|
||||||
|
|
||||||
# get stuff vol
|
# get stuff vol
|
||||||
stuff_vol = self.get_stuff_vol()
|
stuff_vol = self.get_stuff_vol()
|
||||||
|
print("stuff_vol", stuff_vol)
|
||||||
|
|
||||||
# display results
|
# display results
|
||||||
self.ui.efVol_Garage.setText(str(garage_vol))
|
self.ui.efVol_Garage.setText(f"{garage_vol:2.2f}")
|
||||||
self.ui.efVol_Stuff.setText(str(stuff_vol))
|
self.ui.efVol_Stuff.setText(f"{stuff_vol:2.2f}")
|
||||||
self.ui.efVol_Free.setText(str(garage_vol - stuff_vol))
|
self.ui.efVol_Free.setText(f"{garage_vol - stuff_vol:2.2f}")
|
||||||
|
|
||||||
if ( garage_vol - stuff_vol ) < 0:
|
if ( garage_vol - stuff_vol ) < 0:
|
||||||
self.ui.efVol_Free.setStyleSheet("border: 1px solid red;")
|
self.ui.efVol_Free.setStyleSheet("border: 1px solid red;")
|
||||||
|
@ -761,9 +764,9 @@ class MyMainWindow(QMainWindow):
|
||||||
except ValueError:
|
except ValueError:
|
||||||
weight = 0.0
|
weight = 0.0
|
||||||
|
|
||||||
weight_sum = weight_sum + weight
|
weight_sum = round(weight_sum + weight, 2)
|
||||||
|
|
||||||
self.ui.efWeight.setText(str(weight_sum))
|
self.ui.efWeight.setText(f"{weight_sum:2.2f}")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
Loading…
Reference in a new issue