Esempio n. 1
0
 def _layout_common_widgets(self):
     lab_head = factory.label(self.canvas,"Porgram Mutation")
     lab_head.grid(row=0, column=0, columnspan=4, pady=16, padx=16)
     lab_help = factory.label(self.canvas,"P = Probability of change, R = Maximum change.")
     lab_help.grid(row=0,column=4,columnspan=4, sticky='w', padx=16)
     
     frame = factory.frame(self.canvas)
     frame.grid(row=1,column=0,rowspan=15, columnspan=4,pady=16)
     b_mutate = factory.button(frame,"Mutate",command=self.mutate)
     lab_slot = factory.label(frame,"Slot")
     sb_slot = factory.int_spinbox(frame,self._var_fill_start,from_=0,to=127)
     sb_slot.config(width=4)
     sb_slot.config(command=self._link_slots)
     b_reset = factory.button(frame,"Reset",command=self.reset)
     b_zero = factory.button(frame,"Zero",command=self.zero)
     b_max = factory.button(frame,"Max",command=self.max_change)
     b_mutate.grid(row=1,column=0, columnspan=3,sticky="ew", padx=4, pady=6)
     lab_slot.grid(row=2,column=0,sticky="w", padx=4)
     sb_slot.grid(row=2,column=2,sticky="e", padx=4, pady=6)
     #  Fill controls
     lab_fill = factory.label(frame,"Fill to:")
     sb_end = factory.int_spinbox(frame,self._var_fill_end,from_=0,to=127)
     sb_end.config(width=4)
     cb_progressive = factory.checkbutton(frame,"+", var=self._var_progressive_fill)
     lab_fill.grid(row=5,column=0,sticky="e",padx=4,pady=6)
     cb_progressive.grid(row=6,column=0,sticky="w")
     sb_end.grid(row=6,column=2,sticky='e')
     pad1 = factory.padding_label(frame)
     pad1.grid(row=7,column=0,pady=64)
     b_reset.grid(row=8,column=0,columnspan=3,sticky="ew", padx=4)
     b_zero.grid(row=9,column=0,columnspan=3,sticky="ew",padx=4,pady=4)
     b_max.grid(row=10,column=0,columnspan=3,sticky="ew",padx=4)
     pad2 = factory.padding_label(frame)
Esempio n. 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
Esempio n. 3
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
Esempio n. 4
0
def form_test():
    root = Tk()
    a = FormLayout(root, "Why ask why?")
    a.pack(anchor="nw", expand=True, fill="both")
    a.add("Button", factory.button(a, "A"))
    a.add("Spinner box dog", factory.spinner(a, (0, 10)))
    svar = StringVar()
    svar.set("An Entry")
    a.add("Entry", factory.text_entry(a, svar))
    a.separator()
    a.add("Button 2", factory.button(a, "B2"))
    root.mainloop()
Esempio n. 5
0
    def __init__(self, master, sproxy):
        """
        Construct new TkSynthWindow

        master - The Tk container for self.  In practice this is an 
                 instance of llia.gui.tk.GroupWindow

        sproxy - An instance of llia.Proxy.
        """
        Frame.__init__(self, master)
        self.config(background=factory.bg())
        self.synth = sproxy
        self.synth.synth_editor = self
        self.app = sproxy.app
        self.sid = sproxy.sid
        self.group_index = -1
        factory.set_pallet(sproxy.specs["pallet"])
        main = factory.paned_window(self)
        main.pack(expand=True, fill="both")
        self.bank_editor = TkBankEditor(main, self, sproxy)
        self.bus_and_buffer_editor = None
        east = factory.frame(main)
        self.notebook = factory.notebook(east)
        self.notebook.pack(anchor="nw", expand=True, fill="both")
        south = factory.frame(east)
        south.pack(after=self.notebook, anchor="w", expand=True, fill="x")
        self._lab_status = factory.label(south, "<status>")
        self._lab_extended = factory.label(south, "")
        b_panic = factory.panic_button(south, command=self.panic)
        b_lower = factory.button(south, "-", command=self.lower_window)
        b_lift = factory.button(south, "+", command=self.lift_window)
        b_panic.grid(row=0, column=0)
        self._lab_status.grid(row=0, column=4, sticky='ew')
        self._lab_extended.grid(row=0,column=5,sticky='e',padx=16)
        self._lab_extended.config(fg="#f1f1cd")
        self._progressbar = Progressbar(south,mode="indeterminate")
        self._progressbar.grid(row=0,column=PROGRESSBAR_COLUMN, sticky='w', padx=8)
        south.config(background=factory.bg())
        main.add(self.bank_editor)
        main.add(east)
        self.list_channel = None
        self.list_keytab = None
        self.var_transpose = StringVar()
        self.var_keyrange_low = StringVar()
        self.var_keyrange_high = StringVar()
        self.var_bendrange = StringVar()
        self._init_midi_tab(self.notebook)
        self._init_map1_tab(self.notebook) # MIDI controllers and pitchwheel
        self._init_map2_tab(self.notebook) # velocity, aftertouch, keynumber
        self._init_info_tab(self.notebook)
        self._child_editors = {}
        self.update_progressbar(100, 0)
