mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-25 18:55:27 -06:00
graphwidgets: Have cellrenderer sparkline obey 'xalign'
This commit is contained in:
parent
9b6cf41e08
commit
076459a50e
@ -141,6 +141,10 @@ class CellRendererSparkline(gtk.CellRenderer):
|
||||
GRAPH_INDENT = 2
|
||||
GRAPH_PAD = (BORDER_PADDING + GRAPH_INDENT)
|
||||
|
||||
# We don't use yalign, since we expand to the entire height
|
||||
#yalign = self.get_property("yalign")
|
||||
xalign = self.get_property("xalign")
|
||||
|
||||
# Set up graphing bounds
|
||||
graph_x = (cell_area.x + GRAPH_PAD)
|
||||
graph_y = (cell_area.y + GRAPH_PAD)
|
||||
@ -159,6 +163,13 @@ class CellRendererSparkline(gtk.CellRenderer):
|
||||
#border_width = graph_width + GRAPH_PAD
|
||||
border_width = graph_width + (GRAPH_INDENT * 2)
|
||||
|
||||
# Align the widget
|
||||
empty_space = cell_area.width - border_width - (BORDER_PADDING * 2)
|
||||
if empty_space:
|
||||
xalign_space = int(empty_space * xalign)
|
||||
cell_area.x += xalign_space
|
||||
graph_x += xalign_space
|
||||
|
||||
cairo_ct = window.cairo_create()
|
||||
cairo_ct.set_line_width(3)
|
||||
cairo_ct.set_line_cap(cairo.LINE_CAP_ROUND)
|
||||
|
Loading…
Reference in New Issue
Block a user