コード例 #1
0
    def __register_interests(self):

        # identity
        self._PRW_lastname.add_callback_on_lose_focus(
            self._on_leaving_lastname)
        self._PRW_firstnames.add_callback_on_lose_focus(
            self._on_leaving_firstname)
        self._PRW_dob.add_callback_on_lose_focus(self._on_leaving_dob)

        # address
        self._PRW_address_searcher.add_callback_on_lose_focus(
            self._on_leaving_adress_searcher)

        # invalidate address searcher when any field edited
        self._PRW_street.add_callback_on_lose_focus(
            self._invalidate_address_searcher)
        wx.EVT_KILL_FOCUS(self._TCTRL_number, self._on_leaving_number)
        wx.EVT_KILL_FOCUS(self._TCTRL_unit, self._on_leaving_unit)
        self._PRW_urb.add_callback_on_lose_focus(
            self._invalidate_address_searcher)
        self._PRW_region.add_callback_on_lose_focus(
            self._invalidate_address_searcher)

        self._PRW_zip.add_callback_on_lose_focus(self._on_leaving_zip)
        self._PRW_country.add_callback_on_lose_focus(self._on_leaving_country)

        self._PRW_external_id_type.add_callback_on_lose_focus(
            callback=self._on_leaving_ext_id_type)
        self._TCTRL_external_id_value.add_callback_on_lose_focus(
            callback=self._on_leaving_ext_id_val)
コード例 #2
0
 def _init_ctrls(self, prnt):
     # generated method, don't edit
     wxFrame.__init__(self,
                      id=wxID_TSEQDIALOG,
                      name='tseqDialog',
                      parent=prnt,
                      pos=wx.Point(374, 265),
                      size=wx.Size(259, 160),
                      style=wx.DEFAULT_FRAME_STYLE,
                      title='Time Sequence')
     self.SetClientSize(wx.Size(251, 133))
     self.SetBackgroundColour(wx.Colour(209, 208, 203))
     self.staticBox5 = wx.StaticBox(id=wxID_TSEQDIALOGSTATICBOX5,
                                    label='# Slices',
                                    name='staticBox5',
                                    parent=self,
                                    pos=wx.Point(24, 8),
                                    size=wx.Size(88, 48),
                                    style=0)
     self.tNumSlices = wx.TextCtrl(id=wxID_TSEQDIALOGTNUMSLICES,
                                   name='tNumSlices',
                                   parent=self,
                                   pos=wx.Point(40, 24),
                                   size=wx.Size(64, 24),
                                   style=0,
                                   value='100')
     #self.tNumSlices.Enable(False)
     wx.EVT_KILL_FOCUS(self.tNumSlices, self.OnTNumSlicesKillFocus)
     self.staticBox6 = wx.StaticBox(id=wxID_TSEQDIALOGSTATICBOX6,
                                    label=' Time step (s)',
                                    name='staticBox6',
                                    parent=self,
                                    pos=wx.Point(128, 8),
                                    size=wx.Size(88, 48),
                                    style=0)
     self.tTimeStep = wx.TextCtrl(id=wxID_TSEQDIALOGTTIMESTEP,
                                  name='tTimeStep',
                                  parent=self,
                                  pos=wx.Point(136, 24),
                                  size=wx.Size(64, 24),
                                  style=0,
                                  value='0.1')
     wx.EVT_KILL_FOCUS(self.tTimeStep, self.OnTStepSizeKillFocus)
     self.bStart = wx.Button(id=wxID_TSEQDIALOGBSTART,
                             label='Go, Go, Go !!! ',
                             name='bStart',
                             parent=self,
                             pos=wx.Point(80, 104),
                             size=wx.Size(75, 23),
                             style=0)
     wx.EVT_BUTTON(self.bStart, wxID_TSEQDIALOGBSTART, self.OnBStartButton)
     self.stMemory = wx.StaticText(id=wxID_TSEQDIALOGSTMEMORY,
                                   label='staticText1',
                                   name='stMemory',
                                   parent=self,
                                   pos=wx.Point(8, 72),
                                   size=wx.Size(232, 16),
                                   style=0)
コード例 #3
0
    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)
        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._glRobotTexture = None
        self._buttonSize = 64

        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._OnGuiMouseLeftDown)
        wx.EVT_LEFT_UP(self, self._OnGuiMouseLeftUp)
        wx.EVT_MOTION(self, self._OnGuiMouseMotion)
        wx.EVT_CHAR(self, self._OnGuiKeyChar)
        wx.EVT_KILL_FOCUS(self, self.OnFocusLost)
コード例 #4
0
ファイル: enum_editor.py プロジェクト: timdiller/traitsui
    def init(self, parent):
        """ Finishes initializing the editor by creating the underlying toolkit
            widget.
        """
        super(SimpleEditor, self).init(parent)

        factory = self.factory

        if factory.evaluate is None:
            self.control = control = wx.Choice(parent, -1, wx.Point(0, 0),
                                               wx.Size(-1, -1), self.names)
            wx.EVT_CHOICE(parent, self.control.GetId(), self.update_object)
        else:
            self.control = control = wx.ComboBox(parent,
                                                 -1,
                                                 '',
                                                 wx.Point(0, 0),
                                                 wx.Size(-1, -1),
                                                 self.names,
                                                 style=wx.CB_DROPDOWN)
            wx.EVT_COMBOBOX(parent, control.GetId(), self.update_object)
            wx.EVT_TEXT_ENTER(parent, control.GetId(), self.update_text_object)
            wx.EVT_KILL_FOCUS(control, self.on_kill_focus)

            if (not factory.is_grid_cell) and factory.auto_set:
                wx.EVT_TEXT(parent, control.GetId(), self.update_text_object)

        self._no_enum_update = 0
        self.set_tooltip()
コード例 #5
0
    def _pop_up_text(self):
        """ Pop-up a text control to allow the user to enter a value using
            the keyboard.
        """
        control = self.control
        factory = self.factory
        style = (self.text_styles[self.alignment] | wx.TE_PROCESS_ENTER)
        if factory.password:
            style |= wx.TE_PASSWORD

        self._text = text = wx.TextCtrl(control,
                                        -1,
                                        self.str_value,
                                        style=style)
        slice = self.image_slice
        wdx, wdy = control.GetClientSize()
        tdx, tdy = text.GetSize()
        text.SetPosition(
            wx.Point(slice.xleft,
                     ((wdy + slice.xtop - slice.xbottom - tdy) / 2) + 1))
        text.SetSize(wx.Size(wdx - slice.xleft - slice.xright, tdy))
        text.SetSelection(-1, -1)
        text.SetFocus()

        wx.EVT_KILL_FOCUS(text, self._text_completed)
        wx.EVT_CHAR(text, self._key_entered)
        wx.EVT_TEXT_ENTER(control, text.GetId(), self.update_object)

        if factory.auto_set and (not factory.is_grid_cell):
            wx.EVT_TEXT(control, text.GetId(), self.update_object)
コード例 #6
0
    def __init__(self,
                 editor,
                 parent,
                 wid=-1,
                 pos=wx.DefaultPosition,
                 size=wx.DefaultSize):

        super(KeyBindingCtrl,
              self).__init__(parent,
                             wid,
                             pos,
                             size,
                             style=wx.CLIP_CHILDREN | wx.WANTS_CHARS)
        # Save the reference to the controlling editor object:
        self.editor = editor

        # Indicate we don't have the focus right now:
        editor.has_focus = False

        # Set up the 'erase background' event handler:
        wx.EVT_ERASE_BACKGROUND(self, self._on_erase_background)

        # Set up the 'paint' event handler:
        wx.EVT_PAINT(self, self._paint)

        # Set up the focus change handlers:
        wx.EVT_SET_FOCUS(self, self._get_focus)
        wx.EVT_KILL_FOCUS(self, self._lose_focus)

        # Set up mouse event handlers:
        wx.EVT_LEFT_DOWN(self, self._set_focus)
        wx.EVT_LEFT_DCLICK(self, self._clear_contents)

        # Handle key events:
        wx.EVT_CHAR(self, self._on_char)
