-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathApp.py
81 lines (71 loc) · 2.47 KB
/
App.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
from kivy.app import App
from kivy.uix.screenmanager import ScreenManager, Screen
from calculations.Beam import Beam
class MenuUI(Screen):
pass
class BeamUI(Screen):
def on_submit(self):
self.parameters = {
'_fc': self.ids.fc_input.text,
'_fy': self.ids.fy_input.text,
'_es': self.ids.Es_input.text,
'width': self.ids.width_input.text,
'height': self.ids.height_input.text,
'steeldim' : self.ids.sdim_input.text,
'cover' : self.ids.cover_input.text,
'ultimateMoment': self.ids.ultmoment_input.text,
'rebar' : self.ids.rebar_input.text
}
new_parameters = {}
for key, value in self.parameters.items():
if value != '':
try:
new_parameters[key] = int(value)
except ValueError:
new_parameters[key] = float(value)
else:
pass
beam_instance = Beam(**new_parameters)
width = beam_instance.width
height = beam_instance.height
cover = beam_instance.cover
sdim = beam_instance.steeldim
rebar = beam_instance.rebar
ultmoment = beam_instance.ultimateMoment
fc = beam_instance._fc
fy = beam_instance._fy
Es = beam_instance._es
self.ids.height_input.text = str(height)
self.ids.width_input.text = str(width)
self.ids.cover_input.text = str(cover)
self.ids.sdim_input.text = str(sdim)
self.ids.rebar_input.text = str(rebar)
self.ids.ultmoment_input.text = str(ultmoment)
self.ids.fc_input.text = str(fc)
self.ids.fy_input.text = str(fy)
self.ids.Es_input.text = str(Es)
print('Sucessfully calculated')
class DetailUI(Screen):
pass
class ColumnUI(Screen):
pass
class RectangleUI(Screen):
pass
class SpiralUI(Screen):
pass
class InteractiveUI(Screen):
def on_interactive(self):
pass
class MyApp(App):
def build(self):
sm = ScreenManager()
sm.add_widget(MenuUI(name='Menu_UI'))
sm.add_widget(BeamUI(name='Beam_UI'))
sm.add_widget(DetailUI(name='Detail_UI'))
sm.add_widget(ColumnUI(name='Column_UI'))
sm.add_widget(RectangleUI(name='Rectangle_UI'))
sm.add_widget(SpiralUI(name='Interactive_UI'))
sm.add_widget(InteractiveUI(name='Spiral_UI'))
return sm
if __name__ == '__main__':
MyApp().run()