Esempio n. 6
0
 def _init_status_panel(self):
     south = self._main.south
     south.configure(padx=4, pady=4)
     self._lab_status = factory.label(south, "", modal=False)
     b_panic = factory.panic_button(south)
     b_down = factory.button(south, "-")
     b_up = factory.button(south, "+")
     b_panic.grid(row=0, column=0)
     # b_down.grid(row=0,column=1)
     # b_up.grid(row=0,column=2)
     self._lab_status.grid(row=0, column=3, sticky='w')
     south.config(background=factory.bg())
     b_down.configure(command=lambda: self.root.lower())
     b_up.configure(command=lambda: self.root.lift())
Esempio n. 7
0
 def _init_status_panel(self):
     south = self._main.south
     south.configure(padx=4, pady=4)
     self._lab_status = factory.label(south, "", modal=False)
     b_panic = factory.panic_button(south)
     b_down = factory.button(south, "-")
     b_up = factory.button(south, "+")
     b_panic.grid(row=0, column=0)
     # b_down.grid(row=0,column=1)
     # b_up.grid(row=0,column=2)
     self._lab_status.grid(row=0,column=3, sticky='w')
     south.config(background=factory.bg())
     b_down.configure(command=lambda: self.root.lower())
     b_up.configure(command=lambda: self.root.lift())
Esempio n. 8
0
    def __init__(self, master, sproxy):
        Frame.__init__(self, master)
        self.config(background=factory.bg())
        self.synth = sproxy
        self.synth.synth_editor = self
        self.app = sproxy.app
        self.sid = sproxy.sid
        self.group_index = -1
        factory.set_pallet(sproxy.specs["pallet"])
        main = factory.paned_window(self)
        main.pack(expand=True, fill="both")
        self.bank_editor = TkBankEditor(main, self, sproxy)
        self.bus_and_buffer_editor = None
        east = factory.frame(main)
        self.notebook = factory.notebook(east)
        self.notebook.pack(anchor="nw", expand=True, fill="both")
        south = factory.frame(east)
        south.pack(after=self.notebook, anchor="w", expand=True, fill="x")
        # b_panic = factory.panic_button(south, command=self.panic)
        # b_clear_status = factory.clear_button(south, command=self.clear_status)
        # self._lab_status = factory.label(south, "<status>")
        # b_panic.grid(row=0, column=0, sticky='w')
        # b_clear_status.grid(row=0, column=1, sticky='w')
        # self._lab_status.grid(row=0, column=2, sticky='w', padx=8)

        self._lab_status = factory.label(south, "<status>")
        b_panic = factory.panic_button(south, command=self.panic)
        b_lower = factory.button(south, "-", command=self.lower_window)
        b_lift = factory.button(south, "+", command=self.lift_window)
        self._lab_status.grid(row=0, column=2, sticky='w', padx=8)
        b_panic.grid(row=0, column=0)
        self._lab_status.grid(row=0, column=3, sticky='w')
        
        south.config(background=factory.bg())
        main.add(self.bank_editor)
        main.add(east)
        self.list_channel = None
        self.list_keytab = None
        self.var_transpose = StringVar()
        self.var_keyrange_low = StringVar()
        self.var_keyrange_high = StringVar()
        self.var_bendrange = StringVar()
        self._init_info_tab(self.notebook)
        self._init_busconnection_tab(self.notebook)
        self._init_performance_tab(self.notebook)
        self._init_map1_tab(self.notebook) # MIDI controllers and pitchwheel
        self._init_map2_tab(self.notebook) # velocity, aftertouch, keynumber
        self._child_editors = {}
        self.sync()