コード例 #7
0
    def __init__(self, parent, title, label, wildcardDesc, fileSelectCB):
        wx.Panel.__init__(self, parent, -1, style=0)

        self.title = title
        self.fileSelectCB = fileSelectCB
        self.wildcardDesc = wildcardDesc
        self.path = ""
        self.lastFilterIndex = 0

        sizer = self.sizer = wx.BoxSizer(wx.HORIZONTAL)
        t = wx.StaticText(self, -1, label)
        sizer.Add(t, 0, wx.ALIGN_CENTER_VERTICAL)

        self.text = wx.TextCtrl(self, -1, style=wx.TE_PROCESS_ENTER)
        sizer.Add(self.text, 1, wx.ALIGN_CENTER_VERTICAL)
        wx.EVT_TEXT_ENTER(self, self.text.GetId(), self.OnTextEnter)
        if not (IsOSX() and wx.VERSION >= (2, 5, 3, 0)):
            wx.EVT_KILL_FOCUS(self.text, self.OnTextLoseFocus)

        b = wx.Button(self, -1, "Browse")
        sizer.Add(b, 0)
        wx.EVT_BUTTON(self, b.GetId(), self.OnBrowse)

        self.SetSizer(sizer)
        self.SetAutoLayout(1)
        self.Fit()
コード例 #8
0
    def _CreateCanvas(self, parent):
        self._canvas = ogl.ShapeCanvas(parent)
        wx.EVT_LEFT_DOWN(self._canvas, self.OnLeftClick)
        wx.EVT_LEFT_UP(self._canvas, self.OnLeftUp)
        wx.EVT_MOTION(self._canvas, self.OnLeftDrag)
        wx.EVT_LEFT_DCLICK(self._canvas, self.OnLeftDoubleClick)
        wx.EVT_KEY_DOWN(self._canvas, self.OnKeyPressed)

        # need this otherwise mouse clicks don't set focus to this view
        wx.EVT_LEFT_DOWN(self._canvas, self.FocusOnClick)
        wx.EVT_LEFT_DCLICK(self._canvas, self.FocusOnClick)
        wx.EVT_RIGHT_DOWN(self._canvas, self.FocusOnClick)
        wx.EVT_RIGHT_DCLICK(self._canvas, self.FocusOnClick)
        wx.EVT_MIDDLE_DOWN(self._canvas, self.FocusOnClick)
        wx.EVT_MIDDLE_DCLICK(self._canvas, self.FocusOnClick)

        wx.EVT_KILL_FOCUS(self._canvas, self.OnKillFocus)
        wx.EVT_SET_FOCUS(self._canvas, self.OnFocus)

        self._canvas.SetScrollbars(20, 20, self._maxWidth / 20,
                                   self._maxHeight / 20)

        self._canvas.SetBackgroundColour(self._backgroundColor)
        self._diagram = ogl.Diagram()
        self._canvas.SetDiagram(self._diagram)
        self._diagram.SetCanvas(self._canvas)
        self._canvas.SetFont(NORMALFONT)
コード例 #9
0
ファイル: openglGui.py プロジェクト: lssang/testRepo
	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._glRobotTexture = 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_CHAR(self, self._OnGuiKeyChar)
		wx.EVT_KILL_FOCUS(self, self.OnFocusLost)
		wx.EVT_IDLE(self, self._OnIdle)
コード例 #10
0
ファイル: widget_properties.py プロジェクト: italomaia/spe
 def bind_event(self, function):
     def func_2(event):
         if self.text.IsEnabled():
             #misc.wxCallAfter(function, event)
             function(event)
         event.Skip()
     wx.EVT_KILL_FOCUS(self.text, func_2)
