Thanks! This seems to do the trick. Patch applied.
-- Anders
On Mon, Mar 05, 2012 at 02:46:59PM -0000, Joachim Haga wrote: > The following hack is only very lightly tested, but should "fix" it. > > === modified file 'src/viper/viper_dolfin.py' > --- src/viper/viper_dolfin.py 2012-02-09 09:06:11 +0000 > +++ src/viper/viper_dolfin.py 2012-03-05 14:43:26 +0000 > @@ -410,11 +410,16 @@ > return self.autoplot(plot_object, *args, **kwargs) > return self.figureplot(plot_object, *args, **kwargs) > > - def autoplot(self, plot_object, *args, **kwargs): > + def get_plotter(self, plot_object): > for (idx, (plotter,obj)) in self.plots.items(): > if obj is plot_object: > - plotter.update(plot_object, **kwargs) > return plotter > + > + def autoplot(self, plot_object, *args, **kwargs): > + plotter = self.get_plotter(plot_object) > + if plotter: > + plotter.update(plot_object, **kwargs) > + return plotter > idx = self.random.randint(0,10000) > keys = self.plots.keys() > while idx in keys: > @@ -452,6 +457,8 @@ > global _plotter > if _plotter is None: > _plotter = PlotManager() > + > + new_window = not _plotter.get_plotter(data) > n_old_plots = len(_plotter.plots) > > interactive = False > @@ -460,7 +467,7 @@ > kwargs["interactive"] = False > fig = _plotter.plot(data, **kwargs) > > - if n_old_plots > 0 and kwargs.get('autoposition', True): > + if new_window and kwargs.get('autoposition', True): > x, y = fig.window_size > nx, ny = n_old_plots%3, n_old_plots//3 > fig.renWin.SetPosition(nx*x, ny*y) >
Thanks! This seems to do the trick. Patch applied.
--
Anders
On Mon, Mar 05, 2012 at 02:46:59PM -0000, Joachim Haga wrote: viper_dolfin. py' viper_dolfin. py 2012-02-09 09:06:11 +0000 viper_dolfin. py 2012-03-05 14:43:26 +0000 plot_object, *args, **kwargs) (plot_object, *args, **kwargs) update( plot_object, **kwargs) plotter( plot_object) update( plot_object, **kwargs) randint( 0,10000) get_plotter( data) "interactive" ] = False get('autopositi on', True): get('autopositi on', True): SetPosition( nx*x, ny*y)
> The following hack is only very lightly tested, but should "fix" it.
>
> === modified file 'src/viper/
> --- src/viper/
> +++ src/viper/
> @@ -410,11 +410,16 @@
> return self.autoplot(
> return self.figureplot
>
> - def autoplot(self, plot_object, *args, **kwargs):
> + def get_plotter(self, plot_object):
> for (idx, (plotter,obj)) in self.plots.items():
> if obj is plot_object:
> - plotter.
> return plotter
> +
> + def autoplot(self, plot_object, *args, **kwargs):
> + plotter = self.get_
> + if plotter:
> + plotter.
> + return plotter
> idx = self.random.
> keys = self.plots.keys()
> while idx in keys:
> @@ -452,6 +457,8 @@
> global _plotter
> if _plotter is None:
> _plotter = PlotManager()
> +
> + new_window = not _plotter.
> n_old_plots = len(_plotter.plots)
>
> interactive = False
> @@ -460,7 +467,7 @@
> kwargs[
> fig = _plotter.plot(data, **kwargs)
>
> - if n_old_plots > 0 and kwargs.
> + if new_window and kwargs.
> x, y = fig.window_size
> nx, ny = n_old_plots%3, n_old_plots//3
> fig.renWin.
>