def _init_north_toolbar(self): frame = factory.frame(self) toolbar = factory.label_frame(frame, "Bank") specs = self.synth.specs format_ = specs["format"] sid = self.synth.sid logo_filename = os.path.join("resources", format_, "logo_small.png") lab_logo = factory.image_label(frame, logo_filename, format_) lab_sid = factory.label(frame, "ID = %s" % sid) b_open = factory.button(toolbar, "Open", ttip="Read bank file", command=self._open_bank) b_save = factory.button(toolbar, "Save", ttip="Save bank file", command=self._save_bank) b_init = factory.button(toolbar, "Init", ttip="Initialize bank", command=self._init_bank) b_rem = factory.button(toolbar, "Rem", ttip="Edit bank remarks", command=self._edit_remarks) b_help = factory.help_button(toolbar, command= self._help) b_open.grid(row=0, column=0, sticky="ew") b_save.grid(row=0, column=1, sticky="ew") b_init.grid(row=0, column=2, sticky="ew") b_rem.grid(row=1, column=0, sticky="ew") b_help.grid(row=1, column=1, sticky="ew") lab_logo.grid(row=0, column=0, sticky='w', pady=4) lab_sid.grid(row=0, column=1, columnspan=2) toolbar.grid(row=1, column=0, columnspan=2) return frame
def _init_north_toolbar(self): frame = factory.frame(self) toolbar = factory.label_frame(frame, "Bank") specs = self.synth.specs format_ = specs["format"] sid = self.synth.sid logo_filename = os.path.join("resources", format_, "logo_small.png") lab_logo = factory.image_label(frame, logo_filename, format_) lab_sid = factory.label(frame, "ID = %s" % sid) b_open = factory.button(toolbar, "Open", ttip="Read bank file", command=self._open_bank) b_save = factory.button(toolbar, "Save", ttip="Save bank file", command=self._save_bank) b_init = factory.button(toolbar, "Init", ttip="Initialize bank", command=self._init_bank) b_rem = factory.button(toolbar, "Rem", ttip="Edit bank remarks", command=self._edit_remarks) b_help = factory.help_button(toolbar, command= self._help) b_open.grid(row=0, column=0, sticky="ew") b_save.grid(row=0, column=1, sticky="ew") b_init.grid(row=0, column=2, sticky="ew") b_rem.grid(row=1, column=0, sticky="ew") b_help.grid(row=1, column=1, sticky="ew") lab_logo.grid(row=0, column=0, sticky='w', pady=4) lab_sid.grid(row=0, column=1, columnspan=2) toolbar.grid(row=1, column=0, columnspan=2) return frame
def __init__(self, master, parent_editor, synth): print("DEPRECIATED: TkBusAndBufferEditor") Frame.__init__(self, master) self.parent_editor = parent_editor self.synth = synth self.config(background=factory.bg()) self.pack(anchor="nw", expand=True, fill="both") main = layout.VFrame(self) main.pack(anchor="nw", expand=True, fill="both") frame_abus = factory.label_frame(main, "Audio Busses") frame_cbus = factory.label_frame(main, "Control Busses") frame_buf = factory.label_frame(main, "Buffers") main.add(frame_abus, padx=8, pady=8) main.add(frame_cbus, padx=8, pady=8) main.add(frame_buf, padx=8, pady=8) self.lab_abus = factory.label(frame_abus, "") self.lab_abus.pack() self.lab_cbus = factory.label(frame_cbus, "") self.lab_cbus.pack() self.lab_buffers = factory.label(frame_buf, "") self.lab_buffers.pack()
def _edit_remarks(self): bnk = self.synth.bank() name = bnk.name filename = bnk.filename remarks = bnk.remarks dialog = Toplevel(self) frame = factory.frame(dialog, True) frame.pack(expand=True, fill="both") lab_title = factory.center_label(frame, "Bank Info") lab_name = factory.label(frame, "Bank name : '%s'" % name) lab_filename = factory.label(frame, "Filename : '%s'" % filename) frame_text = factory.label_frame(frame, "Remarks") lab_title.grid(row=0, column=0, columnspan=3,pady=12) lab_name.grid(row=1, column=0, sticky="w", padx=4) lab_filename.grid(row=2, column=0, sticky="w", padx=4) frame_text.grid(row=3, column=0, columnspan=3, padx=4, pady=8) text_widget = factory.text_widget(frame_text, "Bank remarks") text_widget.insert('end', remarks) text_widget.config(width=80, height=20) vsb = factory.scrollbar(frame_text, orientation="vertical") hsb = factory.scrollbar(frame_text, orientation="horizontal") text_widget.grid(row=0, column=0, rowspan=8, columnspan=8, ipadx=4, ipady=4) vsb.grid(row=0, column=8, rowspan=8, columnspan=1, sticky="ns") hsb.grid(row=8, column=0, rowspan=1, columnspan=8, sticky="ew") vsb.config(command=text_widget.yview) hsb.config(command=text_widget.xview) text_widget.config(yscrollcommand=vsb.set) text_widget.config(xscrollcommand=hsb.set) frame_toolbar = factory.frame(frame, True) frame_toolbar.grid(row=4, column=0, padx=4, pady=8) def clear(): text_widget.delete(1.0, 'end') def accept(): rem = text_widget.get(1.0, 'end') bnk.remarks = rem self.status("Bank remarks updated") dialog.destroy() def cancel(): self.status("Change bank remarks canceld") dialog.destroy() b_clear = factory.clear_button(frame_toolbar, command=clear, ttip="Clear remarks") b_accept = factory.accept_button(frame_toolbar, command=accept) b_cancel = factory.cancel_button(frame_toolbar, command=cancel) b_clear.grid(row=0, column=0, padx=4, pady=8) b_accept.grid(row=0, column=1) b_cancel.grid(row=0, column=2) dialog.grab_set() dialog.mainloop()
def __init__(self, master, parent_editor, synth): print("DEPRECIATED: TkBusAndBufferEditor") Frame.__init__(self, master) self.parent_editor = parent_editor self.synth = synth self.config(background=factory.bg()) self.pack(anchor="nw", expand=True, fill="both") main = layout.VFrame(self) main.pack(anchor="nw", expand=True, fill="both") frame_abus = factory.label_frame(main, "Audio Busses") frame_cbus = factory.label_frame(main, "Control Busses") frame_buf = factory.label_frame(main, "Buffers") main.add(frame_abus, padx=8, pady=8) main.add(frame_cbus, padx=8, pady=8) main.add(frame_buf, padx=8, pady=8) self.lab_abus = factory.label(frame_abus, "") self.lab_abus.pack() self.lab_cbus = factory.label(frame_cbus, "") self.lab_cbus.pack() self.lab_buffers = factory.label(frame_buf, "") self.lab_buffers.pack()
def _edit_remarks(self): bnk = self.synth.bank() name = bnk.name filename = bnk.filename remarks = bnk.remarks dialog = Toplevel(self) frame = factory.frame(dialog, True) frame.pack(expand=True, fill="both") lab_title = factory.center_label(frame, "Bank Info") lab_name = factory.label(frame, "Bank name : '%s'" % name) lab_filename = factory.label(frame, "Filename : '%s'" % filename) frame_text = factory.label_frame(frame, "Remarks") lab_title.grid(row=0, column=0, columnspan=3,pady=12) lab_name.grid(row=1, column=0, sticky="w", padx=4) lab_filename.grid(row=2, column=0, sticky="w", padx=4) frame_text.grid(row=3, column=0, columnspan=3, padx=4, pady=8) text_widget = factory.text_widget(frame_text, "Bank remarks") text_widget.insert('end', remarks) text_widget.config(width=80, height=20) vsb = factory.scrollbar(frame_text, orientation="vertical") hsb = factory.scrollbar(frame_text, orientation="horizontal") text_widget.grid(row=0, column=0, rowspan=8, columnspan=8, ipadx=4, ipady=4) vsb.grid(row=0, column=8, rowspan=8, columnspan=1, sticky="ns") hsb.grid(row=8, column=0, rowspan=1, columnspan=8, sticky="ew") vsb.config(command=text_widget.yview) hsb.config(command=text_widget.xview) text_widget.config(yscrollcommand=vsb.set) text_widget.config(xscrollcommand=hsb.set) frame_toolbar = factory.frame(frame, True) frame_toolbar.grid(row=4, column=0, padx=4, pady=8) def clear(): text_widget.delete(1.0, 'end') def accept(): rem = text_widget.get(1.0, 'end') bnk.remarks = rem self.status("Bank remarks updated") dialog.destroy() def cancel(): self.status("Change bank remarks canceld") dialog.destroy() b_clear = factory.clear_button(frame_toolbar, command=clear, ttip="Clear remarks") b_accept = factory.accept_button(frame_toolbar, command=accept) b_cancel = factory.cancel_button(frame_toolbar, command=cancel) b_clear.grid(row=0, column=0, padx=4, pady=8) b_accept.grid(row=0, column=1) b_cancel.grid(row=0, column=2) dialog.grab_set() dialog.mainloop()
def _init_performance_toolbar(self): frame = factory.label_frame(self, "Performance") b_pcopy = factory.button(frame, "Copy", ttip="Copy current performance to clipboard", command = self._copy_performance) b_ppaste = factory.button(frame, "Paste", ttip="Paste clipboard to current performance", command = self._paste_performance) b_pfill = factory.button(frame, "Fill", ttip="Copy performance to multiple bank slots", command = self._fill_performance) b_pcopy.grid(row=0, column=0, sticky="ew") b_ppaste.grid(row=0, column=1, sticky="ew") b_pfill.grid(row=0, column=2, sticky="ew") return frame
def _init_performance_toolbar(self): frame = factory.label_frame(self, "Performance") b_pcopy = factory.button(frame, "Copy", ttip="Copy current performance to clipboard", command = self._copy_performance) b_ppaste = factory.button(frame, "Paste", ttip="Paste clipboard to current performance", command = self._paste_performance) b_pfill = factory.button(frame, "Fill", ttip="Copy performance to multiple bank slots", command = self._fill_performance) b_pcopy.grid(row=0, column=0, sticky="ew") b_ppaste.grid(row=0, column=1, sticky="ew") b_pfill.grid(row=0, column=2, sticky="ew") return frame
def _init_south_toolbar(self): frame = factory.label_frame(self, "Program") b_store = factory.button(frame, "Store", command=self._store_program, ttip = "Store current program") b_random = factory.button(frame, "RND", command=self._random_program, ttip = "Generate random program (if defined)") b_init = factory.button(frame, "Init", command=self._init_program, ttip = "Initialize program") b_copy = factory.button(frame, "Copy", command=self._copy_program, ttip="Copy current prgoram to clipbaord") b_paste = factory.button(frame, "Paste", command=self._paste_program, ttip="Paste clipboard to current program") cb_lock = factory.checkbutton(frame,"Lock",self._var_lock_current, command = self.lock_current_program) b_store.grid(row=0, column=0, sticky="ew") b_random.grid(row=0, column=1, sticky="ew") b_init.grid(row=0, column=2, sticky="ew") b_copy.grid(row=1, column=0, sticky="ew") b_paste.grid(row=1, column=1, sticky="ew") cb_lock.grid(row=1, column=2, sticky="ew") return frame
def _init_south_toolbar(self): frame = factory.label_frame(self, "Program") b_store = factory.button(frame, "Store", command=self._store_program, ttip = "Store current program") b_random = factory.button(frame, "RND", command=self._random_program, ttip = "Generate random program (if defined)") b_init = factory.button(frame, "Init", command=self._init_program, ttip = "Initialize program") b_copy = factory.button(frame, "Copy", command=self._copy_program, ttip="Copy current prgoram to clipbaord") b_paste = factory.button(frame, "Paste", command=self._paste_program, ttip="Paste clipboard to current program") cb_lock = factory.checkbutton(frame,"Lock",self._var_lock_current, command = self.lock_current_program) b_store.grid(row=0, column=0, sticky="ew") b_random.grid(row=0, column=1, sticky="ew") b_init.grid(row=0, column=2, sticky="ew") b_copy.grid(row=1, column=0, sticky="ew") b_paste.grid(row=1, column=1, sticky="ew") cb_lock.grid(row=1, column=2, sticky="ew") return frame
def _store_program(self): bnk = self.synth.bank() program = bnk[None] slot = bnk.current_slot var_name = StringVar() var_start = StringVar() var_name.set(program.name) var_start.set(slot) dialog = Toplevel() frame = factory.frame(dialog, True) frame.pack(expand=True, fill="both") lab_title = factory.label(frame, "Store Program", modal=True) lab_name = factory.label(frame, "Name", modal=True) lab_start = factory.label(frame, "Slot", modal=True) entry_name = factory.entry(frame, var_name, "Program name") spin_start = factory.int_spinbox(frame, var_start, 0, len(bnk), "Startng slot") frame_remarks = factory.label_frame(frame, "Remarks", True) text_remarks = factory.text_widget(frame_remarks, "Remarks text", modal=True) text_remarks.insert("end", program.remarks) vsb = factory.scrollbar(frame_remarks, orientation="vertical") hsb = factory.scrollbar(frame_remarks, orientation="horizontal") text_remarks.config(width=40, height=10) text_remarks.grid(row=0, column=0, rowspan=4, columnspan=4) vsb.grid(row=0, column=4, rowspan=4, sticky="ns") hsb.grid(row=4, column=0, columnspan=4, sticky="ew") vsb.config(command=text_remarks.yview) hsb.config(command=text_remarks.xview) text_remarks.config(yscrollcommand=vsb.set) text_remarks.config(xscrollcommand=hsb.set) lab_title.grid(row=0, column=0, columnspan=3, pady=8, padx=4) lab_name.grid(row=1, column=0, padx=4) entry_name.grid(row=1, column=1, columnspan=2) frame_remarks.grid(row=2, column=0, rowspan=4, columnspan=4, padx=4, pady=4) lab_start.grid(row=6, column=0, padx=4, sticky="w") spin_start.grid(row=6, column=1, columnspan=2, pady=4) b_accept = factory.accept_button(frame) b_cancel = factory.cancel_button(frame) b_accept.grid(row=8, column=1, pady=8, sticky="ew") b_cancel.grid(row=8, column=2, pady=8, sticky="ew") def accept(): try: a = int(var_start.get()) name = var_name.get() remarks = text_remarks.get(1.0, "end") program.name = name program.remarks = remarks bnk[a] = program msg = "Stored program '%s' to slots [%3d]" % (name, a) self.status(msg) dialog.destroy() self.sync() except ValueError: msg = "Invalid slot number" self.warning(msg) def cancel(): msg = "Store program canceld" self.status(msg) dialog.destroy() b_accept.config(command=accept) b_cancel.config(command=cancel) dialog.grab_set() dialog.mainloop()
def __init__(self, master, app, synth_type, is_efx=False, is_controller=False): Toplevel.__init__(self, master) main = factory.frame(self) main.pack(anchor=W, expand=True, fill=BOTH) self.app = app self.stype = synth_type self.is_efx = is_efx self.is_controller = is_controller sid = "%s_%d" % (synth_type, SynthProxy.current_synth_serial_number()) specs = SynthSpecs.global_synth_type_registry[synth_type] self._combo_audio_in = {} # Maps synth parameter to combo box self._combo_audio_out = {} self._combo_control_in = {} self._combo_control_out = {} self._buffername_map = {} title = "Add %s " % synth_type if is_efx: title += "Effect" elif is_controller: title += "Controller Synth" else: title += "Synth" title += " sid = %s" % sid frame_north = factory.frame(main) frame_north.grid(row=0, column=0, columnspan=2, sticky='ew', padx=4, pady=8) logo_filename = os.path.join("resources", synth_type, "logo_small.png") lab_logo = factory.image_label(frame_north, logo_filename, synth_type) lab_id = factory.dialog_title_label(frame_north, title) lab_logo.grid(row=0, column=0, padx=8) lab_id.grid(row=0, column=1) # Audio Input Buses frame_audio_in = factory.label_frame(main, "Audio Input Buses") row = 0 for i in range(MAX_BUS_COUNT): try: b = specs["audio-input-buses"][i] param = b[0] lab_name = factory.label(frame_audio_in, "%d - %s" % (i+1, param)) combo = factory.audio_bus_combobox(frame_audio_in, self.app) combo.set(b[1]) lab_name.grid(row=row, column=0, sticky="w", padx=4, pady=4) combo.grid(row=row, column=1, sticky="w", padx=4, pady=4) self._combo_audio_in[param] = combo except IndexError: lab_dummy = factory.label(frame_audio_in, "%d - n/a" % (i+1, )) lab_dummy.grid(row=row, column=0) row += 1 factory.padding_label(frame_audio_in).grid(row=row, column=0) frame_audio_in.grid(row=1, column=0, padx=4, pady=4, sticky='ew') # Audio Output Buses frame_audio_out = factory.label_frame(main, "Audio Output Buses") row = 0 for i in range(MAX_BUS_COUNT): try: b = specs["audio-output-buses"][i] param = b[0] lab_name = factory.label(frame_audio_out, "%d - %s" % (i+1, param)) combo = factory.audio_bus_combobox(frame_audio_out, self.app) combo.set(b[1]) lab_name.grid(row=row, column=0, sticky="w", padx=4, pady=4) combo.grid(row=row, column=1, sticky="w", padx=4, pady=4) self._combo_audio_out[param] = combo except IndexError: lab_dummy = factory.label(frame_audio_out, "%d - n/a" % (i+1,)) lab_dummy.grid(row=row, column=0) row += 1 factory.padding_label(frame_audio_out).grid(row=row, column=0) frame_audio_out.grid(row=5, column=0, padx=4, pady=4, sticky='ew') # Control Input Buses frame_control_in = factory.label_frame(main, "Control Input Buses") row = 0 for i in range(MAX_BUS_COUNT): try: b = specs["control-input-buses"][i] param = b[0] lab_name = factory.label(frame_control_in, "%d - %s" % (i+1, param)) combo = factory.control_bus_combobox(frame_control_in, self.app) combo.set(b[1]) lab_name.grid(row=row, column=0, sticky="w", padx=4, pady=4) combo.grid(row=row, column=1, sticky="w", padx=4, pady=4) self._combo_control_in[param] = combo except IndexError: lab_dummy = factory.label(frame_control_in, "%d - n/a" % (i+1, )) lab_dummy.grid(row=row, column=0) row += 1 factory.padding_label(frame_control_in).grid(row=row, column=0) frame_control_in.grid(row=1, column=3, padx=4, pady=4, sticky='ew') # Control Output Buses frame_control_out = factory.label_frame(main, "Control Output Buses") row = 0 for i in range(MAX_BUS_COUNT): try: b = specs["control-output-buses"][i] param = b[0] lab_name = factory.label(frame_control_out, "%d - %s" % (i+1, param)) combo = factory.control_bus_combobox(frame_control_out, self.app) combo.set(b[1]) lab_name.grid(row=row, column=0, sticky="w", padx=4, pady=4) combo.grid(row=row, column=1, sticky="w", padx=4, pady=4) self._combo_control_out[param] = combo except IndexError: lab_dummy = factory.label(frame_control_out, "%d - n/a" % (i+1, )) lab_dummy.grid(row=row, column=0) row += 1 factory.padding_label(frame_control_out).grid(row=row, column=0) frame_control_out.grid(row=5, column=3, padx=4, pady=4, sticky='ew') # Buffers # if specs["buffers"]: # frame_buffers = factory.label_frame(main, "Buffers") # row = 0 # for param in specs["buffers"]: # lab_name = factory.label(frame_buffers, param) # combo = factory.buffer_combobox(frame_buffers, self.app) # lab_name.grid(row=row, column=0, sticky="w", padx=4, pady=4) # combo.grid(row=row, column=1, sticky="w", padx=4, pady=4) # self._buffername_map[param] = combo # row += 1 # factory.padding_label(frame_buffers).grid(row=row, column=0, sticky='ew') # frame_buffers.grid(row=9, column=3, padx=4, pady=4) # Keymode self.var_keymode = StringVar() self.var_voice_count = StringVar() self.var_voice_count.set(8) frame_keymode = factory.label_frame(main, "Key mode") col = 0 for km in specs["keymodes"]: rb = factory.radio(frame_keymode, km, self.var_keymode, km) rb.grid(row=0, column=col, sticky="w", padx=4, pady=4) col += 1 self.var_keymode.set(specs["keymodes"][0]) # Set default keymode lab_vc = factory.label(frame_keymode, "Voice count") spin_vc = factory.int_spinbox(frame_keymode, self.var_voice_count, from_=1, to=128) lab_vc.grid(row=1, column=0, padx=4) spin_vc.grid(row=1, column=1, columnspan=3, padx=4, pady=4) frame_keymode.grid(row=9, column=0, padx=4, pady=4, sticky='ew') factory.padding_label(frame_keymode).grid(row=2, column=0) # South Toolbar toolbar = factory.frame(main) b_help = factory.help_button(toolbar, command=self.display_help) b_accept = factory.accept_button(toolbar, command=self.accept) b_cancel = factory.cancel_button(toolbar, command=self.cancel) b_help.grid(row=0, column=0, sticky="w") factory.padding_label(toolbar).grid(row=0, column=1) b_accept.grid(row=0, column=2, sticky="e") b_cancel.grid(row=0, column=3, sticky="e") toolbar.grid(row=10, column=0, columnspan=5, sticky="ew", padx=4, pady=8)
def _init_map2_tab(self, master): img = factory.image("resources/Tabs/map.png") HELP_TOPIC = "parameter-maps" HEIGHT = 8 frame = factory.frame(master) master.add(frame, text="Map2",image=img,compound="top") north = factory.label_frame(frame, "Velocity Maps") center = factory.label_frame(frame, "Aftertouch Maps") south = factory.label_frame(frame, "Keynumber Maps") north.grid(row=0, column=0, sticky="ew", padx=8, pady=8) center.grid(row=1, column=0, sticky="ew", padx=8) south.grid(row=2, column=0, sticky="ew", padx=8, pady=8) def help_callback(): self.app.main_window().display_help(HELP_TOPIC) list_vel_maps = factory.listbox(north, ttip="Active velocity maps") list_vel_maps.config(width=80, height=HEIGHT) self.list_vel_maps = list_vel_maps sb = factory.scrollbar(north, orientation="vertical") sb.config(command=list_vel_maps.yview) list_vel_maps.config(yscrollcommand=sb.set) b_add_vel = factory.add_button(north, ttip="Add velocity map") b_delete_vel = factory.delete_button(north, ttip="Delete velocity map") list_vel_maps.grid(row=0, column=0, columnspan=8, sticky="ew") sb.grid(row=0, column=8, sticky="ns") b_add_vel.grid(row=1, column=0, sticky="ew") b_delete_vel.grid(row=1, column=1, sticky="ew") list_atouch_maps = factory.listbox(center, ttip="Active after touch maps") list_atouch_maps.config(width=80, height=HEIGHT) self.list_atouch_maps = list_atouch_maps sb = factory.scrollbar(center, orientation="vertical") sb.config(command=list_atouch_maps.yview) list_atouch_maps.config(yscrollcommand=sb.set) b_add_atouch = factory.add_button(center, ttip="Add after touch map") b_delete_atouch = factory.delete_button(center, ttip="Delete after touch map") list_atouch_maps.grid(row=0, column=0, columnspan=8, sticky="ew") sb.grid(row=0, column=8, sticky="ns") b_add_atouch.grid(row=1, column=0, sticky="ew") b_delete_atouch.grid(row=1, column=1, sticky="ew") list_keynum_maps = factory.listbox(south, ttip="Active key number maps") list_keynum_maps.config(width=80, height=HEIGHT) self.list_keynum_maps = list_keynum_maps sb = factory.scrollbar(south, orientation="vertical") sb.config(command=list_keynum_maps.yview) list_keynum_maps.config(yscrollcommand=sb.set) b_add_keynum = factory.add_button(south, ttip="Add key number map") b_delete_keynum = factory.delete_button(south, ttip="Delete key number map") b_help = factory.help_button(south, command=help_callback) list_keynum_maps.grid(row=0, column=0, columnspan=8, sticky="ew") sb.grid(row=0, column=8, sticky="ns") b_add_keynum.grid(row=1, column=0, sticky="ew") b_delete_keynum.grid(row=1, column=1, sticky="ew") b_help.grid(row=1, column=7, sticky="ew") def add_map_callback(event): widget = event.widget if widget is b_add_vel: dialog = add_map_dialog(self.synth, "velocity", self.app) elif widget is b_add_atouch: dialog = add_map_dialog(self.synth, "aftertouch", self.app) elif widget is b_add_keynum: dialog = add_map_dialog(self.synth, "keynumber", self.app) else: msg = "Invald widget - Should never see this" raise ValueError(msg) def delete_map_callback(event): widget = event.widget if widget is b_delete_vel: dialog = delete_map_dialog(self, self.synth, "velocity", self.app) elif widget is b_delete_atouch: dialog = delete_map_dialog(self, self.synth, "aftertouch", self.app) elif widget is b_delete_keynum: dialog = delete_map_dialog(self, self.synth, "keynumber", self.app) else: msg = "Invald widget - Should never see this" raise ValueError(msg) b_add_vel.bind("<Button-1>", add_map_callback) b_add_atouch.bind("<Button-1>", add_map_callback) b_add_keynum.bind("<Button-1>", add_map_callback) b_delete_vel.bind("<Button-1>", delete_map_callback) b_delete_atouch.bind("<Button-1>", delete_map_callback) b_delete_keynum.bind("<Button-1>", delete_map_callback)
def _init_map2_tab(self, master): img = factory.image("resources/Tabs/map.png") HELP_TOPIC = "parameter-maps" HEIGHT = 8 frame = factory.frame(master) master.add(frame, text="Map2",image=img,compound="top") north = factory.label_frame(frame, "Velocity Maps") center = factory.label_frame(frame, "Aftertouch Maps") south = factory.label_frame(frame, "Keynumber Maps") north.grid(row=0, column=0, sticky="ew", padx=8, pady=8) center.grid(row=1, column=0, sticky="ew", padx=8) south.grid(row=2, column=0, sticky="ew", padx=8, pady=8) def help_callback(): self.app.main_window().display_help(HELP_TOPIC) list_vel_maps = factory.listbox(north, ttip="Active velocity maps") list_vel_maps.config(width=80, height=HEIGHT) self.list_vel_maps = list_vel_maps sb = factory.scrollbar(north, orientation="vertical") sb.config(command=list_vel_maps.yview) list_vel_maps.config(yscrollcommand=sb.set) b_add_vel = factory.add_button(north, ttip="Add velocity map") b_delete_vel = factory.delete_button(north, ttip="Delete velocity map") list_vel_maps.grid(row=0, column=0, columnspan=8, sticky="ew") sb.grid(row=0, column=8, sticky="ns") b_add_vel.grid(row=1, column=0, sticky="ew") b_delete_vel.grid(row=1, column=1, sticky="ew") list_atouch_maps = factory.listbox(center, ttip="Active after touch maps") list_atouch_maps.config(width=80, height=HEIGHT) self.list_atouch_maps = list_atouch_maps sb = factory.scrollbar(center, orientation="vertical") sb.config(command=list_atouch_maps.yview) list_atouch_maps.config(yscrollcommand=sb.set) b_add_atouch = factory.add_button(center, ttip="Add after touch map") b_delete_atouch = factory.delete_button(center, ttip="Delete after touch map") list_atouch_maps.grid(row=0, column=0, columnspan=8, sticky="ew") sb.grid(row=0, column=8, sticky="ns") b_add_atouch.grid(row=1, column=0, sticky="ew") b_delete_atouch.grid(row=1, column=1, sticky="ew") list_keynum_maps = factory.listbox(south, ttip="Active key number maps") list_keynum_maps.config(width=80, height=HEIGHT) self.list_keynum_maps = list_keynum_maps sb = factory.scrollbar(south, orientation="vertical") sb.config(command=list_keynum_maps.yview) list_keynum_maps.config(yscrollcommand=sb.set) b_add_keynum = factory.add_button(south, ttip="Add key number map") b_delete_keynum = factory.delete_button(south, ttip="Delete key number map") b_help = factory.help_button(south, command=help_callback) list_keynum_maps.grid(row=0, column=0, columnspan=8, sticky="ew") sb.grid(row=0, column=8, sticky="ns") b_add_keynum.grid(row=1, column=0, sticky="ew") b_delete_keynum.grid(row=1, column=1, sticky="ew") b_help.grid(row=1, column=7, sticky="ew") def add_map_callback(event): widget = event.widget if widget is b_add_vel: dialog = add_map_dialog(self.synth, "velocity", self.app) elif widget is b_add_atouch: dialog = add_map_dialog(self.synth, "aftertouch", self.app) elif widget is b_add_keynum: dialog = add_map_dialog(self.synth, "keynumber", self.app) else: msg = "Invalid widget - Should never see this" raise ValueError(msg) def delete_map_callback(event): widget = event.widget if widget is b_delete_vel: dialog = delete_map_dialog(self, self.synth, "velocity", self.app) elif widget is b_delete_atouch: dialog = delete_map_dialog(self, self.synth, "aftertouch", self.app) elif widget is b_delete_keynum: dialog = delete_map_dialog(self, self.synth, "keynumber", self.app) else: msg = "Invalid widget - Should never see this" raise ValueError(msg) b_add_vel.bind("<Button-1>", add_map_callback) b_add_atouch.bind("<Button-1>", add_map_callback) b_add_keynum.bind("<Button-1>", add_map_callback) b_delete_vel.bind("<Button-1>", delete_map_callback) b_delete_atouch.bind("<Button-1>", delete_map_callback) b_delete_keynum.bind("<Button-1>", delete_map_callback)
def __init__(self, master, synth, src, app): Toplevel.__init__(self, master) self.src = src self.synth = synth self.app = app self.var_curve = StringVar() self.var_modifier = StringVar() self.var_range_low = StringVar() self.var_range_high = StringVar() self.var_limit_low = StringVar() self.var_limit_high = StringVar() self.var_curve.set("linear") self.var_modifier.set("1.0") self.var_range_low.set("0.0") self.var_range_high.set("1.0") self.var_limit_low.set("0.0") self.var_limit_high.set("1.0") frame = factory.frame(self, modal=True) frame.pack(expand=True, fill="both") lab_title = factory.label(frame, "Add MIDI Source Map", modal=True) lab_title.grid(row=0, column=0, columnspan=4, padx=4, pady=8) if src == "cc": lab_src1 = factory.label(frame, "Controller", modal=True) self.combo_source = factory.controller_combobox(frame, app) lab_src1.grid(row=1, column=0, sticky="w", padx=4) self.combo_source.grid(row=1, column=1) else: lab_src1 = factory.label(frame, "Source", modal=True) lab_src2 = factory.label(frame, src, modal=True) self.combo_source = factory.combobox(None, [src]) # Hidden lab_src1.grid(row=1, column=0, sticky="w", padx=4) lab_src2.grid(row=1, column=1, sticky="w") lab_params = factory.label(frame, "Params", modal=True) bnk = synth.bank() params = sorted(bnk.template.keys()) self.combo_params = factory.combobox(frame, params, "Synth parameters") frame_curve = factory.label_frame(frame, "Curve", modal=True) for i, c in enumerate((("Linear", "linear"), ("Exponential","exp"), ("Logistic (S)", "s"), ("Step","step"))): rb = factory.radio(frame_curve, c[0], self.var_curve, c[1], modal=True) rb.config(command=self._auto_modifier_callback) rb.grid(row=i, column=0, columnspan=2, sticky="w", padx=4) lab_modifier = factory.label(frame_curve, "Modifier", modal=True) spin_modifier = factory.float_spinbox(frame_curve, self.var_modifier, -10, 10, "Curve modifier") lab_modifier.grid(row=4, column=0, padx=4, pady=8, sticky="w") spin_modifier.grid(row=4, column=1) frame_range = factory.label_frame(frame, "Range", modal=True) lab_low = factory.label(frame_range, "Low", modal=True) lab_high = factory.label(frame_range, "High", modal=True) spin_range_low = factory.float_spinbox(frame_range, self.var_range_low, -100, 100) spin_range_low.config(command=self._auto_limit_callback) spin_range_high = factory.float_spinbox(frame_range, self.var_range_high, -100, 100) spin_range_high.config(command=self._auto_limit_callback) lab_low.grid(row=0, column=0, sticky="w", padx=4) spin_range_low.grid(row=0, column=1, sticky="ew") lab_high.grid(row=1, column=0, sticky="w", padx=4) spin_range_high.grid(row=1, column=1, sticky="ew") frame_limit = factory.label_frame(frame, "Limit", modal=True) lab_low = factory.label(frame_limit, "Low", modal=True) lab_high = factory.label(frame_limit, "High", modal=True) spin_limit_low = factory.float_spinbox(frame_limit, self.var_limit_low, -100, 100) spin_limit_high = factory.float_spinbox(frame_limit, self.var_limit_high, -100, 100) lab_low.grid(row=0, column=0, sticky="w", padx=4) spin_limit_low.grid(row=0, column=1, sticky="ew") lab_high.grid(row=1, column=0, sticky="w", padx=4) spin_limit_high.grid(row=1, column=1, sticky="ew") toolbar = factory.frame(frame, modal=True) b_help = factory.help_button(toolbar,command=self.help_callback) b_restore = factory.clear_button(toolbar, ttip="Restore defaults", command=self.restore_callback) b_accept = factory.accept_button(toolbar, command=self.accept_callback) b_cancel = factory.cancel_button(toolbar, command=self.cancel_callback) b_help.grid(row=0, column=0, sticky="ew") b_restore.grid(row=0, column=1, sticky="ew") b_accept.grid(row=0, column=2, sticky="ew") b_cancel.grid(row=0, column=3, sticky="ew") lab_params.grid(row=2, column=0, padx=4, sticky="w") self.combo_params.grid(row=2, column=1) frame_curve.grid(row=3, column=0, columnspan=2, padx=4, pady=8, sticky="ew") frame_range.grid(row=4, column=0, columnspan=2, padx=4, pady=4, sticky="ew") frame_limit.grid(row=5, column=0, columnspan=2, padx=4, pady=4, sticky="ew") toolbar.grid(row=6, column=0, columnspan=4, padx=4, pady=8, sticky="ew") if src == "cc": index = self.get_default_controller(synth) if is_string(index): index = int(index[1:4]) self.combo_source.current(index) index = self.get_default_param(synth) self.combo_params.set(index)
def __init__(self, master, app, synth_type, is_efx=False, is_controller=False): Toplevel.__init__(self, master) main = factory.frame(self) main.pack(anchor=W, expand=True, fill=BOTH) self.app = app self.stype = synth_type self.is_efx = is_efx self.is_controller = is_controller sid = "%s_%d" % (synth_type, SynthProxy.current_synth_serial_number()) specs = SynthSpecs.global_synth_type_registry[synth_type] self._combo_audio_in = {} # Maps synth parameter to combo box self._combo_audio_out = {} self._combo_control_in = {} self._combo_control_out = {} self._buffername_map = {} title = "Add %s " % synth_type if is_efx: title += "Effect" elif is_controller: title += "Controller Synth" else: title += "Synth" title += " sid = %s" % sid frame_north = factory.frame(main) frame_north.grid(row=0, column=0, columnspan=2, sticky='ew', padx=4, pady=8) logo_filename = os.path.join("resources", synth_type, "logo_small.png") lab_logo = factory.image_label(frame_north, logo_filename, synth_type) lab_id = factory.dialog_title_label(frame_north, title) lab_logo.grid(row=0, column=0, padx=8) lab_id.grid(row=0, column=1) # Audio Input Buses frame_audio_in = factory.label_frame(main, "Audio Input Buses") row = 0 for i in range(MAX_BUS_COUNT): try: b = specs["audio-input-buses"][i] param = b[0] lab_name = factory.label(frame_audio_in, "%d - %s" % (i + 1, param)) combo = factory.audio_bus_combobox(frame_audio_in, self.app) combo.set(b[1]) lab_name.grid(row=row, column=0, sticky="w", padx=4, pady=4) combo.grid(row=row, column=1, sticky="w", padx=4, pady=4) self._combo_audio_in[param] = combo except IndexError: lab_dummy = factory.label(frame_audio_in, "%d - n/a" % (i + 1, )) lab_dummy.grid(row=row, column=0) row += 1 factory.padding_label(frame_audio_in).grid(row=row, column=0) frame_audio_in.grid(row=1, column=0, padx=4, pady=4, sticky='ew') # Audio Output Buses frame_audio_out = factory.label_frame(main, "Audio Output Buses") row = 0 for i in range(MAX_BUS_COUNT): try: b = specs["audio-output-buses"][i] param = b[0] lab_name = factory.label(frame_audio_out, "%d - %s" % (i + 1, param)) combo = factory.audio_bus_combobox(frame_audio_out, self.app) combo.set(b[1]) lab_name.grid(row=row, column=0, sticky="w", padx=4, pady=4) combo.grid(row=row, column=1, sticky="w", padx=4, pady=4) self._combo_audio_out[param] = combo except IndexError: lab_dummy = factory.label(frame_audio_out, "%d - n/a" % (i + 1, )) lab_dummy.grid(row=row, column=0) row += 1 factory.padding_label(frame_audio_out).grid(row=row, column=0) frame_audio_out.grid(row=5, column=0, padx=4, pady=4, sticky='ew') # Control Input Buses frame_control_in = factory.label_frame(main, "Control Input Buses") row = 0 for i in range(MAX_BUS_COUNT): try: b = specs["control-input-buses"][i] param = b[0] lab_name = factory.label(frame_control_in, "%d - %s" % (i + 1, param)) combo = factory.control_bus_combobox(frame_control_in, self.app) combo.set(b[1]) lab_name.grid(row=row, column=0, sticky="w", padx=4, pady=4) combo.grid(row=row, column=1, sticky="w", padx=4, pady=4) self._combo_control_in[param] = combo except IndexError: lab_dummy = factory.label(frame_control_in, "%d - n/a" % (i + 1, )) lab_dummy.grid(row=row, column=0) row += 1 factory.padding_label(frame_control_in).grid(row=row, column=0) frame_control_in.grid(row=1, column=3, padx=4, pady=4, sticky='ew') # Control Output Buses frame_control_out = factory.label_frame(main, "Control Output Buses") row = 0 for i in range(MAX_BUS_COUNT): try: b = specs["control-output-buses"][i] param = b[0] lab_name = factory.label(frame_control_out, "%d - %s" % (i + 1, param)) combo = factory.control_bus_combobox(frame_control_out, self.app) combo.set(b[1]) lab_name.grid(row=row, column=0, sticky="w", padx=4, pady=4) combo.grid(row=row, column=1, sticky="w", padx=4, pady=4) self._combo_control_out[param] = combo except IndexError: lab_dummy = factory.label(frame_control_out, "%d - n/a" % (i + 1, )) lab_dummy.grid(row=row, column=0) row += 1 factory.padding_label(frame_control_out).grid(row=row, column=0) frame_control_out.grid(row=5, column=3, padx=4, pady=4, sticky='ew') # Buffers # if specs["buffers"]: # frame_buffers = factory.label_frame(main, "Buffers") # row = 0 # for param in specs["buffers"]: # lab_name = factory.label(frame_buffers, param) # combo = factory.buffer_combobox(frame_buffers, self.app) # lab_name.grid(row=row, column=0, sticky="w", padx=4, pady=4) # combo.grid(row=row, column=1, sticky="w", padx=4, pady=4) # self._buffername_map[param] = combo # row += 1 # factory.padding_label(frame_buffers).grid(row=row, column=0, sticky='ew') # frame_buffers.grid(row=9, column=3, padx=4, pady=4) # Keymode self.var_keymode = StringVar() self.var_voice_count = StringVar() self.var_voice_count.set(8) frame_keymode = factory.label_frame(main, "Key mode") col = 0 for km in specs["keymodes"]: rb = factory.radio(frame_keymode, km, self.var_keymode, km) rb.grid(row=0, column=col, sticky="w", padx=4, pady=4) col += 1 self.var_keymode.set(specs["keymodes"][0]) # Set default keymode lab_vc = factory.label(frame_keymode, "Voice count") spin_vc = factory.int_spinbox(frame_keymode, self.var_voice_count, from_=1, to=128) lab_vc.grid(row=1, column=0, padx=4) spin_vc.grid(row=1, column=1, columnspan=3, padx=4, pady=4) frame_keymode.grid(row=9, column=0, padx=4, pady=4, sticky='ew') factory.padding_label(frame_keymode).grid(row=2, column=0) # South Toolbar toolbar = factory.frame(main) b_help = factory.help_button(toolbar, command=self.display_help) b_accept = factory.accept_button(toolbar, command=self.accept) b_cancel = factory.cancel_button(toolbar, command=self.cancel) b_help.grid(row=0, column=0, sticky="w") factory.padding_label(toolbar).grid(row=0, column=1) b_accept.grid(row=0, column=2, sticky="e") b_cancel.grid(row=0, column=3, sticky="e") toolbar.grid(row=10, column=0, columnspan=5, sticky="ew", padx=4, pady=8)
def _store_program(self): bnk = self.synth.bank() program = bnk[None] slot = bnk.current_slot var_name = StringVar() var_start = StringVar() var_name.set(program.name) var_start.set(slot) dialog = Toplevel() frame = factory.frame(dialog, True) frame.pack(expand=True, fill="both") lab_title = factory.label(frame, "Store Program", modal=True) lab_name = factory.label(frame, "Name", modal=True) lab_start = factory.label(frame, "Slot", modal=True) entry_name = factory.entry(frame, var_name, "Program name") spin_start = factory.int_spinbox(frame, var_start, 0, len(bnk), "Startng slot") frame_remarks = factory.label_frame(frame, "Remarks", True) text_remarks = factory.text_widget(frame_remarks, "Remarks text", modal=True) text_remarks.insert("end", program.remarks) vsb = factory.scrollbar(frame_remarks, orientation="vertical") hsb = factory.scrollbar(frame_remarks, orientation="horizontal") text_remarks.config(width=40, height=10) text_remarks.grid(row=0, column=0, rowspan=4, columnspan=4) vsb.grid(row=0, column=4, rowspan=4, sticky="ns") hsb.grid(row=4, column=0, columnspan=4, sticky="ew") vsb.config(command=text_remarks.yview) hsb.config(command=text_remarks.xview) text_remarks.config(yscrollcommand=vsb.set) text_remarks.config(xscrollcommand=hsb.set) lab_title.grid(row=0, column=0, columnspan=3, pady=8, padx=4) lab_name.grid(row=1, column=0, padx=4) entry_name.grid(row=1, column=1, columnspan=2) frame_remarks.grid(row=2, column=0, rowspan=4, columnspan=4, padx=4, pady=4) lab_start.grid(row=6, column=0, padx=4, sticky="w") spin_start.grid(row=6, column=1, columnspan=2, pady=4) b_accept = factory.accept_button(frame) b_cancel = factory.cancel_button(frame) b_accept.grid(row=8, column=1, pady=8, sticky="ew") b_cancel.grid(row=8, column=2, pady=8, sticky="ew") def accept(): try: a = int(var_start.get()) name = var_name.get() remarks = text_remarks.get(1.0, "end") program.name = name program.remarks = remarks bnk[a] = program msg = "Stored program '%s' to slots [%3d]" % (name, a) self.status(msg) dialog.destroy() self.sync() except ValueError: msg = "Invalid slot number" self.warning(msg) def cancel(): msg = "Store program canceld" self.status(msg) dialog.destroy() b_accept.config(command=accept) b_cancel.config(command=cancel) dialog.grab_set() dialog.mainloop()
def _init_performance_tab(self, master): img = factory.image("resources/Tabs/performance.png") frame = factory.frame(master) master.add(frame, text = "Performance", image=img, compound="top") frame_channel = factory.label_frame(frame, "MIDI Channel") frame_keytab = factory.label_frame(frame, "Key Table") lab_transpose = factory.label(frame, "Transpose") lab_keyrange = factory.label(frame, "Key Range") lab_bend = factory.label(frame, "Bend Range") self.list_channel = factory.listbox(frame_channel) sb_channel = factory.scrollbar(frame_channel) sb_channel.config(command=self.list_channel.yview) self.list_channel.config(yscrollcommand=sb_channel.set) self.list_keytab = factory.listbox(frame_keytab) sb_keytab = factory.scrollbar(frame_keytab) sb_keytab.config(command=self.list_keytab.yview) self.list_keytab.config(yscrollcommand=sb_keytab.set) spin_transpose = factory.int_spinbox(frame, self.var_transpose, -36, 36) spin_keylow = factory.int_spinbox(frame, self.var_keyrange_low, 0, 127) spin_keyhigh = factory.int_spinbox(frame, self.var_keyrange_high, 0, 127) spin_bendrange = factory.int_spinbox(frame, self.var_bendrange, 0, 2400) factory.padding_label(frame).grid(row=0) frame_channel.grid(row=1, column=0, rowspan=4, columnspan=2) self.list_channel.pack(side="left", expand=True, fill="both") sb_channel.pack(after=self.list_channel, side="right", expand=True, fill="y") frame_keytab.grid(row=1, column=2, rowspan=4, columnspan=2) self.list_keytab.pack(side="left", expand=True, fill="both") sb_keytab.pack(after=self.list_keytab, side="right", expand=True, fill="y") factory.padding_label(frame).grid(row=6) lab_transpose.grid(row=7, column=0, sticky="w", padx=4, pady=4) spin_transpose.grid(row=7, column=1, padx=4) lab_keyrange.grid(row=8, column=0, sticky="w", padx=4, pady=4) spin_keylow.grid(row=8, column=1, padx=4) spin_keyhigh.grid(row=8, column=2, padx=4) lab_bend.grid(row=9, column=0, sticky="w", padx=4, pady=4) spin_bendrange.grid(row=9, column=1, padx=4) def channel_callback(_): i = self.list_channel.curselection()[0] c = i+1 self.synth.midi_input_channel(c) self.status("MIDI Input Channel = %s" % c) def keytab_callback(_): i = self.list_keytab.curselection()[0] kt = self.list_keytab.get(i) self.synth.keytable(kt) self.status("Using keytable: %s" % kt) def transpose_callback(*_): try: x = int(self.var_transpose.get()) self.synth.transpose(x) self.status("Transpose = %s" % x) except ValueError: self.warning("Invalid transpose") def keyrange_callback(*_): try: a = int(self.var_keyrange_low.get()) b = int(self.var_keyrange_high.get()) a, b = min(a,b), max(a,b) self.synth.key_range((a,b)) self.status("Key range = [%3d, %3d]" % (a, b)) except ValueError: self.warning("Invalid keyrange") def bend_callback(*_): try: b = int(self.var_bendrange.get()) self.synth.bend_range(b) self.status("Bend range = %s" % b) except ValueError: self.warning("Invalid Bendrange") self.list_channel.bind("<<ListboxSelect>>", channel_callback) self.list_keytab.bind("<<ListboxSelect>>", keytab_callback) spin_transpose.config(command=transpose_callback) spin_transpose.bind("<Return>", transpose_callback) spin_keylow.config(command=keyrange_callback) spin_keylow.bind("<Return>", keyrange_callback) spin_keyhigh.config(command=keyrange_callback) spin_keyhigh.bind("<Return>", keyrange_callback) spin_bendrange.config(command=bend_callback) spin_bendrange.bind("<Return>", bend_callback)
def _init_map1_tab(self, master): img = factory.image("resources/Tabs/map.png") HELP_TOPIC = "parameter-maps" frame = factory.frame(master) master.add(frame, text="Map1", image=img, compound="top") north = factory.label_frame(frame, "MIDI Controller Maps") south = factory.label_frame(frame, "Pitch Wheel Maps") north.grid(row=0, column=0, sticky="ew", padx=8, pady=8) south.grid(row=1, column=0, sticky="ew", padx=8, pady=8) def help_callback(): self.app.main_window().display_help(HELP_TOPIC) list_cc_maps = factory.listbox(north, ttip="Active MIDI controller maps") list_cc_maps.config(width=80, height=16) self.list_cc_maps = list_cc_maps sb = factory.scrollbar(north, orientation="vertical") sb.config(command=list_cc_maps.yview) list_cc_maps.config(yscrollcommand=sb.set) b_add_cc = factory.add_button(north, ttip="Add new controller map") b_delete_cc = factory.delete_button(north, ttip="Delete controller map") list_cc_maps.grid(row=0, column=0, rowspan=4, columnspan=8, sticky="ew") sb.grid(row=0, column=8, rowspan=4, sticky="ns") b_add_cc.grid(row=4, column=0, sticky="ew") b_delete_cc.grid(row=4, column=1, sticky="ew") list_pwheel_maps = factory.listbox(south, ttip="Active pitch wheel maps") list_pwheel_maps.config(width=80, height=8) self.list_pwheel_maps = list_pwheel_maps sb = factory.scrollbar(south, orientation="vertical") sb.config(command=list_pwheel_maps.yview) list_pwheel_maps.config(yscrollcommand=sb.set) b_add_pw = factory.add_button(south, ttip="Add pitchwheel map") b_delete_pw = factory.delete_button(south, ttip="Delete pitchwheel map") b_help = factory.help_button(south, command=help_callback) list_pwheel_maps.grid(row=0, column=0, rowspan=4, columnspan=8, sticky="ew") sb.grid(row=0, column=8, rowspan=4, sticky="ns") b_add_pw.grid(row=4, column=0, sticky="ew") b_delete_pw.grid(row=4, column=1, sticky="ew") b_help.grid(row=4, column=7, sticky="ew") def add_cc_callback(): dialog = add_map_dialog(self.synth, "cc", self.app) def delete_cc_callback(): dialog = delete_map_dialog(self, self.synth, "cc", self.app) def add_pw_callback(): dialog = add_map_dialog(self.synth, "PitchWheel", self.app) def delete_pw_callback(): dialog = delete_map_dialog(self, self.synth, "PitchWheel", self.app) b_add_cc.config(command=add_cc_callback) b_delete_cc.config(command=delete_cc_callback) b_add_pw.config(command=add_pw_callback) b_delete_pw.config(command=delete_pw_callback)
def __init__(self, master, editor, synth): Frame.__init__(self, master) self.editor = editor self.synthhelper = editor.app.ls_parser.synthhelper self.synth = synth self.config(background=factory.bg()) self.pack(anchor="nw", expand=True, fill="both") frame_audio_input = factory.label_frame(self, "Audio Input Buses") frame_audio_output = factory.label_frame(self, "Audio Output Buses") frame_control_input = factory.label_frame(self, "Control Input Buses") frame_control_output = factory.label_frame(self, "Control Output Buses") frame_audio_input.grid(row=0, column=0, rowspan=4, columnspan=4, padx=16, pady=16, sticky='nesw') frame_audio_output.grid(row=4, column=0, rowspan=4, columnspan=4, padx=16, pady=16, sticky='nesw') frame_control_input.grid(row=0, column=4, rowspan=4, columnspan=4, padx=16, pady=16, sticky='nesw') frame_control_output.grid(row=4, column=4, rowspan=4, columnspan=4, padx=16, pady=16, sticky='nesw') specs = synth.specs frame_south = factory.frame(self) frame_south.grid(row=9, column=0, rowspan=1, columnspan=8, sticky='ew', padx=16, pady=16) b_sync = factory.button(frame_south, "Sync", command=self.sync) b_sync.grid(row=0, column=0) # audio inputs self._combo_audio_in = {} row = 0 for i in range(con.MAX_BUS_COUNT): try: b = specs["audio-input-buses"][i] param = b[0] lab_name = factory.label(frame_audio_input, "%d - %s" % (i+1, param)) combo = factory.audio_bus_combobox(frame_audio_input, self.editor.app) combo.param = param combo.bind("<<ComboboxSelected>>", self.audio_in_callback) combo.set(b[1]) lab_name.grid(row=row, column=0, sticky='ew', padx=4, pady=4) combo.grid(row=row, column=1, sticky='ew', padx=4, pady=4) self._combo_audio_in[param] = combo except IndexError: lab_dummy = factory.label(frame_audio_input, "%d - n/a" % (i+1,)) lab_dummy.grid(row=row, column=0) row += 1 # audio output self._combo_audio_out = {} row = 0 for i in range(con.MAX_BUS_COUNT): try: b = specs["audio-output-buses"][i] param = b[0] lab_name = factory.label(frame_audio_output, "%d - %s" % (i+1, param)) combo = factory.audio_bus_combobox(frame_audio_output, self.editor.app) combo.param = param combo.bind("<<ComboboxSelected>>", self.audio_out_callback) combo.set(b[1]) lab_name.grid(row=row, column=0, sticky='ew', padx=4, pady=4) combo.grid(row=row, column=1, sticky='ew', padx=4, pady=4) self._combo_audio_out[param] = combo except IndexError: lab_dummy = factory.label(frame_audio_output, "%d - n/a" % (i+1,)) lab_dummy.grid(row=row, column=0) row += 1 # control inputs self._combo_control_in = {} row = 0 for i in range(con.MAX_BUS_COUNT): try: b = specs["control-input-buses"][i] param = b[0] lab_name = factory.label(frame_control_input, "%d - %s" % (i+1, param)) combo = factory.control_bus_combobox(frame_control_input, self.editor.app) combo.param = param combo.bind("<<ComboboxSelected>>", self.control_in_callback) combo.set(b[1]) lab_name.grid(row=row, column=0, sticky='ew', padx=4, pady=4) combo.grid(row=row, column=1, sticky='ew', padx=4, pady=4) self._combo_control_in[param] = combo except IndexError: lab_dummy = factory.label(frame_control_input, "%d - n/a" % (i+1,)) lab_dummy.grid(row=row, column=0) row += 1 # control output self._combo_control_out = {} row = 0 for i in range(con.MAX_BUS_COUNT): try: b = specs["control-output-buses"][i] param = b[0] lab_name = factory.label(frame_control_output, "%d - %s" % (i+1, param)) combo = factory.control_bus_combobox(frame_control_output, self.editor.app) combo.param = param combo.bind("<<ComboboxSelected>>", self.control_out_callback) combo.set(b[1]) lab_name.grid(row=row, column=0, sticky='ew', padx=4, pady=4) combo.grid(row=row, column=1, sticky='ew', padx=4, pady=4) self._combo_control_out[param] = combo except IndexError: lab_dummy = factory.label(frame_control_output, "%d - n/a" % (i+1,)) lab_dummy.grid(row=row, column=0) row += 14 self.sync()
def _init_map1_tab(self, master): img = factory.image("resources/Tabs/map.png") HELP_TOPIC = "parameter-maps" frame = factory.frame(master) master.add(frame, text="Map1", image=img, compound="top") north = factory.label_frame(frame, "MIDI Controller Maps") south = factory.label_frame(frame, "Pitch Wheel Maps") north.grid(row=0, column=0, sticky="ew", padx=8, pady=8) south.grid(row=1, column=0, sticky="ew", padx=8, pady=8) def help_callback(): self.app.main_window().display_help(HELP_TOPIC) list_cc_maps = factory.listbox(north, ttip="Active MIDI controller maps") list_cc_maps.config(width=80, height=16) self.list_cc_maps = list_cc_maps sb = factory.scrollbar(north, orientation="vertical") sb.config(command=list_cc_maps.yview) list_cc_maps.config(yscrollcommand=sb.set) b_add_cc = factory.add_button(north, ttip="Add new controller map") b_delete_cc = factory.delete_button(north, ttip="Delete controller map") list_cc_maps.grid(row=0, column=0, rowspan=4, columnspan=8, sticky="ew") sb.grid(row=0, column=8, rowspan=4, sticky="ns") b_add_cc.grid(row=4, column=0, sticky="ew") b_delete_cc.grid(row=4, column=1, sticky="ew") list_pwheel_maps = factory.listbox(south, ttip="Active pitch wheel maps") list_pwheel_maps.config(width=80, height=8) self.list_pwheel_maps = list_pwheel_maps sb = factory.scrollbar(south, orientation="vertical") sb.config(command=list_pwheel_maps.yview) list_pwheel_maps.config(yscrollcommand=sb.set) b_add_pw = factory.add_button(south, ttip="Add pitchwheel map") b_delete_pw = factory.delete_button(south, ttip="Delete pitchwheel map") b_help = factory.help_button(south, command=help_callback) list_pwheel_maps.grid(row=0, column=0, rowspan=4, columnspan=8, sticky="ew") sb.grid(row=0, column=8, rowspan=4, sticky="ns") b_add_pw.grid(row=4, column=0, sticky="ew") b_delete_pw.grid(row=4, column=1, sticky="ew") b_help.grid(row=4, column=7, sticky="ew") def add_cc_callback(): dialog = add_map_dialog(self.synth, "cc", self.app) def delete_cc_callback(): dialog = delete_map_dialog(self, self.synth, "cc", self.app) def add_pw_callback(): dialog = add_map_dialog(self.synth, "PitchWheel", self.app) def delete_pw_callback(): dialog = delete_map_dialog(self, self.synth, "PitchWheel", self.app) b_add_cc.config(command=add_cc_callback) b_delete_cc.config(command=delete_cc_callback) b_add_pw.config(command=add_pw_callback) b_delete_pw.config(command=delete_pw_callback)