예제 #1
0
    def __init__(self, parent, id, shapes=None, **kwds):
        wx.glcanvas.GLCanvas.__init__(self, parent, id, **kwds)
        self.parent = parent
        self.camera = Camera()
        self.init = False
        self.lastx = self.x = 30
        self.lasty = self.y = 30

        self.create_menu()

        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_MIDDLE_DOWN(self, self.OnMouseDown)
        wx.EVT_RIGHT_DOWN(self, self.OnMouseDown)
        wx.EVT_LEFT_UP(self, self.OnMouseUp)
        wx.EVT_MIDDLE_UP(self, self.OnMouseUp)
        wx.EVT_RIGHT_UP(self, self.OnMouseUp)
        wx.EVT_MOTION(self, self.OnMouseMotion)

        self.popup_menu = 0
        self.color = (0., 0., 0.)  #black
        #self.color = (1.,1.,1.) #white
        self.dlist = None
        self.measure = False
        self.sketching = False
        self.shapes = shapes

        self.left_button_click = True
        self.middle_button_click = True
        self.right_button_click = True

        self.beginx, self.beginy = 0, 0
        return
예제 #2
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, 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)
예제 #3
0
    def __init__(self,
                 parent,
                 id,
                 size=wx.DefaultSize,
                 style=wx.TE_MULTILINE | wx.TE_RICH,
                 defaulttext=None):
        #initialize parent class
        wx.TextCtrl.__init__(self, parent, id, size=size, style=style)
        self.SetDefaultStyle(wx.TextAttr(wx.RED))

        #will search for text tags within fuzzymargin characters
        self.fuzzymargin = 25
        self.passphrase = None
        #time in seconds until passphrase expires
        self.passphrase_expiry = 120
        #the text selected for encryption/decryption
        self.textselection = None
        self.selectionStart = 0
        self.selectionEnd = 0

        if defaulttext is not None:
            self.WriteText(defaulttext)

        #a reserved ID for events related to this widget
        self.aID = wx.NewId()

        #make this text widget a drop target for drag&dropped text files
        dt = gmTextctrlFileDropTarget(self)
        self.SetDropTarget(dt)

        #bugger... this one for wxGTK
        wx.EVT_RIGHT_UP(self, self.OnRightClick)
        wx.EVT_RIGHT_DOWN(self, self.OnRightDown)
예제 #4
0
    def __init__(self, parent, tasks, onSelect, onEdit, onCreate, popupMenu,
                 **kwargs):
        self.__onDropURLCallback = kwargs.pop('onDropURL', None)
        self.__onDropFilesCallback = kwargs.pop('onDropFiles', None)
        self.__onDropMailCallback = kwargs.pop('onDropMail', None)
        self.__taskList = tasks
        self.__onSelect = onSelect
        self.__onEdit = onEdit
        self.__onCreate = onCreate
        self.__popupMenu = popupMenu
        self.__calFormat = self.CAL_WEEKLY
        self.__hdrFormat = self.HDR_DATE
        self.__drawNow = True
        self.__adapter = parent
        self.getItemTooltipData = parent.getItemTooltipData
        super(HierarchicalCalendar, self).__init__(parent, **kwargs)
        self.SetCalendarFormat(
            self.__calFormat
        )  # This calls _Invalidate() so no need to call SetHeaderFormat

        self.__tip = tooltip.SimpleToolTip(self)
        self.__dropTarget = draganddrop.DropTarget(self.OnDropURL,
                                                   self.OnDropFiles,
                                                   self.OnDropMail)
        self.SetDropTarget(self.__dropTarget)

        EVT_EVENT_SELECTION_CHANGED(self, self._OnSelectionChanged)
        EVT_EVENT_DATES_CHANGED(self, self._OnDatesChanged)
        wx.EVT_LEFT_DCLICK(self, self._OnLeftDClick)
        wx.EVT_RIGHT_UP(self, self._OnRightUp)
예제 #5
0
 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
예제 #6
0
    def __init__(self, parent, winid, value=0.0, title='', **kwds):
        """Layout similar to a bar, but provides a slider for user setting of the value.
        Fires off events when the user changes the value, see add_listener."""
        self._state = "IDLE"  # The state of the control for responding to mouse events
        self._processed = False
        wxBar.__init__(self, parent, winid, value=value, title=title, **kwds)

        self._listeners = []
        self._bar_rect = None  # The rectangle for the bar.  Also see comments in __move_mouse
        self._ptr_rect = None  # The rectangle where the pointer is drawn
        self._rbutton = None  # Rectangle for right button
        self._lbutton = None  # Rectangle for left button
        self._counter = None  # Number of timer ticks since mouse down
        self._value_point = None  # Last x position of the pointer's mark
        self._original_value_point = None  # The pointer mark x position at the moment when mouse down occurred
        self._original_value = None  # The value shown by the slider when mouse went down
        self._last_rect = None  # The last value for the full rectangle (used in scaling)
        self._jump_value = None  # X position of the mouse for a jump operation
        self._offset = None  # Difference between the mouse pointer and the slider mark
        self._is_close = None  # True when the mouse was clicked close to one of the vernier buttons

        wx.EVT_LEFT_DOWN(self, self.__left_down)
        wx.EVT_LEFT_UP(self, self.__left_up)
        wx.EVT_MOTION(self, self.__move_mouse)
        wx.EVT_RIGHT_UP(self, self.__right_up)

        self._timer = wx.Timer(self, 100)
        wx.EVT_TIMER(self, 100, self.__tick)
        self._i_have_mouse = False