Esempio n. 9
0
 def _init_performance_toolbar(self):
     frame = factory.label_frame(self, "Performance")
     b_pcopy = factory.button(frame, "Copy", 
                              ttip="Copy current performance to clipboard",
                              command = self._copy_performance)
     b_ppaste = factory.button(frame, "Paste", 
                               ttip="Paste clipboard to current performance",
                               command = self._paste_performance)
     b_pfill = factory.button(frame, "Fill", 
                              ttip="Copy performance to multiple bank slots",
                              command = self._fill_performance)
     b_pcopy.grid(row=0, column=0, sticky="ew")
     b_ppaste.grid(row=0, column=1, sticky="ew")
     b_pfill.grid(row=0, column=2, sticky="ew")
     return frame
Esempio n. 10
0
 def _init_status_panel(self):
     south = self._main.south
     south.configure(padx=4, pady=4)
     self._lab_status = factory.label(south, "", modal=False)
     b_panic = factory.panic_button(south)
     b_down = factory.button(south, "-")
     b_up = factory.button(south, "+")
     b_panic.grid(row=0, column=0)
     self._progressbar = Progressbar(south,mode="indeterminate")
     self._progressbar.grid(row=0,column=PROGRESSBAR_COLUMN, sticky='w', padx=8)
     self._lab_status.grid(row=0,column=4, sticky='w')
     south.config(background=factory.bg())
     b_down.configure(command=lambda: self.root.lower())
     b_up.configure(command=lambda: self.root.lift())
     self.update_progressbar(100, 0)
Esempio n. 11
0
 def _init_performance_toolbar(self):
     frame = factory.label_frame(self, "Performance")
     b_pcopy = factory.button(frame, "Copy", 
                              ttip="Copy current performance to clipboard",
                              command = self._copy_performance)
     b_ppaste = factory.button(frame, "Paste", 
                               ttip="Paste clipboard to current performance",
                               command = self._paste_performance)
     b_pfill = factory.button(frame, "Fill", 
                              ttip="Copy performance to multiple bank slots",
                              command = self._fill_performance)
     b_pcopy.grid(row=0, column=0, sticky="ew")
     b_ppaste.grid(row=0, column=1, sticky="ew")
     b_pfill.grid(row=0, column=2, sticky="ew")
     return frame
Esempio n. 12
0
 def tbutton(col, text, command=None):
     bwidth = 75
     b = factory.button(self.canvas, text, command=command)
     y0 = 15
     x0 = 15
     x = x0 + col * bwidth
     b.place(x=x, y=y0, width=bwidth)
Esempio n. 13
0
 def tbutton(col, text, command=None):
     bwidth=75
     b = factory.button(self.canvas, text,command=command)
     y0 = 15
     x0 = 15
     x = x0+col*bwidth
     b.place(x=x,y=y0,width=bwidth)
Esempio n. 14
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()
Esempio n. 15
0
def hframe_test():
    root = Tk()
    a = HFrame(root)
    a.pack(anchor="nw", expand=True, fill="both")
    a.add("VFrame Test", padx=4)
    a.add(factory.button(a, "A Button"))
    a.add(factory.text_entry(a, StringVar()))
    root.mainloop()
Esempio n. 16
0
 def _init_south_toolbar(self):
     frame = factory.label_frame(self, "Program")
     b_store = factory.button(frame, "Store", command=self._store_program,
                              ttip = "Store current program")
     b_random = factory.button(frame, "RND", command=self._random_program,
                               ttip = "Generate random program (if defined)")
     b_init = factory.button(frame, "Init", command=self._init_program,
                             ttip = "Initialize program")
     b_copy = factory.button(frame, "Copy", command=self._copy_program,
                             ttip="Copy current prgoram to clipbaord")
     b_paste = factory.button(frame, "Paste", command=self._paste_program,
                              ttip="Paste clipboard to current program")
     cb_lock = factory.checkbutton(frame,"Lock",self._var_lock_current,
                                  command = self.lock_current_program)
     b_store.grid(row=0, column=0, sticky="ew")
     b_random.grid(row=0, column=1, sticky="ew")
     b_init.grid(row=0, column=2, sticky="ew")
     b_copy.grid(row=1, column=0, sticky="ew")
     b_paste.grid(row=1, column=1, sticky="ew")
     cb_lock.grid(row=1, column=2, sticky="ew")
     return frame
