Ejemplo n.º 1
0
    def __init__(self, data, title="a title"):
        """ Create a new Matplotlib plotting window for a 1D line plot """

        log.debug(self.__class__.__name__)
        BaseFrame.__init__(self, id=wx.ID_ANY, title=title, size=(800, 400))

        self.data = data

        self.panel = wx.Panel(self)

        self.dpi = 100
        self.fig = Figure((6.0, 4.0), dpi=self.dpi)
        self.canvas = FigCanvas(self.panel, -1, self.fig)

        self.axes = self.fig.add_subplot(111)
        self.toolbar = NavigationToolbar(self.canvas)

        self.vbox = wx.BoxSizer(wx.VERTICAL)
        self.vbox.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.GROW)
        self.vbox.Add(self.toolbar, 0, wx.EXPAND)

        self.panel.SetSizer(self.vbox)
        self.vbox.Fit(self)

        self.draw_figure()
Ejemplo n.º 2
0
    def __init__(self, parent, df=None):
        wx.Panel.__init__(self, parent)

        self.df = df
        self.available_columns = list(self.df.columns)

        self.figure = Figure()
        self.axes = self.figure.add_subplot(111)
        self.canvas = FigureCanvas(self, -1, self.figure)

        self.toolbar = NavigationToolbar(self.canvas)

        self.dropdown_menu = create_bitmap_dropdown_menu(
            self, self.available_columns, self.df)

        self.Bind(wx.EVT_COMBOBOX, self.column_selected)

        toolbar_sizer = wx.BoxSizer(wx.HORIZONTAL)
        toolbar_sizer.Add(self.dropdown_menu, 0, wx.ALL | wx.ALIGN_CENTER, 5)
        toolbar_sizer.Add(self.toolbar, 0, wx.ALL, 5)

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.GROW)
        sizer.Add(toolbar_sizer)
        self.SetSizer(sizer)
        self.Fit()

        pub.subscribe(self.update_available_column, "UPDATE_DISPLAYED_COLUMNS")
Ejemplo n.º 3
0
    def __init__(self, parent, df=None):
        wx.Panel.__init__(self, parent)

        self.df = df
        self.available_columns = list(self.df.columns)
        self.hue_columns = self._get_hue_column()

        self.figure = Figure()
        self.axes = self.figure.add_subplot(111)
        self.canvas = FigureCanvas(self, -1, self.figure)

        self.toolbar = NavigationToolbar(self.canvas)

        self.text_hue = wx.StaticText(self, label="Hue:")
        self.dropdown_menu = wx.ComboBox(self,
                                         choices=self.hue_columns,
                                         style=wx.CB_READONLY)
        self.Bind(wx.EVT_COMBOBOX, self.column_selected)

        toolbar_sizer = wx.BoxSizer(wx.HORIZONTAL)
        toolbar_sizer.Add(self.text_hue, 0, wx.ALL | wx.ALIGN_CENTER, 5)
        toolbar_sizer.Add(self.dropdown_menu, 0, wx.ALL | wx.ALIGN_CENTER, 5)
        toolbar_sizer.Add(self.toolbar, 0, wx.ALL, 5)

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.GROW)
        sizer.Add(toolbar_sizer)
        self.SetSizer(sizer)
        self.Fit()

        pub.subscribe(self.update_available_column, "UPDATE_DISPLAYED_COLUMNS")
Ejemplo n.º 4
0
 def add_toolbar(self):
     self.toolbar = NavigationToolbar(self.canvas)
     self.toolbar.Realize()
     # By adding toolbar in sizer, we are able to put it at the bottom
     # of the frame - so appearance is closer to GTK version.
     self.sizer.Add(self.toolbar, wx.SizerFlags(0).Left())
     # update the axes menu on the toolbar
     self.toolbar.update()
