def Plug(dsviewer): dsviewer.recipes = RecipePlugin(dsviewer) if not 'overlaypanel' in dir(dsviewer): dsviewer.overlaypanel = OverlayPanel(dsviewer, dsviewer.view, dsviewer.image.mdh) dsviewer.overlaypanel.SetSize(dsviewer.overlaypanel.GetBestSize()) pinfo2 = aui.AuiPaneInfo().Name("overlayPanel").Right().Caption( 'Overlays').CloseButton(False).MinimizeButton(True).MinimizeMode( aui.AUI_MINIMIZE_CAPT_SMART | aui.AUI_MINIMIZE_POS_RIGHT) #.CaptionVisible(False) dsviewer._mgr.AddPane(dsviewer.overlaypanel, pinfo2) dsviewer.panesToMinimise.append(pinfo2)
def test_lib_agw_auiCtor(self): self._mgr = aui.AuiManager() # tell AuiManager to manage this frame self._mgr.SetManagedWindow(self.frame) pane = wx.Panel() self._mgr.AddPane( pane, aui.AuiPaneInfo().Name("pane1").Caption("A pane").CenterPane()) pane = wx.Panel() self._mgr.AddPane( pane, aui.AuiPaneInfo().Name("pane2").Caption("A pane").Top()) pane = wx.Panel() self._mgr.AddPane( pane, aui.AuiPaneInfo().Name("pane3").Caption("A pane").Left()) pane = wx.Panel() self._mgr.AddPane( pane, aui.AuiPaneInfo().Name("pane4").Caption("A pane").Bottom()) self._mgr.Update()
def init_tool(self): sizer = wx.BoxSizer(wx.VERTICAL) self.toolbar = ToolBar(self, False) def on_help(evt, tol): lang = ConfigManager.get('language') doc = DocumentManager.get(tol.title, tag=lang) doc = doc or DocumentManager.get(tol.title, tag='English') self.show_md(doc or 'No Document!', tol.title) self.toolbar.on_help = on_help self.toolbar.Fit() self.auimgr.AddPane(self.toolbar, aui.AuiPaneInfo() .Top() .PinButton( True ).PaneBorder( False ) .CaptionVisible( False ).Dock().FloatingSize( wx.DefaultSize ).MinSize(wx.Size( -1,34 )).DockFixed( True ) . BottomDockable( False ).TopDockable( False ).Layer( 10 ) )
def start(self): #if not WidgetsManager.getref(self.title) is None: return pan = self.pan(IPy.curapp) #WidgetsManager.addref(pan) IPy.curapp.auimgr.AddPane( pan, aui.AuiPaneInfo().Caption(self.title).Left().Layer(15).PinButton( True).Float().Resizable().FloatingSize( wx.DefaultSize).Dockable( IPy.uimode() == 'ipy').DestroyOnClose()) IPy.curapp.Layout() IPy.curapp.auimgr.Update() '''
def OnBSingle(self, event): self.OnBLive(event, True) #monkey patch in a progress panel self.dlgAqProg = SeqProgressPanel(self.scope.zs) self.pinfo1 = aui.AuiPaneInfo().Name("deconvPanel").Top( ).Caption('Acquisition Progress').DestroyOnClose(True).CloseButton( False ) #.MinimizeButton(True).MinimizeMode(aui.AUI_MINIMIZE_CAPT_SMART|aui.AUI_MINIMIZE_POS_RIGHT)#.CaptionVisible(False) self.scope.zs.view._mgr.AddPane(self.dlgAqProg, self.pinfo1) self.scope.zs.view._mgr.Update() self.scope.zs.WantTickNotification.append(self.dlgAqProg.Tick)
def init_tool(self): sizer = wx.BoxSizer(wx.VERTICAL) self.toolbar = ToolBar(self, True) def on_help(evt, tol): lang = Source.manager('config').get('language') doc = Source.manager('document').get(tol.title, tag=lang) doc = doc or Source.manager('document').get(tol.title, tag='English') self.show_md(doc or 'No Document!', tol.title) self.toolbar.on_help = on_help self.toolbar.Fit() self.auimgr.AddPane(self.toolbar, aui.AuiPaneInfo() .Left() .PinButton( True ) .CaptionVisible( True ).Dock().Resizable().FloatingSize( wx.DefaultSize ).MaxSize(wx.Size( 32,-1 )) . BottomDockable( True ).TopDockable( False ).Layer( 10 ) )
def add_evf_pane(self) -> None: """Initialize camera liveview panel. TODO! """ if self.core.edsdk.camera_count == 0: return self.panels['evf'] = EvfPanel(self) self._mgr.AddPane( self.panels['evf'], aui.AuiPaneInfo().Name('Evf').Caption('Live View'). Float().Right().Position(1).Layer(0).MinSize(600, 420). MinimizeButton(True).DestroyOnClose(True).MaximizeButton(True)) self.Update()
def show_widget(self, panel, title='Widgets'): obj = self.manager('widget').get(panel.title) if obj is None: obj = panel(self, self) self.manager('widget').add(panel.title, obj) self.auimgr.AddPane(obj, aui.AuiPaneInfo().Caption(title).Left().Layer( 15 ).PinButton( True ) .Float().Resizable().FloatingSize( wx.DefaultSize ).Dockable(True)) #.DestroyOnClose()) lang = Source.manager('config').get('language') dic = Source.manager('dictionary').get(obj.title, tag=lang) or {} info = self.auimgr.GetPane(obj) info.Show(True).Caption(dic[obj.title] if obj.title in dic else obj.title) self.translate(dic)(obj) self.Layout() self.auimgr.Update()
def show_widget(self, panel, title='Widgets'): obj = self.manager('widget').get(panel.title) if obj is None: pan = panel(self) self.manager('widget').add(obj=pan, name=panel.title) self.auimgr.AddPane( pan, aui.AuiPaneInfo().Caption(panel.title).Left().Layer( 15).PinButton(True).Float().Resizable().FloatingSize( wx.DefaultSize).Dockable(True)) #.DestroyOnClose()) else: info = self.auimgr.GetPane(obj) info.Show(True) self.Layout() self.auimgr.Update()
def build_panels(self): # ---- toolbar de la aplicación self.ttoolbar = TToolBar(self) self._mgr.AddPane( self.ttoolbar, aui.AuiPaneInfo().Name("tb1").Caption( "Big Toolbar").ToolbarPane().Top()) # ---- tree de proyectos self.tree = TTree(self) self._mgr.AddPane( self.tree, aui.AuiPaneInfo().Name("tree_pane").Icon( explorer.GetBitmap()).Caption( L('PROJECT_EXPLORER')).Left().Layer(1).Position( 1).CloseButton(False).MaximizeButton( True).MinimizeButton(True).Floatable(False)) # Panel central self._mgr.AddPane( CentralPanel(self), aui.AuiPaneInfo().Name("space_work_pane").CenterPane()) self._mgr.Update()
def OnConsole(self, event): event.GetId() frame = wx.GetApp().TopWindow pane = frame._mgr.GetPane("hgconsole") if not pane.IsOk(): win = HgConsole(frame) frame._mgr.AddPane(win, aui.AuiPaneInfo().Name("hgconsole").Caption(_("HG console")). Dockable(False).Float().CloseButton(True).MaximizeButton(True)) pane = frame._mgr.GetPane("hgconsole") pane.Float().Show() if pane.floating_pos == wx.DefaultPosition: pane.FloatingPosition(frame.GetStartPosition()) sm = ed_style.StyleMgr(ed_style.StyleMgr.GetStyleSheet(frame.style)) pane.window.UpdateColors(sm) frame._mgr.Update()
def __init__(self): cfg = wx.GetApp().get_config("REPOSITORY") path = cfg.get("path", "") self.username = cfg.get("username", "") self.repo_path = None # keep track of remote opened files self.remote_files_map = {} # search "open file" menu item to insert "open repository" one for pos, it in enumerate(self.menu['file'].GetMenuItems()): if it.GetId() == wx.ID_OPEN: break self.ID_OPEN_REPO = wx.NewId() self.ID_OPEN_WEB_REPO = wx.NewId() self.menu['file'].Insert(pos+1, self.ID_OPEN_REPO, "Open Repo\tCtrl-Shift-O") self.Bind(wx.EVT_MENU, self.OnOpenRepo, id=self.ID_OPEN_REPO) self.menu['file'].Insert(pos+2, self.ID_OPEN_WEB_REPO, "Open Web Repo\tCtrl-Shift-Alt-O") self.Bind(wx.EVT_MENU, self.OnOpenWebRepo, id=self.ID_OPEN_WEB_REPO) # search "recent files" menu item to insert "recent repos" one for pos, it in enumerate(self.menu['file'].GetMenuItems()): if it.GetId() == wx.ID_FILE: break # and a file history recent_repos_submenu = wx.Menu() self.repo_filehistory = wx.FileHistory(idBase=ID_FILE_REPO[0]) self.repo_filehistory.UseMenu(recent_repos_submenu) self.menu['file'].InsertMenu(pos+1, -1, "Recent &Repos", recent_repos_submenu) self.Bind(wx.EVT_MENU_RANGE, self.OnRepoFileHistory, id=ID_FILE_REPO[0], id2=ID_FILE_REPO[9]) self.repo = None #MercurialRepo(path, self.username) repo_panel = self.CreateRepoTreeCtrl() self._mgr.AddPane(repo_panel, aui.AuiPaneInfo(). Name("repo").Caption("Repository"). Left().Layer(1).Position(1).CloseButton(True).MaximizeButton(True)) self._mgr.Update() self.AppendWindowMenuItem('Repository', ('repo', ), self.OnWindowMenu) self.repo_tree.Bind(wx.EVT_LEFT_DCLICK, self.OnRepoLeftDClick) self.repo_tree.Bind(wx.EVT_CONTEXT_MENU, self.OnRepoContextMenu) self.Connect(-1, -1, EVT_REPO_ID, self.OnRepoEvent) # create pop-up menu self.CreateRepoMenu()
def __CreateToolbar(self): """生成工具栏""" # 创建AuiToolBar self.tb = aui.AuiToolBar(self, -1, wx.DefaultPosition, wx.DefaultSize, agwStyle=aui.AUI_TB_DEFAULT_STYLE | aui.AUI_TB_OVERFLOW) # 图标大小 tsize = wx.Size(24, 24) self.tb.SetToolBitmapSize(tsize) # 打开目录 self.tb.AddTool( wx.ID_OPEN, "打开目录", wx.ArtProvider.GetBitmap(wx.ART_FOLDER_OPEN, wx.ART_TOOLBAR, tsize), wx.NullBitmap, wx.ITEM_NORMAL, "打开目录", "打开工程文件夹") # 保存文件 self.tb.AddTool( wx.ID_SAVE, "保存文件", wx.ArtProvider.GetBitmap(wx.ART_FILE_SAVE, wx.ART_TOOLBAR, tsize), wx.NullBitmap, wx.ITEM_NORMAL, "保存文件", "将修改保存到文件中") # 分隔条 self.tb.AddSeparator() # 撤销 self.tb.AddTool( wx.ID_UNDO, "撤销", wx.ArtProvider.GetBitmap(wx.ART_UNDO, wx.ART_TOOLBAR, tsize), wx.NullBitmap, wx.ITEM_NORMAL, "撤销", "撤销上一次修改") # 重做 self.tb.AddTool( wx.ID_REDO, "重做", wx.ArtProvider.GetBitmap(wx.ART_REDO, wx.ART_TOOLBAR, tsize), wx.NullBitmap, wx.ITEM_NORMAL, "重做", "重做撤销的修改") self.tb.Realize() self._mgr.AddPane( self.tb, aui.AuiPaneInfo().Name("toolbar").Caption( "Big Toolbar").ToolbarPane().Top())
def init_table(self): self.tablenbwrap = wx.Panel(self) sizer = wx.BoxSizer(wx.VERTICAL) self.tablenb = GridNoteBook(self.tablenbwrap) sizer.Add(self.tablenb, 1, wx.EXPAND | wx.ALL, 0) self.tablenbwrap.SetSizer(sizer) self.tablenbwrap.Layout() self.auimgr.AddPane( self.tablenbwrap, aui.AuiPaneInfo().Bottom().CaptionVisible(True).PinButton(True). Dock().Hide().MaximizeButton(True).Resizable().FloatingSize( (800, 600)).BestSize( (120, 120)).Caption('Tables').BottomDockable(True).TopDockable( False).LeftDockable(True).RightDockable(True))
def init_canvas(self): self.canvasnbwrap = wx.Panel(self) sizer = wx.BoxSizer(wx.VERTICAL) self.canvasnb = CanvasNoteBook(self.canvasnbwrap) sizer.Add(self.canvasnb, 1, wx.EXPAND | wx.ALL, 0) self.canvasnbwrap.SetSizer(sizer) self.canvasnbwrap.Layout() self.auimgr.AddPane( self.canvasnbwrap, aui.AuiPaneInfo().Center().CaptionVisible(False).PinButton( True).Dock().PaneBorder(False).Resizable().FloatingSize( wx.DefaultSize).BottomDockable(True).TopDockable( False).LeftDockable(True).RightDockable(True)) self.canvasnb.Bind(wx.lib.agw.aui.EVT_AUINOTEBOOK_PAGE_CHANGED, self.on_new_img) self.canvasnb.Bind(wx.lib.agw.aui.EVT_AUINOTEBOOK_PAGE_CLOSE, self.on_close_img)
def scikit(self): # Create an AUI Manager and tell it to manage this Frame NMFAuiWindow._manager = aui.AuiManager() NMFAuiWindow._manager.SetManagedWindow(self) #sizer = wx.BoxSizer(wx.HORIZONTAL) nmf=scikitpanel(parent=self) #sizer.Add(nmf, 1, wx.EXPAND) #self.SetSizer(sizer,deleteOld=True) control_info = aui.AuiPaneInfo().Top().Name('Scikit Parameters').Caption('Scikit Parameters').\ CloseButton(True).MaximizeButton(False).MinimizeButton(False).Show().Floatable(False).DestroyOnClose(b=True).MinSize((600,42)) NMFAuiWindow._manager.AddPane(nmf, control_info) NMFAuiWindow._manager.Update()
def init_text(self): self.mdwarp = wx.Panel(self) sizer = wx.BoxSizer(wx.VERTICAL) self.mdnb = MDNoteBook(self.mdwarp) sizer.Add(self.mdnb, 1, wx.EXPAND | wx.ALL, 0) self.mdwarp.SetSizer(sizer) self.mdwarp.Layout() self.auimgr.AddPane( self.mdwarp, aui.AuiPaneInfo().Bottom().CaptionVisible(True).PinButton(True). Float().Hide().MaximizeButton(True).Resizable().FloatingSize( (400, 400)).BestSize( (120, 120)).Caption('MarkDown').BottomDockable(True). TopDockable(False).LeftDockable(True).RightDockable(True)) self.txtframe = TextNoteFrame(self, 'Sci Text')
def __init__(self, Resource_=None): """ Конструктор. @param: Resource_: Ресурсное представление объекта. """ Resource_ = util.icSpcDefStruct(SPC_IC_AUIMAINWIN, Resource_) ic_win.icMainWindow.__init__(self, Resource_['name'], Resource_) # AUI Менеджер self.aui_manager = icAUImanager.icAUIManager(self) if Resource_['is_main_notebook'] and not Resource_['is_main_notebook'] in ('None', 'False', '0', 'false'): self.aui_manager.AddPane(self.createMainNotebook(), aui.AuiPaneInfo().Name('main_notebook').CenterPane()) # Установить флаги flags = 0 if Resource_['allow_floating']: flags |= aui.AUI_MGR_ALLOW_FLOATING if Resource_['allow_active_pane']: flags |= aui.AUI_MGR_ALLOW_ACTIVE_PANE if Resource_['transparent_drag']: flags |= aui.AUI_MGR_TRANSPARENT_DRAG if Resource_['transparent_hint']: flags |= aui.AUI_MGR_TRANSPARENT_HINT if Resource_['venetian_blinds_hint']: flags |= aui.AUI_MGR_VENETIAN_BLINDS_HINT if Resource_['rectangle_hint']: flags |= aui.AUI_MGR_RECTANGLE_HINT if Resource_['hint_fade']: flags |= aui.AUI_MGR_HINT_FADE if Resource_['no_venetian_blinds_fade']: flags |= aui.AUI_MGR_NO_VENETIAN_BLINDS_FADE self.aui_manager.SetFlags(flags) # Установка градиентной заливки AUI панелей gradient = AUI_PANE_GRADIENTS[Resource_['pane_gradient']] self.aui_manager.setGradient(gradient) # События self.Bind(wx.EVT_SIZE, self.OnSize) self.Bind(wx.EVT_CLOSE, self.OnClose) self.Bind(wx.EVT_SHOW, self.OnOpen)
def Show(self, flag=True): flag = bool(flag) if not self.IsShown() and flag: wx.TreeCtrl.Show(self, True) auiManager = eg.document.frame.auiManager from wx.lib.agw import aui if not isinstance(auiManager, aui.AuiManager): import wx.aui as aui pane = aui.AuiPaneInfo() pane.Name('globalmanagertree').Caption(' ' + Text.treeTitle) pane.Bottom().MinSize((100, 100)).Floatable(True).Dockable(True) pane.MaximizeButton(True).CloseButton(True).DestroyOnClose(True) auiManager.AddPane(self, pane) auiManager.Update() elif self.IsShown() and not flag: wx.TreeCtrl.Show(self, False)
def __CreateEditorView(self): """生成代码编辑区""" # 创建auiNotebook self.nb = aui.AuiNotebook(self, -1) # 添加欢迎页 panel = wx.Panel(self.nb, -1) sizer = wx.BoxSizer() bmp = wx.StaticBitmap(panel, -1, wx.Bitmap(os.path.join("res", "PyEditor.png"))) sizer.Add(bmp, 1, flag=wx.ALIGN_CENTER) panel.SetSizer(sizer) panel.SetAutoLayout(True) self.nb.AddPage(panel, "欢迎") self._mgr.AddPane( self.nb, aui.AuiPaneInfo().Name("code edit").CenterPane().PaneBorder(False))
def OnSegmentAnneal(self, event): newImages = [np.zeros(self.image.data.shape[:3], 'b') for i in range(self.image.data.shape[3])] im = ImageStack(newImages) im.mdh.copyEntriesFrom(self.image.mdh) im.mdh['Parent'] = self.image.filename if self.dsviewer.mode == 'visGUI': mode = 'visGUI' else: mode = 'lite' self.res = ViewIm3D(im, parent=wx.GetTopLevelParent(self.dsviewer), mode = mode, glCanvas = self.dsviewer.glCanvas) self.panAnneal = SegmentationPanel(self.res, self.image, newImages) self.pinfo1 = aui.AuiPaneInfo().Name("annealPanel").Left().Caption('Segmentation').DestroyOnClose(True).CloseButton(False).MinimizeButton(True).MinimizeMode(aui.AUI_MINIMIZE_CAPT_SMART|aui.AUI_MINIMIZE_POS_RIGHT)#.MinimizeButton(True).MinimizeMode(aui.AUI_MINIMIZE_CAPT_SMART|aui.AUI_MINIMIZE_POS_RIGHT)#.CaptionVisible(False) self.res._mgr.AddPane(self.panAnneal, self.pinfo1) self.res._mgr.Update()
def __init__(self, dsviewer): self.do = dsviewer.do self.dsviewer = dsviewer self.cur_label_index = 1 self.line_width = 1 self.lock_mode = 'None' self._annotations = [] self.show_annotations = True self._snake_settings = _Snake_Settings() self.selected_annotations = [] self.penColsA = [ wx.Colour(*plt.cm.hsv(v, alpha=0.5, bytes=True)) for v in np.linspace(0, 1, 16) ] #self.trackPens = [wx.Pen(c, 4) for c in self.penColsA] dsviewer.AddMenuItem('Annotation', "Refine selection\tCtrl-R", self.snake_refine_trace) dsviewer.AddMenuItem('Annotation', "Draw line\tCtrl-L", self.add_curved_line) dsviewer.AddMenuItem('Annotation', itemType='separator') dsviewer.AddMenuItem('Annotation', "Train SVM Classifier", self.train_svm) dsviewer.AddMenuItem('Annotation', "Train Naive Bayes Classifier", self.train_naive_bayes) self.do.on_selection_end.connect(self.snake_refine_trace) self.do.overlays.append(self.DrawOverlays) self.labelPanel = LabelPanel(dsviewer, self) self.labelPanel.SetSize(self.labelPanel.GetBestSize()) pinfo2 = aui.AuiPaneInfo().Name("labelPanel").Right().Caption( 'Annotation').CloseButton(False).MinimizeButton(True).MinimizeMode( aui.AUI_MINIMIZE_CAPT_SMART | aui.AUI_MINIMIZE_POS_RIGHT) #.CaptionVisible(False) dsviewer._mgr.AddPane(self.labelPanel, pinfo2)
def create(self, pluginDefinition): name = pluginDefinition[PluginManager.NAME] module = importlib.import_module( pluginDefinition[PluginManager.MODULE]) panelClass = getattr(module, pluginDefinition[PluginManager.CLASS]) size = pluginDefinition[PluginManager.SIZE] panel = panelClass(util.getMainFrame(), pluginDefinition) location = pluginDefinition[ PluginManager. LOCATION] if PluginManager.LOCATION in pluginDefinition else PluginManager.FLOAT auiManager = util.auiManager() paneInfo = aui.AuiPaneInfo() paneInfo = paneInfo.Caption(name).Name(name).BestSize(size) if location == PluginManager.TOP: paneInfo = paneInfo.Top() elif location == PluginManager.BOTTOM: paneInfo = paneInfo.Bottom() elif location == PluginManager.LEFT: paneInfo = paneInfo.Left() elif location == PluginManager.RIGHT: paneInfo = paneInfo.Right() elif location == PluginManager.FLOAT: paneInfo = paneInfo.Float() elif location == PluginManager.CENTER: paneInfo = paneInfo.Center() else: logging.error("Unknown Location: %s", location) paneInfo = paneInfo.Float() auiManager.AddPane(panel, paneInfo) if PluginManager.VISIBLE in pluginDefinition: self.showPlugin( name, pvscomm.PVSCommandManager().pvsMode in pluginDefinition[PluginManager.VISIBLE]) else: self.showPlugin(name, False) auiManager.Update() pub.sendMessage( PUB_ADDITEMTOVIEWMENU, name=name, callBackFunction=(lambda ce: self.togglePluginVisibility(name))) return None
def init_table(self): self.tablenbwrap = wx.Panel(self) sizer = wx.BoxSizer(wx.VERTICAL) self.tablenb = GridNoteBook(self.tablenbwrap) sizer.Add(self.tablenb, 1, wx.EXPAND | wx.ALL, 0) self.tablenbwrap.SetSizer(sizer) self.tablenbwrap.Layout() self.auimgr.AddPane( self.tablenbwrap, aui.AuiPaneInfo().Bottom().CaptionVisible(True).PinButton(True). Dock().Hide().MaximizeButton(True).Resizable().FloatingSize( (800, 600)).BestSize( (120, 120)).Caption('Table').BottomDockable(True).TopDockable( False).LeftDockable(True).RightDockable(True)) self.tablenb.Bind(wx.lib.agw.aui.EVT_AUINOTEBOOK_PAGE_CHANGED, self.on_active_table) self.tablenb.Bind(wx.lib.agw.aui.EVT_AUINOTEBOOK_PAGE_CLOSE, self.on_close_table)
def init_status(self): self.stapanel = stapanel = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) sizersta = wx.BoxSizer( wx.HORIZONTAL ) self.txt_info = wx.StaticText( stapanel, wx.ID_ANY, "ImagePy v0.2", wx.DefaultPosition, wx.DefaultSize, 0 ) self.txt_info.Wrap( -1 ) sizersta.Add( self.txt_info, 1, wx.ALIGN_BOTTOM|wx.BOTTOM|wx.LEFT|wx.RIGHT, 2 ) #self.pro_bar = wx.Gauge( stapanel, wx.ID_ANY, 100, wx.DefaultPosition, wx.Size( 100,15 ), wx.GA_HORIZONTAL ) self.pro_bar = ProgressBar(stapanel) sizersta.Add( self.pro_bar, 0, wx.ALL|wx.ALIGN_CENTER, 0 ) stapanel.SetSizer(sizersta) class OpenDrop(wx.FileDropTarget): def __init__(self, app): wx.FileDropTarget.__init__(self) self.app = app def OnDropFiles(self, x, y, path): self.app.run_macros(["Open>{'path':'%s'}"%i.replace('\\', '/') for i in path]) stapanel.SetDropTarget(OpenDrop(self)) self.auimgr.AddPane( stapanel, aui.AuiPaneInfo() .Bottom() .CaptionVisible( False ).PinButton( True ) .PaneBorder( False ).Dock().Resizable().FloatingSize( wx.DefaultSize ).DockFixed( True ) . MinSize(wx.Size(-1, 20)). MaxSize(wx.Size(-1, 20)).Layer( 10 ) )
def OnAddX(self, evt=None): """ add XZ viewer """ pps = self._mgr.GetAllPanes() if not any([pp.name == 'XZ' for pp in pps]): self.viewers.append( viewer2.GLViewer(self, dims=(0, 2), style=wx.BORDER_SUNKEN, size=wx.Size(self.doc.nx, self.doc.nz))) self._mgr.AddPane( self.viewers[-1], aui.AuiPaneInfo().Floatable(False).Name('XZ').Caption( "XZ").BestSize( (self.doc.nz, self.doc.ny)).CenterPane().Position(1)) self.viewers[-1].setMyDoc(self.doc, self) self.viewers[-1].setAspectRatio(self.doc.pxlsiz[-3] / self.doc.pxlsiz[-1]) else: self._mgr.GetPane('XZ').Show()
def __init__(self): wx.Frame.__init__(self, None, wx.ID_ANY, "AGW AUI Notebook Tutorial", size=(600,400)) self._mgr = aui.AuiManager() # tell AuiManager to manage this frame self._mgr.SetManagedWindow(self) notebook = aui.AuiNotebook(self) panelOne = TabPanelOne(notebook) panelTwo = TabPanelOne(notebook) notebook.AddPage(panelOne, "PanelOne", False) notebook.AddPage(panelTwo, "PanelTwo", False) self._mgr.AddPane(notebook, aui.AuiPaneInfo().Name("notebook_content"). CenterPane().PaneBorder(False)) self._mgr.Update()
def init_status(self): self.stapanel = stapanel = wx.Panel(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL) sizersta = wx.BoxSizer(wx.HORIZONTAL) self.txt_info = wx.StaticText(stapanel, wx.ID_ANY, "ImagePy v0.2", wx.DefaultPosition, wx.DefaultSize, 0) self.txt_info.Wrap(-1) sizersta.Add(self.txt_info, 1, wx.ALIGN_BOTTOM | wx.BOTTOM | wx.LEFT | wx.RIGHT, 2) self.pro_bar = wx.Gauge(stapanel, wx.ID_ANY, 100, wx.DefaultPosition, wx.Size(100, 15), wx.GA_HORIZONTAL) sizersta.Add(self.pro_bar, 0, wx.ALIGN_BOTTOM | wx.BOTTOM | wx.LEFT | wx.RIGHT, 2) stapanel.SetSizer(sizersta) self.auimgr.AddPane( stapanel, aui.AuiPaneInfo().Bottom().CaptionVisible(False).PinButton( True).PaneBorder(False).Dock().Resizable().FloatingSize( wx.DefaultSize).DockFixed(True).MinSize(wx.Size( -1, 20)).MaxSize(wx.Size(-1, 20)).Layer(10))
def run_main(): window = aui_manager.GetManagedWindow() if 'SCT_DIR' not in os.environ: dlg = wx.MessageDialog( window, 'Spinal Cord Toolbox (SCT) was not ' 'found in your system. Make sure you open fsleyes ' 'from the Terminal (not by clicking on the App). ' 'If you are indeed running from the Terminal, please ' 'check the installation procedure at: ' 'https://github.com/neuropoly/spinalcordtoolbox', 'SCT not found!', wx.OK | wx.ICON_INFORMATION) dlg.ShowModal() dlg.Destroy() return # Adding panels notebook = aui.AuiNotebook(parent=window) panel_propseg = TabPanelPropSeg(parent=notebook) panel_sc = TabPanelSCSeg(parent=notebook) panel_gm = TabPanelGMSeg(parent=notebook) panel_vlb = TabPanelVertLB(parent=notebook) panel_reg = TabPanelRegisterToTemplate(parent=notebook) notebook.AddPage(page=panel_propseg, caption="sct_propseg", select=True) notebook.AddPage(page=panel_sc, caption="sct_deepseg_sc", select=False) notebook.AddPage(page=panel_gm, caption="sct_deepseg_gm", select=False) notebook.AddPage(page=panel_vlb, caption="sct_label_vertebrae", select=False) notebook.AddPage(page=panel_reg, caption="sct_register_to_template", select=False) aui_manager.AddPane( notebook, aui.AuiPaneInfo().Name("notebook_content").CenterPane().PaneBorder( False)) aui_manager.Update()
def __init__(self, dsviewer): self.dsviewer = dsviewer #self.view = dsviewer.view self.do = dsviewer.do self.image = dsviewer.image self.mask = None #self.rois = [] self.curLabel = 1 self.lineWidth = 1 #dsviewer.do.overlays.append(self.DrawOverlays) dsviewer.AddMenuItem('Segmentation', 'Create mask', self.OnCreateMask) dsviewer.AddMenuItem('Segmentation', "Fill selection\tCtrl-F", self.FillSelection) dsviewer.AddMenuItem('Segmentation', "Draw line\tCtrl-L", self.DrawLine) dsviewer.AddMenuItem('Segmentation', "Train Classifier", self.OnSVMTrain) dsviewer.AddMenuItem('Segmentation', "SVM Segmentation", self.OnSVMSegment) dsviewer.AddMenuItem('Segmentation', 'Save Classifier', self.OnSaveClassifier) dsviewer.AddMenuItem('Segmentation', 'Load Classifier', self.OnLoadClassifier) #accel_tbl = wx.AcceleratorTable([(wx.ACCEL_CTRL, ord('k'), PLOT_PROFILE )]) #self.dsviewer.SetAcceleratorTable(accel_tbl) self.labelPanel = LabelPanel(dsviewer, self) self.labelPanel.SetSize(self.labelPanel.GetBestSize()) pinfo2 = aui.AuiPaneInfo().Name("labelPanel").Right().Caption( 'Labels').CloseButton(False).MinimizeButton(True).MinimizeMode( aui.AUI_MINIMIZE_CAPT_SMART | aui.AUI_MINIMIZE_POS_RIGHT) #.CaptionVisible(False) dsviewer._mgr.AddPane(self.labelPanel, pinfo2)