def __init__(self, instrument, iobj): Gtk.VBox.__init__(self) self.engine = iobj.engine self.path = self.engine.path iattribs = iobj.status() attribs = self.engine.status() panel = Gtk.VBox(spacing=5) table = Gtk.Table(2, 2) table.set_col_spacings(5) IntSliderRow("Polyphony", "polyphony", 1, 128).add_row(table, 0, cbox.VarPath(self.path), attribs) self.voices_widget = add_display_row(table, 1, "Voices in use", cbox.VarPath(self.path), attribs, "active_voices") panel.pack_start(table, False, False, 5) WithPatchTable.__init__(self, attribs) panel.pack_start(standard_vscroll_window(-1, 160, self.table), True, True, 5) self.add(panel) hpanel = Gtk.HBox(spacing = 5) hpanel.pack_start(Gtk.Label.new_with_mnemonic("Add from _SFZ:"), False, False, 5) self.filebutton = Gtk.FileChooserButton("Soundfont") self.filebutton.set_action(Gtk.FileChooserAction.OPEN) self.filebutton.set_local_only(True) #self.filebutton.set_filename(cbox.GetThings("%s/status" % self.path, ['soundfont'], []).soundfont) self.filebutton.add_filter(standard_filter(["*.sfz", "*.SFZ"], "SFZ Programs")) self.filebutton.add_filter(standard_filter(["*"], "All files")) self.filebutton.connect('file-set', self.load_sfz) hpanel.pack_start(self.filebutton, False, True, 5) load_button = Gtk.Button.new_with_mnemonic("Add from _config") load_button.connect('clicked', self.load_config) hpanel.pack_start(load_button, False, True, 5) panel.pack_start(hpanel, False, False, 5) set_timer(self, 200, self.voices_update) self.output_model = Gtk.ListStore(GObject.TYPE_INT, GObject.TYPE_STRING) for i in range(iattribs.outputs): self.output_model.append((i + 1, "Out %d" % (i + 1))) self.polyphony_labels = {} self.output_combos = {} for i in range(16): button = Gtk.Button("Dump SFZ") button.connect("clicked", self.dump_sfz, i + 1) self.table.attach(button, 2, 3, i, i + 1, Gtk.AttachOptions.SHRINK, Gtk.AttachOptions.SHRINK) label = Gtk.Label("") self.table.attach(label, 3, 4, i, i + 1, Gtk.AttachOptions.SHRINK, Gtk.AttachOptions.SHRINK) self.polyphony_labels[i + 1] = label combo = standard_combo(self.output_model, column = 1) combo.connect('changed', self.output_combo_changed, i + 1) self.table.attach(combo, 4, 5, i, i + 1, Gtk.AttachOptions.SHRINK, Gtk.AttachOptions.SHRINK) self.output_combos[i + 1] = combo self.output_combo_update()
def __init__(self, location, main_window, path): Gtk.Window.__init__(self, Gtk.WindowType.TOPLEVEL) self.set_type_hint(Gdk.WindowTypeHint.UTILITY) self.set_transient_for(main_window) self.main_window = main_window self.path = path self.vpath = cbox.VarPath(path) self.set_title("%s - %s" % (self.effect_name, location)) self.vbox = Gtk.VBox() menu_bar = Gtk.MenuBar() menu_bar.append( create_menu("_Effect", [ ("_Save as...", self.on_effect_save_as if self.engine_name is not None else None), ("_Close", lambda w: self.destroy()), ])) self.vbox.pack_start(menu_bar, False, False, 0) if hasattr(self, 'params'): values = cbox.GetThings(self.path + "/status", [p.name for p in self.params], []) self.refreshers = [] t = Gtk.Table(2, len(self.params)) for i in range(len(self.params)): p = self.params[i] t.attach(p.create_label(), 0, 1, i, i + 1, Gtk.AttachOptions.SHRINK | Gtk.AttachOptions.FILL, Gtk.AttachOptions.SHRINK) widget, refresher = p.create_widget(self.vpath) refresher(values) t.attach(widget, 1, 2, i, i + 1, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, Gtk.AttachOptions.SHRINK) self.refreshers.append(refresher) self.vbox.pack_start(t, True, True, 5) self.add(self.vbox)
def __init__(self, instrument, iobj): Gtk.VBox.__init__(self) self.engine = iobj.engine self.path = self.engine.path print (iobj.path) attribs = iobj.status() panel = Gtk.VBox(spacing=5) table = Gtk.Table(2, 1) IntSliderRow("Polyphony", "polyphony", 2, 256).add_row(table, 0, cbox.VarPath(self.path), attribs) WithPatchTable.__init__(self, attribs) panel.pack_start(standard_vscroll_window(-1, 160, self.table), True, True, 5) hpanel = Gtk.HBox(spacing = 5) self.filebutton = Gtk.FileChooserButton("Soundfont") self.filebutton.set_action(Gtk.FileChooserAction.OPEN) self.filebutton.set_local_only(True) self.filebutton.set_filename(cbox.GetThings("%s/status" % self.path, ['soundfont'], []).soundfont) self.filebutton.add_filter(standard_filter(["*.sf2", "*.SF2"], "SF2 Soundfonts")) self.filebutton.add_filter(standard_filter(["*"], "All files")) hpanel.pack_start(Gtk.Label.new_with_mnemonic("_Load SF2:"), False, False, 5) hpanel.pack_start(self.filebutton, True, True, 5) unload = Gtk.Button.new_with_mnemonic("_Unload") hpanel.pack_start(unload, False, False, 5) unload.connect('clicked', self.unload) panel.pack_start(hpanel, False, False, 5) self.filebutton.connect('file-set', self.file_set) self.add(panel)