コード例 #11
0
    def createControl(self,
                      parent,
                      value,
                      idx,
                      sizeX,
                      style=wx.TE_PROCESS_ENTER):
        self.editorCtrl = pop.PopupControl(parent,
                                           -1,
                                           pos=(0, 0),
                                           size=(sizeX, oiLineHeight))
        self.win = wx.Window(self.editorCtrl,
                             wx.NewId(),
                             style=wx.TAB_TRAVERSAL | wx.SUNKEN_BORDER,
                             size=(-1, -1))  # (200,200))
        self.win.Show(False)
        self.editorCtrl.SetDimensions(-2, idx * oiLineHeight - 2, sizeX,
                                      oiLineHeight + 3)

        self.cal = AnimationPanel(self.win, self, (0, 0))
        self.cal.resource = self.resource

        self.editorCtrl.SetValue(value)
        self.editorCtrl.SetPopupContent(self.win)
        InspectorEditorControl.createControl(self)
        self.cal.create_buttons()

        wx.EVT_KILL_FOCUS(self.cal, self.on_left_button_down)
コード例 #12
0
ファイル: text_editor.py プロジェクト: timdiller/traitsui
    def init ( self, parent ):
        """ Finishes initializing the editor by creating the underlying toolkit
            widget.
        """
        factory       = self.factory
        style         = self.base_style
        self.evaluate = factory.evaluate
        self.sync_value( factory.evaluate_name, 'evaluate', 'from' )

        if (not factory.multi_line) or factory.password:
            style &= ~wx.TE_MULTILINE

        if factory.password:
            style |= wx.TE_PASSWORD

        multi_line = ((style & wx.TE_MULTILINE) != 0)
        if multi_line:
            self.scrollable = True

        if factory.enter_set and (not multi_line):
            control = wx.TextCtrl( parent, -1, self.str_value,
                                   style = style | wx.TE_PROCESS_ENTER )
            wx.EVT_TEXT_ENTER( parent, control.GetId(), self.update_object )
        else:
            control = wx.TextCtrl( parent, -1, self.str_value, style = style )

        wx.EVT_KILL_FOCUS( control, self.update_object )

        if factory.auto_set:
            wx.EVT_TEXT( parent, control.GetId(), self.update_object )

        self.control = control
        self.set_error_state( False )
        self.set_tooltip()
コード例 #13
0
def wx_editor_factory(parent, editor, use_dir=False, *args):
    import wx
    from traitsui.wx.helper import TraitsUIPanel

    editor.control = panel = TraitsUIPanel(parent, -1)
    sizer = wx.BoxSizer(wx.HORIZONTAL)

    editor.use_dir = use_dir

    pad = 8

    bmp = wx.ArtProvider.GetBitmap(wx.ART_FOLDER_OPEN, size=(15, 15))
    button = wx.BitmapButton(panel, -1, bitmap=bmp)

    editor.text_control = text_control = wx.TextCtrl(panel,
                                                     -1,
                                                     '',
                                                     style=wx.TE_PROCESS_ENTER)

    _do_update_obj = lambda ev: update_file_obj(editor)

    wx.EVT_TEXT_ENTER(panel, text_control.GetId(), _do_update_obj)
    wx.EVT_KILL_FOCUS(text_control, _do_update_obj)

    sizer.Add(text_control, 1, wx.EXPAND | wx.ALIGN_CENTER)
    sizer.Add(button, 0, wx.RIGHT | wx.ALIGN_CENTER, pad)

    wx.EVT_BUTTON(panel, button.GetId(), lambda ev: button_click(editor))
    panel.SetSizerAndFit(sizer)

    return panel
コード例 #14
0
    def __init__(self, parent, label, text_obj):
        SettingBase.__init__(self, parent, label)
        text.AnimatedText.__init__(self, text_obj)
        self.text_obj = text_obj
        self.parent = parent
        self.mpl_figure = text_obj.get_figure()

        self.__bkgd_region = None

        self.tc = wx.TextCtrl(parent,
                              -1,
                              value=text_obj.get_text(),
                              style=wx.TE_PROCESS_ENTER)
        wx.EVT_TEXT(parent, self.tc.GetId(), self.on_text_change)
        self.Add(self.tc, 1, wx.ALIGN_CENTRE_VERTICAL)

        prop_bmp = wx.ArtProvider.GetBitmap("avoplot_text_prop", wx.ART_BUTTON)
        self.prop_button = wx.BitmapButton(parent, wx.ID_ANY, prop_bmp)
        self.prop_button.SetToolTip(wx.ToolTip("Edit font properties"))
        self.Add(self.prop_button, 0,
                 wx.ALIGN_CENTER_VERTICAL | wx.RESERVE_SPACE_EVEN_IF_HIDDEN)
        wx.EVT_BUTTON(parent, self.prop_button.GetId(),
                      self.on_text_prop_button)

        wx.EVT_SET_FOCUS(self.tc, self.on_focus)
        wx.EVT_KILL_FOCUS(self.tc, self.on_unfocus)

        #hide the button if it is an empty string
        if not self.text_obj.get_text():
            self.prop_button.Show(False)
