def showDetail(self, idx): """ Pop up the detail window to show all the sensor parameters value.""" if self.infoWindow is None and gv.iDetailPanel is None: posF = gv.iMainFrame.GetPosition() x = posF[0] y = posF[1] + 300 if not self.selectedPts is None: x += self.selectedPts[0] y += self.selectedPts[1] self.infoWindow = wx.MiniFrame(gv.iMainFrame, -1, 'Attack Point', pos=(x + 10, y + 10), size=(150, 150), style=wx.DEFAULT_FRAME_STYLE) gv.iDetailPanel = rwp.PanelDetailInfo(self.infoWindow, idx) gv.iDetailPanel.updateState(idx=idx, state='Normal', origalV=0, changedV=0) gv.iAttackCtrlPanel.loatAttPtState(idx) self.infoWindow.Bind(wx.EVT_CLOSE, self.infoWinClose) self.infoWindow.Show() else: posF = gv.iMainFrame.GetPosition() x = posF[0] y = posF[1] + 300 if not self.selectedPts is None: x += self.selectedPts[0] y += self.selectedPts[1] self.infoWindow.SetPosition(wx.Point(x + 10, y + 10)) gv.iDetailPanel.updateState(idx=idx, state='Normal', origalV=0, changedV=0)
def makeTestWin(self, res, name): '''Method can be overridden by derived classes to create custom test view. @param res: C{wx.xrc.XmlResource} object with current test resource. @param name: XRC ID of tested object. ''' testWin = view.testWin if self.isTopLevel: # Top-level window creates frame itself frame = None object = res.LoadObject(view.frame, STD_NAME, self.klass) object.Fit() testWin.size = object.GetSize() else: # Create MiniFrame to hold selected subtree frame = testWin.frame if not frame: frame = wx.MiniFrame(view.frame, -1, '%s: %s' % (self.klass, name), name=STD_NAME, style=wx.CAPTION | wx.CLOSE_BOX | wx.RESIZE_BORDER) frame.panel = wx.Panel(frame) object = res.LoadObject(frame.panel, STD_NAME, self.klass) if not object or not isinstance(object, wx.Window): raise TestWinError object.SetPosition((10, 10)) if g.conf.fitTestWin: object.Fit() if frame: frame.SetClientSize(object.GetSize() + (20, 20)) testWin.size = frame.GetSize() return frame, object
def __init__(self, parent, overlayList, displayCtx, frame): """Create a ``ViewPanel``. All arguments are passed through to the :class:`.FSLeyesPanel` constructor. """ fslpanel.FSLeyesPanel.__init__( self, parent, overlayList, displayCtx, frame) self.__profileManager = profiles.ProfileManager( self, overlayList, displayCtx) # The __centrePanel attribute stores a reference # to the main (centre) panel on this ViewPanel. # It is set by sub-class implementations via # the centrePanel property. # # The panels dictionary stores a collection # of {type : instance} mappings of active # FSLeyes control panels that are contained # in this view panel. self.__centrePanel = None self.__panels = {} # See note in FSLeyesFrame about # the user of aero docking guides. self.__auiMgr = aui.AuiManager( self, agwFlags=(aui.AUI_MGR_RECTANGLE_HINT | aui.AUI_MGR_NO_VENETIAN_BLINDS_FADE | aui.AUI_MGR_ALLOW_FLOATING | aui.AUI_MGR_AERO_DOCKING_GUIDES | aui.AUI_MGR_LIVE_RESIZE)) self.__auiMgr.SetDockSizeConstraint(0.5, 0.5) self.__auiMgr.Bind(aui.EVT_AUI_PANE_CLOSE, self.__onPaneClose) # Use a different listener name so that subclasses # can register on the same properties with self.name lName = 'ViewPanel_{}'.format(self.name) self.addListener('profile', lName, self.__profileChanged) # A very shitty necessity. When panes are floated, # the AuiManager sets the size of the floating frame # to the minimum size of the panel, without taking # into account the size of its borders/title bar, # meaning that the panel size is too small. Here, # we're just creating a dummy MiniFrame (from which # the AuiFloatingFrame derives), and saving the size # of its trimmings for later use in the togglePanel # method. ff = wx.MiniFrame(self) size = ff.GetSize().Get() clientSize = ff.GetClientSize().Get() self.__floatOffset = (size[0] - clientSize[0], size[1] - clientSize[1]) ff.Destroy()
def SetFloatable(self, float): self.floatable = float #Find the size of a title bar. if not hasattr(self, 'titleheight'): test = wx.MiniFrame(None, -1, "TEST") test.SetClientSize((0, 0)) self.titleheight = test.GetSize()[1] test.Destroy()
def _create_ui(self, size): panel = wx.MiniFrame(self) panel.SetBackgroundColour(POPUP_BACKGROUND) szr = VerticalSizer() self._details = HtmlWindow(self, size=size) szr.add_expanding(self._details) panel.SetSizer(szr) panel.Fit() return panel
def OnInit(self): #if not pname: pname = 'creaturepalstd.itp' frame = wx.MiniFrame(None, -1, "Palette", wx.DefaultPosition, wx.Size(200, 400)) self.win = PaletteWindow(frame, -1) self.win.fromPalette(Palette.getStandardPalette('Creature')) frame.Show(True) self.SetTopWindow(frame) return True
def _create_ui(self, size): panel = wx.MiniFrame(self) #TODO: Make this colour dependent on colours cycle or by Library panel.SetBackgroundColour(self.color_background) panel.SetForegroundColour(self.color_foreground) szr = VerticalSizer() self._details = HtmlWindow(self, size=size) szr.add_expanding(self._details) panel.SetSizer(szr) panel.Fit() return panel
def onSetupCheckExp(self, event): """ Pop-up the check experiment setup window. """ if self.infoWindow is None and gv.iSetupPanel is None: self.updateLock = True # Lock all the data load process self.infoWindow = wx.MiniFrame(self, -1, 'NetFetcher [Check] Experiment Setup', pos=(300, 300), size=(620, 160), style=wx.DEFAULT_FRAME_STYLE) gv.iSetupPanel = dvp.PanelSetting(self.infoWindow, 1) self.infoWindow.Bind(wx.EVT_CLOSE, self.infoWinClose) self.infoWindow.Show()
def FloatPage(self, pageIndex): pageTitle = self.GetPageText(pageIndex) pageContents = self.GetPage(pageIndex) frame = wx.MiniFrame( self, title=pageTitle, style=wx.DEFAULT_FRAME_STYLE) #|wx.FRAME_TOOL_WINDOW) frame.SetClientSize(pageContents.GetEffectiveMinSize()) pageContents.Reparent(frame) self.RemovePage(pageIndex) frame.Bind(wx.EVT_CLOSE, self.onCloseFloatingPage) frame.Move(wx.GetMousePosition()) frame.Show()
def _create_ui(self, size): if wx.VERSION >= (3, 0, 3, ''): # DEBUG wxPhoenix panel = wx.MiniFrame(self) # DEBUG wx.Panel would not detach on wxPython 4 else: panel = wx.Panel(self) panel.SetBackgroundColour(POPUP_BACKGROUND) szr = VerticalSizer() self._details = HtmlWindow(self, size=size) szr.add_expanding(self._details) panel.SetSizer(szr) panel.Fit() return panel
def showDetail(self, event): """ Pop up the detail window to show all the drone state value.""" if self.infoWindow is None and gv.iDetailPanel is None: posF = gv.iMainFrame.GetPosition() self.infoWindow = wx.MiniFrame(gv.iMainFrame, -1, 'UAV Detail', pos=(posF[0] + 511, posF[1]), size=(130, 500), style=wx.DEFAULT_FRAME_STYLE) gv.iDetailPanel = tp.PanelDetail(self.infoWindow, self.droneRsp.getCrtState()) self.infoWindow.Bind(wx.EVT_CLOSE, self.infoWinClose) self.infoWindow.Show()
def showDebug(self, evnt): """ pop-up the debug window. """ if self.debugFrame == None: posF = gv.iMainFrame.GetPosition() self.debugFrame = wx.MiniFrame(gv.iMainFrame, -1, 'Debug Panel', pos=(posF[0] + 800, posF[1]), size=(240, 420), style=wx.DEFAULT_FRAME_STYLE) gv.iDetailPanel = PanelDebug(self.debugFrame) self.debugFrame.Bind(wx.EVT_CLOSE, self.infoWinClose) self.debugFrame.Show()
def Float(self, bool): "Floats or docks the toolbar programmatically." if bool: self.parentframe = self.GetParent() print(self.title) if self.title: useStyle = wx.DEFAULT_FRAME_STYLE else: useStyle = wx.THICK_FRAME self.floatframe = wx.MiniFrame(self.parentframe, -1, self.title, style=useStyle) self.Reparent(self.floatframe) self.parentframe.SetToolBar(None) self.floating = 1 psize = self.parentframe.GetSize() self.parentframe.SetSize((0, 0)) self.parentframe.SetSize(psize) self.floatframe.SetToolBar(self) self.oldcolor = self.GetBackgroundColour() w = psize[0] h = self.GetSize()[1] if self.title: h = h + self.titleheight self.floatframe.SetSize((w, h)) self.floatframe.SetClientSize(self.GetSize()) newpos = self.parentframe.GetPosition() newpos.y = newpos.y + _DOCKTHRESHOLD * 2 self.floatframe.SetPosition(newpos) self.floatframe.Show(True) self.floatframe.Bind(wx.EVT_CLOSE, self.OnDock) #self.floatframe.Bind(wx.EVT_MOVE, self.OnMove) else: self.Reparent(self.parentframe) self.parentframe.SetToolBar(self) self.floating = 0 self.floatframe.SetToolBar(None) self.floatframe.Destroy() size = self.parentframe.GetSize() self.parentframe.SetSize((0, 0)) self.parentframe.SetSize(size) self.SetBackgroundColour(self.oldcolor)
def __init_dropdown(self, parent = None): szr_dropdown = None try: #raise NotImplementedError # uncomment for testing self.__dropdown_needs_relative_position = False self._picklist_dropdown = wx.PopupWindow(parent) list_parent = self._picklist_dropdown self.__use_fake_popup = False except NotImplementedError: self.__use_fake_popup = True # on MacOSX wx.PopupWindow is not implemented, so emulate it add_picklist_to_sizer = True szr_dropdown = wx.BoxSizer(wx.VERTICAL) # using wx.MiniFrame self.__dropdown_needs_relative_position = False self._picklist_dropdown = wx.MiniFrame ( parent = parent, id = -1, style = wx.SIMPLE_BORDER | wx.FRAME_FLOAT_ON_PARENT | wx.FRAME_NO_TASKBAR | wx.POPUP_WINDOW ) scroll_win = wx.ScrolledWindow(parent = self._picklist_dropdown, style = wx.NO_BORDER) scroll_win.SetSizer(szr_dropdown) list_parent = scroll_win # using wx.Window #self.__dropdown_needs_relative_position = True #self._picklist_dropdown = wx.ScrolledWindow(parent=parent, style = wx.RAISED_BORDER) #self._picklist_dropdown.SetSizer(szr_dropdown) #list_parent = self._picklist_dropdown self.__mac_log('dropdown parent: %s' % self._picklist_dropdown.GetParent()) self._picklist = cPhraseWheelListCtrl ( list_parent, style = wx.LC_NO_HEADER ) self._picklist.InsertColumn(0, u'') if szr_dropdown is not None: szr_dropdown.Add(self._picklist, 1, wx.EXPAND) self._picklist_dropdown.Hide()
def onLeftClick(self, event): """ Handle the left mouse button click on the map panel.""" x, y = event.GetPosition() print("PanelMap: The user has clicked the pos %s" % str((x, y))) # Chech the clicked components. if gv.iMapMgr.signalDict['Monitoring Cam'][0].checkNear(x, y, 20): if self.infoWindow is None and gv.iDetailPanel is None: posF = gv.iMainFrame.GetPosition() PosShow = (x + posF[0] + 30, y + posF[1] + 30) # Pop up the camera display window. self.infoWindow = wx.MiniFrame(gv.iMainFrame, -1, 'Monitoring Camera View', pos=PosShow, size=(300, 230), style=wx.DEFAULT_FRAME_STYLE) gv.iDetailPanel = rwp.PanelCameraView(self.infoWindow, 0) self.infoWindow.Bind(wx.EVT_CLOSE, self.infoWinClose) self.infoWindow.Show()
def HistoryPopup(parent, hist, imgs): f = wx.MiniFrame(parent, -1, _('Editor status history'), size=(350, 200)) lc = wx.ListCtrl(f, style=wx.LC_REPORT | wx.LC_VRULES | wx.LC_NO_HEADER) lc.il = wx.ImageList(16, 16) idxs = {} for tpe, img in imgs.items(): idxs[tpe] = lc.il.Add(img) lc.SetImageList(lc.il, wx.IMAGE_LIST_SMALL) lc.InsertColumn(0, _('Time')) lc.InsertColumn(1, _('Message')) lc.SetColumnWidth(0, 75) lc.SetColumnWidth(1, 750) for tpe, tme, msg, _bell in hist: lc.InsertImageStringItem(0, tme, idxs[tpe]) lc.SetStringItem(0, 1, msg) f.Center() f.Show() wx.PostEvent(f, wx.SizeEvent(f.GetSize())) return f
def OnGenerateCodeSnippet(self, event): msg = self.message.GetValue() cap = self.caption.GetValue() sty = self.GetStyleString() generateCodeTemplate = '''\ def OnShowMessageDialog(self, event=None): msg = "{msg}" cap = "{cap}" sty = {sty} dlg = wx.MessageDialog(self, message=msg, caption=cap, style=sty ) dlg.ShowModal() dlg.Destroy()'''.format(msg=msg, cap=cap, sty=sty) frame = wx.MiniFrame(self, title="Generated Code Snippet", style=wx.DEFAULT_FRAME_STYLE) frame.text = wx.TextCtrl(frame, -1, generateCodeTemplate, style=wx.TE_MULTILINE | wx.TE_NOHIDESEL) frame.Show()
def test_minifram1(self): f = wx.MiniFrame() f.Create(self.frame, title="Hello") f.Show()
def test_minifram2(self): f = wx.MiniFrame(self.frame, title="Hello") f.Show()
def OnCreate(self, doc, flags): config = wx.ConfigBase_Get() windowLoc = self._service.GetEmbeddedWindowLocation() if windowLoc == FLOATING_MINIFRAME: pos = config.ReadInt(self._service.GetServiceName() + "FrameXLoc", -1), config.ReadInt(self._service.GetServiceName() + "FrameYLoc", -1) # make sure frame is visible screenWidth = wx.SystemSettings.GetMetric(wx.SYS_SCREEN_X) screenHeight = wx.SystemSettings.GetMetric(wx.SYS_SCREEN_Y) if pos[0] < 0 or pos[0] >= screenWidth or pos[1] < 0 or pos[1] >= screenHeight: pos = wx.DefaultPosition size = wx.Size(config.ReadInt(self._service.GetServiceName() + "FrameXSize", -1), config.ReadInt(self._service.GetServiceName() + "FrameYSize", -1)) title = _(self._service.GetServiceName()) if wx.GetApp().GetDocumentManager().GetFlags() & wx.lib.docview.DOC_SDI and wx.GetApp().GetAppName(): title = title + " - " + wx.GetApp().GetAppName() frame = wx.MiniFrame(wx.GetApp().GetTopWindow(), -1, title, pos = pos, size = size, style = wx.CLOSE_BOX|wx.CAPTION|wx.SYSTEM_MENU) wx.EVT_CLOSE(frame, self.OnCloseWindow) elif wx.GetApp().IsMDI(): self._embeddedWindow = wx.GetApp().GetTopWindow().GetEmbeddedWindow(windowLoc) frame = self._embeddedWindow else: pos = config.ReadInt(self._service.GetServiceName() + "FrameXLoc", -1), config.ReadInt(self._service.GetServiceName() + "FrameYLoc", -1) # make sure frame is visible screenWidth = wx.SystemSettings.GetMetric(wx.SYS_SCREEN_X) screenHeight = wx.SystemSettings.GetMetric(wx.SYS_SCREEN_Y) if pos[0] < 0 or pos[0] >= screenWidth or pos[1] < 0 or pos[1] >= screenHeight: pos = wx.DefaultPosition size = wx.Size(config.ReadInt(self._service.GetServiceName() + "FrameXSize", -1), config.ReadInt(self._service.GetServiceName() + "FrameYSize", -1)) title = _(self._service.GetServiceName()) if wx.GetApp().GetDocumentManager().GetFlags() & wx.lib.docview.DOC_SDI and wx.GetApp().GetAppName(): title = title + " - " + wx.GetApp().GetAppName() frame = wx.GetApp().CreateDocumentFrame(self, doc, flags, pos = pos, size = size) frame.SetTitle(title) if config.ReadInt(self._service.GetServiceName() + "FrameMaximized", False): frame.Maximize(True) wx.EVT_CLOSE(frame, self.OnCloseWindow) self.SetFrame(frame) sizer = wx.BoxSizer(wx.VERTICAL) windowLoc = self._service.GetEmbeddedWindowLocation() if self._embeddedWindow or windowLoc == FLOATING_MINIFRAME: if (self._service.GetEmbeddedWindowLocation() == wx.lib.pydocview.EMBEDDED_WINDOW_BOTTOM): if ServiceView.bottomTab == None: iconList = wx.ImageList(16, 16, 3) interpreter_icon_path = os.path.join(sysutilslib.mainModuleDir, "noval", "tool", "bmp_source", "interpreter.ico") interpreter_icon = wx.Icon(interpreter_icon_path, wx.BITMAP_TYPE_ICO) ServiceView.InterpreterIconIndex = iconList.AddIcon(interpreter_icon) search_icon_path = os.path.join(sysutilslib.mainModuleDir, "noval", "tool", "bmp_source", "search.ico") search_icon = wx.Icon(search_icon_path, wx.BITMAP_TYPE_ICO) ServiceView.SearchIconIndex = iconList.AddIcon(search_icon) debug_icon_path = os.path.join(sysutilslib.mainModuleDir, "noval", "tool", "bmp_source", "debug.ico") debug_icon = wx.Icon(debug_icon_path, wx.BITMAP_TYPE_ICO) ServiceView.DebugRunIconIndex = iconList.AddIcon(debug_icon) ServiceView.bottomTab = wx.Notebook(frame, wx.NewId(), (0,0), (100,100), wx.LB_DEFAULT, "Bottom Tab") ServiceView.bottomTab.AssignImageList(iconList) wx.EVT_RIGHT_DOWN(ServiceView.bottomTab, self.OnNotebookRightClick) wx.EVT_MIDDLE_DOWN(ServiceView.bottomTab, self.OnNotebookMiddleClick) sizer.Add(ServiceView.bottomTab, 1, wx.TOP|wx.EXPAND, 4) def OnFrameResize(event): ServiceView.bottomTab.SetSize(ServiceView.bottomTab.GetParent().GetSize()) frame.Bind(wx.EVT_SIZE, OnFrameResize) # Factor this out. self._control = self._CreateControl(ServiceView.bottomTab, wx.NewId()) if self._control != None: ServiceView.bottomTab.AddPage(self._control, self._service.GetServiceName()) if self._service.GetIconIndex() != -1: index = ServiceView.bottomTab.GetPageCount() - 1 ServiceView.bottomTab.SetPageImage(index,self._service.GetIconIndex()) ServiceView.bottomTab.Layout() else: # Factor this out. self._control = self._CreateControl(frame, wx.NewId()) sizer.Add(self._control) else: # Factor this out. self._control = self._CreateControl(frame, wx.NewId()) sizer.Add(self._control, 1, wx.EXPAND, 0) frame.SetSizer(sizer) frame.Layout() self.Activate() return True
def OnCreate(self, doc, flags): config = wx.ConfigBase_Get() windowLoc = self._service.GetEmbeddedWindowLocation() if windowLoc == FLOATING_MINIFRAME: pos = config.ReadInt(self._service.GetServiceName() + "FrameXLoc", -1), config.ReadInt( self._service.GetServiceName() + "FrameYLoc", -1) # make sure frame is visible screenWidth = wx.SystemSettings.GetMetric(wx.SYS_SCREEN_X) screenHeight = wx.SystemSettings.GetMetric(wx.SYS_SCREEN_Y) if pos[0] < 0 or pos[0] >= screenWidth or pos[1] < 0 or pos[ 1] >= screenHeight: pos = wx.DefaultPosition size = wx.Size( config.ReadInt(self._service.GetServiceName() + "FrameXSize", -1), config.ReadInt(self._service.GetServiceName() + "FrameYSize", -1)) title = _(self._service.GetServiceName()) if wx.GetApp().GetDocumentManager().GetFlags( ) & wx.lib.docview.DOC_SDI and wx.GetApp().GetAppName(): title = title + " - " + wx.GetApp().GetAppName() frame = wx.MiniFrame(wx.GetApp().GetTopWindow(), -1, title, pos=pos, size=size, style=wx.CLOSE_BOX | wx.CAPTION | wx.SYSTEM_MENU) wx.EVT_CLOSE(frame, self.OnCloseWindow) elif wx.GetApp().IsMDI(): self._embeddedWindow = wx.GetApp().GetTopWindow( ).GetEmbeddedWindow(windowLoc) frame = self._embeddedWindow else: pos = config.ReadInt(self._service.GetServiceName() + "FrameXLoc", -1), config.ReadInt( self._service.GetServiceName() + "FrameYLoc", -1) # make sure frame is visible screenWidth = wx.SystemSettings.GetMetric(wx.SYS_SCREEN_X) screenHeight = wx.SystemSettings.GetMetric(wx.SYS_SCREEN_Y) if pos[0] < 0 or pos[0] >= screenWidth or pos[1] < 0 or pos[ 1] >= screenHeight: pos = wx.DefaultPosition size = wx.Size( config.ReadInt(self._service.GetServiceName() + "FrameXSize", -1), config.ReadInt(self._service.GetServiceName() + "FrameYSize", -1)) title = _(self._service.GetServiceName()) if wx.GetApp().GetDocumentManager().GetFlags( ) & wx.lib.docview.DOC_SDI and wx.GetApp().GetAppName(): title = title + " - " + wx.GetApp().GetAppName() frame = wx.GetApp().CreateDocumentFrame(self, doc, flags, pos=pos, size=size) frame.SetTitle(title) if config.ReadInt( self._service.GetServiceName() + "FrameMaximized", False): frame.Maximize(True) wx.EVT_CLOSE(frame, self.OnCloseWindow) self.SetFrame(frame) sizer = wx.BoxSizer(wx.VERTICAL) windowLoc = self._service.GetEmbeddedWindowLocation() if self._embeddedWindow or windowLoc == FLOATING_MINIFRAME: if (self._service.GetEmbeddedWindowLocation() == wx.lib.pydocview.EMBEDDED_WINDOW_BOTTOM): if ServiceView.bottomTab == None: ServiceView.bottomTab = wx.Notebook( frame, wx.NewId(), (0, 0), (100, 100), wx.LB_DEFAULT, "Bottom Tab") wx.EVT_RIGHT_DOWN(ServiceView.bottomTab, self.OnNotebookRightClick) wx.EVT_MIDDLE_DOWN(ServiceView.bottomTab, self.OnNotebookMiddleClick) sizer.Add(ServiceView.bottomTab, 1, wx.TOP | wx.EXPAND, 4) def OnFrameResize(event): ServiceView.bottomTab.SetSize( ServiceView.bottomTab.GetParent().GetSize()) frame.Bind(wx.EVT_SIZE, OnFrameResize) # Factor this out. self._control = self._CreateControl(ServiceView.bottomTab, wx.NewId()) if self._control != None: ServiceView.bottomTab.AddPage( self._control, self._service.GetServiceName()) ServiceView.bottomTab.Layout() else: # Factor this out. self._control = self._CreateControl(frame, wx.NewId()) sizer.Add(self._control) else: # Factor this out. self._control = self._CreateControl(frame, wx.NewId()) sizer.Add(self._control, 1, wx.EXPAND, 0) frame.SetSizer(sizer) frame.Layout() self.Activate() return True
#!/usr/bin/env python #-Imports.--------------------------------------------------------------------- #--wxPython Imports. import wx if __name__ == '__main__': app = wx.App() miniframe = wx.MiniFrame(None, -1, 'Minimal MiniFrame Demo', style=wx.DEFAULT_FRAME_STYLE) miniframe.Show() app.MainLoop()