-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCreateStation_07.py
37 lines (26 loc) · 1.42 KB
/
CreateStation_07.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from PyQt5 import QtCore, QtWidgets
from Helpers import *
from Middle import *
class CreateStationWindow(QtWidgets.QWidget):
toManageBuildingStation = QtCore.pyqtSignal()
def __init__(self):
QtWidgets.QWidget.__init__(self)
self.setWindowTitle('Window')
self.nameTextbox = buildTextbox()
nameLayout = buildLayout('H', [buildLabel("Name"), self.nameTextbox])
self.capacityTextbox = buildTextbox(True)
capacityLayout = buildLayout('H', [buildLabel("Capacity"), self.capacityTextbox])
self.sponsoredCombobox = buildComboBox(getAvailableBuilding())
sponsoredLayout = buildLayout('H', [buildLabel("Sponsored Building"), self.sponsoredCombobox])
hLayout = buildLayout('H', [capacityLayout, sponsoredLayout])
backButton = buildButton("Back", self.back)
createButton = buildButton("Create", self.create)
buttonsLayout = buildLayout('H', [backButton, createButton])
layout = buildLayout('V', [buildLabel("Create Station"), nameLayout, hLayout, buttonsLayout])
self.setLayout(layout)
def back(self):
self.toManageBuildingStation.emit()
def create(self):
if self.nameTextbox.text() and self.capacityTextbox.text() and int(self.capacityTextbox.text()) >= 0:
insertStation(self.nameTextbox.text(), int(self.capacityTextbox.text()), self.sponsoredCombobox.currentText())
self.back()