Esempio n. 17
0
 def _init_south_toolbar(self):
     frame = factory.label_frame(self, "Program")
     b_store = factory.button(frame, "Store", command=self._store_program,
                              ttip = "Store current program")
     b_random = factory.button(frame, "RND", command=self._random_program,
                               ttip = "Generate random program (if defined)")
     b_init = factory.button(frame, "Init", command=self._init_program,
                             ttip = "Initialize program")
     b_copy = factory.button(frame, "Copy", command=self._copy_program,
                             ttip="Copy current prgoram to clipbaord")
     b_paste = factory.button(frame, "Paste", command=self._paste_program,
                              ttip="Paste clipboard to current program")
     cb_lock = factory.checkbutton(frame,"Lock",self._var_lock_current,
                                  command = self.lock_current_program)
     b_store.grid(row=0, column=0, sticky="ew")
     b_random.grid(row=0, column=1, sticky="ew")
     b_init.grid(row=0, column=2, sticky="ew")
     b_copy.grid(row=1, column=0, sticky="ew")
     b_paste.grid(row=1, column=1, sticky="ew")
     cb_lock.grid(row=1, column=2, sticky="ew")
     return frame
Esempio n. 18
0
def border_test():
    root = Tk()
    bframe = BorderFrame(root)
    bframe.pack(anchor="nw", expand=True, fill="both")
    for i in range(4):
        bn = factory.button(bframe.north, "N%d" % i)
        bn.grid(row=0, column=i)
        bs = factory.button(bframe.south, "S%d" % i)
        bs.grid(row=0, column=i)
        be = factory.button(bframe.east, "E%d" % i)
        be.grid(row=i, column=0)
        bw = factory.button(bframe.west, "W%d" % i)
        bw.grid(row=i, column=0)
    for r in range(4):
        for c in range(4):
            b = factory.button(bframe.center, "%d.%d" % (r, c))
            b.grid(row=r, column=c)
            bframe.center.grid_columnconfigure(c, weight=1)
        bframe.center.grid_rowconfigure(r, weight=1)
    bframe.center.config(bg="BLUE")
    root.mainloop()
Esempio n. 19
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()
Esempio n. 20
0
 def _init_info_tab(self, master):
     img = factory.image("resources/Tabs/info.png")
     frame = factory.frame(master)
     inner_frame = factory.frame(frame)
     master.add(frame, text="Info", image=img,compound="top")
     text_widget = factory.text_widget(inner_frame)
     text_widget.config(width=90, height=40)
     vsb = factory.scrollbar(inner_frame, orientation='vertical')
     vsb.config(command=text_widget.yview)
     hsb = factory.scrollbar(inner_frame, orientation='horizontal')
     hsb.config(command=text_widget.xview)
     text_widget.config(yscrollcommand=vsb.set, xscrollcommand=hsb.set,
                        wrap='word',)
     text_widget.grid(row=0, column=0, rowspan=8, columnspan=8)
     vsb.grid(row=0, column=9, rowspan=8, columnspan=1, sticky='ns')
     hsb.grid(row=9, column=0, rowspan=1, columnspan=8, stick='we')
     inner_frame.grid(row=0, column=0, rowspan=8, columnspan=8)
     b_update = factory.button(frame, "Update",
                               command=self.sync_program_tab)
     b_update.grid(row=9, column=0, sticky='ew', pady=8)
     b_remove = factory.button(frame, "Remove Synth", command=self.remove_synth)
     b_remove.grid(row=9, column=1, sticky='ew', pady=8)
     self._info_text_widget = text_widget
