From 30163cb3682f0627842a4dde90a6897ccd300975 Mon Sep 17 00:00:00 2001 From: Tobias Kurze Date: Tue, 15 Sep 2020 16:20:30 +0200 Subject: [PATCH] added most of immo invest fields, layout still crap --- immo.kv | 176 ++++++++++++++++++++++++++++++++++++++++++++++------ immo_gui.py | 15 ++++- 2 files changed, 170 insertions(+), 21 deletions(-) diff --git a/immo.kv b/immo.kv index fd64b35..ef4b77e 100644 --- a/immo.kv +++ b/immo.kv @@ -4,36 +4,177 @@ ImmoScreen: AnchorLayout: size_hint_y: None height: root.height if root.fullscreen else max(root.height, content.height) - GridLayout: + #GridLayout: + BoxLayout: + orientation: 'vertical' id: content - cols: 1 + #cols: 2 spacing: '8dp' padding: '8dp' size_hint: (1, 1) if root.fullscreen else (.8, None) 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 - text: 'Hello' + text: 'Baujahr' 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 height: '32dp' text: '23' input_filter: 'float' - focus: True on_text: app.on_text(args) - Button: - size_hint_y: None - height: '48dp' - text: 'Button normal' 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: size_hint_y: None height: '48dp' - text: 'Button down' - state: 'down' + text: 'Hinzufügen' + Button: size_hint_y: None @@ -41,14 +182,11 @@ ImmoScreen: text: 'Button disabled' disabled: True - Button: - size_hint_y: None - height: '48dp' - text: 'Button down disabled' - state: 'down' - disabled: True on_focus: screen = self.parent.parent.parent.parent - #if screen.parent: screen.focused = self \ No newline at end of file + #if screen.parent: screen.focused = self + + + diff --git a/immo_gui.py b/immo_gui.py index a90dcc9..fca21df 100644 --- a/immo_gui.py +++ b/immo_gui.py @@ -50,14 +50,25 @@ class ImmoApp(App): def build(self): self.title = 'hello world' Clock.schedule_interval(self._update_clock, 1 / 60.) + self.root.ids.per_qm.text = "iaeiae" def _update_clock(self, dt): 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): # print('The widget', instance, 'have:', value) - print(args[1]) - # exit() + text_input = args[0] + print(text_input.name) + + if text_input.name in ["price", "surface"]: + self._update_cost_qm() if __name__ == '__main__':