Skip to content

Instantly share code, notes, and snippets.

View tito's full-sized avatar

Mathieu Virbel tito

View GitHub Profile
@tito
tito / testperf.py
Created September 1, 2017 17:12
Test widget instanciation
# -*- coding: utf-8 -*-
from kivy.factory import Factory
from time import time
MAX_TIME = 2
def time_bounded_perf(f):
def _time_bounded_perf(*args, **kwargs):
@tito
tito / smoothtouch.py
Created May 18, 2017 17:37
[experiment] Smooth touch
# coding=utf-8
"""
Experimentation: Smooth Touch
=============================
The idea is that because Kivy use raw touch, the scrolling while
doing any movement may appear laggy, but it is not due to Python
or whatever, it's just because if there is no touch during a frame,
there is no movement.
@tito
tito / README.md
Last active June 7, 2022 22:29
Kivy RecycleView with dynamic height content

Sometimes, you have RecycleView with unknown height item, and you wish it would work. One idea from tshirtman is to precompute an height approximation and pass it to each item. This approach is to save the latest computed size when the widget is created back into its own data.

Theses are just notes, you have to figure out what to use for your own application.

Data example:

[
  {
    "height": dp(48), # minimum size or default size
#!/usr/bin/env python
from __future__ import print_function
from os.path import join, basename, realpath, exists
import sh
import re
import sys
import argparse
@tito
tito / README.md
Last active March 7, 2017 16:20
Unpack Kivy APK

This is a script that you can use to check the content of a Kivy-based APK. It will automatically create a temporary directory, unpack everything, show you the files inside, and drop a shell for more inspection.

chmod +x unpackapk
./unpackapk PATHTOAPK.apk

Or if you just want the file listing:

@tito
tito / keybase.md
Created February 13, 2017 14:50
keybase.md

Keybase proof

I hereby claim:

  • I am tito on github.
  • I am tito (https://keybase.io/tito) on keybase.
  • I have a public key ASCatwAVv5qii1gF_YYwVDara3KyPexrX8mTvheL3nGOoAo

To claim this, I am signing this object:

@tito
tito / custom_camera.py
Last active January 28, 2017 20:29
Camera using pygst with custom source
"""
UNTESTED !!
camera_options is a dictionnary that is passed to Camera core class directly
so we can use it to pass custom option, such as video_src for pygst (if it's selected)
camera = CustomCamera(camera_options={
"video_src": "udpsrc port=5000 ! application/x-rtp, encoding-name=JPEG,payload=26 ! rtpjpegdepay ! jpegdec"})
"""
@tito
tito / pchip_interpolate.py
Created April 30, 2016 13:17
Pchip interpolation implementation in pure Numpy (no scipy dependency, suitable for Android.)
# coding=utf-8
"""
Pchip implementation in pure numpy
.. author:: Michael Taylor <[email protected]>
.. author:: Mathieu Virbel <[email protected]>
Copyright (c) 2016 Michael Taylor and Mathieu Virbel
Permission is hereby granted, free of charge, to any person obtaining a copy
# coding=utf-8
from kivy.properties import ListProperty
from kivy.lang import Builder
from kivy.app import App
from random import randint
RV = """
#:import RecycleView kivy.garden.recycleview.RecycleView
GridLayout:
from kivy.config import Config
Config.set('modules', 'inspector', '')
# from _recycleview import RecycleView
from kivy.garden.recycleview import RecycleView
from kivy.base import runTouchApp
from kivy.lang import Builder
from kivy.app import App
KV = """
<ContactItem@Label>: