added most of immo invest fields, layout still crap

This commit is contained in:
Tobias Kurze
2020-09-15 16:20:30 +02:00
parent cbb41e481e
commit 30163cb368
2 changed files with 170 additions and 21 deletions

176
immo.kv
View File

@@ -4,36 +4,177 @@ ImmoScreen:
AnchorLayout: AnchorLayout:
size_hint_y: None size_hint_y: None
height: root.height if root.fullscreen else max(root.height, content.height) height: root.height if root.fullscreen else max(root.height, content.height)
GridLayout: #GridLayout:
BoxLayout:
orientation: 'vertical'
id: content id: content
cols: 1 #cols: 2
spacing: '8dp' spacing: '8dp'
padding: '8dp' padding: '8dp'
size_hint: (1, 1) if root.fullscreen else (.8, None) size_hint: (1, 1) if root.fullscreen else (.8, None)
height: self.height if root.fullscreen else self.minimum_height height: self.height if root.fullscreen else self.minimum_height
BoxLayout:
orientation: 'horizontal'
height: '32dp'
spazing: 30
Label
text: 'Name'
height: '32dp'
CTextInput:
name: 'name'
size_hint_y: None
height: '32dp'
multiline: False
focus: True
text: 'Kirschenstr. 27'
on_text: app.on_text(args)
BoxLayout:
orientation: 'horizontal'
height: '32dp'
Label
text: 'Adresse'
height: '32dp'
CTextInput:
name: 'address'
size_hint_y: None
height: '32dp'
text: 'Kirschenstr. 27'
on_text: app.on_text(args)
Label Label
text: 'Hello' text: 'Baujahr'
CTextInput: CTextInput:
id: txt_input name: 'year'
size_hint_y: None
height: '32dp'
text: '23'
input_filter: 'int'
on_text: app.on_text(args)
Label
text: 'Kaufpreis'
CTextInput:
id: price
name: 'price'
size_hint_y: None
height: '32dp'
text: '23'
input_filter: 'int'
on_text: app.on_text(args)
Label
text: 'davon Grundstück (in Euro oder % vom Kaufpreis)'
CTextInput:
name: 'terrain_cost'
size_hint_y: None
height: '32dp'
text: '23'
input_filter: 'int'
focus: True
on_text: app.on_text(args)
Label
text: 'davon Sanierungskosten, etc.'
CTextInput:
name: 'other_cost'
size_hint_y: None
height: '32dp'
text: '23'
input_filter: 'int'
focus: True
on_text: app.on_text(args)
Label
text: 'Kaufnebenkosten (jeweils in %)'
Label
text: 'Notar'
CTextInput:
name: 'cost_solicitor'
size_hint_y: None size_hint_y: None
height: '32dp' height: '32dp'
text: '23' text: '23'
input_filter: 'float' input_filter: 'float'
focus: True
on_text: app.on_text(args) on_text: app.on_text(args)
Button:
size_hint_y: None
height: '48dp'
text: 'Button normal'
Label Label
text: 'Hello' text: 'Grundbuch'
CTextInput:
name: 'cost_register'
size_hint_y: None
height: '32dp'
text: '23'
input_filter: 'float'
on_text: app.on_text(args)
Label
text: 'Grunderwerbssteur'
CTextInput:
id: cost_tax
name: 'cost_tax'
size_hint_y: None
height: '32dp'
text: '23'
input_filter: 'float'
on_text: app.on_text(args)
Label
text: 'Provision'
CTextInput:
id: cost_provision
name: 'cost_provision'
size_hint_y: None
height: '32dp'
text: '23'
input_filter: 'float'
on_text: app.on_text(args)
Label
text: 'Fläche (qm)'
CTextInput:
id: surface
name: 'surface'
size_hint_y: None
height: '32dp'
text: '23'
input_filter: 'float'
on_text: app.on_text(args)
Label
text: 'pro qm'
CTextInput:
id: per_qm
size_hint_y: None
height: '32dp'
#disabled: True
input_filter: 'float'
text: 'Disabled textinput'
Label
text: 'Mieteinnahme (pro Jahr / Monat)'
CTextInput:
size_hint_y: None
height: '32dp'
text: '23'
input_filter: 'float'
on_text: app.on_text(args)
CTextInput:
size_hint_y: None
height: '32dp'
text: '23'
input_filter: 'float'
on_text: app.on_text(args)
Button: Button:
size_hint_y: None size_hint_y: None
height: '48dp' height: '48dp'
text: 'Button down' text: 'Hinzufügen'
state: 'down'
Button: Button:
size_hint_y: None size_hint_y: None
@@ -41,14 +182,11 @@ ImmoScreen:
text: 'Button disabled' text: 'Button disabled'
disabled: True disabled: True
Button:
size_hint_y: None
height: '48dp'
text: 'Button down disabled'
state: 'down'
disabled: True
<CTextInput@TextInput> <CTextInput@TextInput>
on_focus: on_focus:
screen = self.parent.parent.parent.parent screen = self.parent.parent.parent.parent
#if screen.parent: screen.focused = self #if screen.parent: screen.focused = self

View File

@@ -50,14 +50,25 @@ class ImmoApp(App):
def build(self): def build(self):
self.title = 'hello world' self.title = 'hello world'
Clock.schedule_interval(self._update_clock, 1 / 60.) Clock.schedule_interval(self._update_clock, 1 / 60.)
self.root.ids.per_qm.text = "iaeiae"
def _update_clock(self, dt): def _update_clock(self, dt):
self.time = time() self.time = time()
def _update_cost_qm(self):
surface = float('0' + self.root.ids.surface.text)
price = int('0' + self.root.ids.price.text)
if surface is not None and surface > 0 and price is not None and price > 0:
self.root.ids.per_qm.text = (str(price / surface))
def on_text(self, args): def on_text(self, args):
# print('The widget', instance, 'have:', value) # print('The widget', instance, 'have:', value)
print(args[1]) text_input = args[0]
# exit() print(text_input.name)
if text_input.name in ["price", "surface"]:
self._update_cost_qm()
if __name__ == '__main__': if __name__ == '__main__':