예제 #1
0
	def __init__(
		self,
		parent,
		controller,
		size,
		title,
		msg_key
	):
		pubsub.__init__(self)
		#proxy the keys
		self.proxy(MSG_KEY, controller, msg_key)
		#initialize values
		self[RUNNING_KEY] = True
		self[X_DIVS_KEY] = 8
		self[Y_DIVS_KEY] = 8
		self[MARKER_KEY] = 2.0
		#init panel and plot
		wx.Panel.__init__(self, parent, style=wx.SIMPLE_BORDER)
		self.plotter = plotter.channel_plotter(self)
		self.plotter.SetSize(wx.Size(*size))
		self.plotter.set_title(title)
		self.plotter.set_x_label('Inphase')
		self.plotter.set_y_label('Quadrature')
		self.plotter.enable_point_label(False)
		self.plotter.enable_grid_lines(True)

		self.subscribe(MSG_KEY, self.handle_msg)
		#initial update
		self.update_grid()
예제 #2
0
    def __init__(self, parent, controller, size, title, msg_key):
        pubsub.__init__(self)
        #proxy the keys
        self.proxy(MSG_KEY, controller, msg_key)
        #initialize values
        self[RUNNING_KEY] = True
        self[X_DIVS_KEY] = 8
        self[Y_DIVS_KEY] = 8
        self[MARKER_KEY] = 2.0
        #init panel and plot
        wx.Panel.__init__(self, parent, style=wx.SIMPLE_BORDER)
        self.plotter = plotter.channel_plotter(self)
        self.plotter.SetSize(wx.Size(*size))
        self.plotter.set_title(title)
        self.plotter.set_x_label('Inphase')
        self.plotter.set_y_label('Quadrature')
        self.plotter.enable_point_label(False)
        self.plotter.enable_grid_lines(True)

        self.subscribe(MSG_KEY, self.handle_msg)
        #initial update
        self.update_grid()
예제 #3
0
 def __init__(
     self,
     parent,
     controller,
     size,
     title,
     real,
     spectrum_len,
     baseband_freq,
     sample_rate_key,
     y_per_div,
     y_divs,
     ref_level,
     average_key,
     avg_alpha_key,
     peak_hold,
     msg_key,
     use_persistence,
     persist_alpha,
 ):
     pubsub.pubsub.__init__(self)
     #setup
     self.samples = EMPTY_TRACE
     self.real = real
     self.spectrum_len = spectrum_len
     self._reset_peak_vals()
     self._traces = dict()
     #proxy the keys
     self.proxy(constants.MSG_KEY, controller, msg_key)
     self.proxy(constants.AVERAGE_KEY, controller, average_key)
     self.proxy(constants.AVG_ALPHA_KEY, controller, avg_alpha_key)
     self.proxy(constants.SAMPLE_RATE_KEY, controller, sample_rate_key)
     #initialize values
     self[constants.PEAK_HOLD_KEY] = peak_hold
     self[constants.Y_PER_DIV_KEY] = y_per_div
     self[constants.Y_DIVS_KEY] = y_divs
     self[constants.X_DIVS_KEY] = 8 #approximate
     self[constants.REF_LEVEL_KEY] = ref_level
     self[constants.BASEBAND_FREQ_KEY] = baseband_freq
     self[constants.RUNNING_KEY] = True
     self[constants.USE_PERSISTENCE_KEY] = use_persistence
     self[constants.PERSIST_ALPHA_KEY] = persist_alpha
     for trace in TRACES:
         #a function that returns a function
         #so the function wont use local trace
         def new_store_trace(my_trace):
             def store_trace(*args):
                 self._traces[my_trace] = self.samples
                 self.update_grid()
             return store_trace
         def new_toggle_trace(my_trace):
             def toggle_trace(toggle):
                 #do an automatic store if toggled on and empty trace
                 if toggle and not len(self._traces[my_trace]):
                     self._traces[my_trace] = self.samples
                 self.update_grid()
             return toggle_trace
         self._traces[trace] = EMPTY_TRACE
         self[constants.TRACE_STORE_KEY+trace] = False
         self[constants.TRACE_SHOW_KEY+trace] = False
         self.subscribe(constants.TRACE_STORE_KEY+trace, new_store_trace(trace))
         self.subscribe(constants.TRACE_SHOW_KEY+trace, new_toggle_trace(trace))
     #init panel and plot
     wx.Panel.__init__(self, parent, style=wx.SIMPLE_BORDER)
     self.plotter = plotter.channel_plotter(self)
     self.plotter.SetSize(wx.Size(*size))
     self.plotter.set_title(title)
     self.plotter.enable_legend(True)
     self.plotter.enable_point_label(True)
     self.plotter.enable_grid_lines(True)
     self.plotter.set_use_persistence(use_persistence)
     self.plotter.set_persist_alpha(persist_alpha)
     #setup the box with plot and controls
     self.control_panel = control_panel(self)
     main_box = wx.BoxSizer(wx.HORIZONTAL)
     main_box.Add(self.plotter, 1, wx.EXPAND)
     main_box.Add(self.control_panel, 0, wx.EXPAND)
     self.SetSizerAndFit(main_box)
     #register events
     self.subscribe(constants.AVERAGE_KEY, self._reset_peak_vals)
     self.subscribe(constants.MSG_KEY, self.handle_msg)
     self.subscribe(constants.SAMPLE_RATE_KEY, self.update_grid)
     for key in (
         constants.BASEBAND_FREQ_KEY,
         constants.Y_PER_DIV_KEY, constants.X_DIVS_KEY,
         constants.Y_DIVS_KEY, constants.REF_LEVEL_KEY,
     ): self.subscribe(key, self.update_grid)
     self.subscribe(constants.USE_PERSISTENCE_KEY, self.plotter.set_use_persistence)
     self.subscribe(constants.PERSIST_ALPHA_KEY, self.plotter.set_persist_alpha)
     #initial update
     self.update_grid()