def onFitting(self, event): if self.graph.selected_plottable is not None: if self.plots[self.graph. selected_plottable].__class__.__name__ == 'Data1D': PlotPanel.onFitting(self, event) else: self.parent.SetStatusText("Can't fit a theory curve")
def plottable_selected(self, id): PlotPanel.plottable_selected(self, id) if id is not None: self.parent.SetStatusText("Hovering over %s" % self.graph.selected_plottable) else: self.parent.SetStatusText("")
def __init__(self, parent, id=-1, color=None, dpi=None, **kwargs): PlotPanel.__init__(self, parent, id=id, color=color, dpi=dpi, **kwargs) # Keep track of the parent Frame self.parent = parent # Internal list of plottable names (because graph # doesn't have a dictionary of handles for the plottables) self.plots = {}
def __init__(self, parent, id = -1, color = None,\ dpi = None, **kwargs): PlotPanel.__init__(self, parent, id=id, color=color, dpi=dpi, **kwargs) # Keep track of the parent Frame self.parent = parent # Internal list of plottable names (because graph # doesn't have a dictionary of handles for the plottables) self.plots = {}
def __init__(self, parent, id=-1, color=None, dpi=None, style=wx.NO_FULL_REPAINT_ON_RESIZE, **kwargs): PlotPanel.__init__(self, parent, id=id, style=style, **kwargs) PanelBase.__init__(self, parent) ## Reference to the parent window self.parent = parent if hasattr(parent, "parent"): self.parent = self.parent.parent ## Plottables self.plots = {} self.frame = None # context menu self._slicerpop = None self._available_data = [] self._symbol_labels = self.get_symbol_label() self._color_labels = self.get_color_label() self.currColorIndex = "" self._is_changed_legend_label = False self.is_xtick = False self.is_ytick = False self.hide_menu = None ## Unique ID (from gui_manager) self.uid = None self.x_size = None ## Default locations # self._default_save_location = os.getcwd() self.size = None self.vl_ind = 0 ## Graph # self.graph = Graph() self.graph.xaxis("\\rm{Q}", 'A^{-1}') self.graph.yaxis("\\rm{Intensity} ", "cm^{-1}") self.graph.render(self) self.cursor_id = None # In resizing event self.resizing = False self.canvas.set_resizing(self.resizing) self.Bind(wx.EVT_SIZE, self._OnReSize) self.parent.SetFocus() # If true, there are 3 qrange bars self.is_corfunc = False
def __init__(self, parent, id=-1, dimension=2, color=None, dpi=None, **kwargs): """ """ PlotPanel.__init__(self, parent, id=id, color=color, dpi=dpi, **kwargs) # Keep track of the parent Frame self.parent = parent # Internal list of plottable names (because graph # doesn't have a dictionary of handles for the plottables) self.dimension = dimension self.plots = {} self.graph = Graph() # add axis labels self.graph.xaxis('\\rm{x} ', '') self.graph.yaxis('\\rm{y} ', '')
def __init__(self, parent, id= -1, is_number=False, content='?', **kwargs): """ """ PlotPanel.__init__(self, parent, id=id, **kwargs) self.is_number = is_number self.content = content self.point = None self.position = (0.4, 0.5) self.scale = 'linear' self.prevXtrans = "x" self.prevYtrans = "y" self.viewModel = "--" self.subplot.set_xticks([]) self.subplot.set_yticks([]) self.add_text() self.figure.subplots_adjust(left=0.1, bottom=0.1)
def onLeftDown(self, event): """ left button down and ready to drag """ # Check that the LEFT button was pressed PlotPanel.onLeftDown(self, event) ax = event.inaxes if ax is not None: # data coordinate position pos_x = "%8.3g" % event.xdata pos_y = "%8.3g" % event.ydata position = "x: %s y: %s" % (pos_x, pos_y) wx.PostEvent(self.parent, StatusEvent(status=position)) self.plottable_selected(self.data2D.id) self._manager.set_panel_on_focus(self) wx.PostEvent(self.parent, PanelOnFocusEvent(panel=self))
def __init__(self, d_min, d_max, parent, id=-1, color=None, dpi=None, style=wx.NO_FULL_REPAINT_ON_RESIZE, **kwargs): """ Initialization. The parameters added to PlotPanel are: :param d_min: Minimum value of D_max to explore :param d_max: Maximum value of D_max to explore """ PlotPanel.__init__(self, parent, id=id, style=style, **kwargs) self.parent = parent self.min = d_min self.max = d_max self.npts = DEFAULT_NPTS step = (self.max - self.min) / (self.npts - 1) self.x = np.arange(self.min, self.max + step * 0.01, step) dx = np.zeros(len(self.x)) y = np.ones(len(self.x)) dy = np.zeros(len(self.x)) # Plot area self.plot = Model1D(self.x, y=y, dy=dy) self.plot.name = DEFAULT_OUTPUT self.plot.symbol = GUIFRAME_ID.CURVE_SYMBOL_NUM # Graph self.graph = Graph() self.graph.xaxis(r"\rm{D_{max}}", 'A') self.graph.yaxis(r"\rm{%s}" % DEFAULT_OUTPUT, "") self.graph.add(self.plot) self.graph.render(self) self.toolbar.DeleteToolByPos(0) self.toolbar.DeleteToolByPos(8) self.toolbar.Realize()
def onLeftDown(self, event): """ left button down and ready to drag Display the position of the mouse on the statusbar """ # self.parent.set_plot_unfocus() self._get_cusor_lines(event) ax = event.inaxes PlotPanel.onLeftDown(self, event) if ax is not None: try: pos_x = float(event.xdata) # / size_x pos_y = float(event.ydata) # / size_y pos_x = "%8.3g" % pos_x pos_y = "%8.3g" % pos_y self.position = str(pos_x), str(pos_y) wx.PostEvent(self.parent, StatusEvent(status=self.position)) except: self.position = None # unfocus all self.parent.set_plot_unfocus() # post nd event to notify guiframe that this panel is on focus wx.PostEvent(self.parent, PanelOnFocusEvent(panel=self))
def __init__(self, d_min, d_max, parent, id= -1, color=None, \ dpi=None, style=wx.NO_FULL_REPAINT_ON_RESIZE, **kwargs): """ Initialization. The parameters added to PlotPanel are: :param d_min: Minimum value of D_max to explore :param d_max: Maximum value of D_max to explore """ PlotPanel.__init__(self, parent, id=id, style=style, **kwargs) self.parent = parent self.min = d_min self.max = d_max self.npts = DEFAULT_NPTS step = (self.max - self.min) / (self.npts - 1) self.x = np.arange(self.min, self.max + step * 0.01, step) dx = np.zeros(len(self.x)) y = np.ones(len(self.x)) dy = np.zeros(len(self.x)) # Plot area self.plot = Model1D(self.x, y=y, dy=dy) self.plot.name = DEFAULT_OUTPUT self.plot.symbol = GUIFRAME_ID.CURVE_SYMBOL_NUM # Graph self.graph = Graph() self.graph.xaxis("\\rm{D_{max}}", 'A') self.graph.yaxis("\\rm{%s}" % DEFAULT_OUTPUT, "") self.graph.add(self.plot) self.graph.render(self) self.toolbar.DeleteToolByPos(0) self.toolbar.DeleteToolByPos(8) self.toolbar.Realize()
def onFitting(self, event): if self.graph.selected_plottable is not None: if self.plots[self.graph.selected_plottable].__class__.__name__ == 'Data1D': PlotPanel.onFitting(self, event) else: self.parent.SetStatusText("Can't fit a theory curve")