This file contains hidden or 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
# coding=utf-8 | |
from kivy.uix.behaviors import FocusBehavior | |
from kivy.uix.checkbox import CheckBox | |
from kivy.uix.textinput import TextInput | |
from kivy.uix.button import Button | |
from kivy.lang import Builder | |
Builder.load_string(""" | |
#:import rgb kivy.utils.get_color_from_hex | |
<FocusableCheckBox,FocusableButton,FocusableTextInput>: |
This file contains hidden or 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
''' | |
Font-based ProgressSpinner | |
========================== | |
''' | |
from kivy.lang import Builder | |
from kivy.properties import NumericProperty, BooleanProperty, StringProperty | |
from kivy.clock import Clock | |
from kivy.uix.widget import Widget |
This file contains hidden or 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 redis | |
import sys | |
host = sys.argv[1] | |
room = sys.argv[2] | |
print "-- connect to redis" | |
client = redis.Redis(host=host) | |
pubsub = client.pubsub() | |
pubsub.subscribe(room) | |
print "-- listen to {}".format(room) |
This file contains hidden or 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 functools import partial | |
def coreimage_animation(self, *largs): | |
# accept reverse direction | |
if not self._image: | |
return | |
textures = self.image.textures | |
self._texture = self.image.textures[self._anim_index] | |
self.dispatch('on_texture') | |
self._anim_index += self._anim_direction |
This file contains hidden or 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
# coding=utf-8 | |
from kivy.app import App | |
from kivy.properties import StringProperty | |
from kivy.uix.relativelayout import RelativeLayout | |
from kivy.uix.screenmanager import ScreenManager, Screen | |
from kivy.lang import Builder | |
from kivy.logger import Logger | |
import re |
This file contains hidden or 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
# coding=utf-8 | |
""" | |
iBeacon Scanner | |
=============== | |
This scanner works exclusively on iOS real devices, simulator don't support | |
iBeacon ranging API at all. | |
The usage is quite simple: |
This file contains hidden or 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 threading | |
from kivy.clock import mainthread | |
def threaded(callback): | |
def _threaded(f): | |
def _threaded_callback(*args, **kwargs): | |
def _run_in_threaded_callback(*args, **kwargs): | |
ret = f(*args, **kwargs) | |
mainthread(callback)(ret) | |
thread = threading.Thread(target=_run_in_threaded_callbacks, args=args, kwargs=kwargs) |
This file contains hidden or 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
# coding=utf-8 | |
""" | |
Automation client for automatesocket.py | |
======================================= | |
""" | |
import socket | |
import struct | |
import json |
This file contains hidden or 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
# Goal: detect when a thread exit to call jnius.detach() | |
# and prevent crash from Android/ART | |
# So we listen to "return" events from the "run" function of the threading.Thread | |
# The profiling function given to threading.set_profilefunc() is installed in the | |
# thread before the run() function of the Thread. | |
# All we need to do is filter on "return" event of the "run" function for the | |
# original Thread.run() of Python's threading.py | |
# ERROR: it doesn't detect when a thread crash (python exception) |
This file contains hidden or 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
# coding=utf-8 | |
""" | |
Console | |
======= | |
Reboot of the old inspector, designed to be modular and keep concerns separated. | |
Open with control+e (or cmd+e on OSX). | |
.. versionadded:: 1.9.1 |