Skip to content

Instantly share code, notes, and snippets.

View clayote's full-sized avatar

clayote

View GitHub Profile
@clayote
clayote / gist:216e2c94dc3788c8a86d
Created September 20, 2014 03:49
Attempting to stack ImageStack widgets atop one another, instead they go behind.
from kivy.uix.widget import Widget
from kivy.core.image import Image
from kivy.graphics import Rectangle
from kivy.properties import (
ListProperty,
DictProperty
)
from kivy.clock import Clock
from kivy.resources import resource_find
from kivy.app import App
@clayote
clayote / arrow.diff
Created February 15, 2014 15:55
A new vertex instruction for drawing arrows that point from things to other things. It's only displaying the "trunk" at the moment.
diff --git a/kivy/graphics/vertex_instructions.pyx b/kivy/graphics/vertex_instructions.pyx
index b867281..214ea57 100644
--- a/kivy/graphics/vertex_instructions.pyx
+++ b/kivy/graphics/vertex_instructions.pyx
@@ -50,7 +50,7 @@ This module includes all the classes for drawing simple vertex objects.
'''
__all__ = ('Triangle', 'Quad', 'Rectangle', 'BorderImage', 'Ellipse', 'Line',
- 'Point', 'Mesh', 'GraphicException', 'Bezier')
+ 'Point', 'Mesh', 'GraphicException', 'Bezier', 'Arrow')
@clayote
clayote / arrow.py
Last active August 29, 2015 13:56
Arrow class connecting one node to another. The nodes may not be the same size, and may move arbitrarily.
# This file is part of LiSE, a framework for life simulation games.
# Copyright (c) 2013 Zachary Spector, zacharyspector@gmail.com
"""That which displays a one-way connection between two places.
An arrow connects two spots, the origin and the destination, and it
points from the origin to the destination, regardless of where on the
screen they are at the moment.
"""
from math import hypot, atan2, pi, sin, cos
@clayote
clayote / gist:8914953
Created February 10, 2014 12:24
SabreDAV doing strange things with mod_rewrite
[Sun Feb 09 19:11:21.468523 2014] [core:alert] [pid 99921:tid 681479680] [client 172.17.0.144:11359] /f5/zacharyspector/public/owncloud/data/.htaccess: Invalid command 'deny', perhaps misspelled or defined by a module not included in the server configuration
[Sun Feb 09 19:13:04.430843 2014] [rewrite:trace3] [pid 43089:tid 681439488] mod_rewrite.c(468): [client 172.17.0.144:11766] 172.17.0.144 - - [zacharyspector.nfshost.com/sid#28962888][rid#28baf058/initial] [perdir /f5/zacharyspector/public/owncloud/] add path info postfix: /f5/zacharyspector/public/owncloud/remote.php -> /f5/zacharyspector/public/owncloud/remote.php/webdav/
[Sun Feb 09 19:13:04.442968 2014] [rewrite:trace3] [pid 43089:tid 681439488] mod_rewrite.c(468): [client 172.17.0.144:11766] 172.17.0.144 - - [zacharyspector.nfshost.com/sid#28962888][rid#28baf058/initial] [perdir /f5/zacharyspector/public/owncloud/] strip per-dir prefix: /f5/zacharyspector/public/owncloud/remote.php/webdav/ -> remote.php/webdav/
[Sun Feb 09 19:13:04.444347 2014] [rew
@clayote
clayote / board test
Created December 31, 2013 22:28
The idea is you should be able to drag pawns from one spot to another and they should stick on the spot where you drop them.
from kivy.properties import (
ObjectProperty,
NumericProperty,
ListProperty
)
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.scatter import Scatter
class Spot(Scatter):
@clayote
clayote / Changes from the last working version
Last active January 1, 2016 18:09
Incomprehensible error in kivy.lang.Parser.
diff --git a/LiSE/gui/lise.kv b/LiSE/gui/lise.kv
index 47e953c..47eb80b 100644
--- a/LiSE/gui/lise.kv
+++ b/LiSE/gui/lise.kv
@@ -1,11 +1,6 @@
-# coding: utf-8
-# This file is part of LiSE, a framework for life simulation games.
-# Copyright (c) 2013 Zachary Spector, zacharyspector@gmail.com
-
#: import lisepathl LiSE.__path__
"""A graphical selector for "swatches," which may be colors, textures,
or standalone sprites."""
from kivy.uix.gridlayout import GridLayout
from kivy.uix.togglebutton import ToggleButton
from kivy.properties import (
NumericProperty,
StringProperty,
ObjectProperty)
@clayote
clayote / gist:7328236
Created November 5, 2013 23:29
error compiling python-igraph
arm-linux-androideabi-gcc -DANDROID -mandroid -fomit-frame-pointer --sysroot /home/sanotehu/android/android-ndk-r8e/platforms/android-14/arch-arm -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -DANDROID -mandroid -fomit-frame-pointer --sysroot /home/sanotehu/android/android-ndk-r8e/platforms/android-14/arch-arm -I/home/sanotehu/android/android-ndk-r8e/sources/cxx-stl/gnu-libstdc++/4.4.3/include -I/home/sanotehu/android/android-ndk-r8e/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include -fPIC -I/usr/local/include/igraph -I/home/sanotehu/src/python-for-android/build/python-install/include/igraph -I/usr/include/python2.7 -c src/random.c -o build/temp.linux-x86_64-2.7/src/random.o
In file included from /usr/include/python2.7/Python.h:8,
from src/py2compat.h:28,
from src/random.c:24:
/usr/include/python2.7/pyconfig.h:15:52: error: arm-linux-gnueabi/python2.7/pyconfig.h: No such file or directory
In file included from /usr/include/python2.7/Python.h:58,
@clayote
clayote / gist:7319614
Created November 5, 2013 14:13
Failed configure of igraph-0.6.5 for kivy's distribute.sh
configure:4438: arm-linux-androideabi-g++ -DANDROID -mandroid -fomit-frame-pointer --sysroot /home/sanotehu/android/android-ndk-r8e/platforms/android-14/arch-arm -c -DANDROID -mandroid -fomit-frame-pointer --sysroot /home/sanotehu/android/android-ndk-r8e/platforms/android-14/arch-arm conftest.cpp >&5
conftest.cpp:12:20: error: iostream: No such file or directory
conftest.cpp: In function 'int main()':
conftest.cpp:17: error: 'cout' is not a member of 'std'
configure:4438: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "igraph"
| #define PACKAGE_TARNAME "igraph"
| #define PACKAGE_VERSION "0.6.5"
@clayote
clayote / SaveableMetaclass.py
Created May 1, 2013 18:36
This is a metaclass to automagically generate some SQL that works with my particular database schema. Plus a couple classes that use it.
class SaveableMetaclass(type):
def __new__(metaclass, clas, parents, attrs):
if 'coldecls' not in attrs:
raise Exception("No coldecls in {0}".format(clas))
if 'primarykeys' not in attrs:
raise Exception("no primarykeys in {0}".format(clas))
coldecls = attrs['coldecls']
primarykeys = attrs['primarykeys']
tablenames = attrs['tablenames']