Skip to content

Commit

Permalink
Merge pull request #1098 from chaosphere2112/vcs_widgets_autot_resize
Browse files Browse the repository at this point in the history
Fixes autot resizing when configurator instantiated
  • Loading branch information
doutriaux1 committed Mar 4, 2015
2 parents 8b03872 + 6701b6d commit 11b5b31
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 4 deletions.
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

0 comments on commit 11b5b31

Please sign in to comment.