def __init__(self, editor): wx.Frame.__init__(self, None, -1, editor.title, size=wx.GetApp().last_window_size) self.raw_menubar = wx.MenuBar() self.SetMenuBar(self.raw_menubar) self.Bind(wx.EVT_MENU, self.on_menu) self.raw_toolbar = self.CreateToolBar(wx.TB_HORIZONTAL | wx.NO_BORDER | wx.TB_FLAT) self.toolbar_timer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.on_timer) self.Bind(wx.EVT_ACTIVATE, self.on_activate) if wx.Platform == "__WXMAC__": self.Bind(wx.EVT_MENU_OPEN, self.on_menu_open_mac) elif wx.Platform == "__WXMSW__": self.Bind(wx.EVT_MENU_OPEN, self.on_menu_open_win) else: self.Bind(wx.EVT_MENU_OPEN, self.on_menu_open_linux) sizer = wx.BoxSizer(wx.VERTICAL) self.notebook = aui.AuiNotebook(self, -1) sizer.Add(self.notebook, 1, wx.GROW) self.SetSizer(sizer) self.Bind(aui.EVT_AUINOTEBOOK_PAGE_CHANGED, self.on_page_changed) self.Bind(aui.EVT_AUINOTEBOOK_PAGE_CLOSED, self.on_page_closed) self.active_editor = None self.add_editor(editor)
def __init__( self, speculoos, parent = None, id = -1, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE ): self.speculoos = speculoos wx.Panel.__init__(self, parent, -1) sizer = wx.BoxSizer(wx.VERTICAL) self.nb = PyAUI.AuiNotebook(self, -1, style = PyAUI.AUI_NB_SCROLL_BUTTONS) sizer.Add(self.nb, 1, wx.EXPAND) self.planes = PlanesListBox(speculoos, self.nb, -1, _("Planes")) self.objects = ObjectListBox(speculoos, self.nb, -1, _("Objects")) self.lights = LightZoneListBox(speculoos, self.nb, -1, _("Lights")) self.sprites = SpriteListBox(speculoos, self.nb, -1, _("Sprites")) self.walk_zones = WalkBoxesListBox(speculoos, self.nb, -1, _("Walk areas")) self.change_scene_zones = ChangeSceneListBox(speculoos, self.nb, -1, _("Change scene")) self.entry_points = EntryPointsListBox(speculoos, self.nb, -1, _("Entry points")) self.scale_zones = ScaleBoxesListBox(speculoos, self.nb, -1, _("Scale zones")) self.characters = CharactersListBox(speculoos, self.nb, -1, _("Characters")) self.areas = OtherZonesListBox(speculoos, self.nb, -1, _("Special areas")) self.SetSizer(sizer) self.nb.AddPage(self.planes, _('Planes')) self.nb.AddPage(self.objects, _('Objects')) self.nb.AddPage(self.characters, _('Characters')) self.nb.AddPage(self.sprites, _('Sprites')) self.nb.AddPage(self.lights, _('Lights')) self.nb.AddPage(self.walk_zones, _('Walk areas')) self.nb.AddPage(self.change_scene_zones, _('Change scene')) self.nb.AddPage(self.entry_points, _('Entry points')) self.nb.AddPage(self.scale_zones, _('Scale zones')) self.nb.AddPage(self.areas, _('Others'))
def __init__(self, parent, title, size=(640, 800)): super().__init__( parent, title=title, size=size, style=wx.DEFAULT_FRAME_STYLE & ~(wx.RESIZE_BORDER | wx.MAXIMIZE_BOX) ) self.CenterOnScreen() self.notebook = aui.AuiNotebook(self) # ----- add main page ----- page1 = LyricsPage(self) self.notebook.AddPage(page1, 'Lyrics') # ----- add dictionary page ----- page2 = DictionaryPage(self) self.notebook.AddPage(page2, 'Dictionary') # ----- main contianer ----- main_sizer = wx.BoxSizer(wx.VERTICAL) main_sizer.Add(self.notebook, 1, wx.EXPAND) self.SetSizer(main_sizer) wx.CallAfter(self.notebook.SendSizeEvent) # ----- menu bar ----- menubar = MyMenuBar(self) self.SetMenuBar(menubar) # ----- status bar ----- self.CreateStatusBar() self.SetStatusText('Hello World.')
def __init__(self, *args, **kargs): self.threadlist = [] # this is added not to have windows "always on parent" # args2 = [x for x in args] # args2[0] = None # args = tuple(args2) ### wx.MiniFrame.__init__(self, *args, style=wx.CAPTION | wx.CLOSE_BOX | wx.MINIMIZE_BOX | wx.RESIZE_BORDER | wx.FRAME_FLOAT_ON_PARENT) panel = wx.Panel(self) vbox = wx.BoxSizer(wx.VERTICAL) self.SetSizer(vbox) vbox.Add(panel, 1, wx.EXPAND | wx.ALL, 5) self.nb = aui.AuiNotebook(panel) bpanel = wx.Panel(panel) button2 = wx.Button(bpanel, wx.ID_ANY, "Close Finished Thread Tab") button = wx.Button(bpanel, wx.ID_ANY, "Close") vbox = wx.BoxSizer(wx.VERTICAL) hbox = wx.BoxSizer(wx.HORIZONTAL) panel.SetSizer(vbox) vbox.Add(self.nb, 1, wx.EXPAND) vbox.Add(bpanel, 0, wx.EXPAND | wx.ALL, 5) hbox.AddStretchSpacer() hbox.Add(button2, 0, wx.EXPAND | wx.ALL, 2) hbox.Add(button, 0, wx.EXPAND | wx.ALL, 2) bpanel.SetSizer(hbox) #sys.stdout = RedirectOutput(self.log) #sys.stderr = RedirectOutput(self.log) button.Bind(wx.EVT_BUTTON, self.onPanelClose) button2.Bind(wx.EVT_BUTTON, self.onCloseFinished) self.Bind(wx.EVT_CLOSE, self.onWindowClose) self.Bind(wx.aui.EVT_AUINOTEBOOK_PAGE_CLOSE, self.onPageClose) self.Layout() self.Centre() self.Hide() self.redirector = None #self.timer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.check_thread) self.Bind(wx.EVT_ACTIVATE, self.onActivate)
def CreateNotebook(self): bookStyle = aui.AUI_NB_DEFAULT_STYLE # bookStyle &= ~(aui.AUI_NB_CLOSE_ON_ACTIVE_TAB) bookStyle = aui.AUI_NB_DEFAULT_STYLE | aui.AUI_NB_TAB_EXTERNAL_MOVE | wx.NO_BORDER client_size = self.GetClientSize() nb = aui.AuiNotebook(self, -1, wx.Point(client_size.x, client_size.y), wx.Size(430, 200), agwStyle=bookStyle) nb.AddPage(ListPanel(self, self, self.controller._model, self.controller._interp), "Main") return nb
def CreateNotebook(self): client_size = self.GetClientSize() self.ctrl = aui.AuiNotebook(self, -1, wx.Point(client_size.x, client_size.y), wx.Size(430, 200)) art = aui.AuiSimpleTabArt() self.ctrl.SetArtProvider(art) self.filecount = 1 #self.page_bmp = wx.ArtProvider.GetBitmap(wx.ART_NORMAL_FILE, wx.ART_OTHER, wx.Size(16, 16)) self.ctrl.AddPage(TextEditor(self.ctrl, -1, template, wx.DefaultPosition, wx.DefaultSize, wx.TE_MULTILINE|wx.NO_BORDER,''), "File"+str(self.filecount), True) self.newfilelist.append(self.ctrl.GetSelection()) return self.ctrl
def __init__(self, parent, controller): super(LogView, self).__init__(parent, -1, style=wx.BORDER_NONE, size=(800, 150), controller=controller) self.notebook = aui.AuiNotebook( self, -1, style=wx.BORDER_NONE | aui.AUI_NB_TAB_MOVE | aui.AUI_NB_TAB_SPLIT) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.notebook, 1, wx.EXPAND) self.controller = controller self.SetSizer(sizer) self.__setup()
def _create_layout(self): ctrl_sizer = wx.StaticBoxSizer(wx.VERTICAL, self, "Figure Controls") static_box = ctrl_sizer.GetStaticBox() self.figure_notebook = aui.AuiNotebook(self, style=aui.AUI_NB_TAB_MOVE | aui.AUI_NB_TAB_SPLIT | aui.AUI_NB_SCROLL_BUTTONS) top_sizer = wx.BoxSizer(wx.VERTICAL) top_sizer.Add(ctrl_sizer, border=5, flag=wx.ALL) top_sizer.Add(self.figure_notebook, border=5, flag=wx.ALL) self.SetSizer(top_sizer)
def __init__(self, parent, log): self.log = log wx.Panel.__init__(self, parent, -1) self.nb = aui.AuiNotebook(self) page = wx.TextCtrl(self.nb, -1, text, style=wx.TE_MULTILINE) self.nb.AddPage(page, "Welcome") for num in range(1, 5): page = wx.TextCtrl(self.nb, -1, "This is page %d" % num , style=wx.TE_MULTILINE) self.nb.AddPage(page, "Tab Number %d" % num) sizer = wx.BoxSizer() sizer.Add(self.nb, 1, wx.EXPAND) self.SetSizer(sizer) wx.CallAfter(self.nb.SendSizeEvent)
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 __init__(self, parent, frame, interpreter): self._frame = frame wx.Panel.__init__(self, parent, -1) bookStyle = aui.AUI_NB_DEFAULT_STYLE bookStyle &= ~(aui.AUI_NB_CLOSE_ON_ACTIVE_TAB) self.rawpanel = HttpRawPanel(self, self) self.renderpanel = self.create_web_view() self.nb = aui.AuiNotebook(self, style=bookStyle) self.nb.AddPage(self.rawpanel, "HTML Raw") self.nb.AddPage(self.renderpanel, "HTML Render") sizer = wx.BoxSizer() sizer.Add(self.nb, 1, wx.EXPAND) self.SetSizer(sizer) wx.CallAfter(self.nb.SendSizeEvent) pub.subscribe(self.on_selected_row, "selected_row")
def _create_layout(self): ctrl_sizer = wx.StaticBoxSizer(wx.VERTICAL, self, "Plot Controls") static_box = ctrl_sizer.GetStaticBox() self.control_notebook = wx.Notebook(static_box) self.control_notebook.AddPage(self._create_axes_tick_ctrl( self.control_notebook), 'Axes', select=True) ctrl_sizer.Add(self.control_notebook, border=5, flag=wx.ALL | wx.EXPAND, proportion=1) self.plot_notebook = aui.AuiNotebook(self, style=aui.AUI_NB_TAB_MOVE | aui.AUI_NB_TAB_SPLIT | aui.AUI_NB_SCROLL_BUTTONS) self.plot_notebook.Bind(aui.EVT_AUINOTEBOOK_PAGE_CHANGED, self._on_plot_change) top_sizer = wx.BoxSizer(wx.HORIZONTAL) top_sizer.Add(ctrl_sizer, border=5, flag=wx.ALL | wx.EXPAND, proportion=1) top_sizer.Add(self.plot_notebook, border=5, flag=wx.ALL | wx.EXPAND, proportion=2) self.SetSizer(top_sizer) self.plot_ctrl_lookup = { value[0]: key for (key, value) in self.plot_ctrls.items() }
def __init__(self, result, *args, **kargs): wx.MiniFrame.__init__(self, *args, style=wx.CAPTION | wx.CLOSE_BOX | wx.MINIMIZE_BOX | wx.RESIZE_BORDER | wx.FRAME_FLOAT_ON_PARENT) panel = wx.Panel(self) vbox = wx.BoxSizer(wx.VERTICAL) self.SetSizer(vbox) vbox.Add(panel, 1, wx.EXPAND | wx.ALL, 5) self.nb = aui.AuiNotebook(panel) bpanel = wx.Panel(panel) button = wx.Button(bpanel, wx.ID_ANY, "Done") vbox = wx.BoxSizer(wx.VERTICAL) hbox = wx.BoxSizer(wx.HORIZONTAL) panel.SetSizer(vbox) vbox.Add(self.nb, 1, wx.EXPAND) vbox.Add(bpanel, 0, wx.EXPAND | wx.ALL, 5) hbox.AddStretchSpacer() hbox.Add(button, 0, wx.EXPAND | wx.ALL, 2) bpanel.SetSizer(hbox) #sys.stdout = RedirectOutput(self.log) #sys.stderr = RedirectOutput(self.log) for k, r in enumerate(result): log = wx.TextCtrl(self.nb, -1, style=wx.TE_MULTILINE | wx.TE_READONLY) log.AppendText(r['diff']) self.nb.AddPage(log, r['filename']) button.Bind(wx.EVT_BUTTON, self.onClose) self.Show() self.SetTitle('HG diff result')
def __init__(self, parent, id, title): global shell wx.Frame.__init__( self, parent, id, title, (100, 100), # Win32 change [600, 550], style=wx.DEFAULT_FRAME_STYLE|wx.CLIP_CHILDREN|wx.NO_FULL_REPAINT_ON_RESIZE) compat_wx.handle_event_0(self, wx.EVT_CLOSE, self._OnCloseWindow) self.known_modules = {} self.menu = self.make_menu() self.SetMenuBar(self.menu) if aui: self._aui = aui.AuiManager(self) nb_style = (aui.AUI_NB_TAB_SPLIT|aui.AUI_NB_TAB_MOVE| aui.AUI_NB_TAB_EXTERNAL_MOVE|aui.AUI_NB_SCROLL_BUTTONS) nb = aui.AuiNotebook(self, style=nb_style) control_parent = self else: splitter = wx.SplitterWindow( self, -1, style=wx.SP_3DSASH|wx.CLIP_CHILDREN| wx.NO_FULL_REPAINT_ON_RESIZE|wx.SP_LIVE_UPDATE) control_parent = splitter self.icon_display = icon_display.IconDisplay(control_parent, self) if aui: self.shell = PyShellGameraShell(parent=self) rootObject = self.shell.interp.locals self.filling = wx.py.filling.Filling(parent=nb, rootObject=rootObject, rootIsNamespace=True) # Add 'filling' to the interpreter's locals. self.calltip = Calltip(parent=nb) self.sessionlisting = wx.py.crust.SessionListing(parent=nb) else: crust = PyCrustGameraShell(control_parent, -1) self.shell = crust.shell self.shell.main_win = self self.shell.update = self.Update image_menu.set_shell(self.shell) image_menu.set_shell_frame(self) self.shell.push("from gamera.gui import gui") self.shell.push("from gamera.gui.matplotlib_support import *") self.shell.push("from gamera.core import *") self.shell.push("init_gamera()") self.shell.update = self.Update self.icon_display.shell = self.shell self.icon_display.main = self self.Update() self.shell.SetFocus() if aui: self._aui.AddPane( self.icon_display, aui.AuiPaneInfo() .Name("icon_display") .CenterPane() .MinSize(wx.Size(96, 96)) .CloseButton(False) .CaptionVisible(True) .Caption("Objects") .Dockable(True)) self._aui.AddPane( self.shell, aui.AuiPaneInfo() .Name("shell") .CenterPane() .MinSize(wx.Size(200,200)) .CloseButton(False) .CaptionVisible(True) .MaximizeButton(True) .Caption("Interactive Python Shell") .Dockable(True)) nb.AddPage(self.calltip, "Documentation") nb.AddPage(self.filling, "Namespace") nb.AddPage(self.sessionlisting, "History") self._aui.AddPane( nb, aui.AuiPaneInfo() .Name("notebook") .CenterPane() .MinSize(wx.Size(200, 100)) .MaximizeButton(True)) self._aui.GetPane("notebook").Show().Bottom() self._aui.GetPane("icon_display").Show().Left() self._aui.Update() else: splitter.SetMinimumPaneSize(20) splitter.SplitVertically(self.icon_display, crust, 120) splitter.SetSashPosition(120) self.status = StatusBar(self) self.SetStatusBar(self.status) from gamera.gui import gamera_icons icon = compat_wx.create_icon_from_bitmap(gamera_icons.getIconBitmap()) self.SetIcon(icon) self.Move(wx.Point(int(30), int(30))) wx.Yield()
def __init__(self, parent, title): # setup wx.Frame.__init__(self, parent, title=title, size=(1280, 800)) # song self.song = Song() # icon icon = wx.Icon() icon.CopyFromBitmap(wx.Bitmap("melody_mine.gif", wx.BITMAP_TYPE_GIF)) self.SetIcon(icon) # status bar self.CreateStatusBar() # file menu fileMenu = wx.Menu() newItem = fileMenu.Append(wx.ID_NEW, "&New", "Create new document") openItem = fileMenu.Append(wx.ID_OPEN, "&Open...", "Open existing document") fileMenu.AppendSeparator() importItem = fileMenu.Append(wx.ID_ANY, "&Import...", "Import MIDI file") exportItem = fileMenu.Append(wx.ID_ANY, "&Export...", "Export MIDI file") fileMenu.AppendSeparator() saveItem = fileMenu.Append(wx.ID_SAVE, "&Save", "Save document") saveAsItem = fileMenu.Append(wx.ID_SAVEAS, "Save &As...", "Save document with name") exitItem = fileMenu.Append(wx.ID_EXIT, "E&xit", "Close the application") # edit menu editMenu = wx.Menu() cutItem = editMenu.Append(wx.ID_CUT, "C&ut") copyItem = editMenu.Append(wx.ID_COPY, "&Copy") pasteItem = editMenu.Append(wx.ID_PASTE, "&Paste") editMenu.AppendSeparator() deleteItem = editMenu.Append(wx.NewId(), "&Delete") # help menu helpMenu = wx.Menu() aboutItem = helpMenu.Append(wx.ID_ABOUT, "&About...", "About this application") # menu bar menuBar = wx.MenuBar() menuBar.Append(fileMenu, "&File") menuBar.Append(editMenu, "&Edit") menuBar.Append(helpMenu, "&Help") self.SetMenuBar(menuBar) # panels projectPanel = ProjectPanel(self) propertyPanel = PropertyPanel(self) # Tag pages songPanel = SongPanel(self, self.song) patternPanel = PatternPanel(self) tabPanel = wxaui.AuiNotebook(self) tabPanel.AddPage(songPanel, "Song") tabPanel.AddPage(patternPanel, "Patterns") # sizers vBox = wx.BoxSizer(wx.VERTICAL) vBox.Add(projectPanel, 1, wx.EXPAND) vBox.Add(propertyPanel, 1, wx.EXPAND) hBox = wx.BoxSizer(wx.HORIZONTAL) hBox.Add(vBox, 1, wx.EXPAND) hBox.Add(tabPanel, 5, wx.EXPAND) self.SetSizer(hBox) self.SetAutoLayout(1) # binding/events self.Bind(wx.EVT_MENU, self.OnImport, importItem) self.Bind(wx.EVT_MENU, self.OnExport, exportItem) self.Bind(wx.EVT_MENU, self.OnAbout, aboutItem) self.Bind(wx.EVT_MENU, self.OnExit, exitItem) self.Show(True)
def __init__(self, parent, id, title, pos=wx.DefaultPosition): wx.Frame.__init__(self, parent, id, title, pos) self.info = Info(self) self.SetTitle(self.info.GetName()) self.SetIcon(wx.Icon(LOGO_ICON, wx.BITMAP_TYPE_PNG)) self.apiUrl = 'http://' + CONF['server']['host'] + ':' + str( CONF['server']['port']) self.interface = SqlmapInterface(self.apiUrl, CONF['server']['headers']) self.addOptions = None self.taskID = None self.saved = True self.scanThread = None self.options = dict() self.auiMgr = aui.AuiManager() self.auiMgr.SetManagedWindow(self) self.Bind(wx.EVT_CLOSE, self.OnCloseWindow) #====================# # menus and menu bar # #====================# self.menuFile = wx.Menu() self.menuFile.Append(ID_MENU_SAVE, '&Save\tCtrl-S', 'Save scan results') self.menuFile.AppendSeparator() self.menuFile.Append(ID_MENU_EXIT, 'E&xit', 'Exit the Application') self.menuFile.Enable(ID_MENU_SAVE, False) self.menuScan = wx.Menu() self.menuScan.Append(ID_MENU_NEW_SCAN, '&New Scan\tCtrl-N', 'Start a new scan.') self.menuScan.AppendSeparator() self.menuScan.Append(ID_MENU_OPTIONS, '&Options\tCtrl-O', 'Set scan options') self.menuScan.Enable(ID_MENU_OPTIONS, False) menuHelp = wx.Menu() menuHelp.Append(ID_MENU_ABOUT, '&About...') self.Bind(wx.EVT_MENU, self.OnSave, id=ID_MENU_SAVE) self.Bind(wx.EVT_MENU, self.OnExit, id=ID_MENU_EXIT) self.Bind(wx.EVT_MENU, self.OnNewScan, id=ID_MENU_NEW_SCAN) self.Bind(wx.EVT_MENU, self.OnOptions, id=ID_MENU_OPTIONS) self.Bind(wx.EVT_MENU, self.OnAbout, id=ID_MENU_ABOUT) menuBar = wx.MenuBar() menuBar.Append(self.menuFile, "&File") menuBar.Append(self.menuScan, "&Scan") menuBar.Append(menuHelp, "&Help") self.SetMenuBar(menuBar) #============================# # panel top : target, inputs # #============================# sizerPnlTop = wx.BoxSizer(wx.VERTICAL) pnlTop = wx.Panel(self, -1) self.sizerPnlTarget = wx.BoxSizer(wx.HORIZONTAL) pnlTarget = wx.Panel(pnlTop, -1) self.lTarget = wx.StaticText(pnlTarget, -1, label='target-url: ') self.tcTarget = wx.TextCtrl(pnlTarget, -1) self.tcTarget.Enable(False) self.tcTarget.Bind(wx.EVT_TEXT, self.set_tree_target) self.sizerPnlTarget.Add(self.lTarget, flag=wx.ALIGN_CENTRE_VERTICAL) self.sizerPnlTarget.Add(self.tcTarget, 1, wx.EXPAND) pnlTarget.SetSizerAndFit(self.sizerPnlTarget) # self.tcTarget.SetValue('http://www.beispiel.com/?id=1') #========================================================# # panel top: button panel: create buttons bind functions # #========================================================# sizerPnlButtons = wx.BoxSizer(wx.HORIZONTAL) pnlButtons = wx.Panel(pnlTop, -1) self.btnPanel = bp.ButtonPanel(pnlButtons, -1, agwStyle=bp.BP_DEFAULT_STYLE) self.btnPanel.GetBPArt().SetMetric(bp.BP_PADDING_SIZE, wx.Size(4, 4)) self.btnPanel.GetBPArt().SetMetric(bp.BP_MARGINS_SIZE, wx.Size(4, 4)) self.btnPanel.GetBPArt().GetFont(bp.BP_BUTTONTEXT_FONT)\ .SetPointSize(8) self.btnStop = bp.ButtonInfo(self.btnPanel, -1, self.get_icon('stop'), text='Stop', shortHelp='Stop the current scan') self.btnStop.Enable(False) self.btnStart = bp.ButtonInfo(self.btnPanel, -1, self.get_icon('target'), text='Start', shortHelp='Start the customized scan') self.btnSetOptions = bp.ButtonInfo(self.btnPanel, -1, self.get_icon('options'), text='Options', shortHelp='Set scan options') self.btnGetDBs = bp.ButtonInfo(self.btnPanel, -1, self.get_icon('db'), text='Get DBs', shortHelp='Enumerate DBMS databases') self.btnGetTbls = bp.ButtonInfo( self.btnPanel, -1, self.get_icon('tbl'), text='Get Tables', shortHelp='Enumerate DBMS database tables') self.btnGetCols = bp.ButtonInfo( self.btnPanel, -1, self.get_icon('col'), text='Get Columns', shortHelp='Enumerate DBMS database table columns') self.btnGetData = bp.ButtonInfo( self.btnPanel, -1, self.get_icon('tblDump'), text='Get Data', shortHelp='Dump DBMS database table entries') self.btnOutput = bp.ButtonInfo(self.btnPanel, -1, self.get_icon('view'), text='View Output', shortHelp='View data output') self.btnSave = bp.ButtonInfo(self.btnPanel, -1, self.get_icon('save'), text=' Save ', shortHelp='save scan results') self.btnCloseAll = bp.ButtonInfo(self.btnPanel, -1, self.get_icon('closeTab'), text='Close Tabs', shortHelp='Close all tabs') self.btnCloseAll.Enable(False) self.Bind(wx.EVT_BUTTON, self.stop_scan, self.btnStop) self.Bind(wx.EVT_BUTTON, self.run_custom, self.btnStart) self.Bind(wx.EVT_BUTTON, self.OnOptions, self.btnSetOptions) self.Bind(wx.EVT_BUTTON, self.run_get_dbs, self.btnGetDBs) self.Bind(wx.EVT_BUTTON, self.run_get_tables, self.btnGetTbls) self.Bind(wx.EVT_BUTTON, self.run_get_columns, self.btnGetCols) self.Bind(wx.EVT_BUTTON, self.run_get_data, self.btnGetData) self.Bind(wx.EVT_BUTTON, self.OnShowOutput, self.btnOutput) self.Bind(wx.EVT_BUTTON, self.OnSave, self.btnSave) self.Bind(wx.EVT_BUTTON, self.OnDeletePages, self.btnCloseAll) self.btnPanel.AddButton(self.btnStop) self.btnPanel.AddSeparator() self.btnPanel.AddButton(self.btnStart) self.btnPanel.AddSeparator() self.btnPanel.AddButton(self.btnSetOptions) self.btnPanel.AddSeparator() self.btnPanel.AddButton(self.btnGetDBs) self.btnPanel.AddButton(self.btnGetTbls) self.btnPanel.AddButton(self.btnGetCols) self.btnPanel.AddButton(self.btnGetData) self.btnPanel.AddSeparator() self.btnPanel.AddButton(self.btnOutput) self.btnPanel.AddSeparator() self.btnPanel.AddButton(self.btnSave) self.btnPanel.AddSeparator() self.btnPanel.AddButton(self.btnCloseAll) self.btnPanel.DoLayout() self.scanBtns = [ self.btnStart, self.btnGetDBs, self.btnGetTbls, self.btnGetCols, self.btnGetData, self.btnOutput, self.btnSave, self.btnSetOptions ] sizerPnlButtons.Add(self.btnPanel, 1, wx.EXPAND) pnlButtons.SetSizerAndFit(sizerPnlButtons) self.enable_scan_inputs(False) sizerPnlTop.Add(pnlTarget, 0, wx.EXPAND | wx.LEFT | wx.TOP, 2) sizerPnlTop.Add(pnlButtons, 0, wx.EXPAND) pnlTop.SetSizerAndFit(sizerPnlTop) #==============================================# # panel center: aui notebook, grid data output # #==============================================# sizerPnlCenter = wx.BoxSizer(wx.VERTICAL) self.pnlCenter = wx.Panel(self, -1) self.nb = aui.AuiNotebook( self.pnlCenter, -1, style=aui.AUI_NB_CLOSE_ON_ALL_TABS | aui.AUI_NB_WINDOWLIST_BUTTON | aui.AUI_NB_TAB_SPLIT | aui.AUI_NB_TAB_MOVE | aui.AUI_NB_TAB_EXTERNAL_MOVE | aui.AUI_NB_SCROLL_BUTTONS) self.Bind(aui.EVT_AUINOTEBOOK_PAGE_CLOSED, self.OnPageClosed, self.nb) sizerPnlCenter.Add(self.nb, 1, wx.EXPAND) self.pnlCenter.SetSizerAndFit(sizerPnlCenter) #==========================# # panel left: tree control # #==========================# self.sizerPnlTree = wx.BoxSizer(wx.HORIZONTAL) pnlTree = wx.Panel(self, -1) self.tree = ct.CustomTreeCtrl( pnlTree, -1, agwStyle=ct.TR_HAS_BUTTONS | ct.TR_AUTO_CHECK_PARENT | ct.TR_AUTO_CHECK_CHILD | ct.TR_HAS_VARIABLE_ROW_HEIGHT) self.Bind(ct.EVT_TREE_ITEM_CHECKED, self.OnCheckTree, self.tree) self.sizerPnlTree.Add(self.tree, 1, wx.EXPAND) # creating image list and assigning list to tree # (target, db, table and column icon) il = wx.ImageList(16, 16) for k in TREE_ICONS.keys(): TREE_ICONS[k] = il.Add(TREE_ICONS[k].Scale(16, 16).ConvertToBitmap()) self.tree.AssignImageList(il) self.treeRoot = self.tree.AddRoot('', image=TREE_ICONS['target']) self.treeDBs = None self.treeTbls = None self.treeData = dict() self.set_tree_target(None) self.tree.Layout() pnlTree.SetSizerAndFit(self.sizerPnlTree) #========================# # pane bottom: scan logs # #========================# self.tcLog = wx.TextCtrl(self, -1, style=wx.TE_MULTILINE | wx.TE_READONLY) #=================================================# # adding panels and components to the aui manager # #=================================================# self.auiMgr.AddPane( pnlTop, aui.AuiPaneInfo().Name('inputs').Top().DockFixed().CaptionVisible( False).PaneBorder(False).CloseButton(False)) self.auiMgr.AddPane( pnlTree, aui.AuiPaneInfo().Name('tree').Caption( 'Target Schema').Left().BestSize(wx.Size(160, 500)).PaneBorder( False).MaximizeButton(True).CloseButton(False)) self.auiMgr.AddPane( self.pnlCenter, aui.AuiPaneInfo().Name('center').Caption('Table Dumps').Center(). PaneBorder(False).MaximizeButton(True).CloseButton(False)) self.auiMgr.AddPane( self.tcLog, aui.AuiPaneInfo().Name('log').Caption( 'Scan Log').Bottom().BestSize(wx.Size(600, 140)).PaneBorder( False).MaximizeButton(True).CloseButton(False)) self.CreateStatusBar() self.SetStatusText(self.info.GetName())
def __init__(self, *args, **kwargs): super(Frame, self).__init__(*args, **kwargs) self.games = [] status_bar = self.CreateStatusBar() menu_bar = wx.MenuBar() file_menu = wx.Menu() edit_menu = wx.Menu() view_menu = wx.Menu() zoom_menu = wx.Menu() help_menu = wx.Menu() m = file_menu.Append(wx.ID_NEW, text='&New Room', help="Create a new room in the current game file") self.Bind(wx.EVT_MENU, self.OnNew, m) m = file_menu.Append(wx.ID_OPEN, text='&Open Rooms', help="Open the rooms from a game file") self.Bind(wx.EVT_MENU, self.OnOpen, m) file_menu.AppendSeparator() m = file_menu.Append(wx.ID_SAVE, text='&Save Rooms', help="Save the rooms of the current game file") self.Bind(wx.EVT_MENU, self.OnSave, m) m = file_menu.Append(wx.ID_REVERT_TO_SAVED) self.Bind(wx.EVT_MENU, self.OnRevert, m) file_menu.AppendSeparator() m = file_menu.Append( wx.ID_REFRESH, text="Reload Resources", help="Reload the non-room resources of the current game file") self.Bind(wx.EVT_MENU, self.OnReload, m) file_menu.AppendSeparator() m = file_menu.Append(wx.ID_CLOSE, help="Close the current game file") self.Bind(wx.EVT_MENU, self.OnClose, m) m = file_menu.Append(wx.ID_EXIT) self.Bind(wx.EVT_MENU, self.OnQuit, m) m = edit_menu.Append(wx.ID_UNDO) self.Bind(wx.EVT_MENU, self.OnUndo, m) m = edit_menu.Append(wx.ID_REDO) self.Bind(wx.EVT_MENU, self.OnRedo, m) edit_menu.AppendSeparator() m = edit_menu.Append(wx.ID_CUT) self.Bind(wx.EVT_MENU, self.OnCut, m) m = edit_menu.Append(wx.ID_COPY) self.Bind(wx.EVT_MENU, self.OnCopy, m) m = edit_menu.Append(wx.ID_PASTE) self.Bind(wx.EVT_MENU, self.OnPaste, m) m = edit_menu.Append(wx.ID_DELETE) self.Bind(wx.EVT_MENU, self.OnDelete, m) edit_menu.AppendSeparator() m = edit_menu.Append(wx.ID_SELECTALL) self.Bind(wx.EVT_MENU, self.OnSelectAll, m) edit_menu.AppendSeparator() m = edit_menu.Append(wx.ID_PROPERTIES) self.Bind(wx.EVT_MENU, self.OnProperties, m) m = view_menu.Append(wx.ID_ZOOM_OUT) self.Bind(wx.EVT_MENU, self.OnZoomOut, m) m = view_menu.Append(wx.ID_ZOOM_IN) self.Bind(wx.EVT_MENU, self.OnZoomIn, m) m = view_menu.Append(wx.ID_ZOOM_100) self.Bind(wx.EVT_MENU, self.OnZoomReset, m) edit_menu.AppendSeparator() m = zoom_menu.AppendRadioItem(wx.ID_ANY, text="&No Grid", help="Show no grid") self.Bind(wx.EVT_MENU, self.OnNoGrid, m) m = zoom_menu.AppendRadioItem(wx.ID_ANY, text="&Rectangular Grid", help="Show a rectangular grid") self.Bind(wx.EVT_MENU, self.OnRectangularGrid, m) m = zoom_menu.AppendRadioItem(wx.ID_ANY, text="&Isometric Grid", help="Show an isometric (diagonal) grid") self.Bind(wx.EVT_MENU, self.OnIsometricGrid, m) view_menu.AppendSubMenu(zoom_menu, text="&Grid") m = help_menu.Append(wx.ID_ABOUT) self.Bind(wx.EVT_MENU, self.OnAbout, m) menu_bar.Append(file_menu, '&File') menu_bar.Append(edit_menu, '&Edit') menu_bar.Append(view_menu, '&View') menu_bar.Append(help_menu, '&Help') self.SetMenuBar(menu_bar) # TODO: Get a toolbar working #toolbar = self.CreateToolBar(style=wx.TB_HORIZONTAL) #toolbar.AddLabelTool(wx.ID_NEW, label="New Room") #toolbar.Realize() sizer = wx.BoxSizer(wx.VERTICAL) self.games_notebook = aui.AuiNotebook( self, style=aui.AUI_NB_TOP | aui.AUI_NB_TAB_MOVE | aui.AUI_NB_SCROLL_BUTTONS | aui.AUI_NB_CLOSE_ON_ALL_TABS) #self.games_notebook = flatnotebook.FlatNotebook(self, style=wx.NB_TOP) self.Bind(aui.EVT_AUINOTEBOOK_PAGE_CLOSE, self.OnPageClose, self.games_notebook) sizer.Add(self.games_notebook, proportion=1, flag=wx.EXPAND) self.SetSizer(sizer) self.Refresh() self.load_game('test.json') self.load_game('test2.json') self.load_game('test.json') self.Show()
def create_notebook(self): notebook = aui.AuiNotebook(self, -1) self.Bind(aui.EVT_AUINOTEBOOK_PAGE_CHANGED, self.on_page_changed) self.Bind(aui.EVT_AUINOTEBOOK_PAGE_CLOSE, self.on_page_closing) self.Bind(aui.EVT_AUINOTEBOOK_PAGE_CLOSED, self.on_page_closed) return notebook
def __init__(self, parent, log, title): wx.Frame.__init__(self, None, title=title) self.log = log self.Maximize(True) self._mgr = aui.AuiManager() self._mgr.SetManagedWindow(self) self.notebookCtrl = aui.AuiNotebook(self) self.shellPage = ShellListCtrl.ShellList(self, self.log) self.notebookCtrl.AddPage( self.shellPage, 'Shell', True, wx.ArtProvider.GetBitmap(wx.ART_GO_HOME, client=wx.ART_FRAME_ICON)) self._mgr.AddPane(self.notebookCtrl, aui.AuiPaneInfo().Name("mainWindow").CenterPane()) self.treeCtrlHttpStatus = wx.TreeCtrl( self, id=wx.ID_ANY, pos=wx.DefaultPosition, size=(-1, 150), style=wx.TR_DEFAULT_STYLE | wx.TR_HIDE_ROOT | wx.TR_NO_LINES | wx.TR_HAS_BUTTONS | wx.TR_HAS_VARIABLE_ROW_HEIGHT) self.treeCtrlHttpStatusRoot = self.treeCtrlHttpStatus.AddRoot( 'hideRoot') self._mgr.AddPane( self.treeCtrlHttpStatus, aui.AuiPaneInfo().Name("HttpStatusWindow").Caption( "请求状态信息").Bottom().Layer(1).Position(1).CloseButton( True).MaximizeButton(True).MinimizeButton(True)) self.treeCtrlTunnelStatus = wx.TreeCtrl( self, id=wx.ID_ANY, pos=wx.DefaultPosition, size=(300, -1), style=wx.TR_DEFAULT_STYLE | wx.TR_HIDE_ROOT | wx.TR_NO_LINES | wx.TR_HAS_BUTTONS | wx.TR_HAS_VARIABLE_ROW_HEIGHT) self.treeCtrlTunnelStatusRoot = self.treeCtrlTunnelStatus.AddRoot( 'hideRoot') self._mgr.AddPane( self.treeCtrlTunnelStatus, aui.AuiPaneInfo().Name("TunnelStatusWindow").Caption( "隧道状态信息").Right().Layer(1).Position(1).CloseButton( True).MaximizeButton(True).MinimizeButton(True).Hide()) self._mgr.Update() self.notebookCtrl.Bind(wx.aui.EVT_AUINOTEBOOK_TAB_RIGHT_UP, self.OnTabRightClick) self.Bind(wx.EVT_CLOSE, self.OnClose) self.taskStatusList = {} self.sessionBelongList = {} self.OnInitMenu()
def __init__(self, parent, id=-1): wx.Panel.__init__(self, parent, id=id) self.nb = aui.AuiNotebook(self) sizer = wx.BoxSizer() sizer.Add(self.nb, 1, wx.EXPAND) self.SetSizer(sizer)
def __init__(self, parent, id=wx.ID_ANY, title="Rfc Viewer", pos=wx.DefaultPosition, size=(800, 600), style=wx.DEFAULT_FRAME_STYLE, name='RfcViewer'): """ Initialize - inherits from wx.Frame. Instantiates all widgets and variables for application :param parent: (wx.Window) The window parent. This may be, and often is, None. If it is not None, the frame will be minimized when its parent is minimized and restored when it is restored (although it will still be possible to minimize and restore just this frame itself). :param id: (wx.WindowID) The window identifier. It may take a value of -1 to indicate a default value. :param title: (string) The caption to be displayed on the frame’s title bar. :param pos: (wx.point) The window position. The value DefaultPosition indicates a default position, chosen by either the windowing system or wxWidgets, depending on platform. :param size: (wx.Size) – The window size. The value DefaultSize indicates a default size, chosen by either the windowing system or wxWidgets, depending on platform. :param style: (long) – The window style. See wx.Frame class description. :param name: (string) The name of the window. This parameter is used to associate a name with the item, allowing the application user to set Motif resource values for individual windows. """ wx.Frame.__init__(self, parent, id, title, pos, size, style) print(f'PyMuPDF version: {fitz.__doc__}') self.rpath = RfcPaths.RfcPaths() self.rfc_document_data = None with self.rpath.rfc_index_json.open() as f: self.rfc_index = json.load(f) self.pnl = pnl = MainPanel(self) self._mgr = aui.AuiManager(pnl) # notify AUI which frame to use self._mgr.SetManagedWindow(self) # First pane is Rfc Selection window located top left # ----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+ self.rfc_selector = wx.ListCtrl(self, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.Size(200, 150), style=wx.NO_BORDER | wx.TE_MULTILINE, name='RfcSelector') self.rfc_selector.InsertColumn(0, 'RFC Id', width=60) self.rfc_selector.InsertColumn(1, 'Title', width=200) self.rfc_selector.SetMinSize(wx.Size(500, 300)) self.rfc_selector.SetMaxSize(wx.Size(1000, 800)) # Need to distinguish between single and double click so self.rfc_id = None self.dbl_clk_delay = 250 self.rfc_selector.Bind(wx.EVT_LIST_ITEM_FOCUSED, self.run_summary) self.rfc_selector.Bind(wx.EVT_LEFT_DCLICK, self.display_detail) self.rfc_selector_load() # Second pane is Rfc Summary window Data displayed in this window on single click in # selection window. # ----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+ self.summary = wx.TextCtrl(self, id=wx.ID_ANY, value="Pane 2 - Summary Text Here", pos=wx.DefaultPosition, size=wx.Size(200, 150), style=wx.NO_BORDER | wx.TE_MULTILINE, name='RfcSummary') # Third pane (left top) is a two tab notebook, one for text files and one for pdf files. One # or both may be populated for any given RFC document. # ----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+ self.nb = aui.AuiNotebook(self, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=0, agwStyle=wx.lib.agw.aui.AUI_NB_DEFAULT_STYLE, name="RfcDocumentNotebook") self.text_page = wx.TextCtrl(self.nb, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.NO_BORDER | wx.TE_MULTILINE, name='DetailNotebookTabs') self.pdf_page = wx.Panel(self.nb, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.TAB_TRAVERSAL, name='pdfpage') # hsizer = wx.BoxSizer(wx.HORIZONTAL) # vsizer = wx.BoxSizer(wx.VERTICAL) # # self.btnpanl = pdfButtonPanel(self.pdf_page, # nid=wx.ID_ANY, # pos=wx.DefaultPosition, # size=wx.DefaultSize, # style=None) # # vsizer.Add(self.btnpanl, 0, wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT | wx.TOP, 5) # # self.viewer = pdfViewer(self.pdf_page, # nid=wx.ID_ANY, # pos=wx.DefaultPosition, # size=wx.DefaultSize, # style=wx.HSCROLL | wx.VSCROLL | wx.VSCROLL | wx.SUNKEN_BORDER) # # vsizer.Add(self.viewer, 1, wx.GROW | wx.LEFT | wx.RIGHT | wx.BOTTOM, 5) # hsizer.Add(vsizer, 1, wx.GROW | wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 5) # # self.SetSizer(hsizer) # self.SetAutoLayout(True) # # self.btnpanl.viewer = self.viewer # self.viewer.buttonpanel = self.btnpanl self.nb.AddPage(self.text_page, "Text Document") self.nb.AddPage(self.pdf_page, "PDF Document") self._mgr.AddPane(self.rfc_selector, aui.AuiPaneInfo().Left().Caption("RFC Selection")) self._mgr.AddPane(self.summary, aui.AuiPaneInfo().Bottom().Caption("RFC Summary")) self._mgr.AddPane(self.nb, aui.AuiPaneInfo().CenterPane().Name('RFC Detail')) # tell the manager to "commit" all the changes just made self._mgr.Update() self.Bind(wx.EVT_CLOSE, self.OnClose)
def Main_Frame_Adapter(self): # dictionary of arrays to plot on maxplot. self._dict = dict() self._dict1 = dict() self.canvas_dict = dict() self.tab_reference = dict() self.dt_dictionary = dict() self.io_dictionary = dict() # create frame self.main_frame = CtrlFrame(None) # create aui manager self.main_frame.__auiManager = aui.AuiManager() self.main_frame.__auiManager.SetManagedWindow(self.main_frame) # create menubar self.main_frame.menubar = wx.MenuBar() self.main_frame.fileMenu = wx.Menu() self.main_frame.submenu = wx.MenuItem() self.main_frame.PlotMenu = wx.Menu() Functions = [] content = package_contents("percolate/Functions") for file in content: if re.search(".py", file): Functions.append(file) # break # look in functions directory to fill menu with functions create a dict of functions """if os.path.exists(os.path.join(os.getcwd(), 'Functions')): for (dirpath, dirnames, filenames) in walk(os.path.join(os.getcwd(), 'Functions')): Functions.extend(filenames) break""" # self.main_frame.open_file = [] # self.main_frame.open_file = Functions for file in Functions: self.main_frame.fileMenu.Append(wx.ID_ANY, file) self.main_frame.PlotMenu.Append(wx.ID_ANY, "Canvas") # create menu hierarchy # self.main_frame.open_file = self.main_frame.fileMenu.Append(wx.ID_ANY, 'Select function...') self.main_frame.menubar.Append(self.main_frame.fileMenu, "&Load Function") self.main_frame.menubar.Append(self.main_frame.PlotMenu, "Plot") self.main_frame.SetMenuBar(self.main_frame.menubar) # create tree ctrl #self.main_frame.tree_ctrl = wx.TreeCtrl(self.main_frame) #create function ctrl tree #self.main_frame.function_control_tree["initial function control"] = wx.TreeCtrl(self.main_frame) #create a notebook for the func ctrl trees to sit self.main_frame.function_notebooks["Function Ctrl"] = aui.AuiNotebook( self.main_frame) self.main_frame.function_notebooks[ "Function Ctrl"].SetAGWWindowStyleFlag( aui.AUI_NB_SCROLL_BUTTONS | aui.AUI_NB_TAB_MOVE | aui.AUI_NB_TAB_EXTERNAL_MOVE) # create aui notebook self.main_frame.function_notebooks["Function view"] = aui.AuiNotebook( self.main_frame) self.main_frame.function_notebooks[ "Function view"].SetAGWWindowStyleFlag( aui.AUI_NB_WINDOWLIST_BUTTON | aui.AUI_NB_SCROLL_BUTTONS | aui.AUI_NB_TAB_EXTERNAL_MOVE | aui.AUI_NB_TAB_MOVE | aui.AUI_NB_TAB_SPLIT | aui.AUI_NB_TAB_EXTERNAL_MOVE) self.main_frame.__auiManager.AddPane( self.main_frame.function_notebooks["Function Ctrl"], aui.AuiPaneInfo().Name("Function Ctrl").Caption( "Function Ctrl").Left().CloseButton(False).MinSize(180, 180), ) # add panes to the manager to sort out display self.main_frame.__auiManager.AddPane( self.main_frame.function_notebooks["Function view"], aui.AuiPaneInfo().Name("Function view").Caption( "Function view").Center().CloseButton(False).MinSize(400, 400), ) # just update to let the manager know self.main_frame.__auiManager.Update() # Bind handlers to controls self.main_frame.Bind(wx.EVT_CLOSE, self.WindowOnClose) # for function in self.main_frame.fileMenu: self.Bind(wx.EVT_MENU, self.on_func_select) self.main_frame.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.on_clicked) self.main_frame.PlotMenu.Bind(wx.EVT_MENU, self.On_Create_MaxPlot) # uncomment for shortcut # self.on_file_select(None) # self.main_frame.Bind(aui.EVT_AUI_PANE_CLOSE, self.on_pane_close) self.main_frame.__auiManager.Bind(aui.EVT_AUI_PANE_CLOSE, self.on_pane_close) self.main_frame.function_notebooks["Function view"].Bind( aui.EVT_AUINOTEBOOK_PAGE_CLOSED, self.on_tab_close) # self.main_frame.__auiManager.Bind(aui.EVT_AUINOTEBOOK_PAGE_CLOSE, self.on__close) self.func = None self.count = 0 self.addedtabs = dict()
def __init__(self, *args, **kwds): self.appMode = kwds.pop("appMode", GlbModes.standard) #self.logHndlr = CTTextCtrlHandler.CTTextCtrlHandler(self.txt_log) self.logHndlr = logging.StreamHandler() FORMAT = "%(asctime)s - %(name)s - %(levelname)s - %(message)s" self.logHndlr.setFormatter(logging.Formatter(FORMAT)) self.LOGGER = logging.getLogger("INRS.ASur") # .frame") self.LOGGER.addHandler(self.logHndlr) self.LOGGER.setLevel(logging.INFO) self.LOGGER.info('Start') wx.Frame.__init__(self, *args, **kwds) self.nbk_dspl = wx_AUI.AuiNotebook(self, wx.ID_ANY) self.pnl_pnts = ASPanelScenario(self.nbk_dspl, wx.ID_ANY) self.pnl_asur = ASPanelPlot(self.nbk_dspl, wx.ID_ANY) self.pnl_slin = ASPanelPath(self.nbk_dspl, wx.ID_ANY) self.dlgHelp = None self.dlgParamPath = None # ASDlgParamPath.ASDlgParamPath(None) self.statusbar = self.CreateStatusBar(2) self.tmrMsg = wx.Timer(self, ASur.TIMER_ID_MSG) self.histCfg = wx.Config('ASur - File history', style=wx.CONFIG_USE_LOCAL_FILE) self.prmsCfg = wx.Config('ASur - Parameters', style=wx.CONFIG_USE_LOCAL_FILE) self.__create_menu_bar() self.__create_tool_bar() self.__set_properties() self.__do_layout() # --- Event processing self.Bind(wx.EVT_MENU, self.on_mnu_file_open, self.mnu_file_open) self.Bind(wx.EVT_MENU, self.on_mnu_file_add, self.mnu_file_add) self.Bind(wx.EVT_MENU_RANGE, self.on_mnu_file_hist, id=wx.ID_FILE1, id2=wx.ID_FILE9) # TODO : il faut regénérer les ID à chaque appel # self.Bind(wx.EVT_MENU_RANGE,self.on_mnu_file_xone, id=self.ID_MDL[0], id2=self.ID_MDL[-1]) self.Bind(wx.EVT_MENU, self.on_mnu_file_close, self.mnu_file_close) self.Bind(wx.EVT_MENU, self.on_mnu_file_quit, self.mnu_file_quit) self.Bind(wx.EVT_MENU, self.on_mnu_parm_maree, self.mnu_parm_maree) self.Bind(wx.EVT_MENU, self.on_mnu_parm_path, self.mnu_parm_path) self.Bind(wx.EVT_MENU, self.on_mnu_parm_glbx, self.mnu_parm_glbx) if self.appMode == GlbModes.debug: self.Bind(wx.EVT_MENU, self.on_mnu_help_reload, self.mnu_help_reload) self.Bind(wx.EVT_MENU, self.on_mnu_help_log, self.mnu_help_log) self.Bind(wx.EVT_MENU, self.on_mnu_help_help, self.mnu_help_help) self.Bind(wx.EVT_MENU, self.on_mnu_help_info, self.mnu_help_info) self.Bind(wx.EVT_MENU, self.on_mnu_help_about, self.mnu_help_about) self.Bind(wx.EVT_BUTTON, self.on_btn_apply, self.btn_apply) self.Bind(wx.EVT_TOOL, self.on_btn_rst, self.btn_rst) self.Bind(wx.EVT_TOOL, self.on_btn_bck, self.btn_bck) self.Bind(wx.EVT_TOOL, self.on_btn_fwd, self.btn_fwd) self.Bind(wx.EVT_TOOL, self.on_btn_pan, self.btn_pan) self.Bind(wx.EVT_TOOL, self.on_btn_zsl, self.btn_zsl) self.Bind(wx_AUI.EVT_AUINOTEBOOK_PAGE_CHANGED, self.on_page_change, self.nbk_dspl) self.Bind(wx.EVT_TIMER, self.cb_panel_message_clear, self.tmrMsg) self.Bind(ASEVT_MESSAGE, self.cb_panel_message) self.Bind(ASEVT_MOTION, self.cb_panel_motion) #self.Bind(ASEVT_BUTTON, self.on_btn_parm_path) self.mnu_states = { GlbStates.started: ( [ self.mnu_file, # off self.mnu_parm, self.mnu_help ], [ self.mnu_file, # on self.mnu_parm_path, self.mnu_parm_glbx, self.mnu_help ]), GlbStates.data_loaded: ( [], # off [ self.mnu_file, # on self.mnu_parm, self.mnu_help ]) } self.btn_states = { BtnStates.off: ( [self.toolbar], # off [self.btn_apply]), # on BtnStates.on: ( [], # off [self.toolbar]), # on BtnStates.pan: ( [self.toolbar], # off [ self.btn_rst, self.btn_bck, self.btn_fwd, self.btn_pan, self.btn_apply ]), # on BtnStates.zoom: ( [self.toolbar], # off [ self.btn_rst, self.btn_bck, self.btn_fwd, self.btn_zsl, self.btn_apply ]), # on } self.mnuState = None self.btnState = None self.__set_state(GlbStates.started, BtnStates.off) # --- Initialize data attributes self.dirname = '' self.bbModels = [] self.bbCycles = [] self.__initConfig()
def __init__(self, parent, id, title): wx.Frame.__init__(self, parent, id, title, size=(800, 600), style=wx.MINIMIZE_BOX | wx.CAPTION | wx.CLOSE_BOX) self.Maximize(False) appimg = wx.Bitmap('img/app.ico', wx.BITMAP_TYPE_ICO) icon = wx.EmptyIcon() icon.CopyFromBitmap(appimg) self.SetIcon(icon) self.process = 0 self.update = 0 self.users = {} self.speed = 0 self.speedCheck = 0 self.tim = 0 self.mgr = aui.AuiManager() self.mgr.SetManagedWindow(self) self.tb = wx.ToolBar(self, style=TBFLAGS) self.tb.SetToolBitmapSize(wx.Size(48, 48)) self.status = self.CreateStatusBar() self.status.SetFieldsCount(3) make = self.status.GetField(1) self.status.SetStatusWidths([250, -2, -1]) rect2 = self.status.GetFieldRect(2) rect1 = self.status.GetFieldRect(1) self.sendtext = wx.StaticText(self.status, -1, "") self.sendtext.SetPosition((rect1.x + 2, rect1.y + 2)) self.sendtext.SetSize((rect1.width - 4, rect1.height - 4)) self.g1 = wx.Gauge(self.status, -1, 50, (110, 95), (250, 25)) self.g1.SetPosition((rect2.x + 2, rect2.y + 2)) self.g1.SetSize((rect2.width - 4, rect2.height - 4)) tsize = (50, 50) create_bmp = wx.Bitmap('img/create_small.png') join_bmp = wx.Bitmap('img/join_small.png') send_bmp = wx.Bitmap('img/send_small.png') stop_bmp = wx.Bitmap('img/cancel_small.png') profile_bmp = wx.Bitmap('img/settings_small.png') disc_bmp = wx.Bitmap('img/discon_small.png') recon_bmp = wx.Bitmap('img/recon_small.png') info_bmp = wx.Bitmap('img/info_small.png') self.tbox = wx.BoxSizer(wx.HORIZONTAL) Lpeers = wx.StaticText(self.tb, -1, 'Peers:\t') self.peers = wx.CheckListBox(self.tb, -1, size=((-1, 68))) self.tbox.Add(Lpeers) self.tbox.Add(self.peers) self.tb.SetToolBitmapSize(tsize) #Toolbars self.tb.AddLabelTool(11, "Create Network", create_bmp, shortHelp="Create Network", longHelp="Create Network") self.tb.AddLabelTool(12, "Join Network", join_bmp, shortHelp="Join Network", longHelp="Join a created Network") self.tb.AddLabelTool(16, "Reconnect", recon_bmp, shortHelp="Reconnect", longHelp="Reconnect to same Network") self.tb.AddLabelTool(17, "Disconnect", disc_bmp, shortHelp="Disconnect", longHelp="Disconnect Network") self.tb.AddLabelTool(13, "Send", send_bmp, shortHelp="Send", longHelp="Send Files/Folders") self.tb.AddLabelTool(14, "Cancel", stop_bmp, shortHelp="Cancel", longHelp="Cancel File(s)") self.tb.AddLabelTool(15, "Preference ", profile_bmp, shortHelp="Preference", longHelp="Preference") self.tb.AddLabelTool(18, "Info ", info_bmp, shortHelp="About", longHelp="About") self.tb.AddSeparator() self.tb.AddSeparator() self.tb.AddControl(Lpeers) self.tb.AddControl(self.peers) self.tb.AddStretchableSpace() self.tb.Realize() self.tb.EnableTool(13, False) self.tb.EnableTool(14, False) #ToolBar Bindings self.Bind(wx.EVT_TOOL, self.CreateNet, id=11) self.Bind(wx.EVT_TOOL, self.JoinNet, id=12) self.Bind(wx.EVT_TOOL, self.OnSend, id=13) self.Bind(wx.EVT_TOOL, self.OnPreference, id=15) self.Bind(wx.EVT_TOOL, self.OnCancel, id=14) self.Bind(wx.EVT_TOOL, self.OnReconnect, id=16) self.Bind(wx.EVT_TOOL, self.OnDisconncet, id=17) self.Bind(wx.EVT_TOOL, self.aboutDialog, id=18) self.dir = wx.GenericDirCtrl(self, -1) tree = self.dir.GetTreeCtrl() #self.Bind(wx.EVT_TREE_SEL_CHANGED,self.tellMe,tree) self.nb = aui.AuiNotebook(self, style=aui.AUI_NB_TOP) self.panel1 = wx.Panel(self) self.panel1.SetBackgroundColour("WHITE") self.panel2 = scrolled.ScrolledPanel(self, -1, size=(140, 300), style=wx.TAB_TRAVERSAL | wx.SUNKEN_BORDER, name="panel1") self.panel2.SetupScrolling() self.queues = wx.ListBox(self, -1) self.probox = wx.BoxSizer(wx.VERTICAL) self.hisbox = wx.BoxSizer(wx.VERTICAL) self.listhis = wx.ListCtrl(self.panel2, -1, style=wx.LC_REPORT) self.listhis.InsertColumn(0, "Filename") self.listhis.InsertColumn(1, "Size") self.listhis.InsertColumn(2, "Date Created") self.listhis.SetColumnWidth(0, 300) self.listhis.SetColumnWidth(1, 90) self.listhis.SetColumnWidth(2, 180) self.real = wx.Menu() openfile = self.real.Append(-1, "Open File") openfolder = self.real.Append(-1, "Open Folder") delete = self.real.Append(-1, "Delete File history") self.realqueue = wx.Menu() deletequeue = self.realqueue.Append(-1, "Delete Queue") self.Bind(wx.EVT_MENU, self.deleteQueue, deletequeue) self.Bind(wx.EVT_MENU, self.openFile, openfile) self.Bind(wx.EVT_MENU, self.openFolder, openfolder) self.Bind(wx.EVT_MENU, self.deleteFile, delete) self.listhis.Bind(wx.EVT_CONTEXT_MENU, self.listMenu) self.queues.Bind(wx.EVT_CONTEXT_MENU, self.queueMenu) self.panel1.SetSizer(self.probox) self.panel2.SetSizer(self.hisbox) self.hisbox.Add(self.listhis, 0, wx.GROW) self.perc = wx.BoxSizer(wx.HORIZONTAL) self.detail1 = wx.BoxSizer(wx.HORIZONTAL) self.detail2 = wx.BoxSizer(wx.HORIZONTAL) self.probox.Clear() self.g1 = wx.Gauge(self.panel1, -1, 50, (110, 40), (250, 25)) self.filename = wx.StaticText(self.panel1, -1, "Filename: ") self.filenamereal = wx.StaticText(self.panel1, -1) self.start = gz.LEDNumberCtrl(self.panel1, -1, size=(75, 30)) self.start.SetValue("--") self.end = gz.LEDNumberCtrl(self.panel1, -1, size=(75, 30)) self.end.SetValue("--") self.filesize = wx.StaticText(self.panel1, -1, "Filesize: ") self.size = wx.StaticText(self.panel1, -1) self.make = wx.StaticText(self.panel1, -1) #self.start.Hide() #self.end.Hide() self.perc.Add(self.start) self.perc.Add(self.end) self.detail1.Add(self.filename) self.detail1.Add(self.filenamereal) self.detail2.Add(self.filesize) self.detail2.Add(self.size) self.probox.Add(self.perc, 0, wx.ALIGN_CENTER | wx.TOP | wx.BOTTOM, 2) self.probox.Add(self.g1, 0, wx.GROW | wx.ALL, 5) self.probox.Add(self.detail1, 0, wx.LEFT | wx.RIGHT, 5) self.probox.Add(self.detail2, 0, wx.LEFT | wx.RIGHT, 5) self.probox.Add(self.make, 0, wx.LEFT | wx.RIGHT, 5) self.probox.Layout() self.probox.RecalcSizes() self.panel1.Layout() self.populateHistory() self.nb.AddPage(self.panel1, "Downloading") self.nb.AddPage(self.panel2, "History") self.Bind(wx.EVT_CLOSE, self.OnCloseWindow) self.nb.SetSelection(1) self.mgr.AddPane(self.tb, aui.AuiPaneInfo().ToolbarPane().Top().Dockable(False)) self.mgr.AddPane(self.dir, aui.AuiPaneInfo().Name('main').CenterPane()) self.mgr.AddPane( self.queues, aui.AuiPaneInfo().Name('side').Right().Caption( "Process Queue").CloseButton(False).BestSize((150, -1))) self.mgr.AddPane( self.nb, aui.AuiPaneInfo().Caption("Thread").Bottom().CloseButton( False).BestSize((-1, 500))) self.mgr.Update() self.Center() pub.subscribe(self.peerListener, "peers") pub.subscribe(self.lostListener, "lost") pub.subscribe(self.processListener, "process") pub.subscribe(self.updateListener, "update") pub.subscribe(self.clearListener, "done") pub.subscribe(self.sendingListener, "analysing") pub.subscribe(self.stopListener, "stopanalysing") pub.subscribe(self.sentListener, "donereceived") pub.subscribe(self.fileQueue, "filequeue") pub.subscribe(self.deleteFileQueue, "deletefile") pub.subscribe(self.folderQueue, "folderqueue") pub.subscribe(self.deleteFileQueue, "deletefolder") pub.subscribe(self.folderFile, "updatefolder")
def __init__(self, parent, id, title): wx.Frame.__init__( self, parent, id, title, \ pos = wx.DefaultPosition,\ size = (1024,768),\ style = wx.DEFAULT_FRAME_STYLE,\ name = 'frame' ) Frame.mainFrame = self self.__InitXRC() self.SetMinSize((800, 600)) self.haveFocus = False # pnl = wx.Panel(self) # self.pnl = pnl self.mgr = aui.AuiManager() self.mgr.SetManagedWindow(self) icon = wx.Icon(name='res/Python.ico', type=wx.BITMAP_TYPE_ICO) self.SetIcon(icon) if sys.version_info.major == 2: self.statusBar = self.CreateStatusBar(2, wx.ST_SIZEGRIP) elif sys.version_info.major == 3: self.statusBar = self.CreateStatusBar(2, wx.STB_SIZEGRIP) self.statusBar.SetStatusWidths([-2, -1]) statusText = u'MicroChat use wxPython %s' % wx.version() self.statusBar.SetStatusText(statusText, 0) if platform.system() == 'Windows': ctrl_style = wx.TE_RICH | wx.TE_MULTILINE | wx.TE_READONLY | wx.HSCROLL | wx.NO_BORDER else: ctrl_style = wx.TE_MULTILINE | wx.TE_READONLY | wx.HSCROLL | wx.NO_BORDER # self.log = rt.RichTextCtrl( self, style=wx.VSCROLL|wx.HSCROLL|wx.NO_BORDER|rt.RE_READONLY ) self.log = wx.TextCtrl(self, wx.ID_ANY, style=ctrl_style) if sys.version_info.major == 2: wx.Log_SetActiveTarget(MyLog(self.log)) elif sys.version_info.major == 3: wx.Log.SetActiveTarget(MyLog(self.log)) # self.mgr.AddPane( ConfigurePanel(self, style=wx.TAB_TRAVERSAL|wx.CLIP_CHILDREN, log=self.log), # aui.AuiPaneInfo(). # Centre().Layer(2).BestSize((240,-1)). # MinSize((160,-1)). # Floatable(ALLOW_AUI_FLOATING).FloatingSize((240,700)). # Caption(u'Configure'). # CloseButton(False). # Name(u'A2')) s = aui.AUI_NB_SCROLL_BUTTONS | aui.AUI_NB_TAB_EXTERNAL_MOVE | aui.AUI_NB_TAB_FIXED_WIDTH | aui.AUI_NB_TAB_SPLIT | aui.AUI_NB_TOP | aui.AUI_NB_WINDOWLIST_BUTTON # | aui.AUI_NB_LEFT # | aui.AUI_NB_RIGHT # | aui.AUI_NB_TAB_MOVE # | aui.AUI_NB_BOTTOM self.nb = aui.AuiNotebook(self, style=s) page = MicroChatPanel(self, style=wx.TAB_TRAVERSAL | wx.CLIP_CHILDREN, log=self.log) stockPanel = page # DataMngr().ob_ui.panels.append( page ) # page.draw() self.nb.AddPage(page, u'MicroChat') self.mgr.AddPane( self.nb, aui.AuiPaneInfo().Centre().Layer(2).BestSize((240, -1)).MinSize( (160, -1)).Floatable(ALLOW_AUI_FLOATING).FloatingSize( (240, 700)).Caption(u'Configure').CloseButton( False).MaximizeButton(True).Name(u'A2')) self.mgr.AddPane( self.log, aui.AuiPaneInfo().Caption(u'Log Messages').Right().Layer(1). Position(1).BestSize((-1, 80)).Dockable(False).MinSize( (-1, 80)).Floatable(ALLOW_AUI_FLOATING).FloatingSize( (500, 160)).CloseButton(True).MaximizeButton(True).Name(u'A3')) self.mgr.Update() if sys.version_info.major == 2: self.mgr.SetFlags(self.mgr.GetFlags() ^ aui.AUI_MGR_TRANSPARENT_DRAG) # 绑定事件处理 self.Bind(wx.EVT_CLOSE, self.OnCloseWindow) self.Bind(EVT_TASK_FINISH, self.OnTaskFinish) self.Bind(aui.EVT_AUINOTEBOOK_PAGE_CHANGING, self.OnPageChangeine) self.Bind(wx.EVT_SET_FOCUS, self.OnSetFocus) # self.Bind(wx.EVT_KILL_FOCUS, self.OnKillFocus) self.Bind(wx.EVT_MOUSE_EVENTS, self.OnMouse) self.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown) self.Bind(wx.EVT_KEY_UP, self.OnKeyUp) self.Bind(wx.EVT_CHAR, self.OnChar) self.Bind(wx.EVT_MOVE, self.OnMove) # LOG self.Bind(EVT_WX_LOG_EVENT, self.OnLogEvent) self.uilog = wxLogHandler(self) if g_log is not None: g_log.AddHandler(self.uilog) self.SetFocus() # self.searchDlg = wx.Dialog(self, -1, 'test dlg') self.nb.SetSelection(0) # self.nb.ChangeSelection(1) # wx.LogError('test log error') # wx.LogWarning('test log warning') # wx.LogDebug('test log debug') # stockPanel.LoadDataFromHDF5( 'sz002487' ) # stockPanel.LoadDataFromHDF5( 'sh000001' ) # stockPanel.LoadDataFromHDF5( 'sz000666' ) # stockPanel.LoadDataFromHDF5( Config.stock, Config.kType ) # stockPanel.LoadDataFromHDF5( 'sz300315' ) # Start Work Thread def RunOtherThread(*args): pass # print( 'RunOtherThread', *args ) # start = -1 # end = -1 # pipeline, code, ktype, rtype = args # df = DataMngr.GetKBarDF( code, ktype, start, end, rtype=rtype ) # if df is not None: # wx.CallAfter( stockPanel.OnDFLoaded, df ) # core.taskMng.SubmitTask( core.tid, None, RunOtherThread, 1 ) # Test new thread task pipline. task = Task() task.phase = 0 task.process = RunOtherThread # task.params = (Config.stock, Config.kType, Config.rtype) task.params = () core.taskMng.SubmitTask(task)