예제 #7
0
    def createWidgets(self):
        self.listCtrl = wxskinListCtrl(self,
                                       ID_LISTCTRL,
                                       style=wx.LC_REPORT | wx.SUNKEN_BORDER
                                       | wx.LC_SINGLE_SEL | wx.LC_VRULES
                                       | wx.LC_HRULES)
        self.listCtrl.InsertColumn(0, "Name")
        self.listCtrl.InsertColumn(1, "Number")

        ColumnSorterMixin.__init__(self, 2)

        self.currentItem = 0

        wx.EVT_SIZE(self, self.OnSize)
        wx.EVT_LIST_ITEM_SELECTED(self, ID_LISTCTRL, self.OnItemSelected)
        wx.EVT_LIST_ITEM_ACTIVATED(self, ID_LISTCTRL, self.OnItemActivated)
        wx.EVT_CLOSE(self, self.closeWindow)

        wx.EVT_LEFT_DCLICK(self.listCtrl, self.OnPopupEdit)
        wx.EVT_RIGHT_DOWN(self.listCtrl, self.OnRightDown)

        # for wxMSW and wxGTK respectively
        wx.EVT_COMMAND_RIGHT_CLICK(self.listCtrl, ID_LISTCTRL,
                                   self.OnRightClick)
        wx.EVT_RIGHT_UP(self.listCtrl, self.OnRightClick)
예제 #8
0
	def __init__(self, width, height, alpha = symbol, mirr = 0, parent = None):
		"""
		Initialise. width and height define the physical size of the
		CRT in cm.
		"""
		wx.Frame.__init__ (self, parent, -1, _("Snellen Chart"))

		# width/Y is screen size (X/Y in cm)
		#wx.SystemSettings.GetMetric(wx.SYS_SCREEN_X)
#		screensizes = {_("14 inch"):(28, 21), _("16 inch"):(30, 23)}
		self.screen_width_cm = width
		self.screen_height_cm = height

		self.screen_width_pixel = 0
		self.screen_height_pixel = 0

		self.standard_patient_chart_distances = [3, 5, 6, 7.5, 9, 12, 15, 18, 24, 30, 48, 60] # in metres
		self.mirror = mirr
		self.alphabet = alpha

		wx.EVT_CLOSE (self, self.OnClose)
		wx.EVT_KEY_DOWN (self, self.OnKeyUp)
		wx.EVT_LEFT_UP (self, self.OnLeftDown)
		wx.EVT_RIGHT_UP (self, self.OnRightDown)
		wx.EVT_LEFT_DCLICK (self, self.OnDClick)
		wx.EVT_PAINT (self, self.OnPaint)
#		wx.EVT_WINDOW_CREATE (self, self.OnCreate)

		self.ShowFullScreen(1)
예제 #9
0
    def __init__(self, wxWidget):
        """Constructor.
        @param wxWidget The wxWidget this Widget manages.
        """
        self.wxWidget = wxWidget
        self.menuItems = None
        self.focusId = ''
        self.menuId = None

        # Callback functions for listening directly to changes.
        self.reactors = []

        self.setNormalStyle()

        # Listen for right mouse clicks in case a popup menu should be
        # displayed.
        wx.EVT_RIGHT_DOWN(wxWidget, self.onRightClick)
        wx.EVT_RIGHT_UP(wxWidget, self.onRightClick)

        # A notification is sent when the widget is entered.
        wx.EVT_ENTER_WINDOW(wxWidget, self.onEnterWidget)

        # Listen for focus changes.
        wx.EVT_SET_FOCUS(wxWidget, self.onFocus)

        # Register a notification listener. These notifications are expected
        # to be handled by all widgets.
        events.addNotifyListener(self.onNotify,
                                 ['language-changed', 'focus-request'])
예제 #10
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()
예제 #11
0
    def __init__(self,
                 parent=None,
                 id=-1,
                 title='Title',
                 pos=wx.DefaultPosition,
                 size=wx.DefaultSize,
                 style=wx.DEFAULT_FRAME_STYLE | wx.CLIP_CHILDREN):
        """Create a Frame instance.
        """

        # Create the actual window (a wx Frame)
        self._wx = wx.Frame(parent, id, title, pos, size, style)

        self._keys = keys.Keys()
        self._keys.attach(self)

        # Set up the wx main menu bar
        self._menu_id_manager = idmanager.IDManager(10)
        menubar = wx.MenuBar()
        self._wx.SetMenuBar(menubar)
        self._menu = None

        self.CreateStatusBar()

        wx.EVT_LEFT_DOWN(self, self.onLeftDown)
        wx.EVT_LEFT_UP(self, self.onLeftUp)
        wx.EVT_MIDDLE_DOWN(self, self.onMiddleDown)
        wx.EVT_MIDDLE_UP(self, self.onMiddleUp)
        wx.EVT_RIGHT_DOWN(self, self.onRightDown)
        wx.EVT_RIGHT_UP(self, self.onRightUp)
예제 #12
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)
예제 #13
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)
예제 #14
0
파일: filesystem.py 프로젝트: deosai/bitpim
 def __init__(self, mainwindow, parent, id, style):
     wx.TreeCtrl.__init__(self, parent, id, style=style)
     self.parent=parent
     self.mainwindow=mainwindow
     wx.EVT_TREE_ITEM_EXPANDED(self, id, self.OnItemExpanded)
     wx.EVT_TREE_SEL_CHANGED(self,id, self.OnItemSelected)
     self.dirmenu=wx.Menu()
     self.dirmenu.Append(guihelper.ID_FV_NEWSUBDIR, "Make subdirectory ...")
     self.dirmenu.Append(guihelper.ID_FV_NEWFILE, "New File ...")
     self.dirmenu.AppendSeparator()
     self.dirmenu.Append(guihelper.ID_FV_BACKUP, "Backup directory ...")
     self.dirmenu.Append(guihelper.ID_FV_BACKUP_TREE, "Backup entire tree ...")
     self.dirmenu.Append(guihelper.ID_FV_RESTORE, "Restore ...")
     self.dirmenu.AppendSeparator()
     self.dirmenu.Append(guihelper.ID_FV_REFRESH, "Refresh")
     self.dirmenu.AppendSeparator()
     self.dirmenu.Append(guihelper.ID_FV_DELETE, "Delete")
     self.dirmenu.AppendSeparator()
     self.dirmenu.Append(guihelper.ID_FV_TOTAL_REFRESH, "Refresh Filesystem")
     self.dirmenu.Append(guihelper.ID_FV_OFFLINEPHONE, "Offline Phone")
     self.dirmenu.Append(guihelper.ID_FV_REBOOTPHONE, "Reboot Phone")
     self.dirmenu.Append(guihelper.ID_FV_MODEMMODE, "Go to modem mode")
     # generic menu
     self.genericmenu=wx.Menu()
     self.genericmenu.Append(guihelper.ID_FV_TOTAL_REFRESH, "Refresh Filesystem")
     self.genericmenu.Append(guihelper.ID_FV_OFFLINEPHONE, "Offline Phone")
     self.genericmenu.Append(guihelper.ID_FV_REBOOTPHONE, "Reboot Phone")
     self.genericmenu.Append(guihelper.ID_FV_MODEMMODE, "Go to modem mode")
     wx.EVT_MENU(self.genericmenu, guihelper.ID_FV_TOTAL_REFRESH, self.OnRefresh)
     wx.EVT_MENU(self.genericmenu, guihelper.ID_FV_OFFLINEPHONE, parent.OnPhoneOffline)
     wx.EVT_MENU(self.genericmenu, guihelper.ID_FV_REBOOTPHONE, parent.OnPhoneReboot)
     wx.EVT_MENU(self.genericmenu, guihelper.ID_FV_MODEMMODE, parent.OnModemMode)
     wx.EVT_MENU(self.dirmenu, guihelper.ID_FV_NEWSUBDIR, self.OnNewSubdir)
     wx.EVT_MENU(self.dirmenu, guihelper.ID_FV_NEWFILE, self.OnNewFile)
     wx.EVT_MENU(self.dirmenu, guihelper.ID_FV_DELETE, self.OnDirDelete)
     wx.EVT_MENU(self.dirmenu, guihelper.ID_FV_BACKUP, self.OnBackupDirectory)
     wx.EVT_MENU(self.dirmenu, guihelper.ID_FV_BACKUP_TREE, self.OnBackupTree)
     wx.EVT_MENU(self.dirmenu, guihelper.ID_FV_RESTORE, self.OnRestore)
     wx.EVT_MENU(self.dirmenu, guihelper.ID_FV_REFRESH, self.OnDirRefresh)
     wx.EVT_MENU(self.dirmenu, guihelper.ID_FV_TOTAL_REFRESH, self.OnRefresh)
     wx.EVT_MENU(self.dirmenu, guihelper.ID_FV_OFFLINEPHONE, parent.OnPhoneOffline)
     wx.EVT_MENU(self.dirmenu, guihelper.ID_FV_REBOOTPHONE, parent.OnPhoneReboot)
     wx.EVT_MENU(self.dirmenu, guihelper.ID_FV_MODEMMODE, parent.OnModemMode)
     wx.EVT_RIGHT_DOWN(self, self.OnRightDown)
     wx.EVT_RIGHT_UP(self, self.OnRightUp)
     self.image_list=wx.ImageList(16, 16)
     self.img_dir=self.image_list.Add(wx.ArtProvider_GetBitmap(guihelper.ART_FOLDER,
                                                          wx.ART_OTHER,
                                                          (16, 16)))
     self.img_dir_open=self.image_list.Add(wx.ArtProvider_GetBitmap(guihelper.ART_FOLDER_OPEN,
                                                          wx.ART_OTHER,
                                                          (16, 16)))
     self.SetImageList(self.image_list)
     self.add_files=[]
     self.add_target=""
     self.droptarget=fileview.MyFileDropTarget(self, True, True)
     self.SetDropTarget(self.droptarget)
     self.ResetView()
예제 #15
0
    def show(self):
        """ Shows the feature bar.
        """
        # Make sure all prerequisites are met:
        dock_control, parent = self.dock_control, self.parent
        if (dock_control is None) or (parent is None):
            return

        # Create the actual control (if needed):
        control = self.control
        if control is None:
            self.control = control = wx.Frame(None,
                                              -1,
                                              '',
                                              style=wx.BORDER_NONE)

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

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

            # Set up mouse event handlers:
            wx.EVT_LEFT_DOWN(control, self._left_down)
            wx.EVT_LEFT_UP(control, self._left_up)
            wx.EVT_RIGHT_DOWN(control, self._right_down)
            wx.EVT_RIGHT_UP(control, self._right_up)
            wx.EVT_MOTION(control, self._mouse_move)
            wx.EVT_ENTER_WINDOW(control, self._mouse_enter)

            control.SetDropTarget(PythonDropTarget(self))

        # Calculate the best size and position for the feature bar:
        size = wx.Size(32, 32)
        width = height = 0
        horizontal = self.horizontal
        for feature in dock_control.active_features:
            bitmap = feature.bitmap
            if bitmap is not None:
                if horizontal:
                    width += (bitmap.GetWidth() + 3)
                    height = max(height, bitmap.GetHeight())
                else:
                    width = max(width, bitmap.GetWidth())
                    height += (bitmap.GetHeight() + 3)

        if width > 0:
            if horizontal:
                size = wx.Size(width + 5, height + 8)
            else:
                size = wx.Size(width + 8, height + 5)

        control.SetSize(size)
        px, py = parent.GetScreenPosition()
        fx, fy = dock_control.feature_popup_position
        control.SetPosition(wx.Point(px + fx, py + fy))
        control.Show()
예제 #16
0
파일: testGMDS.py 프로젝트: ctralie/G-RFLCT
    def __init__(self, parent):
        attribs = (glcanvas.WX_GL_RGBA, glcanvas.WX_GL_DOUBLEBUFFER,
                   glcanvas.WX_GL_DEPTH_SIZE, 24)
        glcanvas.GLCanvas.__init__(self, parent, -1, attribList=attribs)
        self.context = glcanvas.GLContext(self)

        self.parent = parent
        #Camera state variables
        self.size = self.GetClientSize()
        #self.camera = MouseSphericalCamera(self.size.x, self.size.y)
        self.camera = MousePolarCamera(self.size.width, self.size.height)

        #Main state variables
        self.MousePos = [0, 0]
        self.initiallyResized = False

        self.bbox = BBox3D()
        self.unionbbox = BBox3D()
        random.seed()

        #Face mesh variables and manipulation variables
        self.mesh1 = None
        self.mesh1Dist = None
        self.mesh1DistLoaded = False
        self.mesh2 = None
        self.mesh2DistLoaded = False
        self.mesh2Dist = None
        self.mesh3 = None
        #Holds the transformations of the best iteration in ICP
        self.transformations = []
        self.savingMovie = False
        self.movieIter = 0

        self.displayMeshFaces = True
        self.displayMeshEdges = False
        self.displayMeshVertices = False
        self.displayMeshNormals = False
        self.displayPrincipalAxes = False
        self.vertexColors = np.zeros(0)

        self.cutPlane = None
        self.displayCutPlane = False

        self.GLinitialized = False
        #GL-related events
        wx.EVT_ERASE_BACKGROUND(self, self.processEraseBackgroundEvent)
        wx.EVT_SIZE(self, self.processSizeEvent)
        wx.EVT_PAINT(self, self.processPaintEvent)
        #Mouse Events
        wx.EVT_LEFT_DOWN(self, self.MouseDown)
        wx.EVT_LEFT_UP(self, self.MouseUp)
        wx.EVT_RIGHT_DOWN(self, self.MouseDown)
        wx.EVT_RIGHT_UP(self, self.MouseUp)
        wx.EVT_MIDDLE_DOWN(self, self.MouseDown)
        wx.EVT_MIDDLE_UP(self, self.MouseUp)
        wx.EVT_MOTION(self, self.MouseMotion)
