コード例 #1
0
    def __init__(self, parent, id=wx.ID_ANY,
                 pos=wx.DefaultPosition,
                 size=wx.DefaultSize):
        """
        Constructor.
        """
        style=wx.NO_BORDER|wx.NO_FULL_REPAINT_ON_RESIZE|wx.CLIP_CHILDREN|wx.WANTS_CHARS

        wx.Window.__init__(self, parent, id, pos, size, style)
        self.SetDoubleBuffered(True)
        self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM)

        self.Initialize(size)

        # Bind the events related to our control:

        # Only refresh drawing when resizing is finished
        wx.EVT_PAINT(self, self.OnPaint)
        wx.EVT_SIZE(self,  self.OnSize)
        wx.EVT_IDLE(self,  self.OnIdle)
        wx.EVT_CLOSE(self, self.OnClose)
        wx.EVT_ERASE_BACKGROUND(self, lambda event: None)

        # Bind the events related to this control:
        wx.EVT_LEFT_UP(self, self.OnMouseLeftUp)

        # Start the background redraw timer.
        # This is optional, but it gives the double-buffered contents a
        # chance to redraw even when idle events are disabled (like during
        # resize and scrolling)
        self.redrawTimer = wx.Timer(self)
        self.redrawTimer.Start(500)
コード例 #2
0
    def _create_scene(self):
        """ Create the TVTK scene widget.
        """

        factory = self.factory
        self._scene = factory.scene_class(self.control)
        scene = self._scene
        self.value.scene_editor = scene

        # Disable rendering on the scene until we're finished.
        scene.disable_render = True
        # Add all of the actors in the current actor map.
        for obj, actors in self.value.actor_map.items():
            self._add_actors_widgets(actors)
        # Add all of the actors in the current actor map.
        self._add_actors_widgets(self.value.actor_list)
        # Set up Traits notifications.
        self._setup_scene_notifications()
        # Re-enable rendering.
        scene.disable_render = False

        # Ensure the scene's wx control is sized to fill our view's area.  Note
        # that the sizer doesn't automatically layout its contents upon adding
        # a new child so we have to force it to do a layout.
        self._sizer.Add(scene.control, 1, wx.EXPAND)
        self._sizer.Layout()

        wx.EVT_IDLE(scene.control, None)

        # Force a render.
        scene.render()
コード例 #3
0
    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)
コード例 #4
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()
コード例 #5
0
ファイル: main.py プロジェクト: italomaia/spe
    def OnInit(self):
        import sys
        sys.stdout = sys.__stdout__
        sys.stderr = sys.__stderr__
        # needed for wx >= 2.3.4 to disable wxPyAssertionError exceptions
        if misc.check_wx_version(2, 3, 4):
            self.SetAssertMode(0)
        wx.InitAllImageHandlers()
        config.init_preferences()

        # ALB 2004-10-27
        if wx.Platform == '__WXGTK__' and config.preferences.use_kde_dialogs:
            import kdefiledialog
            if kdefiledialog.test_kde():
                misc.FileSelector = kdefiledialog.kde_file_selector
                misc.DirSelector = kdefiledialog.kde_dir_selector

        wx.ArtProvider.PushProvider(wxGladeArtProvider())

        frame = wxGladeFrame()
        ##         if wx.Platform == '__WXMSW__':
        ##             def on_activate(event):
        ##                 if event.GetActive() and not frame.IsIconized():
        ##                     frame.show_and_raise()
        ##                 event.Skip()
        ##             wx.EVT_ACTIVATE_APP(self, on_activate)

        self.SetTopWindow(frame)
        self.SetExitOnFrameDelete(True)

        wx.EVT_IDLE(self, self.on_idle)

        return True
