Skip to content

Instantly share code, notes, and snippets.

View achadwick's full-sized avatar
🍃
Let's get this thing working again

Andrew Chadwick achadwick

🍃
Let's get this thing working again
View GitHub Profile
@achadwick
achadwick / xfce4-tablet-inserted.sh
Created December 14, 2017 11:31
Xfce4 "tablet inserted" script with support for a Wacom Cintiq 13HD
#!/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
#!/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 February 27, 2017 19:19
Python-GI name search tool
#!/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
@achadwick
achadwick / gdk-screen-layout-tester.py
Created August 18, 2015 17:34
gdk-screen-layout-tester
#!/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 11:23
GtkNotebook minimal code, for debugging
#!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 April 7, 2015 11:11
Idea for extended OpenRaster layers
<?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 March 1, 2015 21:30
Draggable treemodel (test apparent regression between gtk 3.12 and 3.14)
#!/usr/bin/python
# Custom draggable TreeModel demo code
# Author: Andrew Chadwick <[email protected]>
# 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
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 August 29, 2015 14:12
An attempt at some MyPaint build instructions for Windows
@achadwick
achadwick / axischart.py
Last active January 26, 2016 15:46
Input axis stripchart for python-gobject and Gtk3
#!/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