update trying to solve rerender bug on resize

This commit is contained in:
Antoine 2020-03-10 19:25:10 +01:00
parent 0c56442ad0
commit 2882dadce9
4 changed files with 37 additions and 30 deletions

View File

@ -1,23 +0,0 @@
#:kivy 1.0
<guiApp>:
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()

View File

@ -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('''
<guiApp>:
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,6 +58,7 @@ 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)
@ -44,7 +67,7 @@ class guiApp(GridLayout):
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))

3
requirements.txt Normal file
View File

@ -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

View File

@ -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(),