Ejemplo n.º 5
0
    def __init__(self, *args, **kwds):
        # begin wxGlade: GeneratedWireframe.__init__
        kwds["style"] = wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)
        self.x_axis_list = wx.ListBox(self,
                                      -1,
                                      choices=["Test1", "Test2", "Test3"],
                                      style=wx.LB_SINGLE | wx.LB_HSCROLL)
        self.sizer_3_staticbox = wx.StaticBox(self, -1, "x-axis")
        self.y_axis_list = wx.ListBox(self,
                                      -1,
                                      choices=["Test1", "Test2", "Test3"],
                                      style=wx.LB_SINGLE | wx.LB_HSCROLL)
        self.sizer_4_staticbox = wx.StaticBox(self, -1, "y-axis")
        self.button_load_fcs = wx.Button(self, -1, "Load FCS")
        self.button_horz_threshold_gate = wx.Button(self, -1, "---")
        self.button_vertical_threshold_gate = wx.Button(self, -1, "|")
        self.button_interval_gate = wx.Button(self, -1, "|--|")
        self.button_polygon_gate = wx.Button(self, -1, "Polygon Gate")
        self.button_quad_gate = wx.Button(self, -1, "Quad Gate")
        self.button_delete_gate = wx.Button(self, -1, "Delete Gate")
        self.button_quit = wx.Button(self, wx.ID_EXIT, "")
        self.button_controls_staticbox = wx.StaticBox(self, -1, "")
        self.canvas = FigureCanvas(self, -1, Figure())
        self.navtoolbar = NavigationToolbar(self.canvas)
        self.btn_generate_code = wx.Button(self, -1, "Generate Code")
        self.tb_gen_code = wx.TextCtrl(self,
                                       -1,
                                       "",
                                       style=wx.TE_MULTILINE | wx.TE_READONLY)
        self.sizer_8_staticbox = wx.StaticBox(self, -1, "")
        self.tree_ctrl_1 = wx.TreeCtrl(self,
                                       -1,
                                       style=wx.TR_HAS_BUTTONS | wx.TR_NO_LINES
                                       | wx.TR_DEFAULT_STYLE
                                       | wx.SUNKEN_BORDER)
        self.sizer_9_staticbox = wx.StaticBox(self, -1, "Gates")

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_LISTBOX, self.btn_choose_x_channel, self.x_axis_list)
        self.Bind(wx.EVT_LISTBOX, self.btn_choose_y_channel, self.y_axis_list)
        self.Bind(wx.EVT_BUTTON, self.btnLoadFCS, self.button_load_fcs)
        self.Bind(wx.EVT_BUTTON, self.btn_create_horizontal_threshold_gate,
                  self.button_horz_threshold_gate)
        self.Bind(wx.EVT_BUTTON, self.btn_create_vertical_threshold_gate,
                  self.button_vertical_threshold_gate)
        self.Bind(wx.EVT_BUTTON, self.btn_create_poly_gate,
                  self.button_polygon_gate)
        self.Bind(wx.EVT_BUTTON, self.btn_create_quad_gate,
                  self.button_quad_gate)
        self.Bind(wx.EVT_BUTTON, self.btn_delete_gate, self.button_delete_gate)
        self.Bind(wx.EVT_BUTTON, self.btnQuitApp, self.button_quit)
        self.Bind(wx.EVT_BUTTON, self.btn_gen_code, self.btn_generate_code)
Ejemplo n.º 6
0
    def __init__(self, parent):
	global red_x,red_y,blue_x,blue_y
        wx.Panel.__init__(self, parent)
        self.figure = Figure()
        self.axes = self.figure.add_subplot(111)
        self.canvas = FigureCanvas(self, -1, self.figure)
        self.sizer = wx.BoxSizer(wx.VERTICAL)
	self.toolbar = NavigationToolbar(self.canvas)
        self.sizer.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.GROW)
	self.sizer.Add(self.toolbar, 0, wx.EXPAND)
        self.SetSizer(self.sizer)
        self.Fit()
	self.flexscale=1000
	self.resscale=10000	
	self.pathscale=1000		
