This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python2.7 | |
from mididings import * | |
config( | |
client_name='MidiKeyPress', | |
in_ports = [('Mixer', 'USB Midi 4i4o:.*MIDI 1')], | |
out_ports = 0, | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
''' | |
Two alternatives for scene switch callback. | |
1. Using a custom made Hook() object, which responds only *after* a scene | |
change has been made. This means that if a scene switch request contains | |
a non existing scene/subscene, nothing happens. | |
2. Rewriting the private Engine.scene_switch_callback function, which | |
intercepts scene switch requests and can do some further actions before | |
the change is actually made. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python2.7 | |
import sys | |
import midi | |
def getTempoMap(pattern, maxTick=None): | |
#create a first tempo (default to 120, if there is no tempo event) | |
tempoMap = [[0, .5 / pattern.resolution]] | |
lastTick = 0 | |
for track in pattern: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Different ways to doSomething(row, column) based on the clicked button | |
''' | |
class GuiBase(QtWidgets.QWidget): | |
def doSomething(self, row, column): | |
print(row, column) | |
''' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def getSlices(l, step): | |
# stepCount, rest = divmod(len(l) - 1, step) | |
rest = (len(l) - 1) % step | |
if not rest: | |
return l[::step] | |
stepCount = len(l) // (rest + 1) | |
indexes = [0] | |
maxIndex = len(l) | |
i = 0 | |
# maybe done = step for short/odd lists? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PyQt5 import QtCore, QtGui, QtWidgets | |
class FakeCursor(QtWidgets.QWidget): | |
def __init__(self): | |
super().__init__() | |
self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.ToolTip) | |
self.setFixedSize(16, 16) | |
path = QtGui.QPainterPath() | |
path.moveTo(0, 8) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"be": { | |
"basic": { | |
"name": "Belgian", | |
"include": ["latin","level3.ralt_switch"], | |
"keys": { | |
"0": { | |
"0": "w", | |
"6": ",", | |
"7": ";", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PyQt5 import QtCore, QtGui, QtWidgets | |
class SimpleDial(QtWidgets.QDial): | |
def paintEvent(self, event): | |
# create a QStyleOption for the dial, and initialize it with the basic properties | |
# that will be used for the configuration of the painter | |
opt = QtWidgets.QStyleOptionSlider() | |
self.initStyleOption(opt) | |
# construct a QRectF that uses the minimum between width and height, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try: | |
from PySide2 import QtCore, QtWidgets | |
print(QtCore.__version__) | |
except: | |
from PyQt5 import QtCore, QtWidgets | |
print(QtCore.QT_VERSION_STR) | |
class Model(QtCore.QAbstractTableModel): | |
def __init__(self,): | |
super().__init__() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PyQt5 import QtWidgets | |
import sys | |
app = QtWidgets.QApplication(sys.argv) | |
window = QtWidgets.QWidget() | |
mainLayout = QtWidgets.QGridLayout(window) | |
labels = [] | |
for r in range(3): | |
for c in range(4): | |
button = QtWidgets.QPushButton() |
OlderNewer