Skip to content

Instantly share code, notes, and snippets.

Avatar
😥
I may be slow to respond.

Andrew Chadwick achadwick

😥
I may be slow to respond.
View GitHub Profile
@achadwick
achadwick / xfce4-tablet-inserted.sh
Created Dec 14, 2017
Xfce4 "tablet inserted" script with support for a Wacom Cintiq 13HD
View xfce4-tablet-inserted.sh
#!/bin/sh
# Configure Wacom tablets for XFCE4's "Removable Media" scripting.
DEV_13HD="Wacom Cintiq 13HD"
LOCKFILE="/tmp/.xfce4-tablet-inserted-$USER.lock"
set -e
# set -x
View app_chooser_dialog.py
#!/usr/bin/env python
# All rights waived: https://creativecommons.org/publicdomain/zero/1.0/
# Andrew Chadwick, 29 Jan 2016.
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
from gi.repository import Gio
import os
@achadwick
achadwick / pygi-grep
Last active Feb 27, 2017
Python-GI name search tool
View pygi-grep
#!/usr/bin/env python
# Search for names known to Python GObject-Introspection.
# All rights waived: https://creativecommons.org/publicdomain/zero/1.0/
from __future__ import print_function
import importlib
import os.path
import sys
import re
from optparse import OptionParser
View gdk-screen-layout-tester.py
#!/usr/bin/env python
# Draws the layout of the current GdkScreen.
# CC0 1.0 2014-12-15 Andrew Chadwick, all rights waived
# https://creativecommons.org/publicdomain/zero/1.0/
import logging
from gi.repository import Gtk
from gi.repository import Gdk
@achadwick
achadwick / notebook_drag_minimal.py
Last active May 19, 2016
GtkNotebook minimal code, for debugging
View notebook_drag_minimal.py
#!python
# Tester for reorderable tabs. Sure are a lot of GTK regressions here.
# Script is good for either Python2 or Python3.
#
# Copyright waived: http://creativecommons.org/publicdomain/zero/1.0/
# Andrew Chadwick, 2016-05-19.
#
# GTK 3.20.4 terminates the drag as soon as the pointer goes outside the
# notebook whose tab is being dragged. Reordering of tabs within a
# notebook is still possible. https://github.com/mypaint/mypaint/issues/682
@achadwick
achadwick / openraster-extended-layer-idea.xml
Created Apr 7, 2015
Idea for extended OpenRaster layers
View openraster-extended-layer-idea.xml
<?xml version='1.0' encoding='UTF-8'?>
<image h="100" version="0.0.4+extendedlayerideas.001" w="100">
<stack isolation="auto" name="" visibility="visible">
<layer composite-op="svg:src-over" name="silly eyebrows" opacity="0.333" src="data/layer-00.png" visibility="visible" x="0" y="0">
<annotation href="data/layer-00-strokemap.dat" media-type="application/x.mypaint-strokemap-v2"/>
<!--
An annotation is supplementary data which can be used to describe
the pixels of the rendered layer (and by inference any source files).
Annotations are 2d metadata, and MUST NOT be used for rendering a new @src.
In MyPaint's case, the strokemap data maps pixels to brushstroke settings.
@achadwick
achadwick / custom_draggable_treemodel.py
Created Mar 1, 2015
Draggable treemodel (test apparent regression between gtk 3.12 and 3.14)
View custom_draggable_treemodel.py
#!/usr/bin/python
# Custom draggable TreeModel demo code
# Author: Andrew Chadwick <a.t.chadwick@gmail.com>
# To the extent possible under law, the author has waived all copyright
# and related or neighboring rights to this work.
# https://creativecommons.org/publicdomain/zero/1.0/
## Module imports
import logging
View drag fail log (under gtk 3.14.5)
DEBUG:lib.document:Created working-doc tempdir u'/tmp/tmpAI1l2Fmypaint'
(layers.py:25446): Gtk-WARNING **: Symbolic icon mypaint-layer-group-symbolic-ltr of size 16 is in an icon theme directory of size 128
(layers.py:25446): Gtk-WARNING **: Symbolic icon mypaint-object-visible-symbolic-ltr of size 16 is in an icon theme directory of size 128
(layers.py:25446): Gtk-WARNING **: Symbolic icon mypaint-object-unlocked-symbolic-ltr of size 16 is in an icon theme directory of size 128
(layers.py:25446): Gtk-WARNING **: Symbolic icon mypaint-layer-painting-symbolic-ltr of size 16 is in an icon theme directory of size 128
@achadwick
achadwick / WINDOWS.md
Last active Aug 29, 2015
An attempt at some MyPaint build instructions for Windows
View WINDOWS.md
@achadwick
achadwick / axischart.py
Last active Jan 26, 2016
Input axis stripchart for python-gobject and Gtk3
View axischart.py
#!/usr/bin/env python
# Input axis stripchart for (python-gobject & Gtk3) or (PyGtk, evolving)
# CC0 1.0 2016-01-26 Andrew Chadwick, all rights waived
# https://creativecommons.org/publicdomain/zero/1.0/
import sys
import os
from getopt import getopt
from collections import deque