def _set_orientation(self, orientation): """ Set columns orientation @param orientation as Gtk.Orientation """ if not TracksView._set_orientation(self, orientation): return self._responsive_widget.insert_row(0) self.__label = Gtk.Label.new(_("Tracks")) self.__label.show() self.__label.set_ellipsize(Pango.EllipsizeMode.END) self.__label.get_style_context().add_class("dim-label") self.__update_label(App().window.folded) self.__label.set_hexpand(True) self.__label.set_property("halign", Gtk.Align.START) idx = 1 # Vertical ########################## # --------Label-------- # # | Column 1 | # # | Column 2 | # ########################## # Horizontal ########################### # ---------Label--------- # # | Column 1 | Column 2 | # ########################### if orientation == Gtk.Orientation.VERTICAL: self._responsive_widget.attach(self.__label, 0, 0, 1, 1) self._responsive_widget.attach(self._tracks_widget_left[0], 0, idx, 2, 1) idx += 1 else: self._responsive_widget.attach(self.__label, 0, 0, 2, 1) self._responsive_widget.attach(self._tracks_widget_left[0], 0, idx, 1, 1) if not self.view_type & ViewType.SINGLE_COLUMN: if orientation == Gtk.Orientation.VERTICAL: self._responsive_widget.attach(self._tracks_widget_right[0], 0, idx, 2, 1) else: self._responsive_widget.attach(self._tracks_widget_right[0], 1, idx, 1, 1) idx += 1
def _set_orientation(self, orientation): """ Set columns orientation @param orientation as Gtk.Orientation """ if not TracksView._set_orientation(self, orientation): return idx = 0 # Vertical ########################## # --------Label-------- # # | Column 1 | # # | Column 2 | # ########################## # Horizontal ########################### # ---------Label--------- # # | Column 1 | Column 2 | # ########################### for disc in self.__discs: show_label = len(self.__discs) > 1 disc_names = self.__album.disc_names(disc.number) if show_label or disc_names: if disc_names: disc_text = ", ".join(disc_names) elif show_label: disc_text = _("Disc %s") % disc.number label = Gtk.Label.new() label.set_ellipsize(Pango.EllipsizeMode.END) label.set_text(disc_text) label.set_property("halign", Gtk.Align.START) label.get_style_context().add_class("dim-label") label.show() eventbox = Gtk.EventBox() eventbox.connect("realize", set_cursor_type) eventbox.set_tooltip_text(_("Play")) eventbox.connect("button-press-event", self.__on_disc_button_press_event, disc) eventbox.add(label) eventbox.show() if orientation == Gtk.Orientation.VERTICAL: self._responsive_widget.attach( eventbox, 0, idx, 1, 1) else: self._responsive_widget.attach( eventbox, 0, idx, 2, 1) idx += 1 if orientation == Gtk.Orientation.VERTICAL: self._responsive_widget.attach( self._tracks_widget_left[disc.number], 0, idx, 2, 1) idx += 1 else: self._responsive_widget.attach( self._tracks_widget_left[disc.number], 0, idx, 1, 1) if not self.view_type & ViewType.SINGLE_COLUMN: if orientation == Gtk.Orientation.VERTICAL: self._responsive_widget.attach( self._tracks_widget_right[disc.number], 0, idx, 2, 1) else: self._responsive_widget.attach( self._tracks_widget_right[disc.number], 1, idx, 1, 1) idx += 1