Commit ba2a1ed1 authored by Roman Alifanov's avatar Roman Alifanov

widgets/info_graph_multi: use Adw.WrapBox for centered last row

parent 4ec846c6
from gi.repository import Gtk from gi.repository import Adw, Gtk
from .BaseWidget import BaseWidget from .BaseWidget import BaseWidget
...@@ -14,22 +14,24 @@ class InfoGraphMultiWidget(BaseWidget): ...@@ -14,22 +14,24 @@ class InfoGraphMultiWidget(BaseWidget):
self.columns = setting.map.get('columns', 3) if setting.map else 3 self.columns = setting.map.get('columns', 3) if setting.map else 3
def create_row(self): def create_row(self):
self.flow_box = Gtk.FlowBox( self.wrap_box = Adw.WrapBox(
homogeneous=True, line_homogeneous=True,
selection_mode=Gtk.SelectionMode.NONE, natural_line_length=self.columns * 160,
justify=Adw.JustifyMode.NONE,
align=0.5,
margin_start=6, margin_start=6,
margin_end=6, margin_end=6,
margin_top=6, margin_top=6,
margin_bottom=6, margin_bottom=6,
row_spacing=6, line_spacing=6,
column_spacing=6 child_spacing=6
) )
self.row = Gtk.ListBoxRow( self.row = Gtk.ListBoxRow(
selectable=False, selectable=False,
activatable=False activatable=False
) )
self.row.set_child(self.flow_box) self.row.set_child(self.wrap_box)
return self.row return self.row
...@@ -46,7 +48,8 @@ class InfoGraphMultiWidget(BaseWidget): ...@@ -46,7 +48,8 @@ class InfoGraphMultiWidget(BaseWidget):
orientation=Gtk.Orientation.VERTICAL, orientation=Gtk.Orientation.VERTICAL,
spacing=0, spacing=0,
css_classes=["card"], css_classes=["card"],
width_request=150 width_request=150,
hexpand=False
) )
drawing_area = Gtk.DrawingArea() drawing_area = Gtk.DrawingArea()
...@@ -152,7 +155,7 @@ class InfoGraphMultiWidget(BaseWidget): ...@@ -152,7 +155,7 @@ class InfoGraphMultiWidget(BaseWidget):
if name not in self.graphs: if name not in self.graphs:
card = self._create_graph_card(name) card = self._create_graph_card(name)
self.flow_box.append(card) self.wrap_box.append(card)
graph = self.graphs[name] graph = self.graphs[name]
graph['history'].append(value) graph['history'].append(value)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment