Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes autot resizing when configurator instantiated #1098

Merged
merged 3 commits into from
Mar 4, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Packages/vcs/Lib/Canvas.py
Original file line number Diff line number Diff line change
Expand Up @@ -3735,7 +3735,7 @@ def set_convert_labels(copy_mthd,test=0):
self.configurator.detach()
self.configurator = None
if self.backend.bg == False and self.configurator is not None:
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:
Expand Down
45 changes: 42 additions & 3 deletions Packages/vcs/Lib/configurator.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,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.listeners.append(self.interactor.AddObserver("TimerEvent", self.animate))
Expand All @@ -188,7 +188,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
Expand Down Expand Up @@ -418,7 +458,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
Expand Down