From b138431a50f9e8a8776420c321b1bb993a6931d8 Mon Sep 17 00:00:00 2001 From: Sam Fries Date: Mon, 2 Mar 2015 13:42:25 -0800 Subject: [PATCH] Fixes autot resizing when configurator instantiated --- Packages/vcs/Lib/Canvas.py | 2 +- Packages/vcs/Lib/configurator.py | 45 +++++++++++++++++++++++++++++--- 2 files changed, 43 insertions(+), 4 deletions(-) diff --git a/Packages/vcs/Lib/Canvas.py b/Packages/vcs/Lib/Canvas.py index 09ec6edfab..55f2d76223 100644 --- a/Packages/vcs/Lib/Canvas.py +++ b/Packages/vcs/Lib/Canvas.py @@ -3731,7 +3731,7 @@ def set_convert_labels(copy_mthd,test=0): if dn is not None: self.display_names.append(result.name) if self.backend.bg == False: - self.configurator.update(self.display_names) + self.configurator.update() # Commented out as agreed we shouldn't use warnings in these contexts. #if not hasattr(__main__,"__file__") and not bg: # warnings.warn("VCS Behaviour changed, in order to interact with window, start the interaction mode with:\n x.interact()") diff --git a/Packages/vcs/Lib/configurator.py b/Packages/vcs/Lib/configurator.py index 62503b10aa..9ebd3a11b1 100644 --- a/Packages/vcs/Lib/configurator.py +++ b/Packages/vcs/Lib/configurator.py @@ -172,7 +172,7 @@ def __init__(self, canvas, show_on_update=False): def shift(self): return self.interactor.GetShiftKey() == 1 - def update(self, displays): + def update(self): if self.backend.renWin and self.interactor is None: self.interactor = self.backend.renWin.GetInteractor() self.interactor.AddObserver("TimerEvent", self.animate) @@ -187,7 +187,47 @@ def update(self, displays): self.displays = [vcs.elements["display"][display] for display in self.canvas.display_names] for display in self.displays: - if display.template in self.templates: + + if display._template_origin in self.templates: + # Adjust data coords if display.ratio is not none + if display.ratio is not None: + t = vcs.gettemplate(display.template) + orig = vcs.gettemplate(self.templates[display._template_origin]) + t.data._ratio = -999. + t.data._x1 = orig.data._x1 + t.data._x2 = orig.data._x2 + t.data._y1 = orig.data._y1 + t.data._y2 = orig.data._y2 + t.box1._x1 = orig.box1._x1 + t.box1._x2 = orig.box1._x2 + t.box1._y1 = orig.box1._y1 + t.box1._y2 = orig.box1._y2 + t.xlabel1._y = orig.xlabel1._y + t.xlabel2._y = orig.xlabel2._y + t.xtic2._y1 = orig.xtic2._y1 + t.ylabel1._x = orig.ylabel1._x + t.ytic1._x1 = orig.ytic1._x1 + t.ylabel2._x = orig.ylabel2._x + t.ytic2._x1 = orig.ytic2._x1 + t.xtic1._y2 = orig.xtic1._y2 + t.xtic1._y1 = orig.xtic1._y1 + t.data._y1 = orig.data._y1 + t.xtic1.y1 = orig.xtic1.y1 + t.xtic2._y2 = orig.xtic2._y2 + t.data._y2 = orig.data._y2 + t.xtic2.y1 = orig.xtic2.y1 + t.xmintic1._y2 = orig.xmintic1._y2 + t.xmintic1._y1 = orig.xmintic1._y1 + t.xmintic2._y2 = orig.xmintic2._y2 + t.xmintic2._y1 = orig.xmintic2._y1 + t.ytic1._x2 = orig.ytic1._x2 + t.data._x1 = orig.data._x1 + t.ytic2._x2 = orig.ytic2._x2 + t.data._x2 = orig.data._x2 + t.ymintic1._x2 = orig.ymintic1._x2 + t.ymintic1._x1 = orig.ymintic1._x1 + t.ymintic2._x2 = orig.ymintic2._x2 + t.ymintic2._x1 = orig.ymintic2._x1 # It already has a template we created continue # Manufacture a placeholder template to use for updates @@ -399,7 +439,6 @@ def save(self): def init_toolbar(self): self.toolbar = vtk_ui.Toolbar(self.interactor, "Configure", on_open=self.setup_animation) - # Canvas background color color_toolbar = self.toolbar.add_toolbar("Background Color") red, green, blue = self.canvas.backgroundcolor