Beispiel #1
0
    def __init__(self, groups):

        Gtk.Dialog.__init__(self, _('Show tracks with groups'))

        # setup combo box selections
        self.group_model = Gtk.ListStore(GObject.TYPE_STRING)
        groups_set = gt_common.get_groups_from_categories()
        groups_set |= set(groups)

        for group in groups_set:
            self.group_model.append([group])

        self.combo_model = Gtk.ListStore(GObject.TYPE_STRING)
        self.choices = [
            _('Must have this tag [AND]'),
            _('May have this tag [OR]'),
            _('Must not have this tag [NOT]'),
            _('Ignored')
        ]
        for choice in self.choices:
            self.combo_model.append([choice])

        # setup table
        self.table = Gtk.Table(rows=len(groups) + 1, columns=2)

        self.table.attach(Gtk.Label(label=_('Group')), 0, 1, 0, 1, ypadding=5)
        self.table.attach(Gtk.Label(label=_('Selected Tracks')),
                          1,
                          2,
                          0,
                          1,
                          ypadding=5)

        # TODO: Scrolled window
        self.combos = []

        # TODO: Add/remove groups to/from table

        for i, group in enumerate(sorted(groups)):

            # label
            gcombo = self._init_combo(self.group_model)
            gcombo.set_active(self._get_group_index(group))
            self.table.attach(gcombo, 0, 1, i + 1, i + 2, xpadding=3)

            # combo
            combo = self._init_combo(self.combo_model)
            combo.set_active(0)
            self.table.attach(combo, 1, 2, i + 1, i + 2)

            self.combos.append((gcombo, combo))

        self.vbox.pack_start(self.table, True, True, 0)

        self.add_buttons(Gtk.STOCK_OK, Gtk.ResponseType.OK, Gtk.STOCK_CANCEL,
                         Gtk.ResponseType.CANCEL)
        self.show_all()
Beispiel #2
0
    def __init__(self, groups):

        Gtk.Dialog.__init__(self, title=_('Show tracks with groups'))

        # setup combo box selections
        self.group_model = Gtk.ListStore(GObject.TYPE_STRING)
        groups_set = gt_common.get_groups_from_categories()
        groups_set |= set(groups)

        for group in groups_set:
            self.group_model.append([group])

        self.combo_model = Gtk.ListStore(GObject.TYPE_STRING)
        self.choices = [
            _('Must have this tag [AND]'),
            _('May have this tag [OR]'),
            _('Must not have this tag [NOT]'),
            _('Ignored'),
        ]
        for choice in self.choices:
            self.combo_model.append([choice])

        # setup table
        self.table = Gtk.Grid()

        self.table.attach(Gtk.Label(label=_('Group')), 0, 0, 1, 1)
        self.table.attach(Gtk.Label(label=_('Selected Tracks')), 1, 0, 1, 1)

        # TODO: Scrolled window
        self.combos = []

        # TODO: Add/remove groups to/from table

        for i, group in enumerate(sorted(groups)):

            # label
            gcombo = self._init_combo(self.group_model)
            gcombo.set_active(self._get_group_index(group))
            self.table.attach(gcombo, 0, i + 1, 1, 1)

            # combo
            combo = self._init_combo(self.combo_model)
            combo.set_active(0)
            self.table.attach(combo, 1, i + 1, 1, 1)

            self.combos.append((gcombo, combo))

        self.vbox.pack_start(self.table, True, True, 0)

        self.add_buttons(
            Gtk.STOCK_OK, Gtk.ResponseType.OK, Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL
        )
        self.show_all()
Beispiel #3
0
 def __init__(self, groups):
     
     gtk.Dialog.__init__(self, _('Show tracks with groups') )
     
     # setup combo box selections
     self.group_model = gtk.ListStore(gobject.TYPE_STRING)
     groups_set = gt_common.get_groups_from_categories()
     groups_set |= set(groups)
     
     for group in groups_set:
         self.group_model.append( [group] )
     
     self.combo_model = gtk.ListStore(gobject.TYPE_STRING)
     self.choices = [ _('Must have this tag [AND]'), _('May have this tag [OR]'), _('Must not have this tag [NOT]'), _('Ignored') ]
     for choice in self.choices:
         self.combo_model.append( [choice] )
     
     # setup table
     self.table = gtk.Table(rows=len(groups)+1, columns=2)
     
     self.table.attach(gtk.Label(_('Group')), 0, 1, 0, 1, ypadding=5)
     self.table.attach(gtk.Label(_('Selected Tracks')), 1, 2, 0, 1, ypadding=5)
     
     # TODO: Scrolled window
     self.combos = []
     
     # TODO: Add/remove groups to/from table
     
     for i,group in enumerate(sorted(groups)):
         
         # label
         gcombo = self._init_combo(self.group_model)
         gcombo.set_active(self._get_group_index(group))
         self.table.attach(gcombo, 0, 1, i+1, i+2, xpadding=3)
         
         # combo
         combo = self._init_combo(self.combo_model)
         combo.set_active(0)
         self.table.attach(combo, 1, 2, i+1, i+2)
         
         self.combos.append( (gcombo, combo) )
         
         
     self.vbox.pack_start(self.table)
     
     self.add_buttons(gtk.STOCK_OK, gtk.RESPONSE_OK, gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL)
     self.show_all()