コード例 #6
0
    def __init__(self, parent, ID):
        wx.Window.__init__(self, parent, ID, style=wx.NO_FULL_REPAINT_ON_RESIZE)
        self.SetBackgroundColour("WHITE")
        self.listeners = []
        self.thickness = 1
        self.SetColour("Black")
        self.lines = []
        self.x = self.y = 0
        self.MakeMenu()

        self.InitBuffer()

        # hook some mouse events
        wx.EVT_LEFT_DOWN(self, self.OnLeftDown)
        wx.EVT_LEFT_UP(self, self.OnLeftUp)
        wx.EVT_RIGHT_UP(self, self.OnRightUp)
        wx.EVT_MOTION(self, self.OnMotion)

        # the window resize event and idle events for managing the buffer
        wx.EVT_SIZE(self, self.OnSize)
        wx.EVT_IDLE(self, self.OnIdle)

        # and the refresh event
        wx.EVT_PAINT(self, self.OnPaint)

        # When the window is destroyed, clean up resources.
        wx.EVT_WINDOW_DESTROY(self, self.Cleanup)
コード例 #7
0
    def __init__(self, form):
        print "FormFrame.__init__()"
        #self.ui = ui
        title = form.getLabel()
        #title = self.session.db.getLabel()
        #parent = form.getSession().getCurrentForm()
        parent = None
        wx.Frame.__init__(self,
                          parent,
                          -1,
                          title,
                          size=(400, 300),
                          style=wx.DEFAULT_FRAME_STYLE
                          | wx.NO_FULL_REPAINT_ON_RESIZE)

        wx.EVT_IDLE(self, self.OnIdle)
        wx.EVT_CLOSE(self, self.OnCloseWindow)
        wx.EVT_ICONIZE(self, self.OnIconfiy)
        wx.EVT_MAXIMIZE(self, self.OnMaximize)

        self.Centre(wx.BOTH)
        self.CreateStatusBar(1, wx.ST_SIZEGRIP)

        self.setForm(form)

        self.Show()
コード例 #8
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)
コード例 #9
0
    def __init__(self, parent, id, resources, events, **options):
        wx.Control.__init__(*(self, parent, id), **options)
        self.parent = parent
        self.resources = resources
        self.stage = Stage(self.resources)
        self.events = events

        self._initialized = 0
        self._resized = 0
        self._surface = None
        self.__needsDrawing = 1
        self.size = self.GetSizeTuple()

        self.stageevents = StageEvents()
        wx.EVT_SIZE(self, self.OnSize)
        wx.EVT_IDLE(self, self.OnIdle)
        self.timer = wx.Timer(self)
        self.events.subscribe(self, ['projload', 'play', 'stop'])
        self.Bind(wx.EVT_PAINT, self.OnPaint)
        self.Bind(wx.EVT_TIMER, self.Update, self.timer)
        self.Bind(self.events.EVT_NOTICE, self.notice_handler)
        self.Bind(wx.EVT_KEY_DOWN, self.stageevents.translate_key)
        self.Bind(wx.EVT_KEY_UP, self.stageevents.translate_key)
        self.Bind(wx.EVT_MOUSE_EVENTS, self.stageevents.translate_mouse)

        self.max_fps = 25.0
        self.timespacing = 1000.0 / self.max_fps
        self.timer.Start(self.timespacing, False)
        self.default_backcolor = (255, 255, 255)
コード例 #10
0
 def __init__(self, parent):
     """Create EditorNotebook instance."""
     wx.Notebook.__init__(self, parent, id=-1, style=wx.CLIP_CHILDREN)
     wx.EVT_NOTEBOOK_PAGE_CHANGING(self, self.GetId(),
                                   self.OnPageChanging)
     wx.EVT_NOTEBOOK_PAGE_CHANGED(self, self.GetId(),
                                  self.OnPageChanged)
     wx.EVT_IDLE(self, self.OnIdle)
コード例 #11
0
          def __init__(self, parent, game):
              pypoujol.ClanlibCanvas.__init__(self, parent, game)

              wx.EVT_PAINT(self.canvas, self.OnPaint)
              wx.EVT_IDLE(self.canvas, self.OnIdle)
              wx.EVT_LEFT_DOWN(self.canvas, speculoos.on_left_button_down)
              wx.EVT_LEFT_UP(self.canvas, speculoos.on_left_button_up)
              wx.EVT_RIGHT_DOWN(self.canvas, speculoos.on_right_button_down)
              wx.EVT_MOTION(self.canvas, speculoos.on_mouse_motion)
