Пример #1
0
 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
Пример #2
0
 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
Пример #3
0
 def __init__(self, master, app):
     Toplevel.__init__(self, master)
     self.wm_title = "Control Buses"
     self.app = app
     self.proxy = app.proxy
     self.parser = app.ls_parser
     main = factory.frame(self, modal=True)
     main.pack(expand=True)
     lab_title = factory.label(main, "Control Busses", modal=True)
     frame_list = factory.frame(main, modal=True)
     frame_list.config(width=248, height=320)
     frame_list.pack_propagate(False)
     self.listbox = factory.listbox(frame_list, command=self.select_bus)
     self.listbox.pack(expand=True, fill=BOTH)
     sb = factory.scrollbar(main, yclient=self.listbox)
     lab_name = factory.label(main, "Name", modal=True)
     lab_channels = factory.label(main, "Channels", modal=True)
     self._var_name = StringVar()
     entry_name = factory.entry(main,
                                self._var_name,
                                ttip="Control bus name")
     #self._var_chancount = StringVar()
     #spin_chancount = factory.int_spinbox(main, self._var_chancount, 1, 64)
     self.lab_warning = factory.warning_label(main, modal=True)
     button_bar = factory.frame(main, modal=True)
     #b_remove = factory.delete_button(button_bar,ttip="Delete control bus",command=self.remove_bus)
     b_add = factory.add_button(button_bar,
                                ttip="Add new control bus",
                                command=self.add_bus)
     #b_refresh = factory.refresh_button(button_bar, ttip="Refresh bus list", command=self.refresh)
     b_accept = factory.accept_button(button_bar, command=self.accept)
     b_help = factory.help_button(button_bar, command=self.display_help)
     lab_title.grid(row=0, column=0, columnspan=6, pady=8)
     frame_list.grid(row=1, column=0, rowspan=5, columnspan=5, pady=8)
     sb.grid(row=1, column=4, rowspan=5, sticky=NS, pady=4, padx=4)
     lab_name.grid(row=6, column=0, sticky=W, padx=4)
     entry_name.grid(row=6, column=1)
     lab_channels.grid(row=7, column=0, sticky=W, pady=8, padx=4)
     #spin_chancount.grid(row=7, column=1)
     self.lab_warning.grid(row=8, column=0, columnspan=6)
     button_bar.grid(row=9, column=0, columnspan=6, padx=8, pady=4)
     #b_remove.grid(row=0, column=0)
     b_add.grid(row=0, column=1)
     #b_refresh.grid(row=0, column=2)
     b_help.grid(row=0, column=3)
     #factory.label(button_bar, "").grid(row=0, column=4, padx=16)
     factory.padding_label(button_bar).grid(row=0, column=4, padx=16)
     b_accept.grid(row=0, column=5)
     self._current_selection = 0
     entry_name.bind('<Down>', self.increment_selection)
     entry_name.bind('<Up>', self.decrement_selection)
     entry_name.bind('<Return>', self.add_bus)
     self.listbox.bind('<Down>', self.increment_selection)
     self.listbox.bind('<Up>', self.decrement_selection)
     self.refresh()
     self.grab_set()
     self.mainloop()
