gui: fix the global orientation changes
This broke at some point, let's fix it again by moving to the drawing and calling refresh() from there - no need for the DrawingPerspective to call into the drawing here.
This commit is contained in:
parent
b7079e2343
commit
78fc886375
|
@ -50,6 +50,7 @@ class Drawing(Gtk.Box):
|
|||
def __init__(self, json_data, *args, **kwargs):
|
||||
super().__init__()
|
||||
self.orientation = Config.instance().orientation
|
||||
Config.instance().connect('notify::orientation', self._on_orientation_changed)
|
||||
|
||||
self.json_data = json_data
|
||||
self.svg = svg = JsonSvg(json_data, orientation=self.orientation)
|
||||
|
@ -60,6 +61,10 @@ class Drawing(Gtk.Box):
|
|||
self.image_svg.set_from_file(svg.filename)
|
||||
self.timestamp = svg.timestamp
|
||||
|
||||
def _on_orientation_changed(self, config, pspec):
|
||||
self.orientation = config.orientation
|
||||
self.refresh()
|
||||
|
||||
def refresh(self):
|
||||
self.svg = svg = JsonSvg(self.json_data, self.orientation)
|
||||
self.image_svg.set_from_file(svg.filename)
|
||||
|
|
|
@ -63,12 +63,6 @@ class DrawingPerspective(Gtk.Stack):
|
|||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.known_drawings = []
|
||||
Config.instance().connect('notify::orientation', self._on_orientation_changed)
|
||||
|
||||
def _on_orientation_changed(self, config, pspec):
|
||||
# When the orientation changes, we just re-generate all SVGs. This
|
||||
# isn't something that should happen very often anyway so meh.
|
||||
self.flowbox_drawings.foreach(lambda child: child.get_child().refresh())
|
||||
|
||||
def _cache_drawings(self, device, pspec):
|
||||
# The config backend filters duplicates anyway, so don't care here
|
||||
|
|
Loading…
Reference in New Issue