コード例 #15
0
    def __init__(self, parent):
        wx.Panel.__init__(self, parent)

        wx.EVT_SIZE(self, self.OnSize)
        wx.EVT_IDLE(self, self.OnIdle)
        wx.EVT_MOVE(self, self.OnMove)
        wx.EVT_SET_FOCUS(self, self.OnFocus)
        wx.EVT_KILL_FOCUS(self, self.OnLostFocus)
        wx.EVT_MAXIMIZE(self, self.OnMaximize)

        wx.EVT_LEFT_DOWN(self, self.OnLeftDown)
        #~ wx.EVT_LEFT_UP(self, self.OnLeftUp)
        wx.EVT_RIGHT_DOWN(self, self.OnRightDown)
        wx.EVT_MIDDLE_DOWN(self, self.OnMiddleDown)
        wx.EVT_RIGHT_UP(self, self.OnRightUp)
        wx.EVT_MIDDLE_UP(self, self.OnMiddleUp)
        wx.EVT_MOTION(self, self.OnMotion)
        wx.EVT_KEY_DOWN(self, self.OnKeyDown)

        self._3dDisplay = None
        self._inited = False
        self.DynaZoom = False
        self.DynaRotate = False
        self.DynaPan = False
        self.dragStartPos = None
        self._drawbox = None
        self._selection = None

        if sys.platform == 'win32':
            self.Init3dViewer()
コード例 #16
0
    def init(self, parent):
        """ Finishes initializing the editor by creating the underlying toolkit
            widget.
        """
        if not self.factory.low_name:
            self.low = self.factory.low

        if not self.factory.high_name:
            self.high = self.factory.high

        self.sync_value(self.factory.low_name, 'low', 'from')
        self.sync_value(self.factory.high_name, 'high', 'from')

        if self.factory.enter_set:
            control = wx.TextCtrl(parent,
                                  -1,
                                  self.str_value,
                                  style=wx.TE_PROCESS_ENTER)
            wx.EVT_TEXT_ENTER(parent, control.GetId(), self.update_object)
        else:
            control = wx.TextCtrl(parent, -1, self.str_value)

        wx.EVT_KILL_FOCUS(control, self.update_object)

        if self.factory.auto_set:
            wx.EVT_TEXT(parent, control.GetId(), self.update_object)

        self.evaluate = self.factory.evaluate
        self.sync_value(self.factory.evaluate_name, 'evaluate', 'from')

        self.control = control
        self.set_tooltip()
コード例 #17
0
    def init(self, parent):
        """
        Finishes initializing the editor by creating the underlying widget.
        """
        self.control = self._panel = parent = TraitsUIPanel(parent, -1)
        sizer = wx.BoxSizer(wx.HORIZONTAL)

        # 'text_control' is the text display of the color.
        text_control = wx.TextCtrl(parent,
                                   -1,
                                   self.str_value,
                                   style=wx.TE_PROCESS_ENTER)
        wx.EVT_KILL_FOCUS(text_control, self.update_object)
        wx.EVT_TEXT_ENTER(parent, text_control.GetId(), self.update_object)

        # 'button_control' shows the 'Edit' button.
        button_control = wx.Button(parent, label='Edit', style=wx.BU_EXACTFIT)
        wx.EVT_BUTTON(button_control, button_control.GetId(),
                      self.open_color_dialog)

        sizer.Add(text_control, wx.ALIGN_LEFT)
        sizer.AddSpacer(8)
        sizer.Add(button_control, wx.ALIGN_RIGHT)
        self.control.SetSizer(sizer)

        self._text_control = text_control
        self._button_control = button_control

        self.set_tooltip()

        return
