Skip to content

Commit

Permalink
a little better
Browse files Browse the repository at this point in the history
it's all coming together now >:)
  • Loading branch information
pussinboot committed Oct 22, 2015
1 parent 6cba1da commit c8aec7c
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 83 deletions.
108 changes: 54 additions & 54 deletions v0.5.0/Twitch.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,72 +3,72 @@ Input Name = Twitch
Input ID = 1

[Keys]
previous set = [151, 18]
scale 2nd layer =
next = [152, 19]
l pad #6 = [151, 101]
l pad #7 = [151, 102]
prev = [152, 18]
change amplitude =
l pad #4 = [151, 99]
cycle waveform =
r pad #6 = [152, 101]
scale waveform =
r pad #1 = [152, 96]
waveform opacity =
r pad #7 = [152, 102]
motion left/right = [184, 53]
stop = [152, 22]
r pad #3 = [152, 98]
l pad #3 = [151, 98]
rotate =
next set = [151, 19]
motion up/down = [183, 53]
l pad #2 = [151, 97]
flip 2nd layer =
prev = [152, 18]
r pad #2 = [152, 97]
l pad #5 = [151, 100]
r pad #5 = [152, 100]
r pad #8 = [152, 103]
r pad #4 = [152, 99]
play/pause = [152, 23]
l pad #2 = [151, 97]
zoom =
flip 2nd layer =
l pad #8 = [151, 103]
l pad #1 = [151, 96]
play/pause = [152, 23]
stop = [152, 22]
l pad #6 = [151, 101]
brightness =
r pad #6 = [152, 101]
l pad #3 = [151, 98]
previous set = [151, 18]
change amplitude =
r pad #4 = [152, 99]
r pad #8 = [152, 103]
r pad #1 = [152, 96]
r pad #7 = [152, 102]
next = [152, 19]
scale 2nd layer =
motion up/down = [183, 53]
l pad #1 = [151, 96]
l pad #5 = [151, 100]
scale waveform =
l pad #7 = [151, 102]
rotate =
next set = [151, 19]
waveform opacity =
r pad #3 = [152, 98]
motion left/right = [184, 53]
l pad #4 = [151, 99]

[Type]
previous set = p
scale 2nd layer = o
next = p
l pad #6 = p
l pad #7 = p
prev = p
change amplitude = o
l pad #4 = p
cycle waveform = p
r pad #6 = p
scale waveform = o
r pad #1 = p
waveform opacity = o
r pad #7 = p
motion left/right = s
stop = p
r pad #3 = p
l pad #3 = p
rotate = o
next set = p
motion up/down = s
l pad #2 = p
flip 2nd layer = p
prev = p
r pad #2 = p
l pad #5 = p
r pad #5 = p
r pad #8 = p
r pad #4 = p
play/pause = p
l pad #2 = p
zoom = o
flip 2nd layer = p
l pad #8 = p
l pad #1 = p
play/pause = p
stop = p
l pad #6 = p
brightness = o
r pad #6 = p
l pad #3 = p
previous set = p
change amplitude = o
r pad #4 = p
r pad #8 = p
r pad #1 = p
r pad #7 = p
next = p
scale 2nd layer = o
motion up/down = s
l pad #1 = p
l pad #5 = p
scale waveform = o
l pad #7 = p
rotate = o
next set = p
waveform opacity = o
r pad #3 = p
motion left/right = s
l pad #4 = p

25 changes: 12 additions & 13 deletions v0.5.0/mdvj.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,20 +124,19 @@ def change_text(self,new_text):
def select(self,event):
self.padgroup.parent.mdc.select_preset(self.preset)

class Setup:
def Setup():
""" loads config if exists, otherwise guides you through setup process"""

def __init__(self):
if os.path.exists('vj_config.ini'):
# load config
print('config exists')
else:
#Screenshot()
#ConfigMidi(tk.Toplevel())
midi_config.main()
main()
# and then configure midi controller : )
# and then finna run the fun

