From 2882dadce9e7c9c95dde1f373437fd108ce0b5f6 Mon Sep 17 00:00:00 2001 From: Antoine Date: Tue, 10 Mar 2020 19:25:10 +0100 Subject: [PATCH] update trying to solve rerender bug on resize --- VDMAPI/Display/kivy.kv | 23 ---------------------- VDMAPI/Display/kivyDisplay.py | 37 ++++++++++++++++++++++++++++++----- requirements.txt | 3 +++ setup.py | 4 ++-- 4 files changed, 37 insertions(+), 30 deletions(-) delete mode 100644 VDMAPI/Display/kivy.kv create mode 100644 requirements.txt diff --git a/VDMAPI/Display/kivy.kv b/VDMAPI/Display/kivy.kv deleted file mode 100644 index 90b13c4..0000000 --- a/VDMAPI/Display/kivy.kv +++ /dev/null @@ -1,23 +0,0 @@ -#:kivy 1.0 - -: - Button: - id: prev - - size_hint_x: None - width: 100 - - text: '<<' - on_press: root._prevAction() - Label: - text_size: 300, None - id: Message - text: 'no VDM load for the moment' - Button: - id: next - - size_hint_x: None - - width: 100 - text: '>>' - on_press: root._nextAction() \ No newline at end of file diff --git a/VDMAPI/Display/kivyDisplay.py b/VDMAPI/Display/kivyDisplay.py index 8a6b525..dc955f6 100755 --- a/VDMAPI/Display/kivyDisplay.py +++ b/VDMAPI/Display/kivyDisplay.py @@ -26,6 +26,28 @@ import kivy from kivy.app import App from kivy.properties import * from kivy.uix.gridlayout import GridLayout +from kivy.lang import Builder + +Builder.load_string(''' +: + Button: + id: prev + size_hint_x: None + width: 100 + text: '<<' + on_press: root._prevAction() + Label: + id: content + text_size: 300, None + text: root.currentVdm + Button: + id: next + size_hint_x: None + width: 100 + text: '>>' + on_press: root._nextAction() +''') + class guiApp(GridLayout): """ display all vdm into kivy interface """ @@ -36,15 +58,16 @@ class guiApp(GridLayout): indice = NumericProperty(0) vdm = ListProperty([]) + currentVdm = StringProperty('no VDM load for the moment') def __init__(self, **kwargs): super(guiApp, self).__init__(**kwargs) - + self._keyboard = Window.request_keyboard(self._keyboard_closed, self) self._keyboard.bind(on_key_down = self._on_keyboard_down) - + self.v = VDM() - self.vdm = self.v.get() + self.vdm = ['toto', 'titi', 'tutu']#self.v.get() self.render() def _nextAction(self): @@ -72,9 +95,13 @@ class guiApp(GridLayout): self._prevAction() def render(self): - print(self.indice) - self.ids["Message"].text = self.vdm[self.indice] + #print(self.indice) + #print(self.vdm[self.indice]) + + self.currentVdm = self.vdm[self.indice] + #self.ids.content.text = self.vdm[self.indice] class kivyApp(App): def build(self): return guiApp(cols=3, pos=(0,0)) + diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..9e40ac2 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +-e git+https://github.com/kivy/kivy.git@1.10.1#egg=kivy-1.10.1 +# @master +#kivy==1.11.1 diff --git a/setup.py b/setup.py index 8403aa5..40a3af0 100644 --- a/setup.py +++ b/setup.py @@ -28,8 +28,8 @@ setup( author_email='antoinroux@hotmail.fr', description='VDM API: an API for recover random VDM from vdm.fr website', long_description=read('README.rst'), - url='git://antoine-roux.fr.to/python/vdmAPI.git', - download_url='git://antoine-roux.fr.to/python/vdmAPI.git/tags', + url='https://antoine-roux.ml/projects/python/vdmAPI.git', + download_url='gitolite@antoine-roux.ml:python/vdmAPI.git', license='Beerware', platforms='any', packages=find_packages(),