Ejemplo n.º 7
0
    def __init__(self, parent):
        sizerPanel = wx.BoxSizer(wx.VERTICAL)

        wx.Panel.__init__(self, parent, size=wx.Size(806, 450))
        sizerPlot = wx.BoxSizer(wx.VERTICAL)
        #self.SetBackgroundColour("red")

        self.GetParent().SetSizer(sizerPanel)
        sizerPanel.Add(self, 1, wx.EXPAND | wx.ALL | wx.GROW)
        self.figure = Figure()
        self.axes = self.figure.add_subplot(111)
        self.canvas = FigureCanvas(self, -1, self.figure)
        #cursor event connection to function
        self.canvas.mpl_connect('motion_notify_event', self.UpdateStatusBar)

        self.toolbar = NavigationToolbar(self.canvas)
        sizerPlot.Add(self.canvas, 1, wx.EXPAND | wx.ALL | wx.GROW)
        sizerPlot.Add(self.toolbar, 0, wx.EXPAND | wx.ALL | wx.GROW)
        self.SetSizer(sizerPlot)
Ejemplo n.º 8
0
    def __init__(self, parent):
        wx.Panel.__init__(self, parent=parent, id=-1)

        self.Figure = matplotlib.figure.Figure(figsize=(4, 3))
        self.axes = self.Figure.add_axes([0.1, 0.1, 0.8, 0.8])
        self.FigureCanvas = FigureCanvas(self, -1, self.Figure)

        # 继承鼠标移动显示鼠标处坐标的事件
        self.FigureCanvas.mpl_connect('motion_notify_event', self.MPLOnMouseMove)

        self.NavigationToolbar = NavigationToolbar(self.FigureCanvas)

        self.StaticText = wx.StaticText(self, -1, label='Show Help String')

        self.SubBoxSizer = wx.BoxSizer(wx.HORIZONTAL)
        self.SubBoxSizer.Add(self.NavigationToolbar, proportion=0, border=2, flag=wx.ALL | wx.EXPAND)
        self.SubBoxSizer.Add(self.StaticText, proportion=-1, border=2, flag=wx.ALL | wx.EXPAND)

        self.TopBoxSizer = wx.BoxSizer(wx.VERTICAL)
        self.TopBoxSizer.Add(self.SubBoxSizer, proportion=-1, border=2, flag=wx.ALL | wx.EXPAND)
        self.TopBoxSizer.Add(self.FigureCanvas, proportion=-10, border=2, flag=wx.ALL | wx.EXPAND)

        self.SetSizer(self.TopBoxSizer)
Ejemplo n.º 9
0
    def _InitUI(self, two_axes=False):
        """Builds this UI component.  Obviously, must be called in the UI thread.
"""
        dpis = wx.ScreenDC().GetPPI()
        size = (WIDGET_PREF_SIZE[0] / dpis[0], WIDGET_PREF_SIZE[1] / dpis[0])
        self.fig = Figure(facecolor='#ececec', figsize=size, dpi=dpis[0])

        self._InitAxes()
        #    if two_axes:
        #      self.ax = self.fig.add_axes([ 0.1, 0.1, 0.85, 0.65 ])
        #      self.ax2 = self.ax.twiny()
        #    else:
        #      self.ax = self.fig.add_subplot( 111 )
        self.canvas = FigureCanvas(self, -1, self.fig)
        self.canvas.SetMinClientSize(wx.Size(200, 200))
        self.toolbar = NavigationToolbar(self.canvas)
        #self.toolbar.Realize()
        self.toolbar.SetBackgroundColour(wx.Colour(236, 236, 236, 255))
        self.toolbar.Show(False)

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.toolbar, 0, wx.LEFT | wx.TOP | wx.BOTTOM | wx.EXPAND, 1)
        sizer.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.BOTTOM | wx.EXPAND, 1)
        self.SetSizer(sizer)

        self.callbackIds[ 'button_release_event' ] = \
          self.canvas.mpl_connect( 'button_release_event', self._OnMplMouseRelease )
        self.callbackIds[ 'motion_notify_event' ] = \
          self.canvas.mpl_connect( 'motion_notify_event', self._OnMplMouseMotion )

        self.Bind(wx.EVT_CLOSE, self._OnClose)
        self.Bind(wx.EVT_CONTEXT_MENU, self._OnContextMenu)
        self.Bind(wx.EVT_SIZE, self._OnSize)

        self.timer = wx.Timer(self, TIMERID_RESIZE)
        self.Bind(wx.EVT_TIMER, self._OnTimer)
Ejemplo n.º 10
0
 def add_toolbar(self):
     self.toolbar = NavigationToolbar(self.figure)
     self.toolbar.Realize()
     self.sizer.Add(self.toolbar, 0, wx.LEFT | wx.EXPAND)
     self.toolbar.update()
Ejemplo n.º 11
0
 def add_toolbar(self):
     self.toolbar = NavigationToolbar(self.notebook)
     self.toolbar.Realize()
     self.GetSizer().Add(self.toolbar, 0, wx.LEFT | wx.EXPAND)
     self.toolbar.update()
Ejemplo n.º 12
0
    def __init__(self, parent, df=None):
        wx.Panel.__init__(self, parent)

        self.df = df
        self.available_columns = list(self.df.columns)

        self.splitter = wx.SplitterWindow(self, wx.ID_ANY)
        self.box_panel = wx.Panel(self.splitter, 1)
        self.violin_panel = wx.Panel(self.splitter, 1)
        self.splitter.SplitVertically(self.box_panel, self.violin_panel)
        self.splitter.SetSashGravity(0.5)  # Set proportion for the splitter window

        self.buttonpanel = wx.Panel(self, 1)  # Panel contains all the buttons
        self.buttonpanel.SetBackgroundColour("white")

        self.box_figure = Figure()
        self.box_axes = self.box_figure.add_subplot(111)
        self.box_canvas = FigureCanvas(self.box_panel, -1, self.box_figure)
        self.box_toolbar = NavigationToolbar(self.box_canvas)

        self.violin_figure = Figure()
        self.violin_axes = self.violin_figure.add_subplot(111)
        self.violin_canvas = FigureCanvas(self.violin_panel, -1, self.violin_figure)
        self.violin_toolbar = NavigationToolbar(self.violin_canvas)

        # Drop-down select boxes
        self.text_y_axis = wx.StaticText(self.buttonpanel, label='Y Axis:')
        self.text_x_axis = wx.StaticText(self.buttonpanel, label='X Axis:')
        self.text_hue = wx.StaticText(self.buttonpanel, label='Hue:')
        self.column_x = wx.ComboBox(
            self.buttonpanel, choices=self.available_columns, style=wx.CB_READONLY
        )
        self.column_y = wx.ComboBox(
            self.buttonpanel, choices=self.available_columns, style=wx.CB_READONLY
        )
        self.column_hue = wx.ComboBox(
            self.buttonpanel, choices=self.available_columns, style=wx.CB_READONLY
        )
        self.Bind(wx.EVT_COMBOBOX, self.column_selected)

        # Box plot layout
        box_sizer = wx.BoxSizer(wx.VERTICAL)
        box_sizer.Add(self.box_canvas, 1, wx.LEFT | wx.TOP | wx.GROW)
        box_sizer.Add(self.box_toolbar, 0, wx.ALL | wx.ALIGN_CENTER, 5)
        self.box_panel.SetSizer(box_sizer)

        # Violin plot layout
        violin_sizer = wx.BoxSizer(wx.VERTICAL)
        violin_sizer.Add(self.violin_canvas, 1, wx.LEFT | wx.TOP | wx.GROW)
        violin_sizer.Add(self.violin_toolbar, 0, wx.ALL | wx.ALIGN_CENTER, 5)
        self.violin_panel.SetSizer(violin_sizer)

        # Bottom button bar layout
        button_sizer = wx.BoxSizer(wx.HORIZONTAL)
        button_sizer.Add(self.text_x_axis, 0, wx.ALL | wx.ALIGN_CENTER, 5)
        button_sizer.Add(self.column_x, 0, wx.ALL | wx.ALIGN_CENTER, 5)
        button_sizer.Add(self.text_y_axis, 0, wx.ALL | wx.ALIGN_CENTER, 5)
        button_sizer.Add(self.column_y, 0, wx.ALL | wx.ALIGN_CENTER, 5)
        button_sizer.Add(self.text_hue, 0, wx.ALL | wx.ALIGN_CENTER, 5)
        button_sizer.Add(self.column_hue, 0, wx.ALL | wx.ALIGN_CENTER, 5)
        self.buttonpanel.SetSizer(button_sizer)

        # Main panel layout
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.splitter, 1, wx.EXPAND | wx.ALL)
        sizer.Add(self.buttonpanel)
        self.SetSizer(sizer)
        self.Fit()

        pub.subscribe(self.update_available_column, "UPDATE_DISPLAYED_COLUMNS")