Пример #4
0
 def __init__(self, master, app):
     Toplevel.__init__(self, master)
     self.wm_title = "Control Buses"
     self.app = app
     self.proxy = app.proxy
     self.parser = app.ls_parser
     main = factory.frame(self, modal=True)
     main.pack(expand=True)
     lab_title = factory.label(main, "Control Busses", modal=True)
     frame_list = factory.frame(main, modal=True)
     frame_list.config(width=248, height=320)
     frame_list.pack_propagate(False)
     self.listbox = factory.listbox(frame_list, command=self.select_bus)
     self.listbox.pack(expand=True, fill=BOTH)
     sb = factory.scrollbar(main, yclient=self.listbox)
     lab_name = factory.label(main, "Name", modal=True)
     lab_channels = factory.label(main, "Channels", modal=True)
     self._var_name = StringVar()
     entry_name = factory.entry(main, self._var_name, ttip="Control bus name")
     #self._var_chancount = StringVar()
     #spin_chancount = factory.int_spinbox(main, self._var_chancount, 1, 64)
     self.lab_warning = factory.warning_label(main, modal=True)
     button_bar = factory.frame(main, modal=True)
     #b_remove = factory.delete_button(button_bar,ttip="Delete control bus",command=self.remove_bus)
     b_add = factory.add_button(button_bar, ttip="Add new control bus", command=self.add_bus)
     #b_refresh = factory.refresh_button(button_bar, ttip="Refresh bus list", command=self.refresh)
     b_accept = factory.accept_button(button_bar, command=self.accept)
     b_help = factory.help_button(button_bar, command=self.display_help)
     lab_title.grid(row=0, column=0, columnspan=6, pady=8)
     frame_list.grid(row=1, column=0, rowspan=5, columnspan=5, pady=8)
     sb.grid(row=1, column=4, rowspan=5, sticky=NS, pady=4, padx=4)
     lab_name.grid(row=6, column=0, sticky=W, padx=4)
     entry_name.grid(row=6, column=1)
     lab_channels.grid(row=7, column=0, sticky=W, pady=8, padx=4)
     #spin_chancount.grid(row=7, column=1)
     self.lab_warning.grid(row=8, column=0, columnspan=6)
     button_bar.grid(row=9, column=0, columnspan=6, padx=8, pady=4)
     #b_remove.grid(row=0, column=0)
     b_add.grid(row=0, column=1)
     #b_refresh.grid(row=0, column=2)
     b_help.grid(row=0, column=3)
     #factory.label(button_bar, "").grid(row=0, column=4, padx=16)
     factory.padding_label(button_bar).grid(row=0, column=4, padx=16)
     b_accept.grid(row=0, column=5)
     self._current_selection = 0
     entry_name.bind('<Down>', self.increment_selection)
     entry_name.bind('<Up>', self.decrement_selection)
     entry_name.bind('<Return>', self.add_bus)
     self.listbox.bind('<Down>', self.increment_selection)
     self.listbox.bind('<Up>', self.decrement_selection)
     self.refresh()
     self.grab_set()
     self.mainloop()
Пример #5
0
 def __init__(self, master, app):
     Toplevel.__init__(self, master)
     self.config(background=factory.pallet("DIALOG-BG"))
     self.wm_title = "MIDI Controllers"
     self.app = app
     self.config = app.config()
     self.parser = app.ls_parser
     self._current_controller=0
     self._save_backup()
     main = factory.frame(self, modal=True)
     main.pack(expand=True)
     main.pack_propagate(False)
     lab_title = factory.label(main, "MIDI Controller Names", modal=True)
     self.lab_warning = factory.warning_label(main, "", modal=True)
     frame_list = factory.frame(main, modal=True)
     frame_list.config(width=248, height=320)
     frame_list.pack_propagate(False)
     self.listbox = factory.listbox(frame_list, command=self.select_controller)
     self.listbox.pack(expand=True, fill=BOTH)
     sb = factory.scrollbar(main, yclient=self.listbox)
     self.refresh()
     self.var_name = StringVar()
     entry_name = factory.entry(main, self.var_name)
     button_bar = factory.frame(main, modal=True)
     b_refresh = factory.refresh_button(button_bar, command=self.refresh)
     b_help = factory.help_button(button_bar, command = self.display_help)
     b_accept = factory.accept_button(button_bar, command=self.accept)
     b_cancel = factory.cancel_button(button_bar, command=self.cancel)
     lab_title.grid(row=0, column=0, columnspan=4, pady=8)
     frame_list.grid(row=1, column=0, rowspan=6, columnspan=4, sticky=N)
     sb.grid(row=1, column=4, rowspan=6, sticky=NS, padx=4)
     factory.label(main, "Name", modal=True).grid(row=7, column=0, padx=4, sticky="w")
     entry_name.grid(row=7, column=1, columnspan=1, sticky=W, padx=4, pady=8)
     self.lab_warning.grid(row=8, column=0, columnspan=5, sticky=W)
     button_bar.grid(row=9, column=0, columnspan=5, sticky=EW, padx=4, pady=4)
     b_refresh.grid(row=0, column=0)
     b_help.grid(row=0, column=1)
     b_accept.grid(row=0, column=2)
     b_cancel.grid(row=0, column=3)
     entry_name.bind('<Return>', self.change_name)
     entry_name.bind('<Down>', self.increment_selection)
     entry_name.bind('<Up>', self.decrement_selection)
     self.listbox.bind('<Down>', self.increment_selection)
     self.listbox.bind('<Up>', self.decrement_selection)
     self.protocol("WM_DELETE_WINDOW", None)
     self.grab_set()
     self.mainloop()
