Skip to content

Instantly share code, notes, and snippets.

View rnixx's full-sized avatar
💭
building things

Robert Niederreiter rnixx

💭
building things
  • Innsbruck, Austria
View GitHub Profile
@rnixx
rnixx / gist:6027502
Created July 18, 2013 07:47
patch for plone.app.async providing REQUEST on context
"""plone.app.async patch to provide old school Zope2 REQUEST on context.
Contributions:
* Jean Jordaan
* Robert Niederreiter
"""
import Zope2
import sys
from AccessControl.SecurityManagement import (
@rnixx
rnixx / gist:add38d808b5a8ad73947
Last active September 2, 2020 13:21
Kivy App - Sticky hiding of navigation on Android
from kivy.app import App
from kivy.logger import Logger
try:
from jnius import autoclass
from android.runnable import run_on_ui_thread
android_api_version = autoclass('android.os.Build$VERSION')
AndroidView = autoclass('android.view.View')
AndroidPythonActivity = autoclass('org.renpy.android.PythonActivity')
@rnixx
rnixx / gist:491bf758918e3a1e13e9
Created March 12, 2015 14:35
Python: function debug decorator
def debug(func):
def wrapped(*args, **kwargs):
name = '{0}.{1}'.format(
func.__module__,
func.func_name
)
if args:
inst = args[0]
inst_func = getattr(inst, func.func_name, None)
unwrapped_func = getattr(inst_func, '_original_func', None)
@rnixx
rnixx / gist:f1c94490e636a4ed54b4
Last active May 2, 2016 20:14
Kivy: Material design ripple behavior mixin, based on TouchRippleBehavior from FlatKivy
from kivy.animation import Animation
from kivy.graphics import CanvasBase
from kivy.graphics import Color
from kivy.graphics import Ellipse
from kivy.graphics import ScissorPush
from kivy.graphics import ScissorPop
from kivy.properties import ListProperty
from kivy.properties import NumericProperty
from kivy.uix.relativelayout import RelativeLayout
@rnixx
rnixx / gist:c60a744576866a7f1a42
Last active August 29, 2015 14:23
Kivy: Screen orientation change on Android at runtime
from android.runnable import run_on_ui_thread
from jnius import autoclass
from kivy.app import App
AndroidActivityInfo = autoclass('android.content.pm.ActivityInfo')
AndroidPythonActivity = autoclass('org.renpy.android.PythonActivity')
class MyApp(App):
@rnixx
rnixx / gist:2aab5e13e17c1582b6dd
Created June 15, 2015 08:43
Kivy: Extended Screen manager with better convenience for switching between screens.
from kivy.uix.screenmanager import ScreenManager
from kivy.uix.screenmanager import ScreenManagerException
from kivy.uix.screenmanager import Screen
class ExtScreenManager(ScreenManager):
def __init__(self, **kwargs):
Logger.debug('ExtScreenManager.__init__')
self.register_event_type('on_finish_screen_switch')
@rnixx
rnixx / gist:794837ac5a29bc8dee4b
Last active August 29, 2015 14:23
Kivy: CoverBehavior - cover image or video to widget size
from decimal import Decimal
from kivy.lang import Builder
from kivy.properties import ListProperty
Builder.load_string("""
<-CoverBehavior>:
canvas.before:
StencilPush
Rectangle:
@rnixx
rnixx / gist:1f26328044b6e8996c6e
Last active August 29, 2015 14:23
Kivy: Widget Covering MJPEG Video based on https://gist.github.com/tito/d6eb474543c32eb33504
import io
import urllib
import threading
from kivy.uix.image import Image
from kivy.properties import StringProperty
from kivy.core.image import Image as CoreImage
from kivy.clock import Clock
from coverbehavior import CoverBehavior
@rnixx
rnixx / kv lang extensions proposal
Last active November 20, 2017 17:51
logical program structure extensions proposal for kivy language
# proposal for kivy language extensions
BoxLayout:
############
# conditions
if root.foo:
Label:
text: 'Condition true'
@rnixx
rnixx / README.rst
Last active March 25, 2019 13:42
Lightweight zope.testrunner integration on package level for layered tests

Lightweight zope.testrunner integration on package level for layered tests

Usage:

python setup.py test

or:

python -m mypackage.tests