Esempio n. 21
0
File: editor.py Progetto: kaos/Llia
 def __init__(self, editor):
     frame = editor.create_tab(self.NAME, self.TAB_FILE)
     frame.config(background=factory.bg())
     canvas = factory.canvas(frame, 1000, 600, self.IMAGE_FILE)
     canvas.pack()
     TkSubEditor.__init__(self, canvas, editor, self.NAME)
     editor.add_child_editor(self.NAME, self)
     y0 = 75
     x0 = 75
     x1 = x0 + 160
     xdelta = 75
     x_tog_offset = -23
     y_tog_offset = 160
     self.tumbler("hold", 5, 0.001, x0, y0 + 160)
     self.tumbler("clkfreq", 5, 0.001, x0, y0)
     self.toggle("clksrc",
                 x0 + 7,
                 y0 + 40,
                 off=(0, "Internal"),
                 on=(1, "External"))
     b_half_hold = factory.button(canvas, "1/2", self.half_hold_callback)
     b_half_hold.place(x=x0 + 13, y=y0 + 194)
     for i in range(6):
         j = i + 1
         x = x1 + i * xdelta
         self.norm_slider("amp%d" % j, x, y0)
         self.toggle("gate%d" % j,
                     x + x_tog_offset,
                     y0 + y_tog_offset,
                     off=[0, "On"],
                     on=[1, "Gate"])
     xn = x + xdelta
     self.norm_slider("ampn", xn, y0)
     self.toggle("gaten",
                 xn + x_tog_offset,
                 y0 + y_tog_offset,
                 off=[0, "On"],
                 on=[1, "Gate"])
     y_tumbler_n = y0 + y_tog_offset
     self.tumbler("n", 2, 1, xn - 8, y_tumbler_n + 40)
     xlag = x + 170
     xscale = xlag + 60
     xbias = xscale + 60
     self.norm_slider("lag", xlag, y0)
     self.norm_slider("scale", xscale, y0)
     self.linear_slider("bias", (-4, 4), xbias, y0)
Esempio n. 22
0
File: editor.py Progetto: kaos/Llia
 def __init__(self, editor):
     frame = editor.create_tab(self.NAME, self.TAB_FILE)
     frame.config(background=factory.bg())
     canvas = factory.canvas(frame,1000,600,self.IMAGE_FILE)
     canvas.pack()
     TkSubEditor.__init__(self, canvas, editor, self.NAME)
     editor.add_child_editor(self.NAME, self)
     y0 = 75
     x0 = 75
     x1 = x0 + 160
     xdelta = 75
     x_tog_offset = -23
     y_tog_offset = 160
     self.tumbler("hold",5,0.001,x0,y0+160)
     self.tumbler("clkfreq",5,0.001,x0,y0)
     self.toggle("clksrc",x0+7,y0+40,
                 off = (0, "Internal"),
                 on = (1, "External"))
     b_half_hold = factory.button(canvas,"1/2",self.half_hold_callback)
     b_half_hold.place(x=x0+13,y=y0+194)
     for i in range(6):
         j = i+1
         x = x1 + i*xdelta
         self.norm_slider("amp%d"%j,x,y0)
         self.toggle("gate%d"%j,x+x_tog_offset,y0+y_tog_offset,
                     off = [0,"On"],
                     on = [1,"Gate"])
     xn = x + xdelta
     self.norm_slider("ampn",xn,y0)
     self.toggle("gaten",xn+x_tog_offset,y0+y_tog_offset,
                 off = [0,"On"],
                 on = [1,"Gate"])
     y_tumbler_n = y0+y_tog_offset
     self.tumbler("n",2,1,xn-8,y_tumbler_n+40)
     xlag = x+170
     xscale = xlag+60
     xbias = xscale+60
     self.norm_slider("lag",xlag,y0)
     self.norm_slider("scale",xscale,y0)
     self.linear_slider("bias",(-4,4),xbias,y0)