Пример #6
0
 def __init__(self, master, app):
     Toplevel.__init__(self, master)
     self.config(background=factory.bg())
     self.wm_title("Lliascript History")
     self.app = app
     self.filename = ""
     toolbar = factory.frame(self)
     south = factory.frame(self)
     toolbar.pack(side=TOP, anchor=NW, expand=True, fill=X)
     south.pack(anchor=SW, expand=True, fill=BOTH)
     b_open = factory.button(toolbar,
                             "Open",
                             ttip="Open lliascript file",
                             command=self.open_lliascript_file)
     b_save = factory.button(toolbar,
                             "Save",
                             ttip="Save lliascript file",
                             command=self.save_lliascript_file)
     b_exec = factory.button(toolbar,
                             "Exec",
                             ttip="Execute text",
                             command=self.exec_)
     b_compose = factory.button(toolbar,
                                "Compose",
                                ttip="Build script from current state",
                                command=self.compose_current_state)
     b_help = factory.help_button(toolbar)
     b_help.config(command=self.help_)
     b_open.pack(side=LEFT, expand=True, fill=X)
     b_save.pack(side=LEFT, expand=True, fill=X)
     b_exec.pack(side=LEFT, expand=True, fill=X)
     b_compose.pack(side=LEFT, expand=True, fill=X)
     b_help.pack(side=LEFT, expand=True, fill=X)
     self.text_widget = factory.text_widget(south, modal=True)
     sb1 = factory.scrollbar(south)
     sb2 = factory.scrollbar(south, orientation="horizontal")
     sb1.config(command=self.text_widget.yview)
     sb2.config(command=self.text_widget.xview)
     self.text_widget.config(yscrollcommand=sb1.set)
     self.text_widget.config(xscrollcommand=sb2.set)
     self.text_widget.grid(row=0, column=0, rowspan=5, columnspan=5)
     sb1.grid(row=0, column=5, rowspan=5, sticky=NS)
     sb2.grid(row=5, column=0, columnspan=5, sticky=EW)
     self._get_current_history()
     self.grab_set()
     self.mainloop()
Пример #7
0
 def __init__(self, master, app):
     Toplevel.__init__(self, master)
     self.wm_title = "MIDI Channels"
     self.app = app
     self.config = app.config
     self.parser = app.ls_parser
     self._current_index=0
     self._save_backup()
     main = factory.frame(self, modal=True)
     main.pack(expand=True)
     lab_title = factory.dialog_title_label(main, "MIDI Channels", modal=True)
     frame_list = factory.frame(main, modal=True)
     frame_list.config(width=248, height=320)
     frame_list.pack_propagate(False)
     self.listbox = factory.listbox(frame_list, command=self.select)
     self.listbox.pack(expand=True, fill=BOTH)
     self.lab_warning = factory.warning_label(main)
     self.var_name = StringVar()
     entry_name = factory.entry(main, self.var_name)
     button_bar = factory.frame(main, modal=True)
     b_refresh = factory.refresh_button(button_bar, command=self.refresh)
     b_help = factory.help_button(button_bar, command=self.display_help)
     b_accept = factory.accept_button(button_bar, command=self.accept)
     b_cancel = factory.cancel_button(button_bar, command=self.cancel)
     b_refresh.grid(row=0, column=0)
     b_help.grid(row=0, column=1)
     b_accept.grid(row=0, column=2)
     b_cancel.grid(row=0, column=3)
     lab_title.grid(row=0, column=0, columnspan=5, pady=8)
     frame_list.grid(row=1, column=0, rowspan=5, columnspan=6, padx=4, pady=8)
     factory.label(main, text="Name", modal=True).grid(row=6, column=0)
     entry_name.grid(row=6, column=1, columnspan=4, sticky=W, padx=4, pady=0)
     self.lab_warning.grid(row=7, column=0, columnspan=5, sticky=W, padx=4, pady=8)
     button_bar.grid(row=8, column=0, columnspan=5, sticky=EW, padx=4, pady=8)
     self.refresh()
     self.protocol("WM_DELETE_WINDOW", None) # ISSUE: Not Working
     entry_name.bind('<Return>', self.change_name)
     entry_name.bind('<Down>', self.increment_selection)
     entry_name.bind('<Up>', self.decrement_selection)
     self.listbox.bind('<Down>', self.increment_selection)
     self.listbox.bind('<Up>', self.decrement_selection)
     self.grab_set()
     self.mainloop()
