Fix alignment of tracks on Cover panel (close #106)
GTK 4 centers marks of the Scale widget even when the scale has a vertical orientation. Unfortunately, the Scale widget does not provide a way to set the alignment or to access the internal Label widget in any way. To left-align the labels this commit add a method that traverses the all children of the songs scale recursively and adjusts the alignment if it is a Label widget.
This commit is contained in:
parent
79b3111fb0
commit
cd4f32e7f2
2 changed files with 16 additions and 1 deletions
|
|
@ -141,6 +141,7 @@
|
|||
<child>
|
||||
<object class="GtkScale" id="songs_scale">
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="valign">fill</property>
|
||||
<property name="vexpand">true</property>
|
||||
<property name="restrict-to-fill-level">False</property>
|
||||
|
|
@ -158,4 +159,3 @@
|
|||
</child>
|
||||
</template>
|
||||
</interface>
|
||||
|
||||
|
|
|
|||
|
|
@ -180,6 +180,21 @@ class CoverPanel(Gtk.Overlay):
|
|||
length, Gtk.PositionType.RIGHT,
|
||||
"{0[0]:02d}:{0[1]:02d} minutes".format(divmod(length, 60)))
|
||||
|
||||
# Align marks
|
||||
self._align_songs_scale_marks()
|
||||
|
||||
def _align_songs_scale_marks(self):
|
||||
self._align_songs_scale_mark(self.songs_scale)
|
||||
|
||||
def _align_songs_scale_mark(self, widget):
|
||||
child = widget.get_first_child()
|
||||
while child:
|
||||
if type(child) is Gtk.Label:
|
||||
child.set_halign(Gtk.Align.START)
|
||||
else:
|
||||
self._align_songs_scale_mark(child)
|
||||
child = child.get_next_sibling()
|
||||
|
||||
def _enable_tracklist(self):
|
||||
if self._current_album:
|
||||
# enable
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue