More cleanup; pulled out song list column to its own class
This commit is contained in:
24
sublime/ui/common/song_list_column.py
Normal file
24
sublime/ui/common/song_list_column.py
Normal file
@@ -0,0 +1,24 @@
|
||||
import gi
|
||||
gi.require_version('Gtk', '3.0')
|
||||
from gi.repository import Gtk, Pango
|
||||
|
||||
|
||||
class SongListColumn(Gtk.TreeViewColumn):
|
||||
def __init__(
|
||||
self,
|
||||
header: str,
|
||||
text_idx: int,
|
||||
bold: bool = False,
|
||||
align: int = 0,
|
||||
width: int = None,
|
||||
):
|
||||
renderer = Gtk.CellRendererText(
|
||||
xalign=align,
|
||||
weight=Pango.Weight.BOLD if bold else Pango.Weight.NORMAL,
|
||||
ellipsize=Pango.EllipsizeMode.END,
|
||||
)
|
||||
renderer.set_fixed_size(width or -1, 35)
|
||||
|
||||
super().__init__(header, renderer, text=text_idx)
|
||||
self.set_resizable(True)
|
||||
self.set_expand(not width)
|
Reference in New Issue
Block a user