Esempio n. 23
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)
Esempio n. 24
0
    def __init__(self, master, editor, synth):
        Frame.__init__(self, master)
        self.editor = editor
        self.synthhelper = editor.app.ls_parser.synthhelper
        self.synth = synth
        self.config(background=factory.bg())
        self.pack(anchor="nw", expand=True, fill="both")
        frame_audio_input = factory.label_frame(self, 
                                                "Audio Input Buses")
        frame_audio_output  = factory.label_frame(self, 
                                                  "Audio Output Buses")
        frame_control_input = factory.label_frame(self, 
                                                  "Control Input Buses")
        frame_control_output = factory.label_frame(self, 
                                                   "Control Output Buses")
        frame_audio_input.grid(row=0, column=0, rowspan=4, columnspan=4, 
                               padx=16, pady=16, sticky='nesw')
        frame_audio_output.grid(row=4, column=0, rowspan=4, columnspan=4, 
                                padx=16, pady=16, sticky='nesw')
        frame_control_input.grid(row=0, column=4, rowspan=4, columnspan=4, 
                                 padx=16, pady=16, sticky='nesw')
        frame_control_output.grid(row=4, column=4, rowspan=4, columnspan=4, 
                                  padx=16, pady=16, sticky='nesw')
        specs = synth.specs

        frame_south = factory.frame(self)
        frame_south.grid(row=9, column=0, rowspan=1, columnspan=8, sticky='ew',
                        padx=16, pady=16)
        b_sync = factory.button(frame_south, "Sync", command=self.sync)
        b_sync.grid(row=0, column=0)
        
        # audio inputs
        self._combo_audio_in = {}
        row = 0
        for i in range(con.MAX_BUS_COUNT):
            try:
                b = specs["audio-input-buses"][i]
                param = b[0]
                lab_name = factory.label(frame_audio_input, "%d - %s" % (i+1, param))
                combo = factory.audio_bus_combobox(frame_audio_input, self.editor.app)
                combo.param = param
                combo.bind("<<ComboboxSelected>>", self.audio_in_callback)
                combo.set(b[1])
                lab_name.grid(row=row, column=0, sticky='ew', padx=4, pady=4)
                combo.grid(row=row, column=1, sticky='ew', padx=4, pady=4)
                self._combo_audio_in[param] = combo
            except IndexError:
                lab_dummy = factory.label(frame_audio_input, "%d - n/a" % (i+1,))
                lab_dummy.grid(row=row, column=0)
            row += 1
            
                                         
        # audio output
        self._combo_audio_out = {}
        row = 0
        for i in range(con.MAX_BUS_COUNT):
            try:
                b = specs["audio-output-buses"][i]
                param = b[0]
                lab_name = factory.label(frame_audio_output, "%d - %s" % (i+1, param))
                combo = factory.audio_bus_combobox(frame_audio_output, self.editor.app)
                combo.param = param
                combo.bind("<<ComboboxSelected>>", self.audio_out_callback)
                combo.set(b[1])
                lab_name.grid(row=row, column=0, sticky='ew', padx=4, pady=4)
                combo.grid(row=row, column=1, sticky='ew', padx=4, pady=4)
                self._combo_audio_out[param] = combo
            except IndexError:
                lab_dummy = factory.label(frame_audio_output, "%d - n/a" % (i+1,))
                lab_dummy.grid(row=row, column=0)
            row += 1

        # control inputs
        self._combo_control_in = {}
        row = 0
        for i in range(con.MAX_BUS_COUNT):
            try:
                b = specs["control-input-buses"][i]
                param = b[0]
                lab_name = factory.label(frame_control_input, "%d - %s" % (i+1, param))
                combo = factory.control_bus_combobox(frame_control_input, self.editor.app)
                combo.param = param
                combo.bind("<<ComboboxSelected>>", self.control_in_callback)
                combo.set(b[1])
                lab_name.grid(row=row, column=0, sticky='ew', padx=4, pady=4)
                combo.grid(row=row, column=1, sticky='ew', padx=4, pady=4)
                self._combo_control_in[param] = combo
            except IndexError:
                lab_dummy = factory.label(frame_control_input, "%d - n/a" % (i+1,))
                lab_dummy.grid(row=row, column=0)
            row += 1
            
                                         
        # control output
        self._combo_control_out = {}
        row = 0
        for i in range(con.MAX_BUS_COUNT):
            try:
                b = specs["control-output-buses"][i]
                param = b[0]
                lab_name = factory.label(frame_control_output, "%d - %s" % (i+1, param))
                combo = factory.control_bus_combobox(frame_control_output, self.editor.app)
                combo.param = param
                combo.bind("<<ComboboxSelected>>", self.control_out_callback)
                combo.set(b[1])
                lab_name.grid(row=row, column=0, sticky='ew', padx=4, pady=4)
                combo.grid(row=row, column=1, sticky='ew', padx=4, pady=4)
                self._combo_control_out[param] = combo
            except IndexError:
                lab_dummy = factory.label(frame_control_output, "%d - n/a" % (i+1,))
                lab_dummy.grid(row=row, column=0)
            row += 14
        self.sync()
