def __init__(self, *args, **kwds): # begin wxGlade: ThePanel.__init__ kwds["style"] = kwds.get("style", 0) PlotPanel.__init__(self, *args, **kwds) self.__set_properties() self.__do_layout()
def __init__(self, root): log = logging.getLogger(f"c.{__name__}.init") log.info("Start init") self.root = root # setup grid for root self.root.grid_rowconfigure(0, weight=1) self.root.grid_columnconfigure(0, weight=1) self.root.grid_columnconfigure(1, weight=0) # create children widget self.plot_panel = PlotPanel(self.root, bg="SeaGreen1") self.side_panel = SidePanel(self.root, bg="dark orange") # grid children widget self.plot_panel.grid(row=0, column=0, sticky="nsew") self.side_panel.grid(row=0, column=1, sticky="nsew")
def _panels_default(self): self.sql_panel = SQLPanel() self.gasmixer_panel = GasMixerPanel() self.gpio_panel = GPIOPanel() self.plot_panel = PlotPanel() self.temperature_control_panel = TemperatureControlPanel() self.data_subscribers.append(self.sql_panel) self.data_subscribers.append(self.gpio_panel) self.data_subscribers.append(self.plot_panel) self.data_suppliers.append(self.gasmixer_panel) self.data_suppliers.append(self.temperature_control_panel) self.start_stop_subscribers.append(self.sql_panel) self.start_stop_subscribers.append(self.gasmixer_panel) self.start_stop_subscribers.append(self.gpio_panel) self.start_stop_subscribers.append(self.plot_panel) self.start_stop_subscribers.append(self.temperature_control_panel) return [self.sql_panel, self.gasmixer_panel, self.gpio_panel, self.plot_panel, self.temperature_control_panel]
def __init__(self, parent, title): wx.Frame.__init__(self, parent, title=title, size=(1200, 600)) self.splash = Splash(os.path.normpath( os.path.join(MEDIA_PATH, "Jormungandr.jpg")), parent=self) # Icon _icon = wx.NullIcon _icon.CopyFromBitmap( wx.Bitmap(os.path.normpath(os.path.join(MEDIA_PATH, "icon.png")), wx.BITMAP_TYPE_ANY)) self.SetIcon(_icon) # Status Bar self.statusbar = self.CreateStatusBar() # Menu Bar self.frame_1_menubar = wx.MenuBar() # File menu wxglade_tmp_menu = wx.Menu() ID_FILE_OPEN = wxglade_tmp_menu.Append(wx.ID_ANY, "&Open\tCTRL+O", "Open a previous session", wx.ITEM_NORMAL).GetId() ID_FILE_SAVE = wxglade_tmp_menu.Append(wx.ID_ANY, "&Save\tCTRL+S", "Save this session", wx.ITEM_NORMAL).GetId() ID_FILE_SAVEAS = wxglade_tmp_menu.Append(wx.ID_ANY, "Save &As\tALT+SHIFT+S", "Save this session as...", wx.ITEM_NORMAL).GetId() ID_FILE_QUIT = wxglade_tmp_menu.Append(wx.ID_ANY, "&Quit\tCTRL+Q", "Quit this session", wx.ITEM_NORMAL).GetId() self.frame_1_menubar.Append(wxglade_tmp_menu, "&File") # Help menu wxglade_tmp_menu = wx.Menu() ID_HELP_ABOUT = wxglade_tmp_menu.Append(wx.ID_ANY, "&About", "Display about dialog", wx.ITEM_NORMAL).GetId() self.frame_1_menubar.Append(wxglade_tmp_menu, "&Help") self.SetMenuBar(self.frame_1_menubar) # Splitter Window self.sp = wx.SplitterWindow(self, style=wx.SUNKEN_BORDER) self.p2 = PlotPanel(self.sp, self.statusbar) self.p1 = PropertyGridPanel(self.sp, self.p2.updatePlot) self.sp.SplitVertically(self.p1, self.p2, 400) # Event Bindings self.Bind(wx.EVT_MENU, self.OnOpen, id=ID_FILE_OPEN) self.Bind(wx.EVT_MENU, self.OnSave, id=ID_FILE_SAVE) self.Bind(wx.EVT_MENU, self.OnSaveAs, id=ID_FILE_SAVEAS) self.Bind(wx.EVT_MENU, self.OnExit, id=ID_FILE_QUIT) self.Bind(wx.EVT_MENU, self.OnAbout, id=ID_HELP_ABOUT) # Open Menu Wildcard self.wildcard = "GUI Save File (*.map)|*.map" # Current Working File self.working_file = None # update the plot self.p2.plot(self.p1.pg.GetPropertyValues()) # Set Statusbar text self.statusbar.SetStatusText('Ready')
class MainFrame(wx.Frame): def __init__(self, parent, title): wx.Frame.__init__(self, parent, title=title, size=(1200, 600)) self.splash = Splash(os.path.normpath( os.path.join(MEDIA_PATH, "Jormungandr.jpg")), parent=self) # Icon _icon = wx.NullIcon _icon.CopyFromBitmap( wx.Bitmap(os.path.normpath(os.path.join(MEDIA_PATH, "icon.png")), wx.BITMAP_TYPE_ANY)) self.SetIcon(_icon) # Status Bar self.statusbar = self.CreateStatusBar() # Menu Bar self.frame_1_menubar = wx.MenuBar() # File menu wxglade_tmp_menu = wx.Menu() ID_FILE_OPEN = wxglade_tmp_menu.Append(wx.ID_ANY, "&Open\tCTRL+O", "Open a previous session", wx.ITEM_NORMAL).GetId() ID_FILE_SAVE = wxglade_tmp_menu.Append(wx.ID_ANY, "&Save\tCTRL+S", "Save this session", wx.ITEM_NORMAL).GetId() ID_FILE_SAVEAS = wxglade_tmp_menu.Append(wx.ID_ANY, "Save &As\tALT+SHIFT+S", "Save this session as...", wx.ITEM_NORMAL).GetId() ID_FILE_QUIT = wxglade_tmp_menu.Append(wx.ID_ANY, "&Quit\tCTRL+Q", "Quit this session", wx.ITEM_NORMAL).GetId() self.frame_1_menubar.Append(wxglade_tmp_menu, "&File") # Help menu wxglade_tmp_menu = wx.Menu() ID_HELP_ABOUT = wxglade_tmp_menu.Append(wx.ID_ANY, "&About", "Display about dialog", wx.ITEM_NORMAL).GetId() self.frame_1_menubar.Append(wxglade_tmp_menu, "&Help") self.SetMenuBar(self.frame_1_menubar) # Splitter Window self.sp = wx.SplitterWindow(self, style=wx.SUNKEN_BORDER) self.p2 = PlotPanel(self.sp, self.statusbar) self.p1 = PropertyGridPanel(self.sp, self.p2.updatePlot) self.sp.SplitVertically(self.p1, self.p2, 400) # Event Bindings self.Bind(wx.EVT_MENU, self.OnOpen, id=ID_FILE_OPEN) self.Bind(wx.EVT_MENU, self.OnSave, id=ID_FILE_SAVE) self.Bind(wx.EVT_MENU, self.OnSaveAs, id=ID_FILE_SAVEAS) self.Bind(wx.EVT_MENU, self.OnExit, id=ID_FILE_QUIT) self.Bind(wx.EVT_MENU, self.OnAbout, id=ID_HELP_ABOUT) # Open Menu Wildcard self.wildcard = "GUI Save File (*.map)|*.map" # Current Working File self.working_file = None # update the plot self.p2.plot(self.p1.pg.GetPropertyValues()) # Set Statusbar text self.statusbar.SetStatusText('Ready') def OnOpen(self, event): dlg = wx.FileDialog(self, message="Choose a file", defaultDir=os.getcwd(), defaultFile="", wildcard=self.wildcard, style=wx.OPEN) # Show the dialog and retrieve the user response. If it is the OK # response, process the data. if dlg.ShowModal() == wx.ID_OK: # This returns a Python list of files that were selected. try: with open(dlg.GetPath()) as f: yaml.full_load(f) # Reset Appended Data Objects and create placeholders as needed # Set Properties for key, value in d.iteritems(): self.p1.pg.SetPropertyValue(RUN_DATA[key]['pgid'], value) # TODO: This should work, but is not... # self.p1.pg.SetPropertyValues(obj) except: dlg = wx.MessageDialog(self, 'Unable to load input file.', 'Error', wx.OK | wx.ICON_INFORMATION) dlg.ShowModal() dlg.Destroy() # Destroy the dialog. Do not do this until you are done with it! BAD # things can happen otherwise! dlg.Destroy() # TODO: Update Plot... def OnSave(self, event=None): if not self.working_file: self.OnSaveAs() # Save Data data = self.p1.pg.GetPropertyValues() with open(self.working_file, 'w') as f: f.write(yaml.safe_dump(data, default_flow_style=False)) def OnSaveAs(self, event=None): dlg = wx.FileDialog(self, message="Save file as ...", defaultDir=os.getcwd(), defaultFile="", wildcard=self.wildcard, style=wx.SAVE | wx.OVERWRITE_PROMPT) # This sets the default filter that the user will initially see. # Otherwise, the first filter in the list will be used by default. dlg.SetFilterIndex(0) # Show the dialog and retrieve the user response. If it is the OK # response, process the data. if dlg.ShowModal() == wx.ID_OK: # data = self.p1.pg.GetPropertyValues(inc_attributes=True) self.working_file = dlg.GetPath() self.OnSave() # Destroy the dialog. Do not do this until you are donw ith it! BAD # things can happen otherwise! dlg.Destroy() def OnExit(self, event): self.Close() def OnAbout(self, event): # First we create and fill the info object info = wx.adv.AboutDialogInfo() info.Name = "Map GUI" info.Version = "1.2.3" info.Copyright = "(C) 2016 Systems Engineering Group (SEG)" info.Description = wordwrap( "A \"hello world\" program is a software program that prints out " "\"Hello world!\" on a display device. It is used in many " "introductory " "tutorials for teaching a programming language." "\n\nSuch a program is typically one of the simplest programs " "possible " "in a computer language. A \"hello world\" program can be a " "useful " "sanity test to make sure that a language's compiler, development " "environment, and run-time environment are correctly installed.", 350, wx.ClientDC(self)) info.WebSite = ("https://www.example.com") info.Developers = ["Kenneth E. Bellock"] licenseText = "blah " * 250 + "\n\n" + "yadda " * 100 info.License = wordwrap(licenseText, 500, wx.ClientDC(self)) # Then we call wx.AboutBox giving it that info object wx.adv.AboutBox(info)
class MeasureOverTimeTask(Task): """ A task for measure something over time. """ #### 'Task' interface ##################################################### id = 'sensorscience.unimeas.measureovertime' name = 'Measure over time' menu_bar = SMenuBar(SMenu(id='File', name='&File'), SMenu(id='Edit', name='&Edit'), SMenu(TaskToggleGroup(), id='Tasks', name='&Measurement type'), SMenu(DockPaneToggleGroup(), id='Measurement', name='&Panels'), SMenu(InstrumentShowGroup(), id='Instrument', name='&Instrument')) active_instrument = Instance(IInstrument) sql_panel = Instance(SQLPanel) gasmixer_panel = Instance(GasMixerPanel) gpio_panel = Instance(GPIOPanel) plot_panel = Instance(PlotPanel) temperature_control_panel = Instance(TemperatureControlPanel) pane = Instance(EmptyCentralPane) instruments = List panels = List data_units = List start_stop_subscribers = List data_subscribers = List data_suppliers = List ########################################################################### # 'Task' interface. ########################################################################### def create_central_pane(self): """ Create a plot pane with a list of instruments. Keep track of which instrument is active so that dock panes can introspect it. """ return EmptyCentralPane() def create_dock_panes(self): self.active_instrument = self.instruments[0] return [ GenericPane(panel=self.active_instrument, id = 'sensorscience.unimeas.instrument_config_pane', name = 'Instrument configuration'), InstrumentHelpPane(instrument=self.active_instrument), GenericPane(panel=self.panels[0], id = self.panels[0].pane_id, name = self.panels[0].pane_name), GenericPane(panel=self.panels[1], id = self.panels[1].pane_id, name = self.panels[1].pane_name), GenericPane(panel=self.panels[2], id = self.panels[2].pane_id, name = self.panels[2].pane_name), GenericPane(panel=self.panels[3], id = self.panels[3].pane_id, name = self.panels[3].pane_name), GenericPane(panel=self.panels[4], id = self.panels[4].pane_id, name = self.panels[4].pane_name), ] def activated(self): self._update_active_instrument(None, None, None, None) def set_active_instrument(self, instrument): self.active_instrument = instrument #### Trait initializers ################################################### def _default_layout_default(self): return TaskLayout( left=Splitter(Tabbed(PaneItem('sensorscience.unimeas.instrument_config_pane'), PaneItem('sensorscience.unimeas.instrument_help_pane')), PaneItem(self.panels[0].pane_id), PaneItem(self.panels[1].pane_id), orientation = 'vertical'), right=PaneItem('sensorscience.unimeas.plot_pane') ) def _instruments_default(self): instruments = [] try: from instruments.blank import Blank except ImportError as e: logger.warning('Error on import: %s, %s', type(e), e.message) else: instruments.append(Blank()) try: from instruments.dummysourcemetertime import DummySourcemeterTime except ImportError as e: logger.warning('Error on import: %s, %s', type(e), e.message) else: instruments.append(DummySourcemeterTime()) try: from instruments.sourcemeter import SourceMeter except ImportError as e: logger.warning('Error on import: %s, %s', type(e), e.message) #except WindowsError: # pass else: instruments.append(SourceMeter()) try: from instruments.ni6215 import NI6215 except ImportError as e: logger.warning('Error on import: %s, %s', type(e), e.message) else: instruments.append(NI6215()) try: from instruments.SB50_moslab import NI6215_MOSLab except ImportError as e: logger.warning('Error on import: %s, %s', type(e), e.message) else: instruments.append(NI6215_MOSLab()) try: from instruments.TGS2442_moslab import TGS2442_MOSLab except ImportError as e: logger.warning('Error on import: %s, %s', type(e), e.message) else: instruments.append(TGS2442_MOSLab()) try: from instruments.sensic_cu import SenSiCCU except ImportError as e: logger.warning('Error on import: %s, %s', type(e), e.message) else: instruments.append(SenSiCCU()) try: from instruments.K2100 import K2100 except ImportError as e: logger.warning('Error on import: %s, %s', type(e), e.message) else: instruments.append(K2100()) try: from instruments.time_boonton7200 import Boonton7200 except ImportError as e: logger.warning('Error on import: %s, %s', type(e), e.message) else: instruments.append(Boonton7200()) try: from instruments.time_agilent_4284 import Agilent4284 except Exception as e: logger.warning('Error on import: %s, %s', type(e), e.message) else: instruments.append(Agilent4284()) try: from instruments.ad7451a import ad7451a except Exception as e: logger.warning('Error on import: %s, %s', type(e), e.message) else: instruments.append(ad7451a()) try: from instruments.pyboard_serial import PyBoardSerial except Exception as e: logger.warning('Error on import: %s, %s', type(e), e.message) else: instruments.append(PyBoardSerial()) return instruments def _panels_default(self): self.sql_panel = SQLPanel() self.gasmixer_panel = GasMixerPanel() self.gpio_panel = GPIOPanel() self.plot_panel = PlotPanel() self.temperature_control_panel = TemperatureControlPanel() self.data_subscribers.append(self.sql_panel) self.data_subscribers.append(self.gpio_panel) self.data_subscribers.append(self.plot_panel) self.data_suppliers.append(self.gasmixer_panel) self.data_suppliers.append(self.temperature_control_panel) self.start_stop_subscribers.append(self.sql_panel) self.start_stop_subscribers.append(self.gasmixer_panel) self.start_stop_subscribers.append(self.gpio_panel) self.start_stop_subscribers.append(self.plot_panel) self.start_stop_subscribers.append(self.temperature_control_panel) return [self.sql_panel, self.gasmixer_panel, self.gpio_panel, self.plot_panel, self.temperature_control_panel] #### Trait change handlers ################################################ @on_trait_change('active_instrument') def _update_active_instrument(self, obj, name, old, new): #try: # self.data_suppliers.remove(old) #except ValueError: # pass #self.data_suppliers.append(new) self.on_trait_change(self._dispatch_data, 'active_instrument.acquired_data[]') self.on_trait_change(self._start_stop, 'active_instrument.start_stop') self.on_trait_change(self.plot_panel.update_visible_plots, 'active_instrument.enabled_channels[]') self.configure_new_instrument() self.plot_panel.configure_plots(self.active_instrument) self.gpio_panel.active_instrument = self.active_instrument self.gasmixer_panel.active_instrument = self.active_instrument for dock_pane in self.window.dock_panes: if dock_pane.id.find('instrument_config_pane') != -1: dock_pane.panel = self.active_instrument def configure_new_instrument(self): self.data_units = [] for i in xrange(len(self.active_instrument.output_channels)): for x_unit in self.active_instrument.x_units.values(): self.data_units.append(self.active_instrument.output_channels[i] + x_unit) for y_unit in self.active_instrument.y_units.values(): self.data_units.append(self.active_instrument.output_channels[i] + y_unit) for supplier in self.data_suppliers: self.data_units.append(supplier.output_channels[0] + supplier.y_units[0]) self.sql_panel.set_column_names(self.data_units) @on_trait_change('active_instrument.start_stop') def _start_stop(self): logger.info('otc, active_instrument.start_stop') for subscriber in self.start_stop_subscribers: subscriber.start_stop(self.active_instrument.running) def _dispatch_data(self): while len(self.active_instrument.acquired_data) > 0: data = self.active_instrument.acquired_data.pop(0).copy() for supplier in self.data_suppliers: data[supplier.output_channels[0]] = supplier.get_data() # data['gasmixer'] = self.gasmixer_panel.current_column for subscriber in self.data_subscribers: subscriber.add_data(data)
def __do_layout(self): #Sizers: main_sizer = wx.BoxSizer(wx.VERTICAL) grid_sizer_1 = wx.FlexGridSizer(2, 1, 0, 0) sizerTitleBar = wx.FlexGridSizer(1, 7, 0, 0) #Titlebar: iconTitleBar = wx.StaticBitmap(self.panelTitleBar, wx.ID_ANY, wx.Bitmap("Lx_Icons/Desktop_Icon22x22.png", wx.BITMAP_TYPE_ANY)) sizerTitleBar.Add(iconTitleBar, 0, wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT, 1) title = wx.StaticText(self.panelTitleBar, wx.ID_ANY, "Visual Speech Training System v2.0 ") title.SetForegroundColour(wx.Colour(255, 255, 255)) title.SetFont(wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, 0, "")) sizerTitleBar.Add(title, 0, wx.ALIGN_CENTER_VERTICAL | wx.BOTTOM | wx.TOP, 10) sizerTitleBar.Add(self.btnManual, 0, wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT, 4) sizerTitleBar.Add(self.btnColor, 0, wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT, 4) sizerTitleBar.Add(self.btnMinimize, 0, wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT, 4) sizerTitleBar.Add(self.btnMaximize, 0, wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT, 4) sizerTitleBar.Add(self.btnExit, 0, wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT, 4) sizerTitleBar.AddGrowableRow(0) sizerTitleBar.AddGrowableCol(1) self.panelTitleBar.SetSizer(sizerTitleBar) grid_sizer_1.Add(self.panelTitleBar, 1, wx.EXPAND, 0) grid_sizer_1.Add(self.panelBody, 1, wx.EXPAND, 0) grid_sizer_1.AddGrowableRow(1) grid_sizer_1.AddGrowableCol(0) main_sizer.Add(grid_sizer_1,0, wx.EXPAND, 0) #minimize """Start of frame_box that holds boxsizers which Initialise the left, right toolbars and left, right Panels""" frame_box = wx.BoxSizer(wx.VERTICAL) top_box = wx.BoxSizer(wx.HORIZONTAL) '''Start of left_toolbar_box to hold all the tool on left side of the App''' left_toolbar_box = wx.BoxSizer(wx.VERTICAL) self.leftToolbar = wx.ToolBar(self, style=wx.TB_VERTICAL | wx.EXPAND | wx.TB_FLAT | wx.TB_NODIVIDER) # Add a tool button for clearing the current signal for i in range(20): self.leftToolbar.AddStretchableSpace() # Add a tool button for acquiring a new signal img = wx.Image('Lx_Icons/Signal_Normal.png').Scale(100, 60, wx.IMAGE_QUALITY_HIGH) l_acquire_tool = self.leftToolbar.AddTool(2, 'Signal', wx.Bitmap(img), 'Acquire new signal') self.Bind(wx.EVT_TOOL, self.on_Switch_Left_Panel, l_acquire_tool) for i in range(3): self.leftToolbar.AddStretchableSpace() # Add a tool button for analyzing the current signal img = wx.Image('Lx_Icons/Analysis_Normal.png').Scale(100, 60, wx.IMAGE_QUALITY_HIGH) l_analyze_tool = self.leftToolbar.AddTool(3, 'Analyze', wx.Bitmap(img), 'Analyze current signal') self.Bind(wx.EVT_TOOL, self.on_Switch_Left_Analysis_Panel, l_analyze_tool) for i in range(3): self.leftToolbar.AddStretchableSpace() # Add a tool button for animating the current signal img = wx.Image('Lx_Icons/Animation_Disabled.png').Scale(100, 60, wx.IMAGE_QUALITY_HIGH) l_animate_tool = self.leftToolbar.AddTool(4, 'Animation', wx.Bitmap(img), 'Animate current signal') # self.on_left_animation(None, init=True) self.leftToolbar.EnableTool(4, enable=False) self.Bind(wx.EVT_TOOL, self.on_Switch_Left_Animation_Panel, l_animate_tool) self.leftToolbar.AddStretchableSpace() self.leftToolbar.Realize() left_toolbar_box.Add(self.leftToolbar, 1, wx.EXPAND, 1) self.editLeftMessage = wx.TextCtrl(self, wx.ID_ANY, u"Message", wx.DefaultPosition, wx.Size( 107,40 ), wx.TE_CENTRE|wx.TE_READONLY |wx.TE_RICH2) self.editLeftMessage.SetFont(wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, 0, "")) self.editLeftMessage.SetForegroundColour(wx.Colour(255, 255, 255)) self.editLeftMessage.SetBackgroundColour(wx.Colour(64,134,170,1)) left_toolbar_box.Add(self.editLeftMessage, 0) top_box.Add(left_toolbar_box, 0, wx.ALL | wx.EXPAND, 1) '''End of left_toolbar_box''' '''Start of left_signal_box to hold PlotPanel and SignalAcquisitionDialog Panel on Left Side''' left_signal_box = wx.BoxSizer(wx.VERTICAL) self.plot_panel[0] = PlotPanel(self, title=self.user_data[0].user_name) left_signal_box.Add(self.plot_panel[0], 1, wx.ALL | wx.EXPAND, 1) # Expanded self.signal_acqui[0] = SignalAcquisitionDialog(self, self.user_data[0]) self.signal_acqui[0].Hide() left_signal_box.Add(self.signal_acqui[0], 1, wx.ALL | wx.EXPAND, 1) self.analysis_panel[0] = Analysis_Panel(self, self.user_data[0]) self.analysis_panel[0].Hide() left_signal_box.Add(self.analysis_panel[0], 1, wx.ALL | wx.EXPAND, 1) self.analysis_lower_left[0] = Analysis_Lower_Left(self, self.user_data[0]) self.analysis_lower_left[0].Hide() left_signal_box.Add(self.analysis_lower_left[0], 1, wx.ALL | wx.EXPAND, 1) self.animation_panel[0] = AnimationLeftPanel(self, self.user_data[0]) self.animation_panel[0].Hide() left_signal_box.Add(self.animation_panel[0], 0, wx.ALL | wx.EXPAND | wx.ALIGN_CENTER, 1) top_box.Add(left_signal_box, 1, wx.ALL | wx.EXPAND, 1) '''End of left_signal_box''' '''Start of right_signal_box to hold PlotPanel and SignalAcquisitionDialog Panel on Right Side''' right_signal_box = wx.BoxSizer(wx.VERTICAL) self.plot_panel[1] = PlotPanel(self, title=self.user_data[1].user_name) right_signal_box.Add(self.plot_panel[1], 1, wx.ALL | wx.EXPAND, 1) self.signal_acqui[1] = SignalAcquisitionDialog(self, self.user_data[1]) self.signal_acqui[1].Hide() right_signal_box.Add(self.signal_acqui[1], 1, wx.ALL | wx.EXPAND, 1) self.analysis_panel[1] = Analysis_Panel(self, self.user_data[1]) self.analysis_panel[1].Hide() right_signal_box.Add(self.analysis_panel[1], 1, wx.ALL | wx.EXPAND, 1) self.analysis_lower_left[1] = Analysis_Lower_Left(self, self.user_data[1]) self.analysis_lower_left[1].Hide() right_signal_box.Add(self.analysis_lower_left[1], 1, wx.ALL | wx.EXPAND, 1) self.animation_panel[1] = AnimationRightPanel(self, self.user_data[0]) self.animation_panel[1].Hide() right_signal_box.Add(self.animation_panel[1], 0, wx.ALL | wx.EXPAND | wx.ALIGN_CENTER, 1) top_box.Add(right_signal_box, 1, wx.ALL | wx.EXPAND, 1) '''End of right_signal_box''' '''Start of right_toolbar_box to hold all the tool on right side of the App''' right_toolbar_box = wx.BoxSizer(wx.VERTICAL) self.rightToolbar = wx.ToolBar(self, style=wx.TB_VERTICAL | wx.EXPAND | wx.TB_FLAT | wx.TB_NODIVIDER) for i in range(20): self.rightToolbar.AddStretchableSpace() # Add a tool button for acquiring a new signal img = wx.Image('Lx_Icons/Signal_Normal.png').Scale(100, 60, wx.IMAGE_QUALITY_HIGH) self.r_acquire_tool = self.rightToolbar.AddTool(101, 'Signal', wx.Bitmap(img), 'Acquire new signal') # self.Bind(wx.EVT_TOOL, self.on_acquire_signal_right, self.r_acquire_tool) # self.on_right_signal(None, init=True) self.Bind(wx.EVT_TOOL, self.on_Switch_Right_Panel, self.r_acquire_tool) for i in range(3): self.rightToolbar.AddStretchableSpace() # self.rightToolbar.AddSeparator() # Add a tool button for analyzing the current signal img = wx.Image('Lx_Icons/Analysis_Normal.png').Scale(100, 60, wx.IMAGE_QUALITY_HIGH) self.r_analyze_tool = self.rightToolbar.AddTool(102, 'Analyze', wx.Bitmap(img), 'Analyze current signal') self.Bind(wx.EVT_TOOL, self.on_Switch_Right_Analysis_Panel, self.r_analyze_tool) # self.on_right_analysis(None, init=True) # self.Bind(wx.EVT_TOOL, self.on_right_analysis, self.r_analyze_tool) for i in range(3): self.rightToolbar.AddStretchableSpace() # self.rightToolbar.AddSeparator() # Add a tool button for animating the current signal img = wx.Image('Lx_Icons/Animation_Disabled.png').Scale(100, 60, wx.IMAGE_QUALITY_HIGH) r_animate_tool = self.rightToolbar.AddTool(103, 'Animation', wx.Bitmap(img), 'Animate current signal') self.Bind(wx.EVT_TOOL, self.onClear(), r_animate_tool) self.rightToolbar.EnableTool(103, enable=False) # self.on_right_animation(None, init=True) self.Bind(wx.EVT_TOOL, self.on_Switch_Right_Animation_Panel, r_animate_tool) self.rightToolbar.AddStretchableSpace() self.rightToolbar.Realize() # self.rightToolbar.SetBackgroundColour('#4086aa') # Setting Background Colour on rightToolbar self.leftToolbar.SetBackgroundColour((64,134,170,1)) # Setting Background Colour on leftToolbar self.rightToolbar.SetBackgroundColour((64,134,170,1)) right_toolbar_box.Add(self.rightToolbar, 1, wx.EXPAND, 1) self.editRightMessage = wx.TextCtrl(self, wx.ID_ANY, u"Message", wx.DefaultPosition, wx.Size(107, 40), wx.TE_CENTRE|wx.TE_READONLY |wx.TE_RICH2) self.editRightMessage.SetFont(wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, 0, "")) self.editRightMessage.SetForegroundColour(wx.Colour(255, 255, 255)) self.editRightMessage.SetBackgroundColour(wx.Colour(64, 134, 170, 1)) right_toolbar_box.Add(self.editRightMessage, 0) top_box.Add(right_toolbar_box, 0, wx.ALL | wx.EXPAND, 1) '''End of right_toolbar_box''' frame_box.Add(top_box, 1, wx.ALL | wx.EXPAND, 1) """End of frame_box that holds all boxsizers""" main_sizer.Add(frame_box, 1, wx.EXPAND, 0) self.SetSizer(main_sizer) self.Layout()