[gnome-music/wip/exalm/tnum: 2/2] Use tabular numbers for song duration
- From: Marinus Schraal <mschraal src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/exalm/tnum: 2/2] Use tabular numbers for song duration
- Date: Sun, 26 Jan 2020 20:08:13 +0000 (UTC)
commit 2aa733b7dba72ee5261ae45ecc390e09c3826503
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Fri Jan 24 23:08:36 2020 +0500
Use tabular numbers for song duration
Essentially force monospace for digits if the font supports it. This allows
durations to stay aligned with each other and prevents seekbar changing
size each second.
data/ui/PlayerToolbar.ui | 6 ++++++
data/ui/SongWidget.ui | 3 +++
gnomemusic/views/songsview.py | 4 +++-
3 files changed, 12 insertions(+), 1 deletion(-)
---
diff --git a/data/ui/PlayerToolbar.ui b/data/ui/PlayerToolbar.ui
index 3eebcf6e..78888f6e 100644
--- a/data/ui/PlayerToolbar.ui
+++ b/data/ui/PlayerToolbar.ui
@@ -204,6 +204,9 @@
<property name="halign">start</property>
<property name="valign">center</property>
<property name="label">0:00</property>
+ <attributes>
+ <attribute name="font-features" value="tnum=1"/>
+ </attributes>
</object>
<packing>
<property name="position">0</property>
@@ -228,6 +231,9 @@
<property name="halign">start</property>
<property name="valign">center</property>
<property name="label">0:00</property>
+ <attributes>
+ <attribute name="font-features" value="tnum=1"/>
+ </attributes>
</object>
<packing>
<property name="position">2</property>
diff --git a/data/ui/SongWidget.ui b/data/ui/SongWidget.ui
index c9fe3496..60d0313c 100644
--- a/data/ui/SongWidget.ui
+++ b/data/ui/SongWidget.ui
@@ -146,6 +146,9 @@
<property name="valign">center</property>
<property name="hexpand">True</property>
<property name="single_line_mode">True</property>
+ <attributes>
+ <attribute name="font-features" value="tnum=1"/>
+ </attributes>
</object>
</child>
</object>
diff --git a/gnomemusic/views/songsview.py b/gnomemusic/views/songsview.py
index 756635d5..46891d37 100644
--- a/gnomemusic/views/songsview.py
+++ b/gnomemusic/views/songsview.py
@@ -128,7 +128,9 @@ class SongsView(BaseView):
column_album.props.expand = True
self._view.append_column(column_album)
- duration_renderer = Gtk.CellRendererText(xalign=1.0)
+ attrs = Pango.AttrList()
+ attrs.insert(Pango.AttrFontFeatures.new("tnum=1"))
+ duration_renderer = Gtk.CellRendererText(xalign=1.0, attributes=attrs)
column_duration = Gtk.TreeViewColumn(
"Duration", duration_renderer, text=5)
self._view.append_column(column_duration)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]