Пример #8
0
 def __init__(self, master, app):
     Toplevel.__init__(self, master)
     self.config(background=factory.bg())
     self.wm_title("Lliascript History")
     self.app = app
     self.filename = ""
     toolbar = factory.frame(self)
     south = factory.frame(self)
     toolbar.pack(side=TOP, anchor=NW, expand=True, fill=X)
     south.pack(anchor=SW, expand=True, fill=BOTH)
     b_open = factory.button(toolbar, "Open", ttip="Open lliascript file",
                             command=self.open_lliascript_file)
     b_save = factory.button(toolbar, "Save", ttip="Save lliascript file",
                             command=self.save_lliascript_file)
     b_exec = factory.button(toolbar, "Exec", ttip="Execute text",
                             command=self.exec_)
     b_compose = factory.button(toolbar, "Compose",
                                ttip="Build script from current state",
                                command=self.compose_current_state)
     b_help = factory.help_button(toolbar)
     b_help.config(command=self.help_)
     b_open.pack(side=LEFT, expand=True, fill=X)
     b_save.pack(side=LEFT, expand=True, fill=X)
     b_exec.pack(side=LEFT, expand=True, fill=X)
     b_compose.pack(side=LEFT, expand=True, fill=X)
     b_help.pack(side=LEFT, expand=True, fill=X)
     self.text_widget = factory.text_widget(south, modal=True)
     sb1 = factory.scrollbar(south)
     sb2 = factory.scrollbar(south, orientation="horizontal")
     sb1.config(command=self.text_widget.yview)
     sb2.config(command=self.text_widget.xview)
     self.text_widget.config(yscrollcommand = sb1.set)
     self.text_widget.config(xscrollcommand = sb2.set)
     self.text_widget.grid(row=0, column=0, rowspan=5, columnspan=5)
     sb1.grid(row=0, column=5, rowspan=5, sticky=NS)
     sb2.grid(row=5, column=0, columnspan=5, sticky=EW)
     self._get_current_history()
     self.grab_set()
     self.mainloop()
