Beispiel #1
0
 def __init__(self, parent, sim):
     super(SimPanel, self).__init__(parent)
     self.sim = sim
     box = QtGui.QHBoxLayout()
     self.solution = GLPatchWidget(self, self.sim.grid, vmin=0., vmax=0.8)
     self.bar = ColorBarWidget(self, vmin=0., vmax=0.8)
     box.addWidget(self.solution, 2)
     box.addWidget(self.bar, 2)
     self.param_panel = ParamRuler(self, sim)
     box.addWidget(self.param_panel)
     self.setLayout(box)
Beispiel #2
0
 def __init__(self, parent, sim):
     super().__init__(parent)
     self.sim = sim
     box = QtWidgets.QHBoxLayout()
     if is_windows_platform():
         self.solution = MatplotlibPatchWidget(self, self.sim.grid, vmin=0., vmax=0.8)
         box.addWidget(self.solution, 2)
     else:
         self.solution = GLPatchWidget(self, self.sim.grid, vmin=0., vmax=0.8)
         self.bar = ColorBarWidget(self, vmin=0., vmax=0.8)
         box.addWidget(self.solution, 2)
         box.addWidget(self.bar, 2)
     self.param_panel = ParamRuler(self, sim)
     box.addWidget(self.param_panel)
     self.setLayout(box)
Beispiel #3
0
                def __init__(self):
                    super(PlotWidget, self).__init__()
                    if separate_colorbars:
                        if rescale_colorbars:
                            self.vmins = tuple(np.min(u[0]) for u in U)
                            self.vmaxs = tuple(np.max(u[0]) for u in U)
                        else:
                            self.vmins = tuple(np.min(u) for u in U)
                            self.vmaxs = tuple(np.max(u) for u in U)
                    else:
                        if rescale_colorbars:
                            self.vmins = (min(np.min(u[0])
                                              for u in U), ) * len(U)
                            self.vmaxs = (max(np.max(u[0])
                                              for u in U), ) * len(U)
                        else:
                            self.vmins = (min(np.min(u) for u in U), ) * len(U)
                            self.vmaxs = (max(np.max(u) for u in U), ) * len(U)

                    layout = QHBoxLayout()
                    plot_layout = QGridLayout()
                    self.colorbarwidgets = [
                        ColorBarWidget(self, vmin=vmin, vmax=vmax)
                        for vmin, vmax in izip(self.vmins, self.vmaxs)
                    ]
                    plots = [
                        widget(self,
                               grid,
                               vmin=vmin,
                               vmax=vmax,
                               bounding_box=bounding_box,
                               codim=codim)
                        for vmin, vmax in izip(self.vmins, self.vmaxs)
                    ]
                    if legend:
                        for i, plot, colorbar, l in izip(
                                xrange(len(plots)), plots,
                                self.colorbarwidgets, legend):
                            subplot_layout = QVBoxLayout()
                            caption = QLabel(l)
                            caption.setAlignment(Qt.AlignHCenter)
                            subplot_layout.addWidget(caption)
                            if not separate_colorbars or backend == 'matplotlib':
                                subplot_layout.addWidget(plot)
                            else:
                                hlayout = QHBoxLayout()
                                hlayout.addWidget(plot)
                                hlayout.addWidget(colorbar)
                                subplot_layout.addLayout(hlayout)
                            plot_layout.addLayout(subplot_layout,
                                                  int(i / columns),
                                                  (i % columns), 1, 1)
                    else:
                        for i, plot, colorbar in izip(xrange(len(plots)),
                                                      plots,
                                                      self.colorbarwidgets):
                            if not separate_colorbars or backend == 'matplotlib':
                                plot_layout.addWidget(plot, int(i / columns),
                                                      (i % columns), 1, 1)
                            else:
                                hlayout = QHBoxLayout()
                                hlayout.addWidget(plot)
                                hlayout.addWidget(colorbar)
                                plot_layout.addLayout(hlayout,
                                                      int(i / columns),
                                                      (i % columns), 1, 1)
                    layout.addLayout(plot_layout)
                    if not separate_colorbars:
                        layout.addWidget(self.colorbarwidgets[0])
                        for w in self.colorbarwidgets[1:]:
                            w.setVisible(False)
                    self.setLayout(layout)
                    self.plots = plots