コード例 #12
0
ファイル: openGLPanel.py プロジェクト: sanyaade-iot/Cura2
    def __init__(self, parent):
        super(OpenGLPanel, self).__init__(parent)
        self._refreshQueued = False
        self._idleCalled = False
        self._shownError = False
        self._releaseList = []

        wx.EVT_SIZE(self, self._onSize)
        wx.EVT_IDLE(self, self._onIdle)
コード例 #13
0
ファイル: scene.py プロジェクト: victorliun/mayavi
 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
コード例 #14
0
ファイル: test2.py プロジェクト: yankj12/python_demo
    def __init__(self, parent, id, title='SDL window', **options):
        options['style'] = wx.DEFAULT_FRAME_STYLE | wx.TRANSPARENT_WINDOW
        wx.Frame.__init__(*(self, parent, id, title), **options)

        self._initialized = 0
        self._resized = 0
        self._surface = None
        self.__needsDrawing = 1

        wx.EVT_IDLE(self, self.OnIdle)
コード例 #15
0
ファイル: WaveformView.py プロジェクト: taji/papagayo-ng
    def __init__(self, *args, **kwds):
        # begin wxGlade: WaveformView.__init__
        kwds["style"] = wx.BORDER_SUNKEN | wx.TAB_TRAVERSAL
        wx.ScrolledWindow.__init__(self, *args, **kwds)

        self.__set_properties()
        self.__do_layout()
        # end wxGlade

        # test for wxPython type
        self.cdc = wx.ClientDC(self)
        self.isWxPhoenix = False
        if not "SetClippingRect" in dir(
                self.cdc
        ):  # TODO: Test this version: if "SetClippingRect" not in dir(cdc)
            self.isWxPhoenix = True

        # Other initialization
        self.doc = None
        self.maxWidth = 1
        self.maxHeight = 1
        self.isDragging = False
        self.basicScrubbing = False
        self.curFrame = 0
        self.oldFrame = 0
        self.buffer = None
        self.clipRect = None
        self.sampleWidth = defaultSampleWidth
        self.samplesPerFrame = defaultSamplesPerFrame
        self.samplesPerSec = 24 * self.samplesPerFrame
        self.frameWidth = self.sampleWidth * self.samplesPerFrame
        self.phraseBottom = 16
        self.wordBottom = 32
        self.phonemeTop = 128
        self.didresize = 0

        # Connect event handlers
        # window events
        wx.EVT_PAINT(self, self.OnPaint)
        wx.EVT_SIZE(self, self.OnSize)
        wx.EVT_IDLE(self, self.OnIdle)
        # mouse events
        wx.EVT_LEFT_DOWN(self, self.OnMouseDown)
        wx.EVT_RIGHT_DOWN(self, self.OnMouseDown)
        wx.EVT_LEFT_DCLICK(self, self.OnMouseDown)
        wx.EVT_LEFT_UP(self, self.OnMouseUp)
        wx.EVT_RIGHT_UP(self, self.OnMouseUp)
        wx.EVT_MOTION(self, self.OnMouseMove)
        wx.EVT_MOUSEWHEEL(self, self.OnMouseWheel)

        # Force an update
        self.OnSize()