コード例 #18
0
 def dispose(self):
     """ Disposes of the control at the end of its life cycle.
     """
     control, self.control = self.control, None
     parent = control.GetParent()
     wx.EVT_COMBOBOX(parent, control.GetId(), None)
     wx.EVT_TEXT_ENTER(parent, control.GetId(), None)
     wx.EVT_KILL_FOCUS(control, None)
コード例 #19
0
 def init ( self, parent ):
     """ Finishes initializing the editor by creating the underlying toolkit
         widget.
     """
     self.control = wx.TextCtrl( parent, -1, self.str_value,
                                 style = wx.TE_PROCESS_ENTER )
     wx.EVT_KILL_FOCUS( self.control, self.update_object )
     wx.EVT_TEXT_ENTER( parent, self.control.GetId(), self.update_object )
     self.set_tooltip()
コード例 #20
0
ファイル: widget_properties.py プロジェクト: italomaia/spe
 def bind_event(self, function):
     def func_2(event):
         if self.is_active():
             function(event)
         event.Skip()
     wx.EVT_KILL_FOCUS(self.spin, func_2)
     if wx.Platform == '__WXMAC__' or self.immediate:
         wx.EVT_TEXT(self.spin, self.spin.GetId(), func_2)
         wx.EVT_SPINCTRL(self.spin, self.spin.GetId(), func_2)
コード例 #21
0
    def __init__(self, parent, ID, mainControl):
        EnhancedListControl.__init__(self,
                                     parent,
                                     ID,
                                     style=wx.LC_REPORT | wx.LC_SINGLE_SEL
                                     | wx.LC_NO_HEADER)

        self.mainControl = mainControl

        self.InsertColumn(0, u"", width=3000)

        self.updatingThreadHolder = Utilities.ThreadHolder()
        self.tocList = [
        ]  # List of tuples (char. start in text, headLevel, heading text)
        self.tocListStarts = [
        ]  # List of the char. start items of self.tocList
        self.mainControl.getMiscEvent().addListener(self)
        self.sizeVisible = True  # False if this window has a size
        # that it can't be read (one dim. less than 5 pixels)
        self.ignoreOnChange = False

        self.docPagePresenterSink = wxKeyFunctionSink(
            (("loaded current doc page", self.onUpdateNeeded),
             ("changed live text", self.onUpdateNeeded)
             #                 ("options changed", self.onUpdateNeeded)
             ))

        self.__sinkApp = wxKeyFunctionSink(
            (("options changed", self.onUpdateNeeded), ),
            wx.GetApp().getMiscEvent(), self)

        #         if not self.mainControl.isMainWindowConstructed():
        #             # Install event handler to wait for construction
        #             self.__sinkMainFrame = wxKeyFunctionSink((
        #                     ("constructed main window", self.onConstructedMainWindow),
        #             ), self.mainControl.getMiscEvent(), self)
        #         else:
        #             self.onConstructedMainWindow(None)

        self.__sinkMainFrame = wxKeyFunctionSink(
            (("idle visible", self.onIdleVisible), ),
            self.mainControl.getMiscEvent(), self)

        currPres = self.mainControl.getCurrentDocPagePresenter()
        if currPres is not None:
            self.docPagePresenterSink.setEventSource(currPres.getMiscEvent())

        self.lastSelection = (-1, -1)

        self.updateList()

        wx.EVT_WINDOW_DESTROY(self, self.OnDestroy)
        wx.EVT_LIST_ITEM_SELECTED(self, self.GetId(), self.OnItemSelected)
        wx.EVT_LIST_ITEM_ACTIVATED(self, self.GetId(), self.OnItemActivated)
        wx.EVT_SIZE(self, self.OnSize)

        wx.EVT_KILL_FOCUS(self, self.OnKillFocus)