예제 #17
0
    def __init__(self, parent):
        attribs = (glcanvas.WX_GL_RGBA, glcanvas.WX_GL_DOUBLEBUFFER,
                   glcanvas.WX_GL_DEPTH_SIZE, 24)
        glcanvas.GLCanvas.__init__(self, parent, -1, attribList=attribs)
        self.context = glcanvas.GLContext(self)

        self.parent = parent
        #Camera state variables
        self.size = self.GetClientSize()
        self.camera = MousePolarCamera(self.size.width, self.size.height)

        #Main state variables
        self.MousePos = [0, 0]
        self.initiallyResized = False

        self.bbox = np.array([[1, 1, 1], [-1, -1, -1]])
        random.seed()

        #Point cloud and playing information
        self.displayCount = 0
        self.SampleDelays = np.array([])
        self.NFrames = 0
        self.currFrame = 0
        self.PointClouds = []
        self.Playing = False
        self.PlayIDX = 0

        self.GLinitialized = False
        #GL-related events
        wx.EVT_ERASE_BACKGROUND(self, self.processEraseBackgroundEvent)
        wx.EVT_SIZE(self, self.processSizeEvent)
        wx.EVT_PAINT(self, self.processPaintEvent)
        #Mouse Events
        wx.EVT_LEFT_DOWN(self, self.MouseDown)
        wx.EVT_LEFT_UP(self, self.MouseUp)
        wx.EVT_RIGHT_DOWN(self, self.MouseDown)
        wx.EVT_RIGHT_UP(self, self.MouseUp)
        wx.EVT_MIDDLE_DOWN(self, self.MouseDown)
        wx.EVT_MIDDLE_UP(self, self.MouseUp)
        wx.EVT_MOTION(self, self.MouseMotion)
        #self.initGL()

        #Load in candide mesh information and store in an index buffer
        fin = open('candideFaces.txt', 'r')
        self.candideIndices = np.array([[int(a) for a in x.split()]
                                        for x in fin.readlines()],
                                       dtype=np.int32)
        self.candideFaces = vbo.VBO(candideIndices,
                                    target=GL_ELEMENT_ARRAY_BUFFER)
        fin.close()
        fin = open('candideTexCoords.txt', 'r')
        self.texCoords = vbo.VBO(
            np.array([[float(a) for a in x.split()] for x in fin.readlines()],
                     dtype=np.float32))
        fin.close()
        self.texID = -1
예제 #18
0
    def __register_events(self):
        # wxPython events
        wx.EVT_RIGHT_UP(self, self._on_RightClick_photo)
        wx.EVT_MENU(self, ID_AcquirePhoto, self._on_AcquirePhoto)
        wx.EVT_MENU(self, ID_ImportPhoto, self._on_ImportPhoto)
        wx.EVT_MENU(self, ID_Refresh, self._on_refresh_from_backend)

        # dispatcher signals
        gmDispatcher.connect(receiver=self._on_post_patient_selection,
                             signal=u'post_patient_selection')
예제 #19
0
 def genericinit(self, iconfile):
     self.SetCursor(wx.StockCursor(wx.CURSOR_HAND))
     bitmap=wx.Bitmap(guihelper.getresourcefile(iconfile), wx.BITMAP_TYPE_PNG)
     bit=wx.StaticBitmap(self, -1, bitmap)
     self.Show(True)
     wx.EVT_RIGHT_UP(bit, self.OnRButtonUp)
     wx.EVT_LEFT_UP(bit, self.OnLButtonUp)
     wx.EVT_MOTION(bit, self.OnMouseMotion)
     wx.EVT_LEFT_DOWN(bit, self.OnLeftDown)
     self.bit=bit
예제 #20
0
    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()