Пример #9
0
 def __init__(self, master, app):
     Toplevel.__init__(self, master)
     self.wm_title = "MIDI Channels"
     self.app = app
     self.config = app.config
     self.parser = app.ls_parser
     self._current_index = 0
     self._save_backup()
     main = factory.frame(self, modal=True)
     main.pack(expand=True)
     lab_title = factory.dialog_title_label(main,
                                            "MIDI Channels",
                                            modal=True)
     frame_list = factory.frame(main, modal=True)
     frame_list.config(width=248, height=320)
     frame_list.pack_propagate(False)
     self.listbox = factory.listbox(frame_list, command=self.select)
     self.listbox.pack(expand=True, fill=BOTH)
     self.lab_warning = factory.warning_label(main)
     self.var_name = StringVar()
     entry_name = factory.entry(main, self.var_name)
     button_bar = factory.frame(main, modal=True)
     b_refresh = factory.refresh_button(button_bar, command=self.refresh)
     b_help = factory.help_button(button_bar, command=self.display_help)
     b_accept = factory.accept_button(button_bar, command=self.accept)
     b_cancel = factory.cancel_button(button_bar, command=self.cancel)
     b_refresh.grid(row=0, column=0)
     b_help.grid(row=0, column=1)
     b_accept.grid(row=0, column=2)
     b_cancel.grid(row=0, column=3)
     lab_title.grid(row=0, column=0, columnspan=5, pady=8)
     frame_list.grid(row=1,
                     column=0,
                     rowspan=5,
                     columnspan=6,
                     padx=4,
                     pady=8)
     factory.label(main, text="Name", modal=True).grid(row=6, column=0)
     entry_name.grid(row=6,
                     column=1,
                     columnspan=4,
                     sticky=W,
                     padx=4,
                     pady=0)
     self.lab_warning.grid(row=7,
                           column=0,
                           columnspan=5,
                           sticky=W,
                           padx=4,
                           pady=8)
     button_bar.grid(row=8,
                     column=0,
                     columnspan=5,
                     sticky=EW,
                     padx=4,
                     pady=8)
     self.refresh()
     self.protocol("WM_DELETE_WINDOW", None)  # ISSUE: Not Working
     entry_name.bind('<Return>', self.change_name)
     entry_name.bind('<Down>', self.increment_selection)
     entry_name.bind('<Up>', self.decrement_selection)
     self.listbox.bind('<Down>', self.increment_selection)
     self.listbox.bind('<Up>', self.decrement_selection)
     self.grab_set()
     self.mainloop()
Пример #10
0
    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)
Пример #11
0
    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)
Пример #12
0
    def _build_south_panel(self, south):
        self._midi_input_ports = mido.get_input_names()
        self._midi_output_ports = mido.get_output_names()
        port_rows = max(len(self._midi_input_ports),
                        len(self._midi_output_ports))
        init_id = self.config.global_osc_id()
        init_host = self.config["host"]
        init_port = self.config["port"]
        init_client = self.config["client"]
        init_client_port = self.config["client_port"]
        init_input = self.config["midi-receiver-name"]
        init_output = self.config["midi-transmitter-name"]
        self.var_id = StringVar()
        self.var_host = StringVar()
        self.var_port = StringVar()
        self.var_client = StringVar()
        self.var_client_port = StringVar()
        self.var_input = StringVar()
        self.var_output = StringVar()

        def restore_defaults():
            self.var_id.set(init_id)
            self.var_host.set(init_host)
            self.var_port.set(init_port)
            self.var_client.set(init_client)
            self.var_client_port.set(init_client_port)
            self.var_input.set(init_input)
            self.var_output.set(init_output)

        restore_defaults()
        e_id = factory.entry(south, self.var_id)
        e_host = factory.entry(south, self.var_host)
        e_port = factory.entry(south, self.var_port)
        e_client = factory.entry(south, self.var_client)
        e_client_port = factory.entry(south, self.var_client_port)
        #factory.padding_label(south).grid(row=0, column=0, ipadx=8, ipady=8)
        e_id.grid(row=1, column=1, columnspan=2)
        e_host.grid(row=2, column=1, columnspan=2)
        e_port.grid(row=2, column=5, columnspan=2)
        e_client.grid(row=3, column=1, columnspan=2)
        e_client_port.grid(row=3, column=5, columnspan=2)
        port_count = max(len(self._midi_input_ports),
                         len(self._midi_output_ports))
        lab_id = factory.label(south, "OSC ID")
        lab_host = factory.label(south, "Host")
        lab_host_port = factory.label(south, "Port")
        lab_client = factory.label(south, "Client")
        lab_client_port = factory.label(south, "Port")
        lab_midi_input = factory.label(south, "MIDI Input")
        lab_midi_output = factory.label(south, "MIDI Output")
        # factory.padding_label(south).grid(row=4, column=3, ipadx=8, ipady=8)
        lab_id.grid(row=1, column=0, columnspan=1, ipadx=8, ipady=8)
        lab_host.grid(row=2, column=0, columnspan=1)
        lab_host_port.grid(row=3, column=4, columnspan=1, ipadx=4)
        lab_client.grid(row=3, column=0, columnspan=1)
        lab_client_port.grid(row=3, column=4, columnspan=1)
        lab_midi_input.grid(row=5, column=1, columnspan=2, ipady=8)
        lab_midi_output.grid(row=5, column=5, columnspan=2, ipady=8)
        for n, p in enumerate(self._midi_input_ports):
            rb = factory.radio(south, str(p), self.var_input, str(p))
            rb.grid(row=n + 6, column=1, sticky="W")
        for n, p in enumerate(self._midi_output_ports):
            rb = factory.radio(south, str(p), self.var_output, str(p))
            rb.grid(row=n + 6, column=5, sticky="W")
        factory.padding_label(south).grid(row=0, column=7, ipadx=36)
        #b_restore = factory.button(south, "Restore", command=restore_defaults)
        b_continue = factory.button(south, "Continue", command=self.accept)
        b_help = factory.help_button(south)
        b_help.config(command=self.display_help)
        row = port_count + 6
        #b_restore.grid(row=row, column=1, sticky="EW", pady=16)
        b_continue.grid(row=row, column=1, sticky="EW", pady=16)
        b_help.grid(row=row, column=3, padx=8, sticky="W")
        self.lab_warning = factory.label(south, "")
        self.lab_warning.config(foreground=factory.pallet("warning-fg"))
        self.lab_warning.grid(row=6,
                              column=7,
                              sticky="EW",
                              columnspan=2,
                              rowspan=4)