コード例 #22
0
    def _bindWidgetEvents(self):
        self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.onSelected,
                  self.linkListView)
        self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.onActivated,
                  self.linkListView)
        self.Bind(wx.EVT_LIST_ITEM_RIGHT_CLICK, self.onRightClick,
                  self.linkListView)

        wx.EVT_SET_FOCUS(self.linkListView, self.onFocus)
        wx.EVT_KILL_FOCUS(self.linkListView, self.onUnFocus)
コード例 #23
0
ファイル: MainAreaPanel.py プロジェクト: dongshige/wikidpad
    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)
コード例 #24
0
ファイル: resources.py プロジェクト: dvrhax/cornice3
 def __init__(self, ctrl, bmark_file):
     self.ctrl = ctrl
     self.bmark_file = bmark_file
     self.selected_index = -1
     res = wx.xrc.XmlResource.Get()
     self.dialog = res.LoadDialog(None, 'bookmarks_editor')
     self.fill_bookmarks_list()
     wx.EVT_LIST_ITEM_SELECTED(self.dialog, wx.xrc.XRCID('bookmarks_list'),
                               self.on_item_selected)
     wx.EVT_BUTTON(self.dialog, wx.xrc.XRCID('add'), self.add_item)
     wx.EVT_BUTTON(self.dialog, wx.xrc.XRCID('remove'), self.remove_item)
     wx.EVT_BUTTON(self.dialog, wx.xrc.XRCID('move_up'), self.move_item_up)
     wx.EVT_BUTTON(self.dialog, wx.xrc.XRCID('move_down'),
                   self.move_item_down)
     wx.EVT_KILL_FOCUS(wx.xrc.XRCCTRL(self.dialog, 'name'),
                       self.update_item)
     wx.EVT_KILL_FOCUS(wx.xrc.XRCCTRL(self.dialog, 'path'),
                       self.update_item)
     if self.dialog.ShowModal() == wx.ID_OK:
         self.save_bookmarks()
     self.dialog.Destroy()
コード例 #25
0
ファイル: translationeditor.py プロジェクト: mpm2050/Raven
    def _bindWidgetEvents(self):
        self._bindOkButton(self.onSave)
        self._bindCancelButton(self.onCancel)
        self.Bind(wx.EVT_CHECKBOX, self.onShowOnly, self.showOnlyCB)
        self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.onListSelection,
                  self.listBox)
        self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.onListActivation,
                  self.listBox)
        self.Bind(wx.EVT_TEXT_ENTER, self.onTranslationActivation,
                  self.translationText)

        wx.EVT_KILL_FOCUS(self.translationText, self.onTranslationUnfocus)
コード例 #26
0
    def __init__(self,
                 parent,
                 id,
                 txtCtrl,
                 rect,
                 font,
                 mainControl,
                 searchInit=None):
        # Frame title is invisible but is helpful for workarounds with
        # third-party tools
        wx.Frame.__init__(self, parent, id, u"WikidPad i-search",
                          rect.GetPosition(), rect.GetSize(),
                          wx.NO_BORDER | wx.FRAME_FLOAT_ON_PARENT)

        self.txtCtrl = txtCtrl
        self.mainControl = mainControl
        self.tfInput = wx.TextCtrl(
            self,
            GUI_ID.INC_SEARCH_TEXT_FIELD,
            _(u"Incremental search (ENTER/ESC to finish)"),
            style=wx.TE_PROCESS_ENTER | wx.TE_RICH)

        self.tfInput.SetFont(font)
        self.tfInput.SetBackgroundColour(IncrementalSearchDialog.COLOR_YELLOW)
        mainsizer = wx.BoxSizer(wx.HORIZONTAL)
        mainsizer.Add(self.tfInput, 1, wx.ALL | wx.EXPAND, 0)

        self.SetSizer(mainsizer)
        self.Layout()
        self.tfInput.SelectAll()  #added for Mac compatibility
        self.tfInput.SetFocus()

        config = self.mainControl.getConfig()

        self.closeDelay = 1000 * config.getint(
            "main", "incSearch_autoOffDelay",
            0)  # Milliseconds to close or 0 to deactivate

        wx.EVT_TEXT(self, GUI_ID.INC_SEARCH_TEXT_FIELD, self.OnText)
        wx.EVT_KEY_DOWN(self.tfInput, self.OnKeyDownInput)
        wx.EVT_KILL_FOCUS(self.tfInput, self.OnKillFocus)
        wx.EVT_TIMER(self, GUI_ID.TIMER_INC_SEARCH_CLOSE,
                     self.OnTimerIncSearchClose)
        wx.EVT_MOUSE_EVENTS(self.tfInput, self.OnMouseAnyInput)

        if searchInit:
            self.tfInput.SetValue(searchInit)
            self.tfInput.SetSelection(-1, -1)

        if self.closeDelay:
            self.closeTimer = wx.Timer(self, GUI_ID.TIMER_INC_SEARCH_CLOSE)
            self.closeTimer.Start(self.closeDelay, True)