Esempio n. 25
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)
Esempio n. 26
0
    def __init__(self, editor):
        name = "Misc"
        image_file = "resources/Corvus/editor_misc.png"
        tab_file =   "resources/Tabs/misc.png"
        frame = editor.create_tab(name,tab_file)
        frame.config(background=factory.bg())
        canvas = factory.canvas(frame, 1000, 750,image_file)
        canvas.pack()
        self.canvas = canvas
        self.editor = editor
        TkSubEditor.__init__(self, canvas, editor, name)
        editor.add_child_editor(name, self)
        self.op = n
        y0 = 50
        y_msb = 230
        x0 = 50
        x_port = x0
        x_vib = x_port+90
        x_vdelay = x_vib+90
        x_vsens = x_vdelay+60
        x_vdepth = x_vsens+60
        x_xpitch = x_vdepth+60
        x_lfo1 = x_xpitch+90
        x_lfo2 = x_lfo1 + 90
        x_amp = x_lfo2 + 90
       
        def norm_slider(param,x,y,height=150):
            s = cf.normalized_slider(canvas,param,editor)
            self.add_control(param,s)
            s.widget().place(x=x,y=y,height=height)
            return s

        def volume_slider(param,x,y,height=150):
            s = cf.volume_slider(canvas,param,editor)
            self.add_control(param,s)
            s.widget().place(x=x,y=y,height=height)
            return s

        def linear_slider(param,range_,x,y):
            s = cf.linear_slider(canvas,param,editor,range_=range_)
            self.add_control(param,s)
            s.widget().place(x=x,y=y)
            return s
        
        def tumbler(param,digits,scale,x,y):
            t = Tumbler(canvas,param,editor,digits=digits,scale=scale)
            self.add_control(param,t)
            t.layout((x,y))
            t.update_aspect()
            return t

        def msb_ratio(n,x):
            param = "lfo%d_ratio" % n
            count = len(LFO_RATIOS)
            msb = MSB(canvas,param,editor,count)
            for i,pair in enumerate(LFO_RATIOS):
                value,txt = pair
                d = {"fill" : CFILL,
                     "foreground" : CFOREGROUND,
                     "outline" : COUTLINE,
                     "value" : value,
                     "text" : txt}
                msb.define_aspect(i,value,d)
            self.add_control(param, msb)
            msb.layout((x,y_msb))
            msb.update_aspect()
            return msb
        
        norm_slider("port",x_port,y0)
        tumbler("vfreq",5,0.001,x_vib,y0)
        linear_slider("vdelay",(0,4),x_vdelay,y0)
        norm_slider("vsens",x_vsens,y0)
        norm_slider("vdepth",x_vdepth,y0)
        norm_slider("xpitch",x_xpitch,y0)
        linear_slider("lfo1_delay",(0,4),x_lfo1,y0)
        msb_ratio(1,x_lfo1-22)
        linear_slider("lfo2_delay",(0,4),x_lfo2,y0)
        msb_ratio(2,x_lfo2-22)
        volume_slider("amp",x_amp,y0)
        
        y_penv = 375
        y_buttons = y_penv+200
        x_penv = x0
        for a in (0,1,2,3,4):
            x = x_penv + a*60
            linear_slider("pe_a%d" % a, (-1.0,1.0),x,y_penv)
        x += 60
        for t in (1,2,3,4):
            x = x+60
            linear_slider("pe_t%d" % t, (0,MAX_ENV_SEGMENT),x,y_penv)
        x += 60
        x_send = x
        for i in (1,2,3,4):
          x += 60
          linear_slider("op%d_pe" % i,(-1,1),x,y_penv)
        count = len(PENV_HOLD_NODES)
        msb_loop = MSB(canvas,"pe_loop",editor,count)
        for i,v in enumerate(PENV_LOOP_NODES):
            d = {"fill" : CFILL,
                 "foreground" : CFOREGROUND,
                 "outline" : COUTLINE,
                 "value" : v,
                 "text" : str(v)}
            msb_loop.define_aspect(i,v,d)
        self.add_control("pe_loop",msb_loop)
        msb_loop.layout((x_penv, y_buttons))
        msb_loop.update_aspect()

        def zero_levels():
            for a in (0,1,2,3,4):
                p = "pe_a%d" % a
                self.set_value(p,0.0)
            self.sync()

        def zero_sends():
            for a in (1,2,3,4):
                p = "op%d_pe" % a
                self.set_value(p,0.0)
            self.sync()
            
        b1 = factory.button(canvas,"0", command=zero_levels)
        b1.place(x=x_penv+120,y=y_buttons)
        b2 = factory.button(canvas,"0",command=zero_sends)
        b2.place(x=x_send+49,y=y_buttons)
