Commit 18f0418e authored by Jaden Goter's avatar Jaden Goter

Added explanatory comment to toggle_composition_guidelines and wrapped loop in...

Added explanatory comment to toggle_composition_guidelines and wrapped loop in try/finally to ensure the original guidelines are copied over if all goes awry.
parent aba71355
Pipeline #174525 passed with stage
in 4 minutes and 13 seconds
......@@ -396,10 +396,14 @@ class ViewerContainer(Gtk.Box, Loggable):
grid.attach(switch_widget, 1, row, 1, 1)
def __toggle_composition_guidelines_cb(self, unused_entry, unused_parameter):
# Keep a copy and restore it since the last active guidelines
# can be changed when the switches are toggled.
last_guidelines_copy = self._last_guidelines.copy()
for switch in last_guidelines_copy:
switch.set_active(not switch.get_active())
self._last_guidelines = last_guidelines_copy
try:
for switch in last_guidelines_copy:
switch.set_active(not switch.get_active())
finally:
self._last_guidelines = last_guidelines_copy
def __guideline_switch_cb(self, switch_widget, unused_parameter, drawing_function):
last_guidelines = {switch for switch in self.guidelines_switches if switch.get_active()}
......
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