예제 #21
0
    def __init__(self, parent):
        attribs = (glcanvas.WX_GL_RGBA, glcanvas.WX_GL_DOUBLEBUFFER,
                   glcanvas.WX_GL_DEPTH_SIZE, 24)
        glcanvas.GLCanvas.__init__(self, parent, -1, attribList=attribs)
        self.context = glcanvas.GLContext(self)

        self.parent = parent
        #Camera state variables
        self.size = self.GetClientSize()
        self.camera = MousePolarCamera(self.size.x, self.size.y)
        #self.camera = MousePolarCamera(self.size.width, self.size.height)

        #Main state variables
        self.MousePos = [0, 0]
        self.initiallyResized = False

        self.bbox = BBox3D()
        self.unionbbox = BBox3D()
        random.seed()

        #State variables for saving screenshots
        self.filepath = None
        self.rotfilePrefix = "Rotation"
        self.rotstartAngle = -50
        self.rotendAngle = 50
        self.rotangleInc = 5
        self.rotAngle = 0
        self.zCenter = 0

        #Face mesh variables and manipulation variables
        self.mesh = None
        self.meshCentroid = None
        self.meshPrincipalAxes = None
        self.displayMeshFaces = True
        self.displayMeshEdges = False
        self.displayMeshVertices = False
        self.displayMeshNormals = False
        self.displayPrincipalAxes = False
        self.useLighting = False
        self.useTexture = True
        self.vertexColors = np.zeros(0)

        self.GLinitialized = False
        #GL-related events
        wx.EVT_ERASE_BACKGROUND(self, self.processEraseBackgroundEvent)
        wx.EVT_SIZE(self, self.processSizeEvent)
        wx.EVT_PAINT(self, self.processPaintEvent)
        #Mouse Events
        wx.EVT_LEFT_DOWN(self, self.MouseDown)
        wx.EVT_LEFT_UP(self, self.MouseUp)
        wx.EVT_RIGHT_DOWN(self, self.MouseDown)
        wx.EVT_RIGHT_UP(self, self.MouseUp)
        wx.EVT_MIDDLE_DOWN(self, self.MouseDown)
        wx.EVT_MIDDLE_UP(self, self.MouseUp)
        wx.EVT_MOTION(self, self.MouseMotion)
예제 #22
0
    def __init__(self, parent, mainframe):
        self.initmixin()
        wx.Panel.__init__(self, parent, -1)
        self.parent = parent
        self.mainframe = mainframe
        self.pref = mainframe.pref
        if not hasattr(self.pref, 'share_nodes'):
            self.pref.share_nodes = []

        self.processors = {}
#        self.callplugin('add_process_class', self, self.processors)

        self.sizer = wx.BoxSizer(wx.VERTICAL)

        self.shareimagelist = imagelist = wx.ImageList(16, 16)

        #add share image list
        self.imagefiles = {}
        self.imageids = {}
        self.callplugin('add_images', self.imagefiles)
        for name, imagefile in self.imagefiles.items():
            self.add_image(name, imagefile)

        self.tree = wx.TreeCtrl(self, -1, style = wx.TR_EDIT_LABELS|wx.TR_SINGLE|wx.TR_TWIST_BUTTONS|wx.TR_HAS_BUTTONS|wx.TR_ROW_LINES|wx.TR_HIDE_ROOT)
        self.tree.SetImageList(self.shareimagelist)

        self.sizer.Add(self.tree, 1, wx.EXPAND)
        self.root = self.tree.AddRoot('Share')

        self.nodes = {}
        self.ID = 1

        self.read()

        wx.EVT_TREE_SEL_CHANGING(self.tree, self.tree.GetId(), self.OnChanging)
        wx.EVT_TREE_SEL_CHANGED(self.tree, self.tree.GetId(), self.OnChanged)
        wx.EVT_TREE_BEGIN_LABEL_EDIT(self.tree, self.tree.GetId(), self.OnBeginChangeLabel)
        wx.EVT_TREE_END_LABEL_EDIT(self.tree, self.tree.GetId(), self.OnChangeLabel)
        wx.EVT_TREE_ITEM_ACTIVATED(self.tree, self.tree.GetId(), self.OnSelected)
        wx.EVT_TREE_ITEM_RIGHT_CLICK(self.tree, self.tree.GetId(), self.OnRClick)
        wx.EVT_RIGHT_UP(self.tree, self.OnRClick)
        wx.EVT_TREE_DELETE_ITEM(self.tree, self.tree.GetId(), self.OnDeleteItem)
        wx.EVT_LEFT_DCLICK(self.tree, self.OnDoubleClick)
        wx.EVT_TREE_ITEM_EXPANDING(self.tree, self.tree.GetId(), self.OnExpanding)

        from modules import Id
        wx.EVT_UPDATE_UI(self, Id.makeid(self, 'IDPM_DEL'), self.OnUpdateUI)

        #add init process
        self.callplugin('init', self)

        self.SetSizer(self.sizer)
        self.SetAutoLayout(True)

        self.popmenus = None