コード例 #16
0
ファイル: MainFrame.py プロジェクト: zztalker/ulipad
    def __init__(self, app, filenames):
        self.initmixin()
        
        self.app = app
        self.pref = app.pref
        self.filenames = filenames
        self.closeflag = False

        self.callplugin_once('start', self)

        wx.Frame.__init__(self, None, -1, self.app.appname, size=wx.Size(600, 400), name=self.app.appname)

        Globals.mainframe = self
        
        #@add_menu menulist
        self.callplugin_once('add_menu', MainFrame.menulist)
        #@add_menu_image_list
        self.callplugin_once('add_menu_image_list', MainFrame.imagelist)
        #@add_filewildchar filewildchar
        self.callplugin_once('add_filewildchar', MainFrame.filewildchar)
        #@add_tool_list
        self.callplugin_once('add_tool_list', MainFrame.toollist, MainFrame.toolbaritems)
        #@add_new_files
        self.callplugin_once('add_new_files', MainFrame.filenewtypes)

        self.id = self.GetId()
        self.menubar=makemenu.makemenu(self, self.menulist, MainFrame.accellist, MainFrame.editoraccellist, MainFrame.imagelist)
        self.SetMenuBar(self.menubar)

        a = {}
        self.callplugin_once('init_accelerator', self, MainFrame.accellist, MainFrame.editoraccellist)
        a.update(MainFrame.accellist)
        a.update(MainFrame.editoraccellist)
        MainFrame.default_accellist = copy.deepcopy(MainFrame.accellist)
        MainFrame.default_editoraccellist = copy.deepcopy(MainFrame.editoraccellist)

        self.editorkeycodes = {}
        Accelerator.getkeycodes(self.editoraccellist, self.editorkeycodes)

        makemenu.setmenutext(self, a)
        Accelerator.initaccelerator(self, MainFrame.accellist)

        self.statusbar = MyStatusBar.MyStatusBar(self)
        self.SetStatusBar(self.statusbar)
        self.progressbar = self.statusbar.g1

        self.callplugin('beforeinit', self)
        self.callplugin('init', self)
        self.callplugin('show', self)
        wx.EVT_IDLE(self, self.OnIdle)
        wx.EVT_CLOSE(self, self.OnClose)
        wx.EVT_ACTIVATE(self, self.OnActive)
コード例 #17
0
ファイル: guihelper.py プロジェクト: deosai/bitpim
 def __init__(self, parent):
     wx.Panel.__init__(self,parent, -1, style=wx.NO_FULL_REPAINT_ON_RESIZE)
     self.tb=wx.TextCtrl(self, 1, style=wx.TE_MULTILINE|wx.TE_RICH2|wx.NO_FULL_REPAINT_ON_RESIZE|wx.TE_DONTWRAP|wx.TE_READONLY)
     f=wx.Font(10, wx.MODERN, wx.NORMAL, wx.NORMAL )
     ta=wx.TextAttr(font=f)
     self.tb.SetDefaultStyle(ta)
     self.sizer=wx.BoxSizer(wx.VERTICAL)
     self.sizer.Add(self.tb, 1, wx.EXPAND)
     self.SetSizer(self.sizer)
     self.SetAutoLayout(True)
     self.sizer.Fit(self)
     wx.EVT_IDLE(self, self.OnIdle)
     self.outstandingtext=""
コード例 #18
0
    def __init__(self,
                 view,
                 parent,
                 id=-1,
                 pos=wx.DefaultPosition,
                 size=wx.DefaultSize,
                 style=wx.CLIP_CHILDREN):
        """Create Shell instance."""
        editwindow.EditWindow.__init__(self, parent, id, pos, size, style)
        CellCtrlBase.__init__(self, parent, id, pos, size, style)
        self.view = view
        #self.document = view.doc
        #self.log = self.document.log
        self.oldlineno = 1  # used by OnModified. Is there a way to
        # declare this inside the method? Like a
        # C++ static variable
        self.oldpos = (0, 0)

        self.wrap()

        # Find out for which keycodes the interpreter will autocomplete.
        #self.autoCompleteKeys = self.document.log.interp.getAutoCompleteKeys()
        #TODO: fix this. IPython must tell us which keys go here
        self.autoCompleteKeys = []

        # Keep track of the last non-continuation prompt positions.
        #self.promptPosStart = 0
        self.promptPosEnd = 0
        # Keep track of multi-line commands.
        self.more = False
        # Create the command history.  Commands are added into the
        # front of the list (ie. at index 0) as they are entered.
        # self.historyIndex is the current position in the history; it
        # gets incremented as you retrieve the previous command,
        # decremented as you retrieve the next, and reset when you hit
        # Enter.  self.historyIndex == -1 means you're on the current
        # command, not in the history.
        #self.history = []
        #self.historyIndex = -1
        # Assign handlers for keyboard events.
        wx.EVT_CHAR(self, self.OnChar)
        #This is unnecessary. The method is called by CellCtrlBase.KeyDown
        #wx.EVT_KEY_DOWN(self, self.OnKeyDown)
        # Assign handler for idle time.
        self.waiting = False
        wx.EVT_IDLE(self, self.OnIdle)
        stc.EVT_STC_MODIFIED(self, id, self.OnModified)
        stc.EVT_STC_UPDATEUI(self, id, self.OnUpdateUI)