コード例 #27
0
    def dispose(self):
        """ Disposes of the contents of an editor.
        """
        if self.factory.auto_set:
            self._editor.on_trait_change(self.update_object, 'changed',
                                         remove=True)
        if self.factory.key_bindings is not None:
            self._editor.on_trait_change(self.key_pressed, 'key_pressed',
                                         remove=True)

        wx.EVT_KILL_FOCUS(self.control, None)

        super(SourceEditor, self).dispose()
コード例 #28
0
ファイル: stc.py プロジェクト: italomaia/spe
 def __init__(self,parent, child = None, *args,**kwds):
     PythonBaseSTC.__init__(self,parent,*args,**kwds)
     self.dyn_sash = parent
     self.child    = child
     self._args = args
     self._kwds = kwds
     self.SetupScrollBars()
     wx_gizmos.EVT_DYNAMIC_SASH_SPLIT(self,-1,self.OnSplit)
     wx_gizmos.EVT_DYNAMIC_SASH_UNIFY(self,-1,self.OnUnify)
     wx.EVT_SET_FOCUS(self,self.OnSetFocus)
     wx.EVT_KILL_FOCUS(self,self.OnKillFocus)
     self.SetScrollbar(wx.HORIZONTAL, 0, 0, 0)
     self.SetScrollbar(wx.VERTICAL, 0, 0, 0)
コード例 #29
0
    def _bindWidgetEvents(self):
        ZBoxedView._bindWidgetEvents(self)

        self.Bind(wx.EVT_TREE_SEL_CHANGED, self.onSelectionChanged,
                  self.treeView)
        self.Bind(wx.EVT_TREE_ITEM_RIGHT_CLICK, self.onItemRightClick,
                  self.treeView)
        self.Bind(wx.EVT_BUTTON, self.onDashboardButton, self.dashboardButton)
        self.Bind(wx.EVT_BUTTON, self.onCollapseAllButton,
                  self.collapseAllButton)
        self.Bind(ZEVT_REFRESH, self.onZoundryRefresh, self)

        wx.EVT_SET_FOCUS(self.treeView, self.onFocus)
        wx.EVT_KILL_FOCUS(self.treeView, self.onUnFocus)
コード例 #30
0
    def _bindWidgetEvents(self):
        ZBoxedView._bindWidgetEvents(self)

        self.Bind(ZEVT_REFRESH, self.onZoundryRefresh, self)
        self.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.onLinkActivated,
                  self.linksTreeView)
        self.Bind(wx.EVT_TREE_ITEM_RIGHT_CLICK, self.onLinkRightClick,
                  self.linksTreeView)
        self.Bind(wx.EVT_TREE_SEL_CHANGED, self.onLinkSelected,
                  self.linksTreeView)
        #        self.Bind(wx.EVT_LIST_BEGIN_DRAG, self.onEntryBeginDrag, self.linksTreeView)
        self.Bind(wx.EVT_TEXT_ENTER, self.onSearchText, self.searchTextBox)
        self.Bind(ZEVT_VIEW_SELECTION_CHANGED, self.onViewSelectionChanged)
        wx.EVT_SET_FOCUS(self.linksTreeView, self.onFocus)
        wx.EVT_KILL_FOCUS(self.linksTreeView, self.onUnFocus)