Exemple #1
0
    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()
Exemple #2
0
    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, 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()
Exemple #4
0
    def _fill_performance(self):
        bnk = self.synth.bank()
        dialog = Toplevel(self)
        frame = factory.frame(dialog, True)
        frame.pack(expand=True, fill="both")
        lab_title = factory.label(frame, "Fill Performance", modal=True)
        lab_start = factory.label(frame, "Starting slot", modal=True)
        lab_end = factory.label(frame, "Ending slot", modal=True)
        var_start = StringVar()
        var_end = StringVar()
        spin_start = factory.int_spinbox(frame, var_start, 0, len(bnk))
        spin_end = factory.int_spinbox(frame, var_end, 0, len(bnk))
        var_start.set(bnk.current_slot)
        var_end.set(bnk.current_slot+1)
        lab_title.grid(row=0, column=0, columnspan=3, padx=4, pady=8)
        lab_start.grid(row=1, column=0, sticky="w", padx=4)
        spin_start.grid(row=1, column=1, columnspan=2, padx=4)
        lab_end.grid(row=2, column=0, sticky="w", padx=4)
        spin_end.grid(row=2, column=1, columnspan=2, padx=4)

        def accept():
            try:
                a,b = int(var_start.get()), int(var_end.get())
                bnk.fill_performance(a,b)
                msg = "Performance filled slots [%3d, %3d]" % (a,b)
                self.status(msg)
                dialog.destroy()
            except ValueError:
                msg = "Invalid slot number"
                self.warning(msg)
            except KeyError as err:
                self.warning(err.message)
                

        def cancel():
            msg = "Performance fill canceld"
            self.status(msg)
            dialog.destroy()
            
        b_accept = factory.accept_button(frame, command=accept)
        b_cancel = factory.cancel_button(frame, command=cancel)
        b_accept.grid(row=3, column=1, padx=4, pady=8,sticky="ew")
        b_cancel.grid(row=3, column=2, padx=4, pady=8,sticky="ew")
        dialog.grab_set()
        dialog.mainloop()
Exemple #5
0
    def _fill_performance(self):
        bnk = self.synth.bank()
        dialog = Toplevel(self)
        frame = factory.frame(dialog, True)
        frame.pack(expand=True, fill="both")
        lab_title = factory.label(frame, "Fill Performance", modal=True)
        lab_start = factory.label(frame, "Starting slot", modal=True)
        lab_end = factory.label(frame, "Ending slot", modal=True)
        var_start = StringVar()
        var_end = StringVar()
        spin_start = factory.int_spinbox(frame, var_start, 0, len(bnk))
        spin_end = factory.int_spinbox(frame, var_end, 0, len(bnk))
        var_start.set(bnk.current_slot)
        var_end.set(bnk.current_slot+1)
        lab_title.grid(row=0, column=0, columnspan=3, padx=4, pady=8)
        lab_start.grid(row=1, column=0, sticky="w", padx=4)
        spin_start.grid(row=1, column=1, columnspan=2, padx=4)
        lab_end.grid(row=2, column=0, sticky="w", padx=4)
        spin_end.grid(row=2, column=1, columnspan=2, padx=4)

        def accept():
            try:
                a,b = int(var_start.get()), int(var_end.get())
                bnk.fill_performance(a,b)
                msg = "Performance filled slots [%3d, %3d]" % (a,b)
                self.status(msg)
                dialog.destroy()
            except ValueError:
                msg = "Invalid slot number"
                self.warning(msg)
            except KeyError as err:
                self.warning(err.message)
                

        def cancel():
            msg = "Performance fill canceld"
            self.status(msg)
            dialog.destroy()
            
        b_accept = factory.accept_button(frame, command=accept)
        b_cancel = factory.cancel_button(frame, command=cancel)
        b_accept.grid(row=3, column=1, padx=4, pady=8,sticky="ew")
        b_cancel.grid(row=3, column=2, padx=4, pady=8,sticky="ew")
        dialog.grab_set()
        dialog.mainloop()
Exemple #6
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()
Exemple #7
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)
Exemple #8
0
    def __init__(self, master, synth, src, app):
        Toplevel.__init__(self, master)
        self.src = src
        self.synth = synth
        self.app = app
        self.var_all = StringVar()
        self.var_all.set(0)
        frame = factory.frame(self, modal=True)
        frame.pack(expand=True, fill="both")
        lab_title = factory.label(frame, "Remove MIDI Source Map", modal=True)
        lab_title.grid(row=0, column=0, columnspan=3, padx=4, pady=8)
        if src == "cc":
            lab_src = factory.label(frame, "Controller", modal=True)
            self.combo_source = factory.controller_combobox(frame, app)
            lab_src.grid(row=1, column=0, padx=4, sticky='w')
            self.combo_source.grid(row=1, column=1, columnspan=2, sticky="ew")
        else:
            lab_src = factory.label(frame, "Source: %s" % src, modal=True)
            self.combo_source = factory.combobox(None, [src])
            lab_src.grid(row=1, column=0, columnspan=3, padx=4, sticky='w')
        lab_param = factory.label(frame, "Param", modal=True)
        self.cb_all = factory.checkbutton(frame, "All", var = self.var_all, modal=True)
        params = sorted(synth.bank().template.keys())
        self.combo_params = factory.combobox(frame, params, 
                                             "Synth Parameters")
        lab_param.grid(row=2, column=0, padx=4, pady=4, sticky='w')
        self.cb_all.grid(row=2, column=1, padx=4)
        self.combo_params.grid(row=2, column=2)

        def disable_param_callback():
            val = int(self.var_all.get())
            if val == 0:
                self.combo_params.config(state="normal")
            else:
                self.combo_params.config(state="disabled")
        
        def accept_callback():
            shelper = self.app.ls_parser.synthhelper
            if self.src == "cc":
                src = self.combo_source.get()[1:4]
            else:
                src = self.src
            src = src.lower()
            if int(self.var_all.get()) == 0:
                param = self.combo_params.get()
            else:
                param = "ALL"
            shelper.remove_parameter_map(src, param, self.synth.sid)
            msg = "Removed MIDI source map"
            self.status(msg)
            self.destroy()
            self.synth.synth_editor.sync()

        def cancel_callback():
            msg = "Delete source map canceld"
            self.status(msg)
            self.destroy()

        toolbar = factory.frame(frame, modal=True)
        b_accept = factory.accept_button(toolbar, command=accept_callback)
        b_cancel = factory.cancel_button(toolbar, command=cancel_callback)
        toolbar.grid(row=3, column=0, columnspan=3, padx=4, pady=8, sticky="ew")
        b_accept.grid(row=0, column=0, sticky="ew")
        b_cancel.grid(row=0, column=1, sticky="ew")
        self.cb_all.config(command=disable_param_callback)
        try:                    # ISSUE BUG 0004
            self.grab_set()
        except TclError as err:
            print("-" * 60)
            print("BUG 0004 trapped. TkDeleteSourceMapDialog.__init__")
            print(err.message)
            print("Unable to open dialog as modal")
            
        self.mainloop()
Exemple #9
0
    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):
     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()
Exemple #11
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)
Exemple #12
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()
Exemple #13
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)
Exemple #14
0
    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()