コード例 #19
0
 def __init__(self, parent=None, id=-1, title='PyAlaCarte',
              pos=wx.DefaultPosition, size=(800, 600), 
              style=wx.DEFAULT_FRAME_STYLE | wx.NO_FULL_REPAINT_ON_RESIZE,
              filename=None):
     """Create EditorFrame instance."""
     frame.Frame.__init__(self, parent, id, title, pos, size, style)
     self.buffers = {}
     self.buffer = None  # Current buffer.
     self.editor = None
     self._defaultText = title + ' - the tastiest Python editor.'
     self._statusText = self._defaultText
     self.SetStatusText(self._statusText)
     wx.EVT_IDLE(self, self.OnIdle)
     self._setup()
     if filename:
         self.bufferCreate(filename)
コード例 #20
0
ファイル: vis_mpl.py プロジェクト: zmhou/sailfish
    def run(self):
        import matplotlib
        matplotlib.use('WXAgg')
        matplotlib.rcParams['toolbar'] = 'None'
        import matplotlib.pyplot as plt

        self.fig = plt.figure()
        self.ax = self.fig.add_subplot(111)
        width, height = self.size
        buffer = np.zeros((height, width))
        self.plot = self.ax.imshow(buffer, origin='lower')
        self.fig.colorbar(self.plot)
        import wx
        wx.EVT_IDLE(wx.GetApp(), self.update)
        plt.show()
        self._sim_quit_event.set()
コード例 #21
0
    def __bind_events(self):
        """Bind events."""

        # Only refresh drawing when resizing is finished
        wx.EVT_PAINT(self, self.onPaint)
        wx.EVT_SIZE(self,  self.onSize)
        wx.EVT_CLOSE(self, self.onClose)
        wx.EVT_IDLE(self,  self.onIdle)
        wx.EVT_ERASE_BACKGROUND(self, lambda event: None)

        # Handling mouse moving.
        wx.EVT_MOUSE_EVENTS(self, self.onMouseEvents)

        # Mouse selection
        self.Bind(spEVT_CTRL_SELECTED, self.onSelectedObject)
        self.Bind(wx.EVT_TOOL_RANGE, self.onSelectionRange)
コード例 #22
0
    def __init__(self, panel, frame):
        self.__pipeline = None
        self.__panel = panel
        self.__frame = frame
        self.__module_controls_panel = None
        self.__sizer = wx.BoxSizer(wx.HORIZONTAL)
        self.__panel.SetSizer(self.__sizer)
        self.__panel.SetAutoLayout(True)
        self.__pipeline_slider = wx.Slider(self.__panel,
                                           size=(20, -1),
                                           style=wx.SL_VERTICAL,
                                           value=0,
                                           minValue=0,
                                           maxValue=1)
        self.__pipeline_slider.SetTickFreq(1, 0)
        self.__pipeline_slider.SetBackgroundColour('white')
        self.__slider_sizer = wx.BoxSizer(wx.VERTICAL)
        self.__sizer.Add(self.__slider_sizer)
        self.__slider_sizer_item = self.__slider_sizer.Add(
            self.__pipeline_slider, 0,
            wx.EXPAND | wx.RESERVE_SPACE_EVEN_IF_HIDDEN | wx.TOP, 10)
        self.__slider_sizer.AddStretchSpacer()
        self.make_list()
        self.set_debug_mode(False)
        wx.EVT_IDLE(panel, self.on_idle)
        self.__adjust_rows()
        self.__first_dirty_module = 0
        self.__module_being_validated = 0
        self.__submission_time = 0
        self.drag_underway = False
        self.drag_start = None
        self.drag_time = None
        self.list_ctrl.SetDropTarget(PipelineDropTarget(self))
        panel.SetDropTarget(PanelDropTarget(self))
        panel.SetupScrolling()

        #
        # The following code prevents the panel from scrolling every
        # time it gets the focus - why would anyone ever want this!
        # Remove the code to see something truly horrible.
        #
        # Thank you Mike Conley:
        # http://groups.google.com/group/wxpython-users/browse_thread/thread/5fed262dc3d144bb/2dc29b45d452c8a0?lnk=raot&fwc=2
        def defeat_its_purpose(event):
            event.Skip(False)

        panel.Bind(wx.EVT_CHILD_FOCUS, defeat_its_purpose)
