-
Notifications
You must be signed in to change notification settings - Fork 20
/
r_e_c_u_r.py
executable file
·77 lines (54 loc) · 2.15 KB
/
r_e_c_u_r.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/usr/bin/python
import traceback
from tkinter import Tk, Frame
import sys
import tracemalloc
import argparse
from pythonosc import udp_client
from actions import Actions
from data_centre.data import Data
from display_centre.display import Display
from display_centre.messages import MessageHandler
from user_input.numpad_input import NumpadInput
from user_input.midi_input import MidiInput
from user_input.analog_input import AnalogInput
from video_centre.video_driver import VideoDriver
#from video_centre.capture import Capture
from video_centre.shaders import Shaders
import data_centre
# create tk object
tk = Tk()
frame = Frame(tk, width=500, height=400)
# setup message handler
message_handler = MessageHandler()
# setup data
data = Data(message_handler)
def setup_osc_client():
client_parser = argparse.ArgumentParser()
client_parser.add_argument("--ip", default="127.0.0.1", help="the ip")
client_parser.add_argument("--port", type=int, default=8000, help="the port")
client_args = client_parser.parse_args()
return udp_client.SimpleUDPClient(client_args.ip, client_args.port)
osc_client = setup_osc_client()
# setup the video driver
video_driver = VideoDriver(tk, osc_client, message_handler, data)
#capture = Capture(tk, osc_client, message_handler, data)
shaders = Shaders(tk, osc_client, message_handler, data)
# setup the display
display = Display(tk, video_driver, shaders, message_handler, data)
# setup the actions
actions = Actions(tk, message_handler, data, video_driver, shaders, display, osc_client)
numpad_input = NumpadInput(tk, message_handler, display, actions, data)
midi_input = MidiInput(tk, message_handler, display, actions, data)
analog_input = AnalogInput(tk, message_handler, display, actions, data)
actions.check_and_set_output_mode_on_boot()
actions.check_dev_mode()
actions.check_if_should_start_openframeworks()
actions.toggle_x_autorepeat()
frame.pack()
tk.attributes("-fullscreen", True)
def handle_error(exc, val, tb):
print('traceback for error : {}'.format(traceback.format_exc()))
message_handler.set_message('ERROR', val, traceback.format_exc())
tk.report_callback_exception = handle_error
tk.mainloop()