Code refactoring; Ui-file in Ui-folder

This commit is contained in:
Paul S 2021-06-28 15:21:08 +02:00
parent 655ef2b37d
commit 03424815c3
4 changed files with 100 additions and 2 deletions

View file

@ -23,7 +23,6 @@ from PySide2.QtUiTools import QUiLoader
from utils import show_about, resource_path
# Local globals
UI_FILE = "main.ui"
APP_NAME = "Garagenraum-Rechner"
APP_DISPNAME = "GarageCalc"
APP_VERSION = "v0.3"
@ -32,6 +31,7 @@ APP_DESCR = "Berechnet zur Verfügung stehenden Garagenraum"
APP_COPYRIGHT = "(c) Paul Salajean 2021"
APP_WEBSITE = "https://gitlab.com/ProfP303"
APP_DESKTOPFILENAME = "GarageCalc"
APP_ICON = "./img/icons8-garage-32.ico"
ICON_NEW = "./img/icons8-new-file-32.png"
@ -41,6 +41,8 @@ ICON_EXPORT = "./img/icons8-export-xls-32.png"
ICON_ABOUT = "./img/icons8-information-32.png"
ICON_QUIT = "./img/system-shutdown.png"
UI_MAIN = "./ui/main.ui"
COL_STUFF = 0
COL_LENGTH = 1
COL_WIDTH = 2
@ -72,7 +74,7 @@ class MyMainWindow(QMainWindow):
def load_ui(self):
loader = QUiLoader()
path = os.path.join(os.path.dirname(__file__), resource_path( UI_FILE))
path = os.path.join(os.path.dirname(__file__), resource_path(UI_MAIN))
ui_file = QFile(path)
ui_file.open(QFile.ReadOnly)
self.ui = loader.load(ui_file, self)

View file

@ -1,337 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Form</class>
<widget class="QWidget" name="Form">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>604</width>
<height>596</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<widget class="QGroupBox" name="gbResults">
<property name="geometry">
<rect>
<x>20</x>
<y>440</y>
<width>541</width>
<height>121</height>
</rect>
</property>
<property name="title">
<string>Ergebnis</string>
</property>
<property name="flat">
<bool>true</bool>
</property>
<widget class="QLabel" name="lblVol_Garage">
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>140</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Volumen der Garage:</string>
</property>
</widget>
<widget class="QLabel" name="lblVol_Stuff">
<property name="geometry">
<rect>
<x>10</x>
<y>40</y>
<width>140</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Volumen der Gegenstände:</string>
</property>
</widget>
<widget class="QLabel" name="lblVol_Free">
<property name="geometry">
<rect>
<x>10</x>
<y>60</y>
<width>140</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Freier Raum i. d. Garage:</string>
</property>
</widget>
<widget class="QLineEdit" name="efVol_Garage">
<property name="geometry">
<rect>
<x>174</x>
<y>20</y>
<width>113</width>
<height>20</height>
</rect>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
<widget class="QLineEdit" name="efVol_Stuff">
<property name="geometry">
<rect>
<x>174</x>
<y>40</y>
<width>113</width>
<height>20</height>
</rect>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
<widget class="QLineEdit" name="efVol_Free">
<property name="geometry">
<rect>
<x>174</x>
<y>60</y>
<width>113</width>
<height>20</height>
</rect>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" name="lblM3">
<property name="geometry">
<rect>
<x>294</x>
<y>20</y>
<width>47</width>
<height>13</height>
</rect>
</property>
<property name="text">
<string>m³</string>
</property>
</widget>
<widget class="QLabel" name="lblM3_2">
<property name="geometry">
<rect>
<x>294</x>
<y>40</y>
<width>47</width>
<height>13</height>
</rect>
</property>
<property name="text">
<string>m³</string>
</property>
</widget>
<widget class="QLabel" name="lblM3_3">
<property name="geometry">
<rect>
<x>294</x>
<y>60</y>
<width>47</width>
<height>13</height>
</rect>
</property>
<property name="text">
<string>m³</string>
</property>
</widget>
<widget class="QLineEdit" name="efWeight">
<property name="geometry">
<rect>
<x>174</x>
<y>80</y>
<width>113</width>
<height>20</height>
</rect>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" name="lblM3_4">
<property name="geometry">
<rect>
<x>294</x>
<y>80</y>
<width>47</width>
<height>13</height>
</rect>
</property>
<property name="text">
<string>kg</string>
</property>
</widget>
<widget class="QLabel" name="lblVol_Free_2">
<property name="geometry">
<rect>
<x>10</x>
<y>80</y>
<width>140</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Gesamtgewicht:</string>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="gbStuff">
<property name="geometry">
<rect>
<x>20</x>
<y>120</y>
<width>561</width>
<height>301</height>
</rect>
</property>
<property name="title">
<string>Dimensionen der zu verstauenden Gegenstände</string>
</property>
<property name="flat">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTableWidget" name="tableStuff">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
</property>
<column>
<property name="text">
<string>Gegenstand</string>
</property>
</column>
<column>
<property name="text">
<string>Länge [m]</string>
</property>
</column>
<column>
<property name="text">
<string>Breite [m]</string>
</property>
</column>
<column>
<property name="text">
<string>Höhe [m]</string>
</property>
</column>
<column>
<property name="text">
<string>Gewicht [kg]</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
<widget class="QGroupBox" name="gbGarage">
<property name="geometry">
<rect>
<x>20</x>
<y>20</y>
<width>561</width>
<height>91</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>91</height>
</size>
</property>
<property name="title">
<string>Dimension der Garage</string>
</property>
<property name="flat">
<bool>true</bool>
</property>
<widget class="QTableWidget" name="tableGarage">
<property name="geometry">
<rect>
<x>10</x>
<y>23</y>
<width>351</width>
<height>58</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>58</height>
</size>
</property>
<row>
<property name="text">
<string>Garage</string>
</property>
</row>
<column>
<property name="text">
<string>Länge [m]</string>
</property>
</column>
<column>
<property name="text">
<string>Breite [m]</string>
</property>
</column>
<column>
<property name="text">
<string>Höhe [m]</string>
</property>
</column>
</widget>
</widget>
</widget>
<tabstops>
<tabstop>tableGarage</tabstop>
<tabstop>tableStuff</tabstop>
<tabstop>efVol_Garage</tabstop>
<tabstop>efVol_Stuff</tabstop>
<tabstop>efVol_Free</tabstop>
<tabstop>efWeight</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>