コード例 #23
0
    def __init__(self, parent, ID, clientProfile, sharedAppClient):
        wx.Window.__init__(self, parent, ID, style=wx.NO_FULL_REPAINT_ON_RESIZE)
        
        ## Attributes
        self.clientProfile = clientProfile
        self.user = self.clientProfile.GetName()
        self.sharedAppClient = sharedAppClient
        self.id = self.sharedAppClient.GetPublicId()
        
    # <AGtk code>
        # Register event callback
        self.sharedAppClient.RegisterEventCallback(events.DRAWING_EVENT, self.GetDrawingEvent)
    # <AGtk code>        
        
        """
        Background image & Cursor icon
        """
        self.backImage = None
        
        self.SetCursor(wx.StockCursor(wx.CURSOR_CROSS))
        
        self.SetBackgroundColour("WHITE")
        self.listeners = []
        self.thickness = 1
        self.SetColour("Black")
        self.lines = []
        self.x = self.y = 0
        self.MakeMenu()

        self.InitBuffer()

        # hook some mouse events
        wx.EVT_LEFT_DOWN(self, self.OnLeftDown)
        wx.EVT_LEFT_UP(self, self.OnLeftUp)
        wx.EVT_RIGHT_UP(self, self.OnRightUp)
        wx.EVT_MOTION(self, self.OnMotion)

        # the window resize event and idle events for managing the buffer
        wx.EVT_SIZE(self, self.OnSize)
        wx.EVT_IDLE(self, self.OnIdle)

        # and the refresh event
        wx.EVT_PAINT(self, self.OnPaint)

        # When the window is destroyed, clean up resources.
        wx.EVT_WINDOW_DESTROY(self, self.Cleanup)
コード例 #24
0
    def on_initialize(self, event):
        self.configPath = os.path.join(configuration.homedir, 'textindexer')
        if not os.path.exists(self.configPath):
            os.mkdir(self.configPath)
        self.filename = os.path.join(self.configPath, 'zhome.stack')

        self.storage = FileStorage.FileStorage(self.filename)
        db = DB(self.storage)
        self.connection = conn = db.open()
        dbroot = conn.root()
        if not dbroot.has_key('stack'):
            dbroot['stack'] = CardStack()
        stack = dbroot['stack']
        self._v_idle_tasks = []
        self.wstack = stack
        self.CreateParts()
        stack.SetCard(0)
        wx.EVT_IDLE(self, self.Idler)
コード例 #25
0
ファイル: main.py プロジェクト: NonPlayerCtrl/FreePLC_IDE
    def OnInit(self):
        sys.stdout = sys.__stdout__
        sys.stderr = sys.__stderr__

        if not 'WINGDB_ACTIVE' in os.environ:
            # replace text based exception handler by a graphical exception dialog
            sys.excepthook = self.graphical_exception_handler

        # use graphical implementation to show caught exceptions
        self._exception_orig = logging.exception
        logging.exception = self.exception

        # needed for wx >= 2.3.4 to disable wxPyAssertionError exceptions
        self.SetAssertMode(0)

        common.init_preferences()
        if config.preferences.log_debug_info:
            log.setDebugLevel()

            # enable Python faulthandler to dump a traceback on SIGSEGV, SIGFPE, SIGABRT, SIGBUS, and SIGILL signals.
            try:
                import faulthandler
                faulthandler.enable()
                logging.info(_('Python faulthandler found and activated'))
            except ImportError:
                logging.debug(_('Python faulthandler not found'))
            except RuntimeError as details:
                logging.info(
                    _('Python faulthandler found, but enabling failed: %s'),
                    details)
            except Exception as details:
                logging.info(
                    _('Generic error during faulthandler initialisation: %s'),
                    details)

        compat.wx_ArtProviderPush(wxGladeArtProvider())

        frame = wxGladeFrame()
        self.SetTopWindow(frame)
        self.SetExitOnFrameDelete(True)

        wx.EVT_IDLE(self, self.OnIdle)

        return True