예제 #23
0
    def __init__(self,
                 parent,
                 takeScreenshots,
                 screenshotsPrefix="",
                 rotationAngle=0):
        attribs = (glcanvas.WX_GL_RGBA, glcanvas.WX_GL_DOUBLEBUFFER,
                   glcanvas.WX_GL_DEPTH_SIZE, 24)
        glcanvas.GLCanvas.__init__(self, parent, -1, attribList=attribs)
        self.context = glcanvas.GLContext(self)

        self.parent = parent
        self.takeScreenshots = takeScreenshots
        print "Taking screenshots: %s" % self.takeScreenshots
        self.screenshotCounter = 1
        self.screenshotsPrefix = screenshotsPrefix
        self.rotationAngle = rotationAngle
        #Camera state variables
        self.size = self.GetClientSize()
        #self.camera = MouseSphericalCamera(self.size.x, self.size.y)
        self.camera = MousePolarCamera(self.size.width, self.size.height)

        #Main state variables
        self.MousePos = [0, 0]
        self.initiallyResized = False

        self.bbox = BBox3D()
        self.unionbbox = BBox3D()
        random.seed()

        #Face mesh variables and manipulation variables
        self.faceMesh = None
        self.displayMeshFaces = True
        self.displayMeshEdges = False
        self.displayMeshVertices = False
        self.displayMeshNormals = False
        self.vertexColors = np.zeros(0)

        self.cutPlane = None
        self.displayCutPlane = False

        self.GLinitialized = False
        #GL-related events
        wx.EVT_ERASE_BACKGROUND(self, self.processEraseBackgroundEvent)
        wx.EVT_SIZE(self, self.processSizeEvent)
        wx.EVT_PAINT(self, self.processPaintEvent)
        #Mouse Events
        wx.EVT_LEFT_DOWN(self, self.MouseDown)
        wx.EVT_LEFT_UP(self, self.MouseUp)
        wx.EVT_RIGHT_DOWN(self, self.MouseDown)
        wx.EVT_RIGHT_UP(self, self.MouseUp)
        wx.EVT_MIDDLE_DOWN(self, self.MouseDown)
        wx.EVT_MIDDLE_UP(self, self.MouseUp)
        wx.EVT_MOTION(self, self.MouseMotion)
예제 #24
0
    def __register_events(self):
        # - notebook page is about to change
        self.nb.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGING,
                     self._on_notebook_page_changing)
        # - notebook page has been changed
        self.nb.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED,
                     self._on_notebook_page_changed)
        # - popup menu on right click in notebook
        wx.EVT_RIGHT_UP(self.nb, self._on_right_click)

        gmDispatcher.connect(self._on_post_patient_selection,
                             u'post_patient_selection')
예제 #25
0
    def __init__(self, parent, id, title, pos=wx.DefaultPosition, \
   size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE):
        wx.Frame.__init__(self, parent, id, title, pos, size, style)

        self.table = Table(self)
        self.cards = []
        menu = wx.MenuBar()
        fileMenu = wx.Menu()
        fileMenu.Append(1, "Exit")
        menu.Append(fileMenu, "File")

        for f in card_files:
            dm.loadXML(f)

        for i in range(2):
            self.cards.append(None)

        i = 2
        cardMenu = wx.Menu()
        for card in dm.cards.values():
            cardMenu.Append(i, card.title)
            self.cards.append(card)
            wx.EVT_MENU(self, i, self.add_card)
            i = i + 1
        menu.Append(cardMenu, "Cards")

        deckMenu = wx.Menu()
        for deck in dm.decks.values():
            deckMenu.Append(i, deck.name)
            i = i + 1
            self.cards.append(card)
            wx.EVT_MENU(self, i, self.add_deck)
        menu.Append(deckMenu, "Decks")

        i = i + 1
        foo_menu = wx.Menu()
        foo_menu.Append(i, "Snog")
        wx.EVT_MENU(self, i, self.add_ouidjit)
        menu.Append(foo_menu, "Snog")

        self.SetMenuBar(menu)
        wx.EVT_MENU(self, 1, self.quit)
        wx.EVT_CLOSE(self, self.quit)

        self.SetBackgroundColour(wx.Colour(255, 255, 255))
        self.Refresh()

        wx.EVT_LEFT_DOWN(self.table, self.table.on_lmb_down)
        wx.EVT_LEFT_UP(self.table, self.table.on_lmb_up)
        wx.EVT_RIGHT_DOWN(self.table, self.table.on_rmb_down)
        wx.EVT_RIGHT_UP(self.table, self.table.on_rmb_up)
        wx.EVT_MOTION(self.table, self.table.on_mouse_move)
예제 #26
0
    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()
예제 #27
0
    def __init__(self, parent, log):
        wx.Window.__init__(self, parent, -1, style=wx.SUNKEN_BORDER)
        self.log = log
        self.SetBackgroundColour(wx.WHITE)
        self.lines = []
        self.x = self.y = 0
        self.SetMode("Draw")

        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)
        wx.EVT_PAINT(self, self.OnPaint)
