Ejemplo n.º 1
0
    def __init__(self, parent, figpanel, **kwargs):
        wx.Panel.__init__(self, parent, **kwargs)
        # the panel to draw charts on
        self.figpanel = figpanel

        sizer = wx.BoxSizer(wx.VERTICAL)

        self.x_table_choice = ui.TableComboBox(self, -1, style=wx.CB_READONLY)
        self.y_table_choice = ui.TableComboBox(self, -1, style=wx.CB_READONLY)
        self.x_choice = ComboBox(self,
                                 -1,
                                 size=(200, -1),
                                 style=wx.CB_READONLY)
        self.y_choice = ComboBox(self,
                                 -1,
                                 size=(200, -1),
                                 style=wx.CB_READONLY)
        self.gridsize_input = wx.TextCtrl(self, -1, '50')
        maps = [m for m in matplotlib.cm.datad.keys() if not m.endswith("_r")]
        maps.sort()
        self.colormap_choice = ComboBox(self,
                                        -1,
                                        choices=maps,
                                        style=wx.CB_READONLY)
        self.colormap_choice.SetSelection(maps.index('jet'))
        self.color_scale_choice = ComboBox(self,
                                           -1,
                                           choices=[LINEAR_SCALE, LOG_SCALE],
                                           style=wx.CB_READONLY)
        self.color_scale_choice.Select(0)
        self.x_scale_choice = ComboBox(self,
                                       -1,
                                       choices=[LINEAR_SCALE, LOG_SCALE],
                                       style=wx.CB_READONLY)
        self.x_scale_choice.Select(0)
        self.y_scale_choice = ComboBox(self,
                                       -1,
                                       choices=[LINEAR_SCALE, LOG_SCALE],
                                       style=wx.CB_READONLY)
        self.y_scale_choice.Select(0)
        self.filter_choice = ui.FilterComboBox(self, style=wx.CB_READONLY)
        self.gate_choice = ui.GateComboBox(self, style=wx.CB_READONLY)
        self.update_chart_btn = wx.Button(self, -1, "Update Chart")

        self.update_x_choices()
        self.update_y_choices()

        sz = wx.BoxSizer(wx.HORIZONTAL)
        sz.Add(wx.StaticText(self, -1, "x-axis:"), 0, wx.TOP, 4)
        sz.AddSpacer((3, -1))
        sz.Add(self.x_table_choice, 1, wx.EXPAND)
        sz.AddSpacer((3, -1))
        sz.Add(self.x_choice, 2, wx.EXPAND)
        sz.AddSpacer((5, -1))
        sz.Add(wx.StaticText(self, -1, "scale:"), 0, wx.TOP, 4)
        sz.AddSpacer((3, -1))
        sz.Add(self.x_scale_choice)
        sizer.Add(sz, 1, wx.EXPAND)
        sizer.AddSpacer((-1, 2))

        sz = wx.BoxSizer(wx.HORIZONTAL)
        sz.Add(wx.StaticText(self, -1, "y-axis:"), 0, wx.TOP, 4)
        sz.AddSpacer((3, -1))
        sz.Add(self.y_table_choice, 1, wx.EXPAND)
        sz.AddSpacer((3, -1))
        sz.Add(self.y_choice, 2, wx.EXPAND)
        sz.AddSpacer((5, -1))
        sz.Add(wx.StaticText(self, -1, "scale:"), 0, wx.TOP, 4)
        sz.AddSpacer((3, -1))
        sz.Add(self.y_scale_choice)
        sizer.Add(sz, 1, wx.EXPAND)
        sizer.AddSpacer((-1, 2))

        sz = wx.BoxSizer(wx.HORIZONTAL)
        sz.Add(wx.StaticText(self, -1, "grid size:"), 0, wx.TOP, 4)
        sz.AddSpacer((3, -1))
        sz.Add(self.gridsize_input, 1, wx.TOP, 3)
        sz.AddSpacer((5, -1))
        sz.Add(wx.StaticText(self, label='color map:'), 0, wx.TOP, 4)
        sz.AddSpacer((3, -1))
        sz.Add(self.colormap_choice, 1, wx.EXPAND)
        sz.AddSpacer((5, -1))
        sz.Add(wx.StaticText(self, label='color scale:'), 0, wx.TOP, 4)
        sz.AddSpacer((3, -1))
        sz.Add(self.color_scale_choice, 1, wx.EXPAND)
        sizer.Add(sz, 1, wx.EXPAND)
        sizer.AddSpacer((-1, 5))

        sz = wx.BoxSizer(wx.HORIZONTAL)
        sz.Add(wx.StaticText(self, -1, "filter:"), 0, wx.TOP, 4)
        sz.AddSpacer((3, -1))
        sz.Add(self.filter_choice, 1, wx.EXPAND)
        sz.AddSpacer((5, -1))
        sz.Add(wx.StaticText(self, -1, "gate:"), 0, wx.TOP, 4)
        sz.AddSpacer((3, -1))
        sz.Add(self.gate_choice, 1, wx.EXPAND)
        sizer.Add(sz, 1, wx.EXPAND)
        sizer.AddSpacer((-1, 5))

        sizer.Add(self.update_chart_btn)

        wx.EVT_COMBOBOX(self.x_table_choice, -1, self.on_x_table_selected)
        wx.EVT_COMBOBOX(self.y_table_choice, -1, self.on_y_table_selected)
        self.gate_choice.addobserver(self.on_gate_selected)
        wx.EVT_COMBOBOX(self.colormap_choice, -1, self.on_cmap_selected)
        wx.EVT_BUTTON(self.update_chart_btn, -1, self.update_figpanel)

        self.SetSizer(sizer)
        self.Show(1)