Esempio n. 27
0
    def __init__(self, editor):
        name = "Misc"
        image_file = "resources/Corvus/editor_misc.png"
        tab_file = "resources/Tabs/misc.png"
        frame = editor.create_tab(name, tab_file)
        frame.config(background=factory.bg())
        canvas = factory.canvas(frame, 1000, 750, image_file)
        canvas.pack()
        self.canvas = canvas
        self.editor = editor
        TkSubEditor.__init__(self, canvas, editor, name)
        editor.add_child_editor(name, self)
        self.op = n
        y0 = 50
        y_msb = 230
        x0 = 50
        x_port = x0
        x_vib = x_port + 90
        x_vdelay = x_vib + 90
        x_vsens = x_vdelay + 60
        x_vdepth = x_vsens + 60
        x_xpitch = x_vdepth + 60
        x_lfo1 = x_xpitch + 90
        x_lfo2 = x_lfo1 + 90
        x_amp = x_lfo2 + 90

        def norm_slider(param, x, y, height=150):
            s = cf.normalized_slider(canvas, param, editor)
            self.add_control(param, s)
            s.widget().place(x=x, y=y, height=height)
            return s

        def volume_slider(param, x, y, height=150):
            s = cf.volume_slider(canvas, param, editor)
            self.add_control(param, s)
            s.widget().place(x=x, y=y, height=height)
            return s

        def linear_slider(param, range_, x, y):
            s = cf.linear_slider(canvas, param, editor, range_=range_)
            self.add_control(param, s)
            s.widget().place(x=x, y=y)
            return s

        def tumbler(param, digits, scale, x, y):
            t = Tumbler(canvas, param, editor, digits=digits, scale=scale)
            self.add_control(param, t)
            t.layout((x, y))
            t.update_aspect()
            return t

        def msb_ratio(n, x):
            param = "lfo%d_ratio" % n
            count = len(LFO_RATIOS)
            msb = MSB(canvas, param, editor, count)
            for i, pair in enumerate(LFO_RATIOS):
                value, txt = pair
                d = {
                    "fill": CFILL,
                    "foreground": CFOREGROUND,
                    "outline": COUTLINE,
                    "value": value,
                    "text": txt
                }
                msb.define_aspect(i, value, d)
            self.add_control(param, msb)
            msb.layout((x, y_msb))
            msb.update_aspect()
            return msb

        norm_slider("port", x_port, y0)
        tumbler("vfreq", 5, 0.001, x_vib, y0)
        linear_slider("vdelay", (0, 4), x_vdelay, y0)
        norm_slider("vsens", x_vsens, y0)
        norm_slider("vdepth", x_vdepth, y0)
        norm_slider("xpitch", x_xpitch, y0)
        linear_slider("lfo1_delay", (0, 4), x_lfo1, y0)
        msb_ratio(1, x_lfo1 - 22)
        linear_slider("lfo2_delay", (0, 4), x_lfo2, y0)
        msb_ratio(2, x_lfo2 - 22)
        volume_slider("amp", x_amp, y0)

        y_penv = 375
        y_buttons = y_penv + 200
        x_penv = x0
        for a in (0, 1, 2, 3, 4):
            x = x_penv + a * 60
            linear_slider("pe_a%d" % a, (-1.0, 1.0), x, y_penv)
        x += 60
        for t in (1, 2, 3, 4):
            x = x + 60
            linear_slider("pe_t%d" % t, (0, MAX_ENV_SEGMENT), x, y_penv)
        x += 60
        x_send = x
        for i in (1, 2, 3, 4):
            x += 60
            linear_slider("op%d_pe" % i, (-1, 1), x, y_penv)
        count = len(PENV_HOLD_NODES)
        msb_loop = MSB(canvas, "pe_loop", editor, count)
        for i, v in enumerate(PENV_LOOP_NODES):
            d = {
                "fill": CFILL,
                "foreground": CFOREGROUND,
                "outline": COUTLINE,
                "value": v,
                "text": str(v)
            }
            msb_loop.define_aspect(i, v, d)
        self.add_control("pe_loop", msb_loop)
        msb_loop.layout((x_penv, y_buttons))
        msb_loop.update_aspect()

        def zero_levels():
            for a in (0, 1, 2, 3, 4):
                p = "pe_a%d" % a
                self.set_value(p, 0.0)
            self.sync()

        def zero_sends():
            for a in (1, 2, 3, 4):
                p = "op%d_pe" % a
                self.set_value(p, 0.0)
            self.sync()

        b1 = factory.button(canvas, "0", command=zero_levels)
        b1.place(x=x_penv + 120, y=y_buttons)
        b2 = factory.button(canvas, "0", command=zero_sends)
        b2.place(x=x_send + 49, y=y_buttons)