コード例 #26
0
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
コード例 #27
0
ファイル: MonitorCenter.py プロジェクト: yvs/psychopy
    def __init__(self, parent, id=-1, rows=[], cols=[], data=None):
        self.moveTo = None
        self.nRows, self.nCols = len(rows), len(cols)
        grid.Grid.__init__(self, parent, -1,
                           wx.Point(0, 0))  #,wx.Size( 300, 150 ))

        self.numEditor = grid.GridCellFloatEditor()
        self.CreateGrid(self.nRows, self.nCols)
        for nCol, col in enumerate(cols):
            self.SetColLabelValue(nCol, col)
            self.SetColFormatFloat(nCol, 4, 4)
            #self.SetColMinimalWidth(nCol,800)
        for nRow, row in enumerate(rows):
            self.SetRowLabelValue(nRow, row)
        for nRow in range(self.nRows):
            for nCol in range(self.nCols):
                self.SetCellEditor(nRow, nCol, self.numEditor)
        self.setData(data)
        #self.SetMargins(-5,-5)
        wx.EVT_IDLE(self, self.OnIdle)
コード例 #28
0
ファイル: abstract_grid_view.py プロジェクト: sjl421/code-2
    def __init__(self, parent, ID=-1, **kw):

        Grid.__init__(self, parent, ID, **kw)

        # We have things set up to edit on a single click - so we have to select
        # an initial cursor location that is off of the screen otherwise a cell
        # will be in edit mode as soon as the grid fires up.
        self.moveTo = [1000, 1]
        self.edit = False

        # this seems like a busy idle ...
        wx.EVT_IDLE(self, self.OnIdle)

        # Enthought specific display controls ...
        self.init_labels()
        self.init_data_types()
        self.init_handlers()

        wx.grid.EVT_GRID_EDITOR_CREATED(self, self._on_editor_created)

        return
コード例 #29
0
    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)
コード例 #30
0
ファイル: net_view.py プロジェクト: rosejn/mantis
    def __init__(self, parent, id, model):
        wx.ScrolledWindow.__init__(self,
                                   parent,
                                   id,
                                   style=wx.NO_FULL_REPAINT_ON_RESIZE)
        self.model = model
        self.node_dict = {}
        self.link_dict = {}
        self.node_size = 25
        self.dragNode = None
        self.dragImage = None
        self.queue = event_queue()

        self.SetBackgroundColour("WHITE")
        self.SetCursor(wx.StockCursor(wx.CURSOR_ARROW))

        # Mouse buttons and motion
        wx.EVT_LEFT_DOWN(self, self.OnLeftDown)
        wx.EVT_LEFT_UP(self, self.OnLeftUp)
        wx.EVT_MOTION(self, self.OnMotion)

        wx.EVT_PAINT(self, self.OnPaint)
        wx.EVT_IDLE(self, self.OnIdle)

        self.SetMode("Select")

        # Register network events callback DispatchEvent.
        # See net_view.DispatchEvent() for details.
        model.Bind(net_model.ADD_NODE, self.DispatchEvent, self.add_node)
        model.Bind(net_model.REMOVE_NODE, self.DispatchEvent, self.del_node)
        model.Bind(net_model.ADD_LINK, self.DispatchEvent, self.add_radio_link)
        model.Bind(net_model.REMOVE_LINK, self.DispatchEvent,
                   self.del_radio_link)
        model.Bind(net_model.NET_CHANGED, self.DispatchEvent, self.new_network)
        model.Bind(net_model.FORWARD_PACKET, self.DispatchEvent,
                   self.forward_radio_packet)