Пример #13
0
    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)
Пример #14
0
 def __init__(self, master, app):
     Toplevel.__init__(self, master)
     self.config(background=factory.pallet("DIALOG-BG"))
     self.wm_title = "MIDI Controllers"
     self.app = app
     self.config = app.config
     self.parser = app.ls_parser
     self._current_controller = 0
     self._save_backup()
     main = factory.frame(self, modal=True)
     main.pack(expand=True)
     main.pack_propagate(False)
     lab_title = factory.label(main, "MIDI Controller Names", modal=True)
     self.lab_warning = factory.warning_label(main, "", modal=True)
     frame_list = factory.frame(main, modal=True)
     frame_list.config(width=248, height=320)
     frame_list.pack_propagate(False)
     self.listbox = factory.listbox(frame_list,
                                    command=self.select_controller)
     self.listbox.pack(expand=True, fill=BOTH)
     sb = factory.scrollbar(main, yclient=self.listbox)
     self.refresh()
     self.var_name = StringVar()
     entry_name = factory.entry(main, self.var_name)
     button_bar = factory.frame(main, modal=True)
     b_refresh = factory.refresh_button(button_bar, command=self.refresh)
     b_help = factory.help_button(button_bar, command=self.display_help)
     b_accept = factory.accept_button(button_bar, command=self.accept)
     b_cancel = factory.cancel_button(button_bar, command=self.cancel)
     lab_title.grid(row=0, column=0, columnspan=4, pady=8)
     frame_list.grid(row=1, column=0, rowspan=6, columnspan=4, sticky=N)
     sb.grid(row=1, column=4, rowspan=6, sticky=NS, padx=4)
     factory.label(main, "Name", modal=True).grid(row=7,
                                                  column=0,
                                                  padx=4,
                                                  sticky="w")
     entry_name.grid(row=7,
                     column=1,
                     columnspan=1,
                     sticky=W,
                     padx=4,
                     pady=8)
     self.lab_warning.grid(row=8, column=0, columnspan=5, sticky=W)
     button_bar.grid(row=9,
                     column=0,
                     columnspan=5,
                     sticky=EW,
                     padx=4,
                     pady=4)
     b_refresh.grid(row=0, column=0)
     b_help.grid(row=0, column=1)
     b_accept.grid(row=0, column=2)
     b_cancel.grid(row=0, column=3)
     entry_name.bind('<Return>', self.change_name)
     entry_name.bind('<Down>', self.increment_selection)
     entry_name.bind('<Up>', self.decrement_selection)
     self.listbox.bind('<Down>', self.increment_selection)
     self.listbox.bind('<Up>', self.decrement_selection)
     self.protocol("WM_DELETE_WINDOW", None)
     self.grab_set()
     self.mainloop()
