From cc69073ff044372da84e1a53dddf4f3c5040042a Mon Sep 17 00:00:00 2001 From: thomahl <thomahl@stud.ntnu.no> Date: Sat, 14 Mar 2020 10:31:22 +0100 Subject: [PATCH] #54 inline edit view is now notified on reorg of SOI --- soitool/inline_editable_soi_view.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/soitool/inline_editable_soi_view.py b/soitool/inline_editable_soi_view.py index ff6c124..e43fcfd 100644 --- a/soitool/inline_editable_soi_view.py +++ b/soitool/inline_editable_soi_view.py @@ -35,12 +35,14 @@ class InlineEditableSOIView(QScrollArea): """Reorganize modules when pressed. This is a temporary way to activate reorganization of widgets. Note - that will not be triggered by clicks on modules in the scene - """ - self.reorganize_soi_and_update_pages() + that will not be triggered by clicks on modules in the scene. - def reorganize_soi_and_update_pages(self): - """Reorganize SOI and update pages in one go.""" + If reorganization cannot occur because a module is too large the user + will be informed. It's worth noting that with the current + implementation this is the only way the user will be informed of this, + so reorganization that is not triggered here will not give feedback to + the user. + """ try: self.soi.reorganize() except ModuleLargerThanBinError: @@ -51,7 +53,6 @@ class InlineEditableSOIView(QScrollArea): "for deg. Se igjennom modulene og sjekk at " "alle moduler er mindre enn én enkelt side.", ) - self.update_pages() def __init__(self, soi): super().__init__() @@ -74,6 +75,9 @@ class InlineEditableSOIView(QScrollArea): self.ensure_proxies() self.update_pages() + # update pages after SOI is reorganized + self.soi.add_reorganization_listener(self.update_pages) + # self.launch_auto_zoom() def produce_pdf(self, filename): -- GitLab