def __init__(self, parent): attribList = (glcanvas.WX_GL_RGBA, glcanvas.WX_GL_DOUBLEBUFFER, glcanvas.WX_GL_DEPTH_SIZE, 24, glcanvas.WX_GL_STENCIL_SIZE, 8, 0) glcanvas.GLCanvas.__init__(self, parent, style=wx.WANTS_CHARS, attribList = attribList) self._base = self self._focus = None self._container = None self._container = glGuiContainer(self, (0,0)) self._shownError = False self._context = glcanvas.GLContext(self) #self._glButtonsTexture = None self._buttonSize = 64 self._animationList = [] self.glReleaseList = [] self._refreshQueued = False self._idleCalled = False wx.EVT_PAINT(self, self._OnGuiPaint) wx.EVT_SIZE(self, self._OnSize) wx.EVT_ERASE_BACKGROUND(self, self._OnEraseBackground) wx.EVT_LEFT_DOWN(self, self._OnGuiMouseDown) wx.EVT_LEFT_DCLICK(self, self._OnGuiMouseDown) wx.EVT_LEFT_UP(self, self._OnGuiMouseUp) wx.EVT_RIGHT_DOWN(self, self._OnGuiMouseDown) wx.EVT_RIGHT_DCLICK(self, self._OnGuiMouseDown) wx.EVT_RIGHT_UP(self, self._OnGuiMouseUp) wx.EVT_MIDDLE_DOWN(self, self._OnGuiMouseDown) wx.EVT_MIDDLE_DCLICK(self, self._OnGuiMouseDown) wx.EVT_MIDDLE_UP(self, self._OnGuiMouseUp) wx.EVT_MOTION(self, self._OnGuiMouseMotion) wx.EVT_KEY_DOWN(self, self._OnGuiKeyDown) wx.EVT_KEY_UP(self, self._OnGuiKeyUp) wx.EVT_KILL_FOCUS(self, self.OnFocusLost) wx.EVT_IDLE(self, self._OnIdle)
def _on_close(self, event): # Might be scrollbars or other native components under # us that are generating this event if event.GetWindow() == self.control: self._gc = None wx.EVT_ERASE_BACKGROUND(self.control, None) wx.EVT_PAINT(self.control, None) wx.EVT_SIZE(self.control, None) wx.EVT_LEFT_DOWN(self.control, None) wx.EVT_LEFT_UP(self.control, None) wx.EVT_LEFT_DCLICK(self.control, None) wx.EVT_MIDDLE_DOWN(self.control, None) wx.EVT_MIDDLE_UP(self.control, None) wx.EVT_MIDDLE_DCLICK(self.control, None) wx.EVT_RIGHT_DOWN(self.control, None) wx.EVT_RIGHT_UP(self.control, None) wx.EVT_RIGHT_DCLICK(self.control, None) wx.EVT_MOTION(self.control, None) wx.EVT_ENTER_WINDOW(self.control, None) wx.EVT_LEAVE_WINDOW(self.control, None) wx.EVT_MOUSEWHEEL(self.control, None) wx.EVT_KEY_DOWN(self.control, None) wx.EVT_KEY_UP(self.control, None) wx.EVT_CHAR(self.control, None) wx.EVT_WINDOW_DESTROY(self.control, None) self.control.SetDropTarget(None) self.control = None self.component.cleanup(self) self.component.parent = None self.component.window = None self.component = None return
def __init__(self, parent, filename='memo.txt', title='', style=wx.DEFAULT_FRAME_STYLE): x, y, w, h = Globals.mainframe.GetClientRect().Get() x, y = Globals.mainframe.ClientToScreenXY(x, y) if not hasattr(Globals.mainframe.pref, 'memo_pos'): memo_pos = (max(0, x + w - 200), y) else: memo_pos = Globals.mainframe.pref.memo_pos if not hasattr(Globals.mainframe.pref, 'memo_size'): memo_size = (200, 300) else: memo_size = Globals.mainframe.pref.memo_size wx.MiniFrame.__init__(self, parent, -1, title, memo_pos, memo_size, style) self.filename = filename self.text = wx.stc.StyledTextCtrl(self, -1) self.text.SetMarginWidth(0, 0) #used as symbol self.text.SetMarginWidth(1, 0) #used as symbol self.text.SetMarginWidth(2, 0) #used as folder self.text.SetMargins(0, 0) self.text.SetWrapMode(wx.stc.STC_WRAP_WORD) if os.path.exists(self.filename): text = unicode(file(self.filename).read(), 'utf-8') self.text.SetText(text) self.text.SetFocus() self.text.EnsureCaretVisible() self.text.GotoLine(Globals.mainframe.pref.easy_memo_lastpos) wx.stc.EVT_STC_MODIFIED(self.text, self.text.GetId(), self.OnModified) wx.EVT_KEY_UP(self.text, self.OnKeyUp) wx.EVT_LEFT_UP(self.text, self.OnMouseUp) wx.EVT_CLOSE(self, self.OnClose)
def setupCallbacks(self): """Setup various callbacks for this context Binds most of the wxPython event types to callbacks on this object, which allows interactive sub-classes to easily manage the bindings without needing any wxPython-specific logic. """ if not self.init: self.init = 1 # Bind the wxPython background erase event # Without this binding, the canvas will tend to flicker wx.EVT_ERASE_BACKGROUND(self, self.wxOnEraseBackground) # Handle resizing of the window wx.EVT_SIZE(self, self.wxOnSize) # Handle requests to display this canvas wx.EVT_PAINT(self, self.wxOnPaint) # Handle keyboard events... wx.EVT_KEY_DOWN(self, self.wxOnKeyDown) wx.EVT_KEY_UP(self, self.wxOnKeyUp) wx.EVT_CHAR(self, self.wxOnCharacter) # Handle mouse events... wx.EVT_LEFT_DOWN(self, self.wxOnMouseButton) wx.EVT_RIGHT_DOWN(self, self.wxOnMouseButton) wx.EVT_MIDDLE_DOWN(self, self.wxOnMouseButton) wx.EVT_LEFT_UP(self, self.wxOnMouseButton) wx.EVT_RIGHT_UP(self, self.wxOnMouseButton) wx.EVT_MIDDLE_UP(self, self.wxOnMouseButton) wx.EVT_MOTION(self, self.wxOnMouseMove) if hasattr(self, 'OnIdle'): wx.EVT_IDLE(self, self.wxOnIdle)
def __init__(self, parent, ctrl_id=wx.ID_ANY, value=wx.EmptyString, name=wx.TextCtrlNameStr): wx.TextCtrl.__init__(self, parent, ctrl_id, value, name=name) wx.EVT_KEY_UP(self, self.OnKeyUp)
def __register_interests(self): self.SetModEventMask (wx.stc.STC_MOD_INSERTTEXT | wx.stc.STC_MOD_DELETETEXT | wx.stc.STC_PERFORMED_USER) wx.stc.EVT_STC_MODIFIED (self, self.GetId(), self.__on_STC_modified) wx.EVT_KEY_DOWN (self, self.__on_key_down) wx.EVT_KEY_UP (self, self.__OnKeyUp) wx.EVT_CHAR(self, self.__on_char)
def __register_events(self): wx.EVT_BUTTON(self.BTN_save_request_ID, wx.ID_BTN_save_request_ID, self.on_save_request_ID) wx.EVT_BUTTON(self.BTN_select_all, wx.ID_BTN_select_all, self.on_select_all) wx.EVT_BUTTON(self.BTN_mark_reviewed, wx.ID_BTN_mark_reviewed, self._on_mark_reviewed) wx.EVT_GRID_CELL_LEFT_CLICK(self.__grid_unreviewed_results, self.OnLeftSClick) wx.EVT_GRID_CELL_LEFT_DCLICK(self.__grid_unreviewed_results, self.OnLeftDClick) #wx.EVT_GRID_SELECT_CELL(self.__grid_unreviewed_results, self.OnSelectCell) wx.EVT_KEY_UP(self.__grid_unreviewed_results, self.OnKeyPressed)
def __init__(self, parent, mw, id): wx.TreeCtrl.__init__(self, parent, id, style=wx.TR_HAS_BUTTONS) self.parent = parent self.mw = mw self.config = mw.config bmsize = (22, 22) wx.EVT_TREE_SEL_CHANGED(self, id, self.OnItemSelected) self.image_list = wx.ImageList(22, 22) self.img_dir = self.image_list.Add( wx.ArtProvider_GetBitmap(wx.ART_FOLDER, wx.ART_OTHER, bmsize)) art = [ "phonebook", "wallpaper", "ringers", "calendar", "callhistory", "calls", "sms", "message", "memo", "file", "log", "todo", "playlist", "protocol", "console", "phone_root", "phone", "root_image", "media", "image", "video", "camera", "sounds" ] for k in art: s = "self.%s= self.image_list.Add(wx.ArtProvider_GetBitmap(guihelper.ART_SEL_%s,wx.ART_TOOLBAR,bmsize))" % ( k, k.upper()) exec(s) self.SetImageList(self.image_list) if self.config.ReadInt('startwithtoday', 0): self.startuppage = 'Phone' else: self.startuppage = self.config.Read("viewnotebookpage", "") self.startuppage_item = None self.DeleteAllItems() self.active_phone = None self.active_panel = self.root_panel = widgets.RootWidget( self.parent, wx.NewId()) self.root = self.AddPage(None, self.root_panel, "BitPim", self.root_image) self.del_bmp, self.short_help_delete = self.root_panel.GetDeleteInfo() self.add_bmp, self.short_help_add = self.root_panel.GetAddInfo() self.lw = None self.lwdata = None self.filesystemwidget = None wx.EVT_RIGHT_UP(self, self.OnRightUp) wx.EVT_KEY_DOWN(self, self.OnKeyDown) wx.EVT_KEY_UP(self, self.OnKeyUp) # add shared tabs self.lw = guiwidgets.LogWindow(self.parent) self.lw_id = self.AddPage(self.root, self.lw, "Log", self.log) # Final widgets that depend on config lv = self.config.ReadInt("viewlogdata", 0) if lv: self.OnViewLogData(None) fv = self.config.ReadInt("viewfilesystem", 0) if fv: self.OnViewFilesystem(None) wx.Yield()
def init_keys(self, parent=None): """ Sets events and variables for parent. If no parent is defined then self is assumed to be parent. """ if parent == None: parent = self self.key_pressed = '' # string code of currently pressed key wx.EVT_ENTER_WINDOW(self, self.on_enter_window) wx.EVT_KEY_DOWN(self, self.on_key_down) wx.EVT_KEY_UP(self, self.on_key_up)
def __init__(self, mainControl, parent, id): wx.Notebook.__init__(self, parent, id) # nb = wx.PreNotebook() # self.PostCreate(nb) MiscEventSourceMixin.__init__(self) self.mainControl = mainControl self.mainControl.getMiscEvent().addListener(self) self.currentPresenter = None self.presenters = [] self.mruTabIndex = [] self.tabSwitchByKey = 0 # 2: Key hit, notebook change not processed; # 1: Key hit, nb. change processed # 0: Processing done self.currentPresenterProxyEvent = ProxyMiscEvent(self) # Last presenter for which a context menu was shown self.lastContextMenuPresenter = None self.runningPageChangedEvent = False # res = xrc.XmlResource.Get() # self.docPagePresContextMenu = res.LoadMenu("MenuDocPagePresenterTabPopup") self.tabDragCursor = wx.StockCursor(wx.CURSOR_HAND) self.tabDragging = wx.NOT_FOUND # wx.EVT_NOTEBOOK_PAGE_CHANGED(self, self.GetId(), # self.OnNotebookPageChanged) self.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self.OnNotebookPageChanged) wx.EVT_KEY_UP(self, self.OnKeyUp) wx.EVT_LEFT_DOWN(self, self.OnLeftDown) wx.EVT_LEFT_UP(self, self.OnLeftUp) wx.EVT_MIDDLE_DOWN(self, self.OnMiddleDown) wx.EVT_MOTION(self, self.OnMotion) wx.EVT_CONTEXT_MENU(self, self.OnContextMenu) wx.EVT_SET_FOCUS(self, self.OnFocused) wx.EVT_KILL_FOCUS(self, self.OnKillFocus) # EVT_AFTER_FOCUS(self, self.OnAfterFocus) wx.EVT_MENU(self, GUI_ID.CMD_CLOSE_THIS_TAB, self.OnCloseThisTab) wx.EVT_MENU(self, GUI_ID.CMD_CLOSE_CURRENT_TAB, self.OnCloseCurrentTab) wx.EVT_MENU(self, GUI_ID.CMD_THIS_TAB_SHOW_SWITCH_EDITOR_PREVIEW, self.OnCmdSwitchThisEditorPreview) wx.EVT_MENU(self, GUI_ID.CMD_GO_NEXT_TAB, self.OnGoTab) wx.EVT_MENU(self, GUI_ID.CMD_GO_PREVIOUS_TAB, self.OnGoTab) wx.EVT_MENU(self, GUI_ID.CMD_CLIPBOARD_COPY_URL_TO_THIS_WIKIWORD, self.OnCmdClipboardCopyUrlToThisWikiWord)
def __init__(self, parent, win_id=wx.ID_ANY, value=u'/', defaultValue=u'/', warn=False, name=wx.TextCtrlNameStr): TextArea.__init__(self, parent, win_id, value, defaultValue, name=name) # TODO: Rename to 'self.Default' self.Default = defaultValue self.Warn = warn # For restoring color of text area self.clr_default = self.GetBackgroundColour() # Make sure first character is forward slash wx.EVT_KEY_UP(self, self.OnKeyUp) # Set to default value & check path availability on construction self.Reset()
def message_init(win): wx.EVT_IDLE(win, win.OnIdle) wx.EVT_END_PROCESS(win.mainframe, -1, win.mainframe.OnProcessEnded) wx.EVT_KEY_DOWN(win, win.OnKeyDown) wx.EVT_KEY_UP(win, win.OnKeyUp) wx.EVT_UPDATE_UI(win, win.GetId(), win.RunCheck) win.MAX_PROMPT_COMMANDS = 25 win.process = None win.pid = -1 win.CommandArray = [] win.CommandArrayPos = -1 win.editpoint = 0 win.writeposition = 0 win.callback = None
def __init__(self,parent): glcanvas.GLCanvas.__init__(self, parent, -1) self.init = False self.width = 0 self.height = 0 self.zoom = 50.0 self.minZoom = 5.0 self.maxZoom = 400.0 self.lookingAtX = 0 self.lookingAtY = 0 self.lookingAtZ = 0 self.viewAngleSky = 50.0 self.viewAngleFloor = 90.0 self.angleSpeed = 3.0 self.viewX = 0 self.viewY = 0 self.viewZ = 0 self.point = Numeric.zeros((1,4),typecode=Numeric.Float) self.clearCache() self.frustum = [] self.viewMatrixInv = Numeric.identity(4,Numeric.Float) self.modelMatrix = None self.currentModelView = None self.redrawRequested = False self.preprocessed = False self.preprocessing = False wx.EVT_ERASE_BACKGROUND(self, self.OnEraseBackground) wx.EVT_SIZE(self, self.OnSize) wx.EVT_PAINT(self, self.OnPaint) wx.EVT_LEFT_DOWN(self, self.OnMouseDown) wx.EVT_LEFT_UP(self, self.OnMouseUp) wx.EVT_MOTION(self, self.OnMouseMotion) wx.EVT_MOUSEWHEEL(self, self.OnMouseWheel) wx.EVT_KEY_DOWN(self, self.OnKeyDown) wx.EVT_KEY_UP(self,self.OnKeyUp)
def finish_widget_creation(self, *args, **kwds): # store the actual values of foreground, background and font as default, if the property is deactivated later self.properties["background"].set_default( self.widget.GetBackgroundColour()) self.properties["foreground"].set_default( self.widget.GetForegroundColour()) fnt = self.widget.GetFont() if not fnt.IsOk(): fnt = wx.SystemSettings_GetFont(wx.SYS_DEFAULT_GUI_FONT) self._original['font'] = fnt prop = self.properties size_p = prop['size'] if size_p.is_active(): #self.widget.SetSize([int(s) for s in size.split(',')]) self.set_size(size_p.get()) else: # this is a dirty hack: in previous versions <=0.7.2 self.set_size is practically always called # set_size then calls self.sizer.set_item(item, pos) # without calling this here, e.g. an empty notebook page is not created! # XXX this should be made more straightforward if "pos" in self.properties: self.sizer.set_item(self.pos) size_p.set('%s, %s' % tuple(self.widget.GetSize())) self.widget.SetBackgroundColour(self.background) # active or default self.widget.SetForegroundColour(self.foreground) # active or default font_p = prop.get('font') if font_p and font_p.is_active(): self._set_font() EditBase.finish_widget_creation(self) wx.EVT_SIZE(self.widget, self.on_size) # after setting various Properties, we must Refresh widget in order to see changes self.widget.Refresh() wx.EVT_KEY_DOWN(self.widget, misc.on_key_down_event) wx.EVT_KEY_UP(self.widget, misc.on_key_down_event)
def __init__(self, parent): attrib_list = (glcanvas.WX_GL_RGBA, glcanvas.WX_GL_DOUBLEBUFFER, glcanvas.WX_GL_DEPTH_SIZE, 24, glcanvas.WX_GL_STENCIL_SIZE, 8, 0) glcanvas.GLCanvas.__init__(self, parent, style=wx.WANTS_CHARS, attribList=attrib_list) self._base = self self._focus = None self._container = None self._container = glGuiContainer(self, (0, 0)) self._shown_error = False self._context = glcanvas.GLContext(self) self._button_size = 64 self._animation_list = [] self.gl_release_list = [] self._refresh_queued = False self._idle_called = False wx.EVT_PAINT(self, self._on_gui_paint) wx.EVT_SIZE(self, self._on_size) wx.EVT_ERASE_BACKGROUND(self, self._on_erase_background) wx.EVT_LEFT_DOWN(self, self._on_gui_mouse_down) wx.EVT_LEFT_DCLICK(self, self._on_gui_mouse_down) wx.EVT_LEFT_UP(self, self._on_gui_mouse_up) wx.EVT_RIGHT_DOWN(self, self._on_gui_mouse_down) wx.EVT_RIGHT_DCLICK(self, self._on_gui_mouse_down) wx.EVT_RIGHT_UP(self, self._on_gui_mouse_up) wx.EVT_MIDDLE_DOWN(self, self._on_gui_mouse_down) wx.EVT_MIDDLE_DCLICK(self, self._on_gui_mouse_down) wx.EVT_MIDDLE_UP(self, self._on_gui_mouse_up) wx.EVT_MOTION(self, self._on_gui_mouse_motion) wx.EVT_KEY_DOWN(self, self._on_gui_key_down) wx.EVT_KEY_UP(self, self._on_gui_key_up) wx.EVT_KILL_FOCUS(self, self._on_focus_lost) wx.EVT_IDLE(self, self._on_idle)
def __init__(self, mainControl, parent, id): # TODO: test some of the style flags # * Floating tabs produces issues as the tabs are not longer # associated with this notebook (so SetSelection order fails) # * Check how day order is affected when splitting the page # #aui.AuiNotebook.__init__(self, parent, id, agwStyle=aui.AUI_NB_TAB_MOVE|aui.AUI_NB_TAB_SPLIT|aui.AUI_NB_TAB_FLOAT|aui.AUI_NB_ORDER_BY_ACCESS) aui.AuiNotebook.__init__(self, parent, id, agwStyle=aui.AUI_NB_DEFAULT_STYLE & ~aui.AUI_NB_MIDDLE_CLICK_CLOSE) # nb = wx.PreNotebook() # self.PostCreate(nb) MiscEventSourceMixin.__init__(self) # flags = aui.AUI_NB_TAB_SPLIT |\ # aui.AUI_NB_TAB_MOVE |\ # aui.AUI_NB_TAB_EXTERNAL_MOVE |\ # aui.AUI_NB_TAB_FLOAT # # # Playing around (testing different style flags) # self.SetAGWWindowStyleFlag(flags) self.mainControl = mainControl self.mainControl.getMiscEvent().addListener(self) self.preparingPresenter = False self.currentPresenter = None # References to all tab windows self._mruTabSequence = Utilities.IdentityList() self.tabSwitchByKey = 0 # 2: Key hit, notebook change not processed; # 1: Key hit, nb. change processed # 0: Processing done self.currentPresenterProxyEvent = ProxyMiscEvent(self) # Last presenter for which a context menu was shown self.lastContextMenuPresenter = None self.runningPageChangedEvent = False # res = xrc.XmlResource.Get() # self.docPagePresContextMenu = res.LoadMenu("MenuDocPagePresenterTabPopup") self.Bind(aui.EVT_AUINOTEBOOK_PAGE_CLOSE, self.OnCloseAuiTab) self.Bind(aui.EVT_AUINOTEBOOK_PAGE_CHANGED, self.OnNotebookPageChanged) # self.Bind(aui.EVT_AUINOTEBOOK_PAGE_CHANGING, self.OnNotebookPageChanging) self.Bind(aui.EVT_AUINOTEBOOK_TAB_RIGHT_DOWN, self.OnTabContextMenu, self) self.Bind(aui.EVT_AUINOTEBOOK_TAB_MIDDLE_DOWN, self.OnTabMiddleDown, self) self.Bind(aui.EVT_AUINOTEBOOK_PAGE_VISIBILITY_CHANGED, self.OnNotebookPageVisibilityChanged) self.Bind(aui.EVT_AUINOTEBOOK_SET_FOCUS, self.OnNotebookPageSetFocus) #wx.EVT_CONTEXT_MENU(self, self.OnTabContextMenu) wx.EVT_KEY_UP(self, self.OnKeyUp) #wx.EVT_MIDDLE_DOWN(self, self.OnMiddleDown) # wx.EVT_SET_FOCUS(self, self.OnFocused) wx.EVT_KILL_FOCUS(self, self.OnKillFocus) wx.EVT_MENU(self, GUI_ID.CMD_CLOSE_THIS_TAB, self.OnCloseThisTab) wx.EVT_MENU(self, GUI_ID.CMD_CLOSE_CURRENT_TAB, self.OnCloseCurrentTab) wx.EVT_MENU(self, GUI_ID.CMD_THIS_TAB_SHOW_SWITCH_EDITOR_PREVIEW, self.OnCmdSwitchThisEditorPreview) wx.EVT_MENU(self, GUI_ID.CMD_GO_NEXT_TAB, self.OnGoTab) wx.EVT_MENU(self, GUI_ID.CMD_GO_PREVIOUS_TAB, self.OnGoTab) wx.EVT_MENU(self, GUI_ID.CMD_CLIPBOARD_COPY_URL_TO_THIS_WIKIWORD, self.OnCmdClipboardCopyUrlToThisWikiWord)
def _create_control(self, parent): """ Create the toolkit-specific control that represents the widget. """ # Create the VTK widget. self._vtk_control = window = wxVTKRenderWindowInteractor(parent, -1, stereo=self.stereo) # Override these handlers. wx.EVT_CHAR(window, None) # Remove the default handler. wx.EVT_CHAR(window, self.OnKeyDown) wx.EVT_KEY_UP(window, None) # Remove the default handler. wx.EVT_KEY_UP(window, self.OnKeyUp) wx.EVT_PAINT(window, None) # Remove the default handler. wx.EVT_PAINT(window, self.OnPaint) wx.EVT_SIZE(window, None) # Remove the default handler. wx.EVT_SIZE(window, self.OnSize) # Override the button down and up handlers as well to note the # interaction. This is to toggle the busy status nicely. for evt in (wx.EVT_LEFT_DOWN, wx.EVT_RIGHT_DOWN, wx.EVT_MIDDLE_DOWN): evt(window, None) evt(window, self.OnButtonDown) for evt in (wx.EVT_LEFT_UP, wx.EVT_RIGHT_UP, wx.EVT_MIDDLE_UP): evt(window, None) evt(window, self.OnButtonUp) # Enable the widget. window.Enable(1) # Switch the default interaction style to the trackball one. window.GetInteractorStyle().SetCurrentStyleToTrackballCamera() # Grab the renderwindow. renwin = self._renwin = tvtk.to_tvtk(window.GetRenderWindow()) renwin.set(point_smoothing=self.point_smoothing, line_smoothing=self.line_smoothing, polygon_smoothing=self.polygon_smoothing) # Create a renderer and add it to the renderwindow self._renderer = tvtk.Renderer() renwin.add_renderer(self._renderer) # Save a reference to our camera so it is not GC'd -- needed for # the sync_traits to work. self._camera = self.camera # Sync various traits. self._renderer.background = self.background self.sync_trait('background', self._renderer) self.renderer.on_trait_change(self.render, 'background') self._camera.parallel_projection = self.parallel_projection self.sync_trait('parallel_projection', self._camera) renwin.off_screen_rendering = self.off_screen_rendering self.sync_trait('off_screen_rendering', self._renwin) self.render_window.on_trait_change(self.render, 'off_screen_rendering') self.render_window.on_trait_change(self.render, 'stereo_render') self.render_window.on_trait_change(self.render, 'stereo_type') self.camera.on_trait_change(self.render, 'parallel_projection') def _show_parent_hack(window, parent): """A hack to get the VTK scene properly setup for use.""" # Force the parent to show itself. parent.Show(1) # on some platforms, this SetSize() is necessary to cause # an OnPaint() when the event loop begins; else we get an # empty window until we force a redraw. window.SetSize(parent.GetSize()) # This is necessary on slow machines in order to force the # wx events to be handled. wx.GetApp().Yield(True) window.Render() if wx.Platform == '__WXMSW__': _show_parent_hack(window, parent) else: if (wx.VERSION[0] == 2) and (wx.VERSION[1] < 5): _show_parent_hack(window, parent) window.Update() # Because of the way the VTK widget is setup, and because we # set the size above, the window sizing is usually completely # messed up when the application window is shown. To work # around this a dynamic IDLE event handler is added and # immediately removed once it executes. This event handler # simply forces a resize to occur. The _idle_count allows us # to execute the idle function a few times (this seems to work # better). def _do_idle(event, window=window): w = wx.GetTopLevelParent(window) # Force a resize sz = w.GetSize() w.SetSize((sz[0]-1, sz[1]-1)) w.SetSize(sz) window._idle_count -= 1 if window._idle_count < 1: wx.EVT_IDLE(window, None) del window._idle_count window._idle_count = 2 wx.EVT_IDLE(window, _do_idle) self._interactor = tvtk.to_tvtk(window._Iren) return window
def __init__(self, presenter, parent, ID): wx.html.HtmlWindow.__init__(self, parent, ID) self.presenter = presenter self.presenterListener = wxKeyFunctionSink(( ("loaded current wiki page", self.onLoadedCurrentWikiPage), ("reloaded current doc page", self.onReloadedCurrentPage), ("opened wiki", self.onOpenedWiki), ("closing current wiki", self.onClosingCurrentWiki) ), self.presenter.getMiscEvent()) self.__sinkApp = wxKeyFunctionSink(( ("options changed", self.onOptionsChanged), ), wx.GetApp().getMiscEvent()) self.__sinkDocPage = wxKeyFunctionSink(( ("updated wiki page", self.onUpdatedWikiPage), ("changed live text", self.onChangedLiveText) ), self.presenter.getCurrentDocPageProxyEvent()) self.visible = False self.outOfSync = True # HTML content is out of sync with live content self.counterResizeIgnore = 0 # How often to ignore a size event self.deferredScrollPos = None # Used by scrollDeferred() self.currentLoadedWikiWord = None self.anchor = None # Name of anchor to jump to when view gets visible self.contextHref = None # Link href on which context menu was opened # TODO Should be changed to presenter as controller self.exporterInstance = PluginManager.getExporterTypeDict( self.presenter.getMainControl(), False)[u"html_single"][0]\ (self.presenter.getMainControl()) self._DEFAULT_FONT_SIZES = self.presenter.getMainControl().presentationExt.INTHTML_FONTSIZES # TODO More elegantly self.exporterInstance.exportType = u"html_previewWX" self.exporterInstance.styleSheet = u"" self.exporterInstance.tempFileSet = TempFileSet() self._updateTempFilePrefPath() self.exporterInstance.setWikiDocument( self.presenter.getWikiDocument()) self.exporterInstance.setLinkConverter( LinkConverterForPreview(self.presenter.getWikiDocument())) wx.EVT_KEY_DOWN(self, self.OnKeyDown) wx.EVT_KEY_UP(self, self.OnKeyUp) wx.EVT_SIZE(self, self.OnSize) wx.EVT_MENU(self, GUI_ID.CMD_CLIPBOARD_COPY, self.OnClipboardCopy) wx.EVT_MENU(self, GUI_ID.CMD_SELECT_ALL, lambda evt: self.SelectAll()) wx.EVT_MENU(self, GUI_ID.CMD_ZOOM_IN, lambda evt: self.addZoom(1)) wx.EVT_MENU(self, GUI_ID.CMD_ZOOM_OUT, lambda evt: self.addZoom(-1)) wx.EVT_MENU(self, GUI_ID.CMD_ACTIVATE_THIS, self.OnActivateThis) wx.EVT_MENU(self, GUI_ID.CMD_ACTIVATE_NEW_TAB_THIS, self.OnActivateNewTabThis) wx.EVT_MENU(self, GUI_ID.CMD_ACTIVATE_NEW_TAB_BACKGROUND_THIS, self.OnActivateNewTabBackgroundThis) wx.EVT_MENU(self, GUI_ID.CMD_ACTIVATE_NEW_WINDOW_THIS, self.OnActivateNewWindowThis) wx.EVT_MENU(self, GUI_ID.CMD_OPEN_CONTAINING_FOLDER_THIS, self.OnOpenContainingFolderThis) self.Bind(wx.EVT_SET_FOCUS, self.OnSetFocus) wx.EVT_LEFT_DCLICK(self, self.OnLeftDClick) wx.EVT_MIDDLE_DOWN(self, self.OnMiddleDown) wx.EVT_MOUSEWHEEL(self, self.OnMouseWheel) wx.EVT_MOTION(self, self.OnMouseMotion)
def __init__(self, parent, editctrl, filename, documenttype, multiview=False): self.initmixin() DocumentBase.DocumentBase.__init__(self, parent, filename, documenttype) wx.stc.StyledTextCtrl.__init__(self, parent, -1, size=(0, 0)) self.parent = parent self.editctrl = editctrl self.mainframe = Globals.mainframe self.app = self.mainframe.app self.pref = self.mainframe.pref if filename == '': self.fileid = TextEditor.fid TextEditor.fid += 1 self.settext = False self.canedit = True self.multiview = multiview self.defaultlocale = common.defaultencoding #editor style self.SetMargins(2, 2) #set left and right outer margins to 0 width self.SetMarginMask(1, 0) #can't place any marker in margin 1 self.SetMarginWidth(0, 0) #used as symbol self.SetMarginWidth(2, 0) #used as folder #set caret width self.SetCaretWidth(3) #set caret color self.SetCaretForeground('red') self.SetScrollWidth(5000) #set selection background color self.SetSelBackground(1, 'navy') self.SetSelForeground(1, 'white') #inter modify flag self.modified = False #init key short cut self.initKeyShortCut() #set backspace to unindent self.SetBackSpaceUnIndents(True) #set scroll bar range self.SetEndAtLastLine(False) #set style # font = wx.SystemSettings_GetFont(wx.SYS_DEFAULT_GUI_FONT) font = wx.Font(10, wx.TELETYPE, wx.NORMAL, wx.NORMAL, True) self.StyleSetSpec(wx.stc.STC_STYLE_DEFAULT, "face:%s,size:10" % font.GetFaceName()) self.StyleSetSpec(wx.stc.STC_STYLE_LINENUMBER, "back:#AAFFAA,face:%s,size:10" % font.GetFaceName()) # self.SetModEventMask(wx.stc.STC_PERFORMED_UNDO | wx.stc.STC_PERFORMED_REDO | wx.stc.STC_MOD_DELETETEXT | wx.stc.STC_MOD_INSERTTEXT) #move caret self.have_focus = False self.SetFocus() #disable popup self.UsePopUp(0) #make popup menu #@add_menu menulist self.callplugin_once('add_menu', TextEditor.popmenulist) #@add_menu_image_list imagelist self.callplugin_once('add_menu_image_list', TextEditor.imagelist) # self.popmenu = makemenu.makepopmenu(self, TextEditor.popmenulist, TextEditor.imagelist) makemenu.bind_popup_menu_ids(self, TextEditor.popmenulist) self.popmenu = None wx.stc.EVT_STC_MODIFIED(self, self.GetId(), self.OnModified) wx.stc.EVT_STC_MARGINCLICK(self, self.GetId(), self.OnMarginClick) wx.EVT_KEY_DOWN(self, self.OnKeyDown) wx.EVT_CHAR(self, self.OnChar) wx.EVT_RIGHT_DOWN(self, self.OnPopUp) wx.EVT_LEFT_DOWN(self, self.OnMouseDown) wx.EVT_KEY_UP(self, self.OnKeyUp) wx.EVT_LEFT_UP(self, self.OnMouseUp) wx.stc.EVT_STC_ZOOM(self, self.GetId(), self.OnZoom) wx.EVT_KILL_FOCUS(self, self.OnKillFocus) wx.EVT_SET_FOCUS(self, self.OnSetFocus) wx.stc.EVT_STC_USERLISTSELECTION(self, self.GetId(), self.OnUserListSelection) wx.EVT_UPDATE_UI(self, self.GetId(), self.OnUpdateUI) if ''.join(map(str, wx.VERSION[:3])) >= '2830': wx.stc.EVT_STC_AUTOCOMP_SELECTION(self, self.GetId(), self.OnAutoCompletion) #set some flags self.cansavefileflag = True self.needcheckfile = True self.savesession = True self.canopenfileflag = True self.selection_column_mode = False self.last_routin = None self.last_keydown_routin = None self.saving = False #saving flag self.lock = thread.allocate_lock() self.openning = False self.disable_onmodified = False self.tab_press = False #set drop target # self.SetDropTarget(EditorDropTarget(self)) self.callplugin('init', self)
def populate(self): sizer = wx.BoxSizer(wx.VERTICAL) # # Create the button bar # bsizer = wx.BoxSizer(wx.HORIZONTAL) self.back_button = self.add_button("Back", self.OnBack, bsizer) self.forward_button = self.add_button("Forward", self.OnForward, bsizer) if sys.platform == Platform.WIN: self.home_button = self.add_button("Home", self.OnHome, bsizer) self.stop_button = self.add_button("Stop", self.OnStop, bsizer) self.refresh_button = self.add_button("Refresh", self.OnRefresh, bsizer) t = wx.StaticText(self, -1, "Location: ") bsizer.Add(t, 0, wx.EXPAND) self.location = wx.ComboBox(self, wx.NewId(), "", style=wx.CB_DROPDOWN | wx.PROCESS_ENTER) wx.EVT_COMBOBOX(self, self.location.GetId(), self.OnLocationSelect) wx.EVT_KEY_UP(self.location, self.OnLocationKey) wx.EVT_CHAR(self.location, self.IgnoreReturn) bsizer.Add(self.location, 1, wx.EXPAND) sizer.Add(bsizer, 0, wx.EXPAND) # # Now we can set up the browser widget # if sys.platform == Platform.WIN: self.wxbrowser = iewin.IEHtmlWindow( self, -1, style=wx.NO_FULL_REPAINT_ON_RESIZE) sizer.Add(self.wxbrowser, 1, wx.EXPAND) # Hook up the event handlers for the IE window iewin.EVT_BeforeNavigate2(self, -1, self.OnBeforeNavigate2) iewin.EVT_NewWindow2(self, -1, self.OnNewWindow2) iewin.EVT_DocumentComplete(self, -1, self.OnDocumentComplete) # wx.EVT_MSHTML_STATUSTEXTCHANGE(self, -1, self.OnStatusTextChange) iewin.EVT_TitleChange(self, -1, self.OnTitleChange) else: self.wxbrowser = wxMozillaBrowser( self, -1, style=wx.NO_FULL_REPAINT_ON_RESIZE) sizer.Add(self.wxbrowser, 1, wx.EXPAND) # Hook up the event handlers for the Mozilla window wx.EVT_MOZILLA_BEFORE_LOAD(self, -1, self.OnBeforeLoad) wx.EVT_MOZILLA_URL_CHANGED(self, -1, self.UpdateURL) wx.EVT_MOZILLA_LOAD_COMPLETE(self, -1, self.OnLoadComplete) wx.EVT_MOZILLA_STATUS_CHANGED(self, -1, self.UpdateStatus) wx.EVT_MOZILLA_STATE_CHANGED(self, -1, self.UpdateState) self.SetSizer(sizer) self.SetAutoLayout(1) self.Layout()
def __init__(self, parent, wid=-1, pos=wx.DefaultPosition, size=wx.DefaultSize, **traits): AbstractWindow.__init__(self, **traits) self._timer = None self._mouse_captured = False # Due to wx wonkiness, we don't reliably get cursor position from # a wx KeyEvent. Thus, we manually keep track of when we last saw # the mouse and use that information instead. These coordinates are # in the wx coordinate space, i.e. pre-self._flip_y(). self._last_mouse_pos = (0, 0) # Create the delegate: self.control = control = self._create_control(parent, wid, pos, size) # Set up the 'erase background' event handler: wx.EVT_ERASE_BACKGROUND(control, self._on_erase_background) # Set up the 'paint' event handler: wx.EVT_PAINT(control, self._paint) wx.EVT_SIZE(control, self._on_size) # Set up mouse event handlers: wx.EVT_LEFT_DOWN(control, self._on_left_down) wx.EVT_LEFT_UP(control, self._on_left_up) wx.EVT_LEFT_DCLICK(control, self._on_left_dclick) wx.EVT_MIDDLE_DOWN(control, self._on_middle_down) wx.EVT_MIDDLE_UP(control, self._on_middle_up) wx.EVT_MIDDLE_DCLICK(control, self._on_middle_dclick) wx.EVT_RIGHT_DOWN(control, self._on_right_down) wx.EVT_RIGHT_UP(control, self._on_right_up) wx.EVT_RIGHT_DCLICK(control, self._on_right_dclick) wx.EVT_MOTION(control, self._on_mouse_move) wx.EVT_ENTER_WINDOW(control, self._on_window_enter) wx.EVT_LEAVE_WINDOW(control, self._on_window_leave) wx.EVT_MOUSEWHEEL(control, self._on_mouse_wheel) # Handle key up/down events: wx.EVT_KEY_DOWN(control, self._on_key_pressed) wx.EVT_KEY_UP(control, self._on_key_released) wx.EVT_CHAR(control, self._on_character) # Attempt to allow wxPython drag and drop events to be mapped to # Enable drag events: # Handle window close and cleanup wx.EVT_WINDOW_DESTROY(control, self._on_close) if PythonDropTarget is not None: control.SetDropTarget(LessSuckyDropTarget(self)) self._drag_over = [] # In some cases, on the Mac at least, we never get an initial EVT_SIZE # since the initial size is correct. Because of this we call _on_size # here to initialize our bounds. self._on_size(None) return
def on_initialize(self, event): self.x = 0 self.y = 0 self.filename = None self.directory = None self.zip = None self.bmp = None self.fileList = None self.fileIndex = 0 self.clockTimer = timer.Timer(self.components.bufOff, -1) self.interval = 1000 * 2 # 5 seconds self.loop = 0 self.components.bufOff.backgroundColor = 'black' self.components.bufOff.clear() if sys.platform.startswith('win'): del self.components['htmlView'] self.components['htmlView'] = { 'type': 'IEHtmlWindow', 'name': 'htmlView', 'position': (0, 0), 'size': (150, 150), 'visible': 0 } # can't disable the component if we want it # to scroll, so need another way to capture # key presses so the IE control doesn't get them # however since slideshow is for displaying HTML # where you shouldn't need to scroll this is probably fine # there is still some kind of focus bug with the IE control # on certain HTML pages self.components.htmlView.enabled = 0 # this is the code from pictureViewer # instead of a file argument, slideshow # should take either a file or directory # argument # if given a directory, the slide show would # be setup to start in that directory # if given a file argument, the contents # of the file would contain a list of files to # display, one file per line if len(sys.argv) > 1: # accept a file argument on the command-line filename = os.path.abspath(sys.argv[1]) log.info('slideshow filename: ' + filename) if not os.path.exists(filename): filename = os.path.abspath( os.path.join(self.application.startingDirectory, sys.argv[1])) #print filename if os.path.isfile(filename): #self.openFile(filename) self.buildFileListFromFile(filename) self.on_menuSlideshowFirstSlide_select(None) elif os.path.isdir(filename): includeSubDirs = self.menuBar.getChecked( 'menuOptionsIncludeSubDirectories') self.buildFileListFromDirectory(filename, includeSubDirs) self.on_menuSlideshowFirstSlide_select(None) # PythonCard doesn't currently support # binding key presses to just the background, so this # is a hack wx.EVT_KEY_UP(self.components.bufOff, self.on_keyPress) wx.EVT_KEY_UP(self.components.htmlView, self.on_keyPress) self.visible = True self.on_size(None)
def __init__(self, parent=None, ID=-1, *args, **kw): # First do special handling of some keywords: # stereo, position, size, width, height, style stereo = 0 self._last_mouse_pos = None self.__is_frozen = False if 'stereo' in kw: if kw['stereo']: stereo = 1 del kw['stereo'] position = wx.DefaultPosition if 'position' in kw: position = kw['position'] del kw['position'] size = wx.DefaultSize if 'size' in kw: size = kw['size'] if not isinstance(size, wx.Size): size = wx.Size(*size) del kw['size'] if 'width' in kw and 'height' in kw: size = wx.Size(kw['width'], kw['height']) del kw['width'] del kw['height'] # wx.WANTS_CHARS says to give us e.g. TAB # wx.NO_FULL_REPAINT_ON_RESIZE cuts down resize flicker under GTK style = wx.WANTS_CHARS | wx.NO_FULL_REPAINT_ON_RESIZE if 'style' in kw: style = style | kw['style'] del kw['style'] # if there is no parent, make a frame window if parent is None: parent = wx.Frame(None, -1, "wxRenderWindow", position, size) parent.Show(1) self._wxFrame = parent # initialize the wxWindow -- take care here to ensure double-buffering is # enabled under Linux if wx.Platform != '__WXMSW__': attribList = [ wx.glcanvas.WX_GL_RGBA, wx.glcanvas.WX_GL_DOUBLEBUFFER, wx.glcanvas.WX_GL_DEPTH_SIZE, 16 ] baseClass.__init__(self, parent, id=ID, pos=position, size=size, style=style, attribList=attribList) else: baseClass.__init__(self, parent, ID, position, size, style) # create the RenderWindow and initialize it self._RenderWindow = vtk.vtkRenderWindow() self.__Created = 0 # create the RenderWindow and initialize it self._RenderWindowInteractor = vtk.vtkGenericRenderWindowInteractor() self._RenderWindowInteractor.SetRenderWindow(self._RenderWindow) self._RenderWindowInteractor.GetRenderWindow().AddObserver( 'CursorChangedEvent', self.CursorChangedEvent) try: self._RenderWindowInteractor.GetRenderWindow().SetSize( size.width, size.height) except AttributeError: self._RenderWindowInteractor.GetRenderWindow().SetSize( size[0], size[1]) if stereo: self._RenderWindowInteractor.GetRenderWindow( ).StereoCapableWindowOn() self._RenderWindowInteractor.GetRenderWindow( ).SetStereoTypeToCrystalEyes() # The superclass can't be initialized until _RenderWindow # has been declared. PaneFrame.PaneFrame.__init__(self) self.__handle = None self.__has_painted = False self.__is_mapped = False self._own_mouse = False self._mouse_capture_button = 0 self._cursor_map = { 0: wx.CURSOR_ARROW, # VTK_CURSOR_DEFAULT 1: wx.CURSOR_ARROW, # VTK_CURSOR_ARROW 2: wx.CURSOR_SIZENESW, # VTK_CURSOR_SIZENE 3: wx.CURSOR_SIZENWSE, # VTK_CURSOR_SIZENWSE 4: wx.CURSOR_SIZENESW, # VTK_CURSOR_SIZESW 5: wx.CURSOR_SIZENWSE, # VTK_CURSOR_SIZESE 6: wx.CURSOR_SIZENS, # VTK_CURSOR_SIZENS 7: wx.CURSOR_SIZEWE, # VTK_CURSOR_SIZEWE 8: wx.CURSOR_SIZING, # VTK_CURSOR_SIZEALL 9: wx.CURSOR_HAND, # VTK_CURSOR_HAND 10: wx.CURSOR_CROSS, # VTK_CURSOR_CROSSHAIR } # private variable for better Enter/Leave handling self.__ActiveButton = 0 self.__SaveState = 0 self._Inside = 0 # refresh window by doing a Render self.Bind(wx.EVT_PAINT, self.OnPaint) # turn off background erase to reduce flicker self.Bind(wx.EVT_ERASE_BACKGROUND, lambda e: None) # Bind the events to the event converters self.Bind(wx.EVT_RIGHT_DOWN, self.OnButtonDown) self.Bind(wx.EVT_LEFT_DOWN, self.OnButtonDown) self.Bind(wx.EVT_MIDDLE_DOWN, self.OnButtonDown) self.Bind(wx.EVT_RIGHT_UP, self.OnButtonUp) self.Bind(wx.EVT_LEFT_UP, self.OnButtonUp) self.Bind(wx.EVT_MIDDLE_UP, self.OnButtonUp) # double click events self.Bind(wx.EVT_RIGHT_DCLICK, self.OnButtonDClick) self.Bind(wx.EVT_LEFT_DCLICK, self.OnButtonDClick) self.Bind(wx.EVT_MIDDLE_DCLICK, self.OnButtonDClick) self.Bind(wx.EVT_MOUSEWHEEL, self.OnMouseWheel) self.Bind(wx.EVT_MOTION, self.OnMotion) self.Bind(wx.EVT_ENTER_WINDOW, self.OnEnter) self.Bind(wx.EVT_LEAVE_WINDOW, self.OnLeave) # If we use EVT_KEY_DOWN instead of EVT_CHAR, capital versions # of all characters are always returned. EVT_CHAR also performs # other necessary keyboard-dependent translations. self.Bind(wx.EVT_CHAR, self.OnKeyDown) self.Bind(wx.EVT_KEY_UP, self.OnKeyUp) self.Bind(wx.EVT_SIZE, self.OnSize) # the wx 2.8.7.1 documentation states that you HAVE to handle # this event if you make use of CaptureMouse, which we do. if _useCapture and hasattr(wx, 'EVT_MOUSE_CAPTURE_LOST'): self.Bind(wx.EVT_MOUSE_CAPTURE_LOST, self.OnMouseCaptureLost) # pretend that we're a base window - let atamai help us out self._BindInteractor() # debug debug debug return # Bind the events to the event converters wx.EVT_MOUSE_EVENTS(self, self.ConvertMouseEvent) wx.EVT_KEY_DOWN(self, self.ConvertKeyEvent) wx.EVT_KEY_UP(self, self.ConvertKeyEvent) wx.EVT_SIZE(self, self.ConvertSizeEvent) # wx.EVT_MOVE(self, self.ConvertMoveEvent) wx.EVT_SET_FOCUS(self, self.ConvertFocusEvent) wx.EVT_KILL_FOCUS(self, self.ConvertFocusEvent)
def __init__(self, parent, id, relsize=0.7): wx.html.HtmlWindow.__init__(self, parent, id) wx.EVT_KEY_UP(self, self.OnKeyUp) self.thetext="" self._normal_font_size=max(wx.NORMAL_FONT.GetPointSize(), 10) self.SetFontScale(relsize)
def __init__(self, parent): WizardPage.__init__(self, parent, pgid.FILES) # *** Left Panel *** # pnl_treeopts = BorderedPanel(self) self.chk_individuals = CheckBoxCFG(pnl_treeopts, label=GT(u'List files individually'), name=u'individually', cfgSect=u'FILES') self.chk_preserve_top = CheckBoxCFG(pnl_treeopts, chkid.TOPLEVEL, GT(u'Preserve top-level directories'), name=u'top-level', cfgSect=u'FILES') self.chk_nofollow_symlink = CheckBoxCFG(pnl_treeopts, chkid.SYMLINK, GT(u'Don\'t follow symbolic links'), defaultValue=True, name=u'nofollow-symlink', cfgSect=u'FILES') self.tree_dirs = DirectoryTreePanel(self, size=(300,20)) # ----- Target path pnl_target = BorderedPanel(self) # choices of destination rb_bin = wx.RadioButton(pnl_target, label=u'/bin', style=wx.RB_GROUP) rb_usrbin = wx.RadioButton(pnl_target, label=u'/usr/bin') rb_usrlib = wx.RadioButton(pnl_target, label=u'/usr/lib') rb_locbin = wx.RadioButton(pnl_target, label=u'/usr/local/bin') rb_loclib = wx.RadioButton(pnl_target, label=u'/usr/local/lib') self.rb_custom = wx.RadioButton(pnl_target, inputid.CUSTOM, GT(u'Custom')) self.rb_custom.Default = True # Start with "Custom" selected self.rb_custom.SetValue(self.rb_custom.Default) # group buttons together # FIXME: Unnecessary??? self.grp_targets = ( rb_bin, rb_usrbin, rb_usrlib, rb_locbin, rb_loclib, self.rb_custom, ) # ----- Add/Remove/Clear buttons btn_add = CreateButton(self, btnid.ADD) btn_remove = CreateButton(self, btnid.REMOVE) btn_clear = CreateButton(self, btnid.CLEAR) self.prev_dest_value = u'/usr/bin' self.ti_target = TextArea(self, defaultValue=self.prev_dest_value, name=u'target') self.btn_browse = CreateButton(self, btnid.BROWSE) btn_refresh = CreateButton(self, btnid.REFRESH) # Display area for files added to list self.lst_files = FileListESS(self, inputid.LIST, name=u'filelist') # *** Event Handling *** # # create an event to enable/disable custom widget for item in self.grp_targets: wx.EVT_RADIOBUTTON(item, wx.ID_ANY, self.OnSetDestination) # Context menu events for directory tree wx.EVT_MENU(self, wx.ID_ADD, self.OnImportFromTree) # Button events btn_add.Bind(wx.EVT_BUTTON, self.OnImportFromTree) btn_remove.Bind(wx.EVT_BUTTON, self.OnRemoveSelected) btn_clear.Bind(wx.EVT_BUTTON, self.OnClearFileList) self.btn_browse.Bind(wx.EVT_BUTTON, self.OnBrowse) btn_refresh.Bind(wx.EVT_BUTTON, self.OnRefreshFileList) # ???: Not sure what these do wx.EVT_KEY_DOWN(self.ti_target, self.GetDestValue) wx.EVT_KEY_UP(self.ti_target, self.CheckDest) # Key events for file list wx.EVT_KEY_DOWN(self.lst_files, self.OnRemoveSelected) self.Bind(wx.EVT_DROP_FILES, self.OnDropFiles) # *** Layout *** # lyt_treeopts = BoxSizer(wx.VERTICAL) lyt_treeopts.AddSpacer(5) lyt_treeopts.Add(self.chk_individuals, 0, lyt.PAD_LR, 5) lyt_treeopts.Add(self.chk_preserve_top, 0, lyt.PAD_LR, 5) lyt_treeopts.Add(self.chk_nofollow_symlink, 0, lyt.PAD_LR, 5) lyt_treeopts.AddSpacer(5) pnl_treeopts.SetSizer(lyt_treeopts) lyt_left = BoxSizer(wx.VERTICAL) lyt_left.AddSpacer(10) lyt_left.Add(wx.StaticText(self, label=GT(u'Directory options')), 0, wx.ALIGN_BOTTOM) lyt_left.Add(pnl_treeopts, 0, wx.EXPAND|wx.ALIGN_LEFT|wx.BOTTOM, 5) lyt_left.Add(self.tree_dirs, 1, wx.EXPAND) lyt_target = wx.GridSizer(3, 2, 5, 5) for item in self.grp_targets: lyt_target.Add(item, 0, lyt.PAD_LR, 5) pnl_target.SetAutoLayout(True) pnl_target.SetSizer(lyt_target) pnl_target.Layout() # Put text input in its own sizer to force expand lyt_input = BoxSizer(wx.HORIZONTAL) lyt_input.Add(self.ti_target, 1, wx.ALIGN_CENTER_VERTICAL) lyt_buttons = BoxSizer(wx.HORIZONTAL) lyt_buttons.Add(btn_add, 0) lyt_buttons.Add(btn_remove, 0) lyt_buttons.Add(btn_clear, 0) lyt_buttons.Add(lyt_input, 1, wx.ALIGN_CENTER_VERTICAL) lyt_buttons.Add(self.btn_browse, 0) lyt_buttons.Add(btn_refresh, 0) lyt_right = BoxSizer(wx.VERTICAL) lyt_right.AddSpacer(10) lyt_right.Add(wx.StaticText(self, label=GT(u'Target'))) lyt_right.Add(pnl_target, 0, wx.TOP, 5) lyt_right.Add(lyt_buttons, 0, wx.EXPAND) lyt_right.Add(self.lst_files, 5, wx.EXPAND|wx.TOP, 5) PROP_LEFT = 0 PROP_RIGHT = 1 lyt_main = wx.FlexGridSizer(1, 2) lyt_main.AddGrowableRow(0) # Directory tree size issues with wx 2.8 if wx.MAJOR_VERSION <= 2: PROP_LEFT = 1 lyt_main.AddGrowableCol(0, 1) lyt_main.AddGrowableCol(1, 2) lyt_main.Add(lyt_left, PROP_LEFT, wx.EXPAND|lyt.PAD_LR|wx.BOTTOM, 5) lyt_main.Add(lyt_right, PROP_RIGHT, wx.EXPAND|lyt.PAD_RB, 5) self.SetAutoLayout(True) self.SetSizer(lyt_main) self.Layout() SetPageToolTips(self)
def __init__(self, *args, **kwds): # begin wxGlade: MainFrame.__init__ kwds["style"] = wx.DEFAULT_FRAME_STYLE wx.Frame.__init__(self, *args, **kwds) self.panelSizerControls = wx.Panel(self, -1) self.lblInsertRegExp = wx.StaticText(self.panelSizerControls, -1, "Input regular expression:") self.inputRegExp = wx.TextCtrl(self.panelSizerControls, -1, "", style=wx.TE_PROCESS_ENTER) self.btnProcessRegExp = wx.Button(self.panelSizerControls, -1, "Process", style=wx.BU_EXACTFIT) self.btnFirst = wx.Button(self.panelSizerControls, -1, "|<", style=wx.BU_EXACTFIT) self.btnPrevious = wx.Button(self.panelSizerControls, -1, "<", style=wx.BU_EXACTFIT) self.btnNext = wx.Button(self.panelSizerControls, -1, ">", style=wx.BU_EXACTFIT) self.btnLast = wx.Button(self.panelSizerControls, -1, ">|", style=wx.BU_EXACTFIT) self.panelShownRegExpTop = wx.Panel(self.panelSizerControls, -1) self.lblShownRegExp = wx.StaticText(self.panelSizerControls, -1, "") self.panelShownRegExpBottom = wx.Panel(self.panelSizerControls, -1) self.lblFontSize = wx.StaticText(self.panelSizerControls, -1, "Font size:") self.spinFontSize = wx.SpinCtrl(self.panelSizerControls, -1, "", min=10, max=32) self.lblHighlightColour = wx.StaticText(self.panelSizerControls, -1, "Highlight colour:") self.comboHighlightColour = wx.ComboBox( self.panelSizerControls, -1, choices=[ "Black", "Blue", "Brown", "Cyan", "Green", "Magenta", "Navy", "Orange", "Red" ], style=wx.CB_DROPDOWN | wx.CB_DROPDOWN | wx.CB_READONLY | wx.CB_SORT) self.panelNFABitmap = wx.Panel(self, -1, style=wx.TAB_TRAVERSAL | wx.FULL_REPAINT_ON_RESIZE) self.__set_properties() self.__do_layout() self.Bind(wx.EVT_TEXT_ENTER, self.inputRegExpTextEnter, self.inputRegExp) self.Bind(wx.EVT_TEXT, self.inputRegExpTextChanged, self.inputRegExp) self.Bind(wx.EVT_BUTTON, self.btnProcessRegExpClicked, self.btnProcessRegExp) self.Bind(wx.EVT_BUTTON, self.btnFirstClicked, self.btnFirst) self.Bind(wx.EVT_BUTTON, self.btnPreviousClicked, self.btnPrevious) self.Bind(wx.EVT_BUTTON, self.btnNextClicked, self.btnNext) self.Bind(wx.EVT_BUTTON, self.btnLastClicked, self.btnLast) self.Bind(wx.EVT_SPINCTRL, self.onSpinFontSizeCtrl, self.spinFontSize) self.Bind(wx.EVT_COMBOBOX, self.onComboHiglightColourCombobox, self.comboHighlightColour) # end wxGlade # Initialize instance variables wx.EVT_PAINT(self.panelNFABitmap, self.onPaint) wx.EVT_SIZE(self.panelNFABitmap, self.onPanelNFABitmapResize) wx.EVT_CHAR(self.lblInsertRegExp, self.onKeyUp) wx.EVT_KEY_UP(self.btnProcessRegExp, self.onKeyUp) wx.EVT_KEY_UP(self.btnFirst, self.onKeyUp) wx.EVT_KEY_UP(self.btnPrevious, self.onKeyUp) wx.EVT_KEY_UP(self.btnNext, self.onKeyUp) wx.EVT_KEY_UP(self.btnLast, self.onKeyUp) wx.EVT_KEY_UP(self.panelShownRegExpTop, self.onKeyUp) wx.EVT_KEY_UP(self.lblShownRegExp, self.onKeyUp) wx.EVT_KEY_UP(self.panelShownRegExpBottom, self.onKeyUp) wx.EVT_KEY_UP(self.lblFontSize, self.onKeyUp) wx.EVT_KEY_UP(self.panelNFABitmap, self.onKeyUp) self.spinFontSize.SetValue(self.spinFontSize.GetFont().GetPointSize()) self.__regexp = None self.__step = 0 self.__productList = [] self.__nfaImgs = [] self.__bitmap = None
def __init__(self, parent, id, title): wx.Frame.__init__(self, parent, id, title, size=(948, 738)) #self.panel = wx.Panel(self) #self.panel.Bind(wx.EVT_KEY_UP, self.on_key_up) #self.crypt_config() self.load_config() self.doc = xml.dom.minidom.parse(XML_FILENAME) # create the menus fileMenu = wx.Menu() fileMenu.Append(ID_ABOUT, "&About", " About this program") fileMenu.AppendSeparator() fileMenu.Append(ID_EXIT, "E&xit", " Exit the program") menuBar = wx.MenuBar() menuBar.Append(fileMenu, "&File") # create fonts self.font_med = wx.Font(16, wx.SWISS, wx.NORMAL, wx.NORMAL, False, u'Sans Serif') self.font_big = wx.Font(18, wx.SWISS, wx.NORMAL, wx.NORMAL, False, u'Sans Serif') self.SetFont(self.font_med) # create the form elements self.textctrl_code = wx.TextCtrl(self, ID_TEXTCTRL_CODE) self.textctrl_code.SetEditable(True) self.textctrl_code.SetFont(self.font_big) self.button_codego = wx.Button(self, ID_BUTTON_CODEGO, "Go") self.textctrl_result = wx.TextCtrl(self, ID_TEXTCTRL_RESULT, "Ready to scan") self.textctrl_result.SetEditable(False) self.textctrl_result.SetFont(self.font_big) self.textctrl_result.SetBackgroundColour(wx.WHITE) self.statictext_soldlabel = wx.StaticText(self, ID_STATICTEXT_SOLDLABEL, "Tix Sold: ") self.statictext_soldvalue = wx.StaticText(self, ID_STATICTEXT_SOLDVALUE, "0") self.statictext_usedlabel = wx.StaticText(self, ID_STATICTEXT_USEDLABEL, "Tix Used: ") self.statictext_usedvalue = wx.StaticText(self, ID_STATICTEXT_USEDVALUE, "0") self.textctrl_searchfilter = wx.TextCtrl(self, ID_TEXTCTRL_SEARCHFILTER) self.button_searchgo = wx.Button(self, ID_BUTTON_SEARCHGO, "&Go") self.listbox_searchresults = wx.ListBox(self, ID_LISTBOX_SEARCHRESULTS) self.button_0 = wx.Button(self, ID_BUTTON_0, "&0") self.button_1 = wx.Button(self, ID_BUTTON_1, "&1") self.button_2 = wx.Button(self, ID_BUTTON_2, "&2") self.button_3 = wx.Button(self, ID_BUTTON_3, "&3") self.button_4 = wx.Button(self, ID_BUTTON_4, "&4") self.button_5 = wx.Button(self, ID_BUTTON_5, "&5") self.button_6 = wx.Button(self, ID_BUTTON_6, "&6") self.button_7 = wx.Button(self, ID_BUTTON_7, "&7") self.button_8 = wx.Button(self, ID_BUTTON_8, "&8") self.button_9 = wx.Button(self, ID_BUTTON_9, "&9") self.button_del = wx.Button(self, ID_BUTTON_DEL, "&del") self.button_lookup = wx.Button(self, ID_BUTTON_LOOKUP, "&Look Up") self.button_buy = wx.Button(self, ID_BUTTON_BUY, "&Buy Tickets") self.button_schedules = wx.Button(self, ID_BUTTON_SCHEDULES, "&Schedules") self.button_newgreeter = wx.Button(self, ID_BUTTON_NEWGREETER, "New &Greeter") # populate the data #self.list_people() # add form controls self.CreateStatusBar() self.SetMenuBar(menuBar) self.sizer_controls = wx.BoxSizer(wx.HORIZONTAL) self.sizer_panel = wx.BoxSizer(wx.VERTICAL) self.sizer_panel_stats = wx.BoxSizer(wx.VERTICAL) self.sizer_panel_stats_sold = wx.BoxSizer(wx.HORIZONTAL) self.sizer_panel_stats_sold.Add(self.statictext_soldlabel, 2, wx.EXPAND) self.sizer_panel_stats_sold.Add(self.statictext_soldvalue, 1, wx.EXPAND) self.sizer_panel_stats_used = wx.BoxSizer(wx.HORIZONTAL) self.sizer_panel_stats_used.Add(self.statictext_usedlabel, 2, wx.EXPAND) self.sizer_panel_stats_used.Add(self.statictext_usedvalue, 1, wx.EXPAND) self.sizer_panel_stats.Add(self.sizer_panel_stats_sold, 1, wx.EXPAND) self.sizer_panel_stats.Add(self.sizer_panel_stats_used, 1, wx.EXPAND) self.sizer_panel_search = wx.BoxSizer(wx.VERTICAL) self.sizer_panel_search_filter = wx.BoxSizer(wx.HORIZONTAL) self.sizer_panel_search_filter.Add(self.textctrl_searchfilter, 2, wx.EXPAND) self.sizer_panel_search_filter.Add(self.button_searchgo, 1, wx.EXPAND) self.sizer_panel_search_results = wx.BoxSizer(wx.HORIZONTAL) self.sizer_panel_search_results.Add(self.listbox_searchresults, 1, wx.EXPAND) self.sizer_panel_search.Add(self.sizer_panel_search_filter, 0, wx.EXPAND) self.sizer_panel_search.Add(self.sizer_panel_search_results, 1, wx.EXPAND) self.sizer_panel.Add(self.sizer_panel_stats, 1, wx.EXPAND) self.sizer_panel.Add(self.sizer_panel_search, 7, wx.EXPAND) self.sizer_functions = wx.BoxSizer(wx.VERTICAL) self.sizer_functions.Add(self.button_lookup, 1, wx.EXPAND) self.sizer_functions.Add(self.button_buy, 1, wx.EXPAND) self.sizer_functions.Add(self.button_schedules, 1, wx.EXPAND) self.sizer_functions.Add(self.button_newgreeter, 1, wx.EXPAND) self.sizer_keypad = wx.BoxSizer(wx.VERTICAL) self.sizer_keypad_row1 = wx.BoxSizer(wx.HORIZONTAL) self.sizer_keypad_row2 = wx.BoxSizer(wx.HORIZONTAL) self.sizer_keypad_row3 = wx.BoxSizer(wx.HORIZONTAL) self.sizer_keypad_row4 = wx.BoxSizer(wx.HORIZONTAL) self.sizer_keypad_row1.Add(self.button_7, 1, wx.EXPAND) self.sizer_keypad_row1.Add(self.button_8, 1, wx.EXPAND) self.sizer_keypad_row1.Add(self.button_9, 1, wx.EXPAND) self.sizer_keypad_row2.Add(self.button_4, 1, wx.EXPAND) self.sizer_keypad_row2.Add(self.button_5, 1, wx.EXPAND) self.sizer_keypad_row2.Add(self.button_6, 1, wx.EXPAND) self.sizer_keypad_row3.Add(self.button_1, 1, wx.EXPAND) self.sizer_keypad_row3.Add(self.button_2, 1, wx.EXPAND) self.sizer_keypad_row3.Add(self.button_3, 1, wx.EXPAND) self.sizer_keypad_row4.Add(self.button_0, 2, wx.EXPAND) self.sizer_keypad_row4.Add(self.button_del, 1, wx.EXPAND) self.sizer_keypad.Add(self.sizer_keypad_row1, 1, wx.EXPAND) self.sizer_keypad.Add(self.sizer_keypad_row2, 1, wx.EXPAND) self.sizer_keypad.Add(self.sizer_keypad_row3, 1, wx.EXPAND) self.sizer_keypad.Add(self.sizer_keypad_row4, 1, wx.EXPAND) self.sizer_controls.Add(self.sizer_panel, 1, wx.EXPAND) self.sizer_controls.Add(self.sizer_keypad, 1, wx.EXPAND) #self.sizer_controls.Add(self.sizer_functions, 1, wx.EXPAND) self.sizer_code = wx.BoxSizer(wx.HORIZONTAL) self.sizer_code.Add(self.textctrl_code, 1, wx.EXPAND) self.sizer_code.Add(self.button_codego, 0, wx.EXPAND) self.sizer = wx.BoxSizer(wx.VERTICAL) self.sizer.Add(self.sizer_code, 0, wx.EXPAND) self.sizer.Add(self.textctrl_result, 0, wx.EXPAND) self.sizer.Add(self.sizer_controls, 1, wx.EXPAND) self.SetSizer(self.sizer) self.SetAutoLayout(1) self.sizer.Fit(self) # attach events wx.EVT_MENU(self, ID_ABOUT, self.on_about) wx.EVT_MENU(self, ID_EXIT, self.on_exit) wx.EVT_BUTTON(self, ID_BUTTON_0, self.on_button_0) wx.EVT_BUTTON(self, ID_BUTTON_1, self.on_button_1) wx.EVT_BUTTON(self, ID_BUTTON_2, self.on_button_2) wx.EVT_BUTTON(self, ID_BUTTON_3, self.on_button_3) wx.EVT_BUTTON(self, ID_BUTTON_4, self.on_button_4) wx.EVT_BUTTON(self, ID_BUTTON_5, self.on_button_5) wx.EVT_BUTTON(self, ID_BUTTON_6, self.on_button_6) wx.EVT_BUTTON(self, ID_BUTTON_7, self.on_button_7) wx.EVT_BUTTON(self, ID_BUTTON_8, self.on_button_8) wx.EVT_BUTTON(self, ID_BUTTON_9, self.on_button_9) wx.EVT_BUTTON(self, ID_BUTTON_DEL, self.on_button_del) wx.EVT_BUTTON(self, ID_BUTTON_CODEGO, self.on_button_code_go) wx.EVT_BUTTON(self, ID_BUTTON_SEARCHGO, self.on_button_search_go) wx.EVT_LEFT_DCLICK(self.listbox_searchresults, self.on_left_dclick_search_results) wx.EVT_KEY_UP(self.textctrl_searchfilter, self.on_key_up_search_filter) wx.EVT_KEY_UP(self.textctrl_code, self.on_key_up_code) #wx.EVT_KEY_UP(self, self.on_key_up) #self.Show(True) self.ShowFullScreen(True, style=wx.FULLSCREEN_ALL) self.set_stats() self.load_sound() self.textctrl_code.SetFocus()
def __init__(self, parent, ID, *args, **kw): # miscellaneous protected variables self._CurrentRenderer = None self._CurrentCamera = None self._CurrentZoom = 1.0 self._CurrentLight = None self._ViewportCenterX = 0 self._ViewportCenterY = 0 self._Picker = vtkCellPicker() self._PickedActor = None self._PickedProperty = vtkProperty() self._PickedProperty.SetColor(1, 0, 0) self._PrePickedProperty = None # these record the previous mouse position self._LastX = 0 self._LastY = 0 # the current interaction mode (Rotate, Pan, Zoom, etc) self._Mode = None self._ActiveButton = None # private attributes self.__OldFocus = None # used by the LOD actors self._DesiredUpdateRate = 15 self._StillUpdateRate = 0.0001 # First do special handling of some keywords: # stereo, position, size, width, height, style stereo = 0 if 'stereo' in kw: if kw['stereo']: stereo = 1 del kw['stereo'] position = wx.DefaultPosition if 'position' in kw: position = kw['position'] del kw['position'] size = wx.DefaultSize if 'size' in kw: size = kw['size'] del kw['size'] if 'width' in kw and 'height' in kw: size = (kw['width'], kw['height']) del kw['width'] del kw['height'] # wxWANTS_CHARS says to give us e.g. TAB # wxNO_FULL_REPAINT_ON_RESIZE cuts down resize flicker under GTK style = wx.WANTS_CHARS | wx.NO_FULL_REPAINT_ON_RESIZE if 'style' in kw: style = style | kw['style'] del kw['style'] # the enclosing frame must be shown under GTK or the windows # don't connect together properly l = [] p = parent while p: # make a list of all parents l.append(p) p = p.GetParent() l.reverse() # sort list into descending order for p in l: p.Show() # initialize the wxWindow baseClass.__init__(self, parent, ID, position, size, style) # create the RenderWindow and initialize it self._RenderWindow = vtkRenderWindow() try: self._RenderWindow.SetSize(size.width, size.height) except AttributeError: self._RenderWindow.SetSize(size[0], size[1]) if stereo: self._RenderWindow.StereoCapableWindowOn() self._RenderWindow.SetStereoTypeToCrystalEyes() self.__Created = 0 # Tell the RenderWindow to render inside the wxWindow. if self.GetHandle(): self.__Created = 1 self._RenderWindow.SetWindowInfo(str(self.GetHandle())) # refresh window by doing a Render wx.EVT_PAINT(self, self.OnPaint) # turn off background erase to reduce flicker wx.EVT_ERASE_BACKGROUND(self, lambda e: None) # Bind the events to the event converters wx.EVT_RIGHT_DOWN(self, self._OnButtonDown) wx.EVT_LEFT_DOWN(self, self._OnButtonDown) wx.EVT_MIDDLE_DOWN(self, self._OnButtonDown) wx.EVT_RIGHT_UP(self, self._OnButtonUp) wx.EVT_LEFT_UP(self, self._OnButtonUp) wx.EVT_MIDDLE_UP(self, self._OnButtonUp) wx.EVT_MOTION(self, self.OnMotion) wx.EVT_ENTER_WINDOW(self, self._OnEnterWindow) wx.EVT_LEAVE_WINDOW(self, self._OnLeaveWindow) wx.EVT_CHAR(self, self.OnChar) wx.EVT_KEY_DOWN(self, self.OnKeyDown) wx.EVT_KEY_UP(self, self.OnKeyUp) wx.EVT_SIZE(self, self._OnSize) wx.EVT_MOVE(self, self.OnMove) wx.EVT_SET_FOCUS(self, self.OnSetFocus) wx.EVT_KILL_FOCUS(self, self.OnKillFocus)
def __init__(self, parent, id, title): # --- a basic window frame/form wx.Frame.__init__(self, parent=None, id=-1, title=APP_NAME + " - Developed in wxPython/AHK", pos=wx.Point(0, 0), size=wx.Size(640, 480), name='', style=wx.DEFAULT_FRAME_STYLE) if (len(sys.argv)) == 2: self.Bind(wx.EVT_ACTIVATE, self.OnFileOpenDirect) # wx.EVT_ACTIVATE(self, self.OnFileOpenDirect) # same self.printer = Printer(self) self.SetMinSize((640, 480)) # --- real windows programs have icons, so here's ours! try: # - don't sweat it if it doesn't load self.SetIcon(wx.Icon("SmallEditor.ico", wx.BITMAP_TYPE_ICO)) finally: pass self.codePage = None self.finddlg = None # --- add a menu, first build the menus (with accelerators) self.BuildMenuBar() self.finddata = wx.FindReplaceData() self.finddata.SetFlags(wx.FR_DOWN) # Not needed!, just put them in text form after tab in menu item! # --- add accelerators to the menus #self.SetAcceleratorTable(wx.AcceleratorTable([(wx.ACCEL_CTRL, ord('O'), ID_OPEN), # (wx.ACCEL_ALT, ord('Q'), ID_EXIT)])) # --- add a statusBar (with date/time panel) sb = self.CreateStatusBar(3) sb.SetStatusWidths([-1, 65, 160]) sb.PushStatusText("Ready", SB_INFO) # --- set up a timer to update the date/time (every 5 seconds) self.timer = wx.PyTimer(self.Notify) self.timer.Start(5000) self.Notify() # - call it once right away # --- add a control (a RichTextBox) & trap KEY_DOWN event self.rtb = wx.TextCtrl(self, ID_RTB, size=wx.Size(400 * 2, 200 * 2), style=wx.TE_MULTILINE | wx.TE_RICH2) ### - NOTE: binds to the control itself! wx.EVT_KEY_UP(self.rtb, self.OnRtbKeyUp) # --- need to add a sizer for the control - yuck! self.sizer = wx.BoxSizer(wx.VERTICAL) # self.sizer.SetMinSize(200,400) self.sizer.Add(self.rtb, 1, wx.EXPAND) # --- now add it to the frame (at least this auto-sizes the control!) self.SetSizer(self.sizer) self.SetAutoLayout(True) self.sizer.SetSizeHints(self) # Add some Unicode (Chinese!) if not wx.USE_UNICODE: self.AddLine(self.sizer) self.AddText( self.sizer, "Sorry, this wxPython was not built with Unicode support.", font=wx.Font(12, wx.SWISS, wx.NORMAL, wx.BOLD)) self.AddLine(self.sizer) else: f = self.GetFont() font = wx.Font(14, f.GetFamily(), f.GetStyle(), wx.BOLD, False, f.GetFaceName(), f.GetEncoding()) self.AddLine(self.sizer) self.AddText(self.sizer, chi_uni[0], chi_uni[1], 'Chinese:', font) self.AddLine(self.sizer) # --- initialize other settings self.dirName = "" self.fileName = "" # - this is ugly, but there's no static available # once we build a class for RTB, move this there self.oldPos = -1 self.ShowPos() # --- finally - show it! self.Show(True)