update trying to solve rerender bug on resize
This commit is contained in:
parent
0c56442ad0
commit
2882dadce9
@ -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()
|
|
@ -26,6 +26,28 @@ import kivy
|
|||||||
from kivy.app import App
|
from kivy.app import App
|
||||||
from kivy.properties import *
|
from kivy.properties import *
|
||||||
from kivy.uix.gridlayout import GridLayout
|
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):
|
class guiApp(GridLayout):
|
||||||
""" display all vdm into kivy interface """
|
""" display all vdm into kivy interface """
|
||||||
@ -36,6 +58,7 @@ class guiApp(GridLayout):
|
|||||||
|
|
||||||
indice = NumericProperty(0)
|
indice = NumericProperty(0)
|
||||||
vdm = ListProperty([])
|
vdm = ListProperty([])
|
||||||
|
currentVdm = StringProperty('no VDM load for the moment')
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
super(guiApp, self).__init__(**kwargs)
|
super(guiApp, self).__init__(**kwargs)
|
||||||
@ -44,7 +67,7 @@ class guiApp(GridLayout):
|
|||||||
self._keyboard.bind(on_key_down = self._on_keyboard_down)
|
self._keyboard.bind(on_key_down = self._on_keyboard_down)
|
||||||
|
|
||||||
self.v = VDM()
|
self.v = VDM()
|
||||||
self.vdm = self.v.get()
|
self.vdm = ['toto', 'titi', 'tutu']#self.v.get()
|
||||||
self.render()
|
self.render()
|
||||||
|
|
||||||
def _nextAction(self):
|
def _nextAction(self):
|
||||||
@ -72,9 +95,13 @@ class guiApp(GridLayout):
|
|||||||
self._prevAction()
|
self._prevAction()
|
||||||
|
|
||||||
def render(self):
|
def render(self):
|
||||||
print(self.indice)
|
#print(self.indice)
|
||||||
self.ids["Message"].text = self.vdm[self.indice]
|
#print(self.vdm[self.indice])
|
||||||
|
|
||||||
|
self.currentVdm = self.vdm[self.indice]
|
||||||
|
#self.ids.content.text = self.vdm[self.indice]
|
||||||
|
|
||||||
class kivyApp(App):
|
class kivyApp(App):
|
||||||
def build(self):
|
def build(self):
|
||||||
return guiApp(cols=3, pos=(0,0))
|
return guiApp(cols=3, pos=(0,0))
|
||||||
|
|
||||||
|
3
requirements.txt
Normal file
3
requirements.txt
Normal 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
|
4
setup.py
4
setup.py
@ -28,8 +28,8 @@ setup(
|
|||||||
author_email='antoinroux@hotmail.fr',
|
author_email='antoinroux@hotmail.fr',
|
||||||
description='VDM API: an API for recover random VDM from vdm.fr website',
|
description='VDM API: an API for recover random VDM from vdm.fr website',
|
||||||
long_description=read('README.rst'),
|
long_description=read('README.rst'),
|
||||||
url='git://antoine-roux.fr.to/python/vdmAPI.git',
|
url='https://antoine-roux.ml/projects/python/vdmAPI.git',
|
||||||
download_url='git://antoine-roux.fr.to/python/vdmAPI.git/tags',
|
download_url='gitolite@antoine-roux.ml:python/vdmAPI.git',
|
||||||
license='Beerware',
|
license='Beerware',
|
||||||
platforms='any',
|
platforms='any',
|
||||||
packages=find_packages(),
|
packages=find_packages(),
|
||||||
|
Loading…
Reference in New Issue
Block a user