Ejemplo n.º 13
0
    def __init__(self, *args, **kwds):
        # begin wxGlade: MyFrame.__init__
        kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)
        self.SetSize((1766, 900))
        self.GUI_statusbar = self.CreateStatusBar(3)
        self.GUI_btn_cloudload = wx.Button(self, wx.ID_ANY, u"雲端讀取")
        self.GUI_btn_inputdata = wx.Button(self, wx.ID_ANY, u"輸入資料")
        self.GUI_btn_test = wx.Button(self, wx.ID_ANY, u"測試")
        self.notebook_main = wx.Notebook(self, wx.ID_ANY)
        self.notebook_main_pane_1 = wx.Panel(self.notebook_main, wx.ID_ANY)
        self.window_2 = wx.SplitterWindow(self.notebook_main_pane_1, wx.ID_ANY)
        self.panel_6 = wx.Panel(self.window_2, wx.ID_ANY)
        self.matplotlib_figure_2 = Figure()
        self.GUI_matplotlib_canvas_2 = FigureCanvas(self.panel_6, wx.ID_ANY, self.matplotlib_figure_2)
        self.GUI_matplotlib_toolbar_2 = NavigationToolbar(self.GUI_matplotlib_canvas_2)
        self.GUI_matplotlib_toolbar_2.Realize()
        self.GUI_matplotlib_toolbar_2.update()
        self.panel_5 = wx.Panel(self.panel_6, wx.ID_ANY)
        self.GUI_quick_product_sel = wx.ComboBox(self.panel_5, wx.ID_ANY, choices=["NQ", "XINA50", "2454"], style=wx.CB_DROPDOWN | wx.CB_READONLY)
        self.GUI_quick_multiplier = wx.ComboBox(self.panel_5, wx.ID_ANY, choices=["1", "20", "2000"], style=wx.CB_DROPDOWN)
        self.GUI_quick_max_netvalue = wx.SpinCtrlDouble(self.panel_5, wx.ID_ANY, "26.0", min=0.0, max=9999999999.9)
        self.GUI_quick_current_netvalue = wx.SpinCtrlDouble(self.panel_5, wx.ID_ANY, "25.0", min=0.0, max=9999999999.9)
        self.GUI_quick_stoploss_rate = wx.SpinCtrlDouble(self.panel_5, wx.ID_ANY, "0.1", min=0.0, max=1.0)
        self.GUI_quick_current_price = wx.SpinCtrlDouble(self.panel_5, wx.ID_ANY, "12600.0", min=0.0, max=9999999999.9)
        self.GUI_Q_T1_current_pos = wx.SpinCtrl(self.panel_5, wx.ID_ANY, "0", min=-100, max=100)
        self.GUI_Q_T1_avg_buy_price = wx.SpinCtrlDouble(self.panel_5, wx.ID_ANY, "0.0", min=0.0, max=9999999999.9)
        self.GUI_Q_T1_avg_buy_pos = wx.SpinCtrl(self.panel_5, wx.ID_ANY, "0", min=-100, max=100)
        self.GUI_Q_T1_avg_buy_count = wx.SpinCtrl(self.panel_5, wx.ID_ANY, "1", min=1, max=100)
        self.GUI_Q_T2_current_pos = wx.SpinCtrl(self.panel_5, wx.ID_ANY, "0", min=-100, max=100)
        self.GUI_Q_T2_avg_buy_price = wx.SpinCtrlDouble(self.panel_5, wx.ID_ANY, "0.0", min=0.0, max=9999999999.9)
        self.GUI_Q_T2_avg_buy_pos = wx.SpinCtrl(self.panel_5, wx.ID_ANY, "0", min=-100, max=100)
        self.GUI_Q_T2_avg_buy_count = wx.SpinCtrl(self.panel_5, wx.ID_ANY, "1", min=1, max=100)
        self.GUI_Q_T3_current_pos = wx.SpinCtrl(self.panel_5, wx.ID_ANY, "0", min=-100, max=100)
        self.GUI_Q_T3_avg_buy_price = wx.SpinCtrlDouble(self.panel_5, wx.ID_ANY, "0.0", min=0.0, max=9999999999.9)
        self.GUI_Q_T3_avg_buy_pos = wx.SpinCtrl(self.panel_5, wx.ID_ANY, "0", min=-100, max=100)
        self.GUI_Q_T3_avg_buy_count = wx.SpinCtrl(self.panel_5, wx.ID_ANY, "1", min=1, max=100)
        self.GUI_Q_T4_current_pos = wx.SpinCtrl(self.panel_5, wx.ID_ANY, "0", min=-100, max=100)
        self.GUI_Q_T4_avg_buy_price = wx.SpinCtrlDouble(self.panel_5, wx.ID_ANY, "0.0", min=0.0, max=9999999999.9)
        self.GUI_Q_T4_avg_buy_pos = wx.SpinCtrl(self.panel_5, wx.ID_ANY, "0", min=-100, max=100)
        self.GUI_Q_T4_avg_buy_count = wx.SpinCtrl(self.panel_5, wx.ID_ANY, "1", min=1, max=100)
        self.GUI_Q_button_apply = wx.Button(self.panel_5, wx.ID_APPLY, "")
        self.notebook_2 = wx.Notebook(self.window_2, wx.ID_ANY, style=wx.NB_BOTTOM)
        self.ui_page_message_copy = wx.ScrolledWindow(self.notebook_2, wx.ID_ANY, style=wx.TAB_TRAVERSAL)
        self.GUI_message_copy = wx.TextCtrl(self.ui_page_message_copy, wx.ID_ANY, "", style=wx.TE_MULTILINE | wx.TE_READONLY)
        self.ui_page_log_copy = wx.Panel(self.notebook_2, wx.ID_ANY)
        self.notebook_main_pane_main = wx.Panel(self.notebook_main, wx.ID_ANY)
        self.window_1 = wx.SplitterWindow(self.notebook_main_pane_main, wx.ID_ANY)
        self.panel_2 = wx.Panel(self.window_1, wx.ID_ANY)
        self.matplotlib_figure = Figure()
        self.GUI_matplotlib_canvas = FigureCanvas(self.panel_2, wx.ID_ANY, self.matplotlib_figure)
        self.GUI_matplotlib_toolbar = NavigationToolbar(self.GUI_matplotlib_canvas)
        self.GUI_matplotlib_toolbar.Realize()
        self.GUI_matplotlib_toolbar.update()
        self.panel_1 = wx.Panel(self.panel_2, wx.ID_ANY)
        self.ui_initial_position = wx.SpinCtrl(self.panel_1, wx.ID_ANY, "0", min=0, max=100)
        self.ui_extra_position = wx.ComboBox(self.panel_1, wx.ID_ANY, choices=[], style=wx.CB_DROPDOWN)
        self.ui_extra_time = wx.ComboBox(self.panel_1, wx.ID_ANY, choices=[], style=wx.CB_DROPDOWN)
        self.notebook_1 = wx.Notebook(self.window_1, wx.ID_ANY, style=wx.NB_BOTTOM)
        self.ui_page_message = wx.ScrolledWindow(self.notebook_1, wx.ID_ANY, style=wx.TAB_TRAVERSAL)
        self.GUI_message = wx.TextCtrl(self.ui_page_message, wx.ID_ANY, "", style=wx.TE_MULTILINE | wx.TE_READONLY)
        self.ui_page_log = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.notebook_main_pane_LOG = wx.Panel(self.notebook_main, wx.ID_ANY)
        self.GUI_log = wx.TextCtrl(self.notebook_main_pane_LOG, wx.ID_ANY, "", style=wx.TE_AUTO_URL | wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_RICH | wx.TE_RICH2)

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_BUTTON, self.OnCloudLoad, self.GUI_btn_cloudload)
        self.Bind(wx.EVT_BUTTON, self.OnInputData, self.GUI_btn_inputdata)
        self.Bind(wx.EVT_BUTTON, self.OnTest, self.GUI_btn_test)
        self.Bind(wx.EVT_COMBOBOX, self.OnQuickSimProductSelect, self.GUI_quick_product_sel)
        self.Bind(wx.EVT_BUTTON, self.OnQuickSimApply, self.GUI_Q_button_apply)