예제 #28
0
    def __init__(self, parent, dstack=None):
        wx.ScrolledWindow.__init__(self, parent, -1)

        if (dstack == None):
            self.ds = example.CDataStack("test.kdf")
        else:
            self.ds = dstack

        self.imagepanel = self
        self.selecting = False

        self.SetScrollRate(10, 10)

        self.SetVirtualSize(wx.Size(self.ds.getWidth(), self.ds.getHeight()))
        self.SetSize((self.ds.getWidth(), self.ds.getHeight()))

        self.do = example.CDisplayOpts()
        self.do.setDisp1Chan(0)
        self.do.setDisp2Chan(0)
        self.do.setDisp3Chan(0)

        if (self.ds.getNumChannels() >= 2):
            self.do.setDisp2Chan(1)
            if (self.ds.getNumChannels() >= 3):
                self.do.setDisp1Chan(2)

        self.do.Optimise(self.ds)

        self.rend = example.CLUT_RGBRenderer()
        self.rend.setDispOpts(self.do)

        self.scale = 0

        self.updating = 0

        self.selection = True

        self.ResetSelection()

        wx.EVT_PAINT(self, self.OnPaint)
        wx.EVT_SIZE(self, self.OnSize)

        wx.EVT_RIGHT_DOWN(self, self.OnRightDown)
        wx.EVT_RIGHT_UP(self, self.OnRightUp)

        wx.EVT_LEFT_DOWN(self.imagepanel, self.OnRightDown)
        wx.EVT_LEFT_UP(self.imagepanel, self.OnRightUp)

        wx.EVT_MOTION(self.imagepanel, self.OnMotion)

        wx.EVT_ERASE_BACKGROUND(self, self.DoNix)
    def __init__(self, parent, filename):
        # Use the WANTS_CHARS style so the panel doesn't eat the Return key.
        wx.Panel.__init__(self, parent, -1, style=wx.WANTS_CHARS)
        wx.EVT_SIZE(self, self.OnSize)

        tID = wx.NewId()

        self.tree = MyTreeCtrl(
            self,
            tID,
            wx.DefaultPosition,
            wx.DefaultSize,
            wx.TR_HAS_BUTTONS | wx.TR_EDIT_LABELS,  #| wx.TR_MULTIPLE
            #| wx.TR_HIDE_ROOT
        )

        isz = (16, 16)
        il = wx.ImageList(isz[0], isz[1])
        # wx.ArtProvider_GetBitmap(wx.ART_FOLDER, wx.ART_OTHER, isz) -> wx.ArtProvider.GetBitmap()/3
        self.folderIdx = il.Add(
            wx.ArtProvider.GetBitmap(wx.ART_FOLDER, wx.ART_OTHER, isz))
        self.folderOpenIdx = il.Add(
            wx.ArtProvider.GetBitmap(wx.ART_FILE_OPEN, wx.ART_OTHER, isz))
        self.fileIdx = il.Add(
            wx.ArtProvider.GetBitmap(wx.ART_REPORT_VIEW, wx.ART_OTHER, isz))
        #self.fileIdx  = self.il.Add(images.getFile1Bitmap())
        #self.smileidx = self.il.Add(images.getSmilesBitmap())

        self.tree.SetImageList(il)
        self.il = il

        # NOTE: 1 tree items have to have a data object in order to be sorted.
        #       2 Since our compare just uses the labels we don't need real data, so we'll just
        # use None below for the item data.

        wx.EVT_TREE_ITEM_EXPANDED(self, tID, self.OnItemExpanded)
        wx.EVT_TREE_ITEM_COLLAPSED(self, tID, self.OnItemCollapsed)
        wx.EVT_TREE_SEL_CHANGED(self, tID, self.OnSelChanged)
        wx.EVT_TREE_BEGIN_LABEL_EDIT(self, tID, self.OnBeginEdit)
        wx.EVT_TREE_END_LABEL_EDIT(self, tID, self.OnEndEdit)
        wx.EVT_TREE_ITEM_ACTIVATED(self, tID, self.OnActivate)

        wx.EVT_LEFT_DCLICK(self.tree, self.OnLeftDClick)
        wx.EVT_RIGHT_DOWN(self.tree, self.OnRightClick)
        wx.EVT_RIGHT_UP(self.tree, self.OnRightUp)

        #?? wx.EVT_COMMAND(self, 103,103, self.OnFileOpened) # Newer wxWidgets has no EVT_COMMAND
        # load default tree
        if filename != "":
            self.reload_tree(filename)
예제 #30
0
    def __init__(self, parent): 
        wx.Panel.__init__(self, parent, -1) 
        self.rightDown = False 
        self.leftDown = False 
        self.sqmode = 1
        self.posd = (0,0)
        self.parentFrame = parent
        while self.parentFrame.GetParent() is not None: 
            self.parentFrame = self.parentFrame.GetParent() 

        wx.EVT_RIGHT_DOWN(self, self.OnRightDown) 
        wx.EVT_RIGHT_UP(self, self.OnRightUp) 
        wx.EVT_LEFT_DOWN(self, self.OnLeftDown) 
        wx.EVT_LEFT_UP(self, self.OnLeftUp) 
        wx.EVT_MOTION(self, self.OnMouseMove)