def __init__(self, controller_uid): # super().__init__(controller_uid) # self._mgr = aui.AuiManager(self) # self._mgr.GetArtProvider().SetColour(aui.AUI_DOCKART_BACKGROUND_COLOUR, wx.SystemSettings.GetColour(wx.SYS_COLOUR_3DFACE)) self._mgr.GetArtProvider().SetColour(aui.AUI_DOCKART_INACTIVE_CAPTION_COLOUR, wx.SystemSettings.GetColour(wx.SYS_COLOUR_3DFACE)) # self.main_area_panel = wx.Panel(self) bmp_filename = "gripy_logo.jpg" bmp = GripyBitmap(bmp_filename) self._static_bmp = wx.StaticBitmap(self.main_area_panel, wx.ID_ANY, bmp, wx.Point(0, 0), bmp.GetSize() ) self.main_area_panel.SetBackgroundColour('white') self._mgr.AddPane(self.main_area_panel, aui.AuiPaneInfo().Name("main_area_panel").CenterPane()) # self._notebook = aui.AuiNotebook(self.main_area_panel) # sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self._notebook, 1, flag=wx.EXPAND) sizer.Add(self._static_bmp, 1, flag=wx.EXPAND) # self._notebook.Show(False) # sizer.Layout() # self.main_area_panel.SetSizerAndFit(sizer) # self.Bind(aui.EVT_AUINOTEBOOK_TAB_RIGHT_DOWN, self.on_page_right_down) # self._mgr.Update() # # self.Bind(wx.EVT_CLOSE, self.on_close) self.Bind(aui.EVT_AUINOTEBOOK_PAGE_CLOSE, self.on_page_close, self._notebook) self.Bind(aui.EVT_AUINOTEBOOK_PAGE_CHANGED, self.on_page_changed)
def _build_tool_bar(self): self.fp_item = self._tool_bar.AddTool( CP_FLOAT_PANEL, wx.EmptyString, GripyBitmap('restore_window-25.png'), wx.NullBitmap, wx.ITEM_CHECK, 'Float Panel', 'Float Panel', None) self._tool_bar.ToggleTool(CP_FLOAT_PANEL, False) self._tool_bar.Bind(wx.EVT_TOOL, self._on_change_float_panel, None, CP_FLOAT_PANEL) self._tool_bar.AddSeparator() # self._tool_bar.AddTool(CP_NORMAL_TOOL, wx.EmptyString, GripyBitmap('cursor_24.png'), wx.NullBitmap, wx.ITEM_RADIO, 'Normal Tool', 'Normal Tool', None) self._tool_bar.ToggleTool(CP_NORMAL_TOOL, True) # self._tool_bar.AddTool(CP_SELECTION_TOOL, wx.EmptyString, GripyBitmap('cursor_filled_24.png'), wx.NullBitmap, wx.ITEM_RADIO, 'Selection Tool', 'Selection Tool', None) self._tool_bar.Bind(wx.EVT_TOOL, self._on_change_tool, None, CP_NORMAL_TOOL, CP_SELECTION_TOOL) # self._tool_bar.AddSeparator() self._tool_bar.label_MC = wx.StaticText(self._tool_bar, label='MPL Theme: ') self._tool_bar.AddControl(self._tool_bar.label_MC, '') styles = ['default'] + mstyle.available[:] self._tool_bar.choice_Style = wx.Choice(self._tool_bar, choices=styles) self._tool_bar.choice_Style.SetSelection(0) # self._tool_bar.choice_Style.Bind(wx.EVT_CHOICE, self._on_choice_style) self._tool_bar.AddControl(self._tool_bar.choice_Style, '') self._tool_bar.AddSeparator() button_edit_format = wx.Button(self._tool_bar, label='Edit Crossplot') button_edit_format.Bind(wx.EVT_BUTTON, self._OnEditFormat) self._tool_bar.AddControl(button_edit_format, '') self._tool_bar.AddSeparator() # self._tool_bar.Realize()
def _build_tool_bar(self): self.fp_item = self._tool_bar.AddTool( WP_FLOAT_PANEL, wx.EmptyString, GripyBitmap('restore_window-25.png'), wx.NullBitmap, wx.ITEM_CHECK, 'Float Panel', 'Float Panel', None) self._tool_bar.ToggleTool(WP_FLOAT_PANEL, False) self._tool_bar.Bind(wx.EVT_TOOL, self._on_change_float_panel, None, WP_FLOAT_PANEL) self._tool_bar.AddSeparator() self._tool_bar.Realize()
def PostInit(self): log.debug('{}.AfterInit started'.format(self.name)) UIM = UIManager() main_window = wx.App.Get().GetTopWindow() # DetachPane if granpa object has a AuiManager... parent_uid = UIM._getparentuid(self.uid) grampa_uid = UIM._getparentuid(parent_uid) parent = UIM.get(parent_uid) grampa = UIM.get(grampa_uid) if isinstance(grampa, MainWindowController): mgr = wx.aui.AuiManager.GetManager(main_window) if mgr is not None: mgr.DetachPane(parent.view) if self.pos == -1: # Appending - Not needed to declare pos self.pos = parent.view.GetToolsCount() if self.pos > parent.view.GetToolsCount(): # If pos was setted out of range for inserting in parent Menu msg = 'Invalid tool position for ToolBarTool with text={}. Position will be setting to {}'.format( self.label, parent.view.GetToolsCount()) logging.warning(msg) self.pos = parent.view.GetToolsCount() bitmap = GripyBitmap(self.bitmap) # TODO: Rever isso try: tool = parent.view.InsertTool(self.pos, self.id, self.label, bitmap, wx.NullBitmap, self.kind, self.help, self.long_help, None) except Exception as e: msg = 'Error in creating ToolBarTool: ' + e logging.exception(msg) print('\n\n', msg) raise if self.callback and tool: main_window.Bind(wx.EVT_TOOL, self.callback, tool) parent.view.Realize() # AtachPane again if granpa object had it detached... if isinstance(grampa, MainWindowController): mgr.AddPane(parent.view, parent.view.paneinfo) mgr.Update() logging.debug('{}.AfterInit ended'.format(self.name))
def _build_tool_bar(self): self.fp_item = self._tool_bar.AddTool( WP_FLOAT_PANEL, wx.EmptyString, GripyBitmap('restore_window-25.png'), wx.NullBitmap, wx.ITEM_CHECK, 'Float Panel', 'Float Panel', None) self._tool_bar.ToggleTool(WP_FLOAT_PANEL, False) self._tool_bar.Bind(wx.EVT_TOOL, self._on_change_float_panel, None, WP_FLOAT_PANEL) self._tool_bar.AddSeparator() # self._tool_bar.AddTool(WP_NORMAL_TOOL, wx.EmptyString, GripyBitmap('cursor_24.png'), wx.NullBitmap, wx.ITEM_RADIO, 'Normal Tool', 'Normal Tool', None) self._tool_bar.ToggleTool(WP_NORMAL_TOOL, True) # self._tool_bar.AddTool(WP_SELECTION_TOOL, wx.EmptyString, GripyBitmap('cursor_filled_24.png'), wx.NullBitmap, wx.ITEM_RADIO, 'Selection Tool', 'Selection Tool', None) self._tool_bar.Bind(wx.EVT_TOOL, self._on_change_tool, None, WP_NORMAL_TOOL, WP_SELECTION_TOOL) # self._tool_bar.AddSeparator() # tb_item = self._tool_bar.AddTool(-1, u"Insert Track", GripyBitmap('table_add_24.png'), 'Insert a new track') self._tool_bar.Bind(wx.EVT_TOOL, self._on_toolbar_insert_track, tb_item) # tb_item = self._tool_bar.AddTool(-1, u"Remove Track", GripyBitmap('table_delete_24.png'), 'Remove selected tracks') self._tool_bar.Bind(wx.EVT_TOOL, self._on_toolbar_remove_track, tb_item) # self._tool_bar.AddSeparator() # button_edit_format = wx.Button(self._tool_bar, label='Edit Plot') button_edit_format.Bind(wx.EVT_BUTTON, self._OnEditFormat) self._tool_bar.AddControl(button_edit_format, '') self._tool_bar.AddSeparator() # self._tool_bar.cbFit = wx.CheckBox(self._tool_bar, -1, 'Fit') self._tool_bar.cbFit.Bind(wx.EVT_CHECKBOX, self._on_fit) self._tool_bar.AddControl(self._tool_bar.cbFit, '') # self._tool_bar.AddSeparator() self._tool_bar.label_MC = wx.StaticText(self._tool_bar, label='Multi cursor: ') self._tool_bar.AddControl(self._tool_bar.label_MC, '') self._tool_bar.choice_MC = wx.Choice( self._tool_bar, choices=['None', 'Horizon', 'Vertical', 'Both']) UIM = UIManager() controller = UIM.get(self._controller_uid) idx_mc = ['None', 'Horizon', 'Vertical', 'Both'].index(controller.multicursor) self._tool_bar.choice_MC.SetSelection(idx_mc) self._tool_bar.choice_MC.Bind(wx.EVT_CHOICE, self._on_multicursor) self._tool_bar.AddControl(self._tool_bar.choice_MC, '') # self._tool_bar.AddSeparator() # self._tool_bar.label_IT = wx.StaticText(self._tool_bar, label='Z Axis: ') self._tool_bar.AddControl(self._tool_bar.label_IT, '') self._tool_bar.choice_IT = wx.Choice(self._tool_bar, choices=[]) # self._tool_bar.AddControl(self._tool_bar.choice_IT, '') # static_z_start = wx.StaticText(self._tool_bar, label='Start:') self._tool_bar.AddControl(static_z_start, '') self._tool_bar.z_start = wx.TextCtrl(self._tool_bar, size=(60, 23)) self._tool_bar.AddControl(self._tool_bar.z_start, '') static_z_end = wx.StaticText(self._tool_bar, label='End:') self._tool_bar.AddControl(static_z_end, '') self._tool_bar.z_end = wx.TextCtrl(self._tool_bar, size=(60, 23)) self._tool_bar.AddControl(self._tool_bar.z_end, '') # button_set_zaxis = wx.Button(self._tool_bar, label='Set', size=(40, 23)) button_set_zaxis.Bind(wx.EVT_BUTTON, self._OnSetZAxis) self._tool_bar.AddControl(button_set_zaxis, '') # button_reset_zaxis = wx.Button(self._tool_bar, label='Reset', size=(40, 23)) button_reset_zaxis.Bind(wx.EVT_BUTTON, self._OnResetZAxis) self._tool_bar.AddControl(button_reset_zaxis, '') self._tool_bar.AddSeparator() # self._tool_bar.Realize()