Browse Source

update trying to solve rerender bug on resize

master
Antoine 1 year ago
parent
commit
2882dadce9
4 changed files with 37 additions and 30 deletions
  1. +0
    -23
      VDMAPI/Display/kivy.kv
  2. +32
    -5
      VDMAPI/Display/kivyDisplay.py
  3. +3
    -0
      requirements.txt
  4. +2
    -2
      setup.py

+ 0
- 23
VDMAPI/Display/kivy.kv 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()

+ 32
- 5
VDMAPI/Display/kivyDisplay.py 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,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))


+ 3
- 0
requirements.txt 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

+ 2
- 2
setup.py 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(),


Loading…
Cancel
Save