if os.path.exists('vj_config.ini'):
# load config
print('config exists')
else:
#Screenshot()
#ConfigMidi(tk.Toplevel())
midi_config.main()
#main()
# and then configure midi controller : )
# and then finna run the fun

def main():
root = tk.Tk()
Expand Down
26 changes: 12 additions & 14 deletions v0.5.0/midi_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from tkinter import ttk
import os, configparser

from midi_control import MidiClient
from midi_control import MidiClient, MidiControl

class ConfigMidi:
"""
Expand All @@ -15,9 +15,12 @@ def __init__(self,master):
self.start_fun = lambda : None
self.midi_started = False
self.input_storage = None
self.MC = MidiControl()
# tk stuff
self.nb = ttk.Notebook(self.master)
self.nb.pack()

self.nb.bind_all('<<NotebookTabChanged>>',lambda event: self.master.update())
# description of binds and type restrictions # these are only things that have corresponding keybinds that are sent to md
# 'r' - relative, 'o' - on/off
desc_type = {'prev' : 'o', 'play/pause' : 'o', 'stop' : 'o', 'next' : 'o',
Expand All @@ -44,9 +47,8 @@ def __init__(self,master):
ckeys = ['zoom', 'rotate', 'motion left/right', 'motion up/down', 'change amplitude', 'cycle waveform', 'scale waveform', 'waveform opacity', 'scale 2nd layer', 'flip 2nd layer', 'brightness']
self.c_page = self.nb_page(ckeys)
self.nb.add(self.c_page,text='preset control')
#for i in range(15):
# cl = self.config_line(self.master,self.descs[i],self.binds[i],self.control_types[i]) # create StringVar and pass it as the bind
# cl.pack()

self.start()
# first popup with selection of inputs
# and outputs as well
#self.start()
Expand All @@ -73,9 +75,6 @@ def spit_vals(self,event):
for key in self.dict:
print(key,self.dict[key][0].get(),self.dict[key][1].get())

def set_start_op(self,fun, *args):
self.start_fun = lambda *args: fun(*args)

def start(self):
# if no device
device_select = self.device_selection()
Expand Down Expand Up @@ -158,7 +157,11 @@ def return_vals():
self.input_storage = [choices[0], str(tor[0])]
self.MC.set_inp(tor[0])
self.midi_started = True
self.start_fun()
self.midi_thread = MidiClient(self.master,self,self.MC,250)
self.queue = self.midi_thread.queue
self.midi_thread.start()
self.master.update()


device_select.protocol("WM_DELETE_WINDOW",return_vals)

Expand All @@ -177,8 +180,7 @@ def return_vals():
def set_queue(self,queue):
self.queue = queue

def set_MC(self,MC):
self.MC = MC


def processIncoming(self):
pass
Expand Down Expand Up @@ -278,10 +280,6 @@ def main():
root = tk.Tk()
root.wm_state('iconic')
config = ConfigMidi(root)
midi_thread = MidiClient(root,config,100)
config.set_MC(midi_thread.MC)
config.set_start_op(midi_thread.start)
config.start()
root.mainloop()


Expand Down
7 changes: 5 additions & 2 deletions v0.5.0/midi_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,18 @@ class MidiClient:
endApplication could reside in the GUI part, but putting them here
means that you have all the thread controls in a single place.
"""
def __init__(self, master, gui,refresh_int=25):
def __init__(self, master, gui, mc=None, refresh_int=25):
"""
Start the GUI and the asynchronous threads. We are in the main
(original) thread of the application, which will later be used by
the GUI. We spawn a new thread for the worker.
"""
self.master = master
self.refresh_int = refresh_int
self.MC = MidiControl()
if not mc:
self.MC = MidiControl()
else:
self.MC = mc
# Create the queue
self.queue = queue.Queue()

Expand Down

0 comments on commit c8aec7c

Please sign in to comment.