def _get_combo_box_row(editable_property, compact=False): combo_box = Gtk.ComboBoxText() # Parse options and fill combo box opts_str = editable_property.args[COMBO_BOX_OPTIONS] values = [] opts = opts_str.split(",") for option in opts: sides = option.split(":") values.append(sides[1]) opt = sides[0].replace("!", " ") # Spaces are separators in args # and are replaced with "!" charactes for names opt = translations.get_combo_option(opt) combo_box.append_text(opt) # Set initial value selection = values.index(editable_property.value) combo_box.set_active(selection) combo_box.connect("changed", editable_property.combo_selection_changed, values) if compact: return guiutils.get_right_expand_box( Gtk.Label(editable_property.get_display_name() + ":"), combo_box, True) else: return _get_two_column_editor_row(editable_property.get_display_name(), combo_box)
def _get_combo_box_row(editable_property, compact=False): combo_box = Gtk.ComboBoxText() # Parse options and fill combo box opts_str = editable_property.args[COMBO_BOX_OPTIONS] values = [] opts = opts_str.split(",") for option in opts: sides = option.split(":") values.append(sides[1]) opt = sides[0].replace("!"," ")# Spaces are separators in args # and are replaced with "!" charactes for names opt = translations.get_combo_option(opt) combo_box.append_text(opt) # Set initial value selection = values.index(editable_property.value) combo_box.set_active(selection) combo_box.connect("changed", editable_property.combo_selection_changed, values) if compact: return guiutils.get_right_expand_box(Gtk.Label(editable_property.get_display_name() + ":"), combo_box, True) else: return _get_two_column_editor_row(editable_property.get_display_name(), combo_box)
def _get_combo_box_column(name, values, editable_property): combo_box = Gtk.ComboBoxText() for val in values: val = translations.get_combo_option(val) combo_box.append_text(val) # Set initial value selection = values.index(editable_property.value) combo_box.set_active(selection) combo_box.connect("changed", editable_property.combo_selection_changed, values) vbox = Gtk.VBox(False, 4) vbox.pack_start(Gtk.Label(label=name), True, True, 0) vbox.pack_start(combo_box, True, True, 0) return vbox