Пример #15
0
 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)
Пример #16
0
    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)
Пример #17
0
 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)
Пример #18
0
 def _build_south_panel(self, south):
     self._midi_input_ports = mido.get_input_names()
     self._midi_output_ports = mido.get_output_names()
     port_rows = max(len(self._midi_input_ports),
                     len(self._midi_output_ports))
     init_id = self.config.global_osc_id()
     init_host = self.config["host"]
     init_port = self.config["port"]
     init_client = self.config["client"]
     init_client_port = self.config["client_port"]
     init_input = self.config["midi-receiver-name"]
     init_output = self.config["midi-transmitter-name"]
     self.var_id = StringVar()
     self.var_host = StringVar()
     self.var_port = StringVar()
     self.var_client = StringVar()
     self.var_client_port = StringVar()
     self.var_input = StringVar()
     self.var_output = StringVar()
     def restore_defaults():
         self.var_id.set(init_id)
         self.var_host.set(init_host)
         self.var_port.set(init_port)
         self.var_client.set(init_client)
         self.var_client_port.set(init_client_port)
         self.var_input.set(init_input)
         self.var_output.set(init_output)
     restore_defaults()
     e_id = factory.entry(south, self.var_id)
     e_host = factory.entry(south, self.var_host)
     e_port = factory.entry(south, self.var_port)
     e_client = factory.entry(south, self.var_client)
     e_client_port = factory.entry(south, self.var_client_port)
     #factory.padding_label(south).grid(row=0, column=0, ipadx=8, ipady=8)
     e_id.grid(row=1, column=1, columnspan=2)
     e_host.grid(row=2, column=1, columnspan=2)
     e_port.grid(row=2, column=5, columnspan=2)
     e_client.grid(row=3, column=1, columnspan=2)
     e_client_port.grid(row=3, column=5, columnspan=2)
     port_count = max(len(self._midi_input_ports),
                      len(self._midi_output_ports))
     lab_id = factory.label(south, "OSC ID")
     lab_host = factory.label(south, "Host")
     lab_host_port = factory.label(south, "Port")
     lab_client = factory.label(south, "Client")
     lab_client_port = factory.label(south, "Port")
     lab_midi_input = factory.label(south, "MIDI Input")
     lab_midi_output = factory.label(south, "MIDI Output")
     # factory.padding_label(south).grid(row=4, column=3, ipadx=8, ipady=8)
     lab_id.grid(row=1, column=0, columnspan=1, ipadx=8, ipady=8)
     lab_host.grid(row=2, column=0, columnspan=1)
     lab_host_port.grid(row=3, column=4, columnspan=1, ipadx=4)
     lab_client.grid(row=3, column=0, columnspan=1)
     lab_client_port.grid(row=3, column=4, columnspan=1)
     lab_midi_input.grid(row=5, column=1, columnspan=2, ipady=8)
     lab_midi_output.grid(row=5, column=5, columnspan=2, ipady=8)
     for n,p in enumerate(self._midi_input_ports):
         rb = factory.radio(south, str(p), self.var_input, str(p))
         rb.grid(row=n+6, column=1, sticky="W")
     for n,p in enumerate(self._midi_output_ports):
         rb = factory.radio(south, str(p), self.var_output, str(p))
         rb.grid(row=n+6, column=5, sticky="W")
     factory.padding_label(south).grid(row=0, column=7, ipadx=36)
     #b_restore = factory.button(south, "Restore", command=restore_defaults)
     b_continue = factory.button(south, "Continue", command=self.accept)
     b_help = factory.help_button(south)
     b_help.config(command=self.display_help)
     row = port_count + 6
     #b_restore.grid(row=row, column=1, sticky="EW", pady=16)
     b_continue.grid(row=row, column=1, sticky="EW", pady=16)
     b_help.grid(row=row, column=3, padx=8, sticky="W")
     self.lab_warning = factory.label(south, "")
     self.lab_warning.config(foreground=factory.pallet("warning-fg"))
     self.lab_warning.grid(row=6, column=7, sticky="EW",
                           columnspan=2, rowspan=4)
Пример #19
0
    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)