Ejemplo n.º 2
0
    def __init__(self, parent, figpanel, **kwargs):
        wx.Panel.__init__(self, parent, **kwargs)

        # the panel to draw charts on
        self.SetBackgroundColour('white')  # color for the background of panel
        self.figpanel = figpanel

        sizer = wx.BoxSizer(wx.VERTICAL)

        self.table_choice = ui.TableComboBox(self, -1, style=wx.CB_READONLY)
        self.x_choice = ComboBox(self,
                                 -1,
                                 size=(200, -1),
                                 choices=[''],
                                 style=wx.CB_READONLY)
        self.x_choice.Select(0)
        self.bins_input = wx.SpinCtrl(self, -1, '100')
        self.bins_input.SetRange(1, 400)
        self.x_scale_choice = ComboBox(
            self,
            -1,
            choices=[LINEAR_SCALE, LOG_SCALE, LOG2_SCALE],
            style=wx.CB_READONLY)
        self.x_scale_choice.Select(0)
        self.y_scale_choice = ComboBox(self,
                                       -1,
                                       choices=[LINEAR_SCALE, LOG_SCALE],
                                       style=wx.CB_READONLY)
        self.y_scale_choice.Select(0)
        self.filter_choice = ui.FilterComboBox(self, style=wx.CB_READONLY)
        self.filter_choice.Select(0)
        self.gate_choice = ui.GateComboBox(self, style=wx.CB_READONLY)
        self.gate_choice.set_gatable_columns([self.x_column])
        self.update_chart_btn = wx.Button(self, -1, "Update Chart")

        self.update_column_fields()

        sz = wx.BoxSizer(wx.HORIZONTAL)
        sz.Add(wx.StaticText(self, -1, "x-axis:"), 0, wx.TOP, 4)
        sz.AddSpacer((2, -1))
        sz.Add(self.table_choice, 1, wx.EXPAND)
        sz.AddSpacer((3, -1))
        sz.Add(self.x_choice, 2, wx.EXPAND)
        sizer.Add(sz, 1, wx.EXPAND)
        sizer.AddSpacer((-1, 2))

        sz = wx.BoxSizer(wx.HORIZONTAL)
        sz.Add(wx.StaticText(self, -1, "x-scale:"), 0, wx.TOP, 4)
        sz.AddSpacer((2, -1))
        sz.Add(self.x_scale_choice, 1, wx.EXPAND)
        sz.AddSpacer((5, -1))
        sz.Add(wx.StaticText(self, -1, "y-scale:"), 0, wx.TOP, 4)
        sz.AddSpacer((2, -1))
        sz.Add(self.y_scale_choice, 1, wx.EXPAND)
        sz.AddSpacer((5, -1))
        sz.Add(wx.StaticText(self, -1, "bins:"), 0, wx.TOP, 4)
        sz.AddSpacer((2, -1))
        sz.Add(self.bins_input)
        sizer.Add(sz, 1, wx.EXPAND)
        sizer.AddSpacer((-1, 2))

        sz = wx.BoxSizer(wx.HORIZONTAL)
        sz.Add(wx.StaticText(self, -1, "filter:"), 0, wx.TOP, 4)
        sz.AddSpacer((2, -1))
        sz.Add(self.filter_choice, 1, wx.EXPAND)
        sz.AddSpacer((5, -1))
        sz.Add(wx.StaticText(self, -1, "gate:"), 0, wx.TOP, 4)
        sz.AddSpacer((2, -1))
        sz.Add(self.gate_choice, 1, wx.EXPAND)
        sizer.Add(sz, 1, wx.EXPAND)
        sizer.AddSpacer((-1, 2))

        sizer.Add(self.update_chart_btn)

        wx.EVT_COMBOBOX(self.table_choice, -1, self.on_table_selected)
        wx.EVT_BUTTON(self.update_chart_btn, -1, self.update_figpanel)
        self.gate_choice.addobserver(self.on_gate_selected)

        self.SetSizer(sizer)
        self.Show(1)