Ejemplo n.º 14
0
    def __init__(self, parent, df=None):
        wx.Panel.__init__(self, parent)

        self.df = df
        self.available_columns = list(self.df.columns)

        self.splitter = wx.SplitterWindow(self, wx.ID_ANY)
        self.heatmap_panel = wx.Panel(self.splitter, 1)
        self.correlation_panel = wx.Panel(self.splitter, 1)
        self.splitter.SplitVertically(self.heatmap_panel, self.correlation_panel)
        self.splitter.SetSashGravity(0.5)  # Set proportion for the splitter window
        self.splitter.Unsplit(self.correlation_panel)  # Hide when first load

        self.buttonpanel = wx.Panel(self, 1)  # Panel contains all the buttons
        self.buttonpanel.SetBackgroundColour("white")

        self.figure = Figure()
        self.axes = self.figure.add_subplot(111)
        self.canvas = FigureCanvas(self.heatmap_panel, -1, self.figure)
        self.color_bar = None  # Flag for color bar
        self.toolbar = NavigationToolbar(self.canvas)

        self.correlation_figure = Figure()
        self.correlation_axes = self.correlation_figure.add_subplot(111)
        self.correlation_canvas = FigureCanvas(
            self.correlation_panel, -1, self.correlation_figure
        )
        self.correlation_toolbar = NavigationToolbar(self.correlation_canvas)
        self.has_correlation_plot = False  # Flag for correlation plot
        self.correlation_color_bar = False  # Flag for correlation color bar

        # Drop-down select boxes
        self.text_y_axis = wx.StaticText(self.buttonpanel, label='Y Axis:')
        self.text_x_axis = wx.StaticText(self.buttonpanel, label='X Axis:')
        self.column1 = wx.ComboBox(
            self.buttonpanel, choices=self.available_columns, style=wx.CB_READONLY
        )
        self.column2 = wx.ComboBox(
            self.buttonpanel, choices=self.available_columns, style=wx.CB_READONLY
        )
        self.Bind(wx.EVT_COMBOBOX, self.column_selected)

        # Create a button to display/hide correlation map
        self.correlation_button = wx.ToggleButton(
            self.buttonpanel, label="Display Correlation Map"
        )
        self.correlation_button.SetForegroundColour("blue")
        self.correlation_button.SetBackgroundColour("#D5F5E3")
        self.Bind(wx.EVT_TOGGLEBUTTON, self.correlation_heatmap)

        # Heatmap layout
        canvas_sizer = wx.BoxSizer(wx.VERTICAL)
        canvas_sizer.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.GROW)
        canvas_sizer.Add(self.toolbar, 0, wx.ALL | wx.ALIGN_CENTER, 5)
        self.heatmap_panel.SetSizer(canvas_sizer)

        # Correlation layout
        correlation_sizer = wx.BoxSizer(wx.VERTICAL)
        correlation_sizer.Add(self.correlation_canvas, 1, wx.LEFT | wx.TOP | wx.GROW)
        correlation_sizer.Add(self.correlation_toolbar, 0, wx.ALL | wx.ALIGN_CENTER, 5)
        self.correlation_panel.SetSizer(correlation_sizer)

        # Bottom button bar layout
        button_sizer = wx.BoxSizer(wx.HORIZONTAL)
        button_sizer.Add(self.text_x_axis, 0, wx.ALL | wx.ALIGN_CENTER, 5)
        button_sizer.Add(self.column1, 0, wx.ALL | wx.ALIGN_CENTER, 5)
        button_sizer.Add(self.text_y_axis, 0, wx.ALL | wx.ALIGN_CENTER, 5)
        button_sizer.Add(self.column2, 0, wx.ALL | wx.ALIGN_CENTER, 5)
        button_sizer.Add(
            self.correlation_button, 0, wx.EXPAND | wx.ALL | wx.ALIGN_CENTER, 2
        )
        self.buttonpanel.SetSizer(button_sizer)

        # Main panel layout
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.splitter, 1, wx.EXPAND | wx.ALL)
        sizer.Add(self.buttonpanel)
        self.SetSizer(sizer)
        self.Fit()

        pub.subscribe(self.update_available_column, "UPDATE_DISPLAYED_COLUMNS")