This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def __init__(self, **kwargs): | |
super(RootWidget, self).__init__(**kwargs) | |
for idx, val in enumerate(tx_list): | |
self.tx_dict[idx] = Button(text="tx_id: {0} | amount: {1:.4f}".format(val[0], val[1]), | |
size_hint_y=None, height=15, font_size=9) | |
self.tx_dict[idx].bind(on_press=self._create_button_callback(val[0])) | |
self.ids.tx_list.add_widget(self.tx_dict[idx]) | |
def _create_button_callback(self, val): | |
def callback(button): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SecurityDecorator(object): | |
'''Secures a method by requiring that the security user has | |
a given set of privileges in order to execute the method. | |
''' | |
def __init__(self, *privileges): | |
self.privileges = privileges | |
def __call__(self, f): | |
@functools.wraps(f) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import kivy | |
kivy.require('1.8.1') | |
from kivy.app import App | |
from kivy.lang import Builder | |
root = Builder.load_string(''' | |
<MyWidget@BoxLayout>: | |
text: '' | |
TextInput: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def create(self, dt): | |
for i in range(1, 10): | |
with self.canvas: | |
img = Image('90s-ani.gif') | |
rect = Rectangle(texture=img.texture, size=(20, 20), pos=(random.randint(1, 300), random.randint(1, 300))) | |
def animate(iobj, robj, im): | |
robj.texture = im.texture | |
img.bind(on_texture=partial(animate, obj=rect, im=img)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/kivy/animation.py b/kivy/animation.py | |
index 577d717..6f1b92b 100644 | |
--- a/kivy/animation.py | |
+++ b/kivy/animation.py | |
@@ -391,16 +391,16 @@ class Sequence(Animation): | |
return self.anim1.duration + self.anim2.duration | |
def start(self, widget): | |
- self.stop(widget) | |
+ self.stop(widget, False) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ryan@ryan-lappy:~/g/a/kivy (ee-develop:✖)$ git co -b matham-focus-text4 master | |
Switched to a new branch 'matham-focus-text4' | |
ryan@ryan-lappy:~/g/a/kivy (matham-focus-text4:✖)$ git fetch https://github.com/matham/kivy.git focus-text4 | |
remote: Counting objects: 112, done. | |
remote: Compressing objects: 100% (39/39), done. | |
remote: Total 112 (delta 79), reused 94 (delta 73) | |
Receiving objects: 100% (112/112), 60.11 KiB | 0 bytes/s, done. | |
Resolving deltas: 100% (79/79), done. | |
From https://github.com/matham/kivy | |
* branch focus-text4 -> FETCH_HEAD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from jnius import autoclass | |
python_act = autoclass('org.renpy.android.PythonActivity') | |
rctx = autoclass('android.graphics.Rect')() | |
mActivity = python_act.mActivity | |
if mActivity: | |
decor_view = mActivity.getWindow().getDecorView() | |
height = mActivity.getWindowManager().getDefaultDisplay().getHeight() | |
# get keyboard height | |
def get_keyboard_height(): | |
decor_view.getWindowVisibleDisplayFrame(rctx) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from b import fnb | |
def fna(): | |
fnb() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import kivy | |
kivy.require('1.8.1') | |
from kivy.app import App | |
from kivy.lang import Builder | |
root = Builder.load_string(''' | |
#:import CoreImage kivy.core.image.Image | |
<DataImage@Widget>: | |
color: 1, 1, 1, 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MainScreen(Screen): | |
def __init__(self, **kwargs): | |
super(MainScreen, self).__init__(**kwargs) | |
Clock.schedule_interval(self.test, 0.5) |