예제 #1
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()
예제 #2
0
    def __init__(self):
        window.Window.__init__(self)

        # Create menu
        file = Menu("&File", name="file", items=
                    [("&New"),
                     ("&Open..."),
                     ("&Save"),
                     ("Save &as...", None),
                     ("&Close"),
                     MenuItem("---",name="sep1"),
                     ("&Exit", None)
                     ])

        self.menu = Menu(items=[file])


        # ToolBar palette
        self.toolbars = ToolBarPalette(self.wx, self._menu_id_manager)

        # Create panels
        self.panels = Panels(self.wx)
        self.panels.layout = PanelNode(name="Dummy")


        self.mainlayout = wx.BoxSizer(wx.VERTICAL)
        self.mainlayout.AddSizer(self.toolbars.sizer, 0, wx.EXPAND, 0)
        self.mainlayout.Add(self.panels.wx, 1, wx.EXPAND, 0)
        self.wx.SetSizer(self.mainlayout)


#        views = LayoutNode(splittertype=VERTICAL, name="splitter1")

#        self.btn = wx.Button(parent, -1, "Button", wx.Point(0,0))
#        front = PanelNode(name="front", activatable=True,
#                          widget=PanelWidget(wx=self.btn))

#        dict = globals()
#        dict["app"]=getApp()
#        self.shell = wx.py.shell.Shell(parent, -1, locals=dict)
#        shell = PanelNode(name="shell", widget=PanelWidget(wx=self.shell))
        
#        views.setChildren((front, shell))
#        self.panels.layout = views
#        front.makeCurrent()

#        self.panels.updateLayout()

        if "mainwin.geometry" in getApp().prefs:
            x,y,w,h = getApp().prefs["mainwin.geometry"]
            print(("set",x,y,w,h))
            self.SetDimensions(x,y,w,h)
            if getApp().prefs["mainwin.maximized"]:
                self.Maximize(True)
           
        wx.EVT_SIZE(self, self.onResize)
        wx.EVT_MOVE(self, self.onMove)
        return
예제 #3
0
 def finish_widget_creation(self, sel_marker_parent=None):
     if sel_marker_parent is None: sel_marker_parent = self.parent.widget
     self.sel_marker = misc.SelectionMarker(self.widget, sel_marker_parent)
     WindowBase.finish_widget_creation(self)
     wx.EVT_LEFT_DOWN(self.widget, self.on_set_focus)
     wx.EVT_MOVE(self.widget, self.on_move)
     # re-add the item to update it
     self.sizer.add_item(self, self.pos, self.proportion, self.flag,
                         self.border, self.widget.GetSize())
예제 #4
0
 def finish_widget_creation(self, sel_marker_parent=None):
     if sel_marker_parent is None: sel_marker_parent = self.parent.widget
     self.sel_marker = misc.SelectionMarker(self.widget, sel_marker_parent)
     WindowBase.finish_widget_creation(self)
     wx.EVT_LEFT_DOWN(self.widget, self.on_set_focus)
     wx.EVT_MOVE(self.widget, self.on_move)
     # re-add the item to update it
     self.sizer.add_item(self, self.pos, self.option, self.flag,
                         self.border, self.widget.GetSize())
     # set the value of the properties
     szp = self.sizer_properties
     szp['option'].set_value(self.get_option())
     szp['flag'].set_value(self.get_flag())
     szp['border'].set_value(self.get_border())
     szp['pos'].set_value(self.pos - 1)
예제 #5
0
    def __init__(self,
                 parent,
                 size=wx.DefaultSize,
                 style=0,
                 originLeftBottom=None):
        wxgl.GLCanvas.__init__(self, parent, -1, style=style, size=size)

        self.error = None
        self.doViewportChange = True

        self.x00 = 0  #-.5
        self.y00 = 0  #-.5
        self.x0 = None  # call center() in OnPaint -- self.x00
        self.y0 = None  # call center() in OnPaint -- self.y00
        self.scale = 1.
        self.aspectRatio = 1.
        self.rot = 0.
        self.zoomChanged = True  # trigger a first placing of image
        self.sizeChanged = True
        self.keepCentered = True

        self.pixelGrid_state = 0  # 0-off, 1-everyPixel, 2- every 10 pixels

        self.GLinit = False
        self.context = wxgl.GLContext(self)  # 20141124 cocoa

        self.moreGlLists = []
        self.moreGlLists_enabled = []
        self.moreMaster_enabled = 1
        self.moreGlLists_dict = {}  # map 'name' to list of idx in moreGlLists
        # a given idx can be part of multiple 'name' entries
        # a given name entry can contain a given idx only once
        self.moreGlLists_nameBlacklist = set()
        self.moreGlLists_NamedIdx = {
        }  # map str to int or None -- this is helpful for reusing Idx for "changing" gllists
        # if name (type str) wasn't used before, it defaults to None (20080722)

        self.moreGlListReuseIdx = None

        self.wheelFactor = 2**(1 / 3.
                               )  #1.189207115002721 # >>> 2 ** (1./4)  # 2

        wx.EVT_ERASE_BACKGROUND(self, self.OnEraseBackground)
        wx.EVT_MOVE(parent, self.OnMove)
        wx.EVT_SIZE(self, self.OnSize)  # CHECK # CHECK
        wx.EVT_MOUSEWHEEL(self, self.OnWheel)
예제 #6
0
    def __init__(self, collection=None, controlObject=None, searchColl=None, treeCtrl=None, singleObject=None):
        """Initialize an PlayAllClips object."""
        # The controlObject parameter, pointing to the Transana ControlObject, is required.
        # If this routine is requested from a Collection,
        #   the Collection should be passed in using the collection parameter.
        # If this routine is requested from a Search Collection,
        #   the searchCollection Node should be passed in the searchColl parameter and
        #   the entire dbTree should be passed in using the treeCtrl parameter.
        # If this routine is requested for a single object, as in Video Only Presentation Mode,
        #   the singleObject should be the Episode or Clip object to be displayed.
        #   (A collection CANNOT be passed in with a singleObject.)

        # Show Clips in Nested Collection.  (If we add a Filter Dialog, this will become optional, but
        # for now, it's just True.
        self.showNested = True
        
        # Remember Control Object information sent in by the calling routine
        self.ControlObject = controlObject
        # Remember the singleObject setting too
        self.singleObject = singleObject

        # If a video is currently playing, it must be stopped!
        if self.ControlObject.IsPlaying() or self.ControlObject.IsPaused():
            self.ControlObject.Stop()

        # Get a list of all the clips that should be played in order

        # If PlayAllClips is requested for a Collection ...
        if collection != None:
            # Remember the Collection, making it available throughout this class
            self.collection = collection
            # Load a list of all Clips in the Collection.
            self.clipList = DBInterface.list_of_clips_by_collection(self.collection.id, self.collection.parent)
            # If we're showing Nested Collections ...
            if self.showNested:
                # Get the initial list of nested Collections
                nestedCollections = DBInterface.list_of_collections(collection.number)
                # As long as there are entries in the list of nested collections that haven't been processed ...
                while len(nestedCollections) > 0:
                    # ... extract the data from the top of the nested collection list ...
                    (collNum, collName, parentCollNum) = nestedCollections[0]
                    # ... and remove that entry from the list.
                    del(nestedCollections[0])
                    # now get the clips for the new collection and add them to the Major (clip) list
                    self.clipList += DBInterface.list_of_clips_by_collection(collName, parentCollNum)
                    # Then get the nested collections under the new collection and add them to the Nested Collection list
                    nestedCollections += DBInterface.list_of_collections(collNum)

        # If PlayAllClips is requested for a Search Collection ...
        elif searchColl != None:
            # Get the Collection Node's Data
            itemData = treeCtrl.GetPyData(searchColl)
            # If we have a Search Collection, it has a recNum.  A Search Result node has recNum == 0.  See which we have.
            if itemData.recNum != 0:
                # Load the Real Collection (not the search result collection) to get its data
                self.collection = Collection.Collection(itemData.recNum)
            # If it's a search collection ...
            else:
                # ... we don't have a collection yet.
                self.collection = None
            # Initialize the Clip List to an empty list
            self.clipList = []
            # Create an empty list for Nested Collections so we can recurse through them
            nestedCollections = []
            # extracting data from the treeCtrl requires a "cookie" value, which is initialized to 0
            cookie = 0
            # Get the first Child node from the searchColl collection
            (item, cookie) = treeCtrl.GetFirstChild(searchColl)
            # While looking at children, we need a pointer to the parent node
            currentNode = searchColl
            # Process all children in the searchColl collection
            while item.IsOk():
                # Get the item's Name
                itemText = treeCtrl.GetItemText(item)
                # Get the item's Node Data
                itemData = treeCtrl.GetPyData(item)
                # See if the item is a Clip
                if itemData.nodetype == 'SearchClipNode':
                    # If it's a Clip, add the Clip's Node Data to the clipList
                    self.clipList.append((itemData.recNum, itemText, itemData.parent))
                # If we have a Collection Node ...
                elif self.showNested and (itemData.nodetype == 'SearchCollectionNode'):
                    # ... add it to the list of nested Collections to be processed
                    nestedCollections.append(item)
                    
                # When we get to the last Child Item for the current node, ...
                if item == treeCtrl.GetLastChild(currentNode):
                    # ... check to see if there are nested collections that need to be processed.  If so ...
                    if len(nestedCollections) > 0:
                        # ... set the current node pointer to the first nested collection ...
                        currentNode = nestedCollections[0]
                        # ... get the first child node of the nested collection ...
                        (item, cookie) = treeCtrl.GetFirstChild(nestedCollections[0])
                        # ... and remove the nested collection from the list waiting to be processed
                        del(nestedCollections[0])
                    # If there are no nested collections to be processed ...
                    else:
                        # ... stop looping.  We're done.
                        break
                # If we're not at the Last Child Item ...
                else:
                    # ... get the next Child Item and continue the loop
                    (item, cookie) = treeCtrl.GetNextChild(currentNode, cookie)

        # If a Single Object (Episode or Clip) is passed in ...
        elif singleObject != None:
            # Initialize the Clip List to an empty list
            self.clipList = []
            # Create an empty list for Nested Collections
            nestedCollections = []
            # Remember the collection (which should be None) to avoid processing problems.
            self.collection = collection

        # Register with the ControlObject.  (This allows coordination between the various components that make up Transana.)
        self.ControlObject.Register(PlayAllClips = self)

        # We need to make the Dialog Window a different size depending on whether we are in Presentation Mode or not.
        if self.ControlObject.MenuWindow.menuBar.optionsmenu.IsChecked(MenuSetup.MENU_OPTIONS_PRESENT_ALL):
            # Determine the size of the Data Window.
            (left, top, width, height) = self.ControlObject.DataWindow.GetRect()
            desiredHeight = 122
        else:
            # Determine the size of the Client Window
            (left, top, width, height) = wx.Display(TransanaGlobal.configData.primaryScreen).GetClientArea()  # wx.ClientDisplayRect()
            desiredHeight = 56
            
        # Determine (and remember) the appropriate X and Y coordinates for the window
        self.xPos = left
        self.yPos = top + height - desiredHeight
        
        # This Dialog should cover the bottom edge of the Data Window, and should stay on top of it.
        wx.Dialog.__init__(self, self.ControlObject.MenuWindow, -1, _("Play All Clips"),
#        wx.MDIChildFrame.__init__(self, self.ControlObject.MenuWindow, -1, _("Play All Clips"),
                             pos = (self.xPos, self.yPos), size=(width, desiredHeight), style=wx.CAPTION | wx.STAY_ON_TOP)

        # To look right, the Mac needs the Small Window Variant.
        if "__WXMAC__" in wx.PlatformInfo:
            self.SetWindowVariant(wx.WINDOW_VARIANT_SMALL)

        # Add the Play All Clips window to the Window Menu
        self.ControlObject.MenuWindow.AddWindowMenuItem(_("Play All Clips"), 0)

        self.SetMinSize((10, 10))

        # Layout should be different if we're in "Video Only" or "Video and Transcript Only" presentation Modes
        # vs. Standard Transana Mode

        # Add a label that says "Now Playing:"
        lblNowPlaying = wx.StaticText(self, -1, _("Now Playing:"))
        # If we have a defined collection (ie NOT a Search Result node) ...
        if self.collection != None:
            # Add a label that identifies the Collection
            if 'unicode' in wx.PlatformInfo:
                # Encode with UTF-8 rather than TransanaGlobal.encoding because this is a prompt, not DB Data.
                prompt = unicode(_("Collection: %s"), 'utf8')
            else:
                prompt = _("Collection: %s")
            self.lblCollection = wx.StaticText(self, -1, prompt % self.collection.GetNodeString())
        # If we have a single object ...
        elif self.singleObject != None:
            # Determine the type of the passed-in object and set the prompt accordingly.
            if type(self.singleObject) == Clip.Clip:
                prompt = _("Clip: %s")
            else:
                prompt = _("Episode: %s")
            # Convert the prompt to Unicode
            if 'unicode' in wx.PlatformInfo:
                prompt = unicode(prompt, 'utf8')
            # Display the prompt
            self.lblCollection = wx.StaticText(self, -1, prompt % self.singleObject.id)
        # If we have a Search Result Node ...
        else:
            # ... create a blank label, which will get filled in in just a moment with the first clip's Collection name
            self.lblCollection = wx.StaticText(self, -1, "")

        # If we do NOT have a single object ...
        if self.singleObject == None:
            # Add a label that identifies the Clip
            if 'unicode' in wx.PlatformInfo:
                # Encode with UTF-8 rather than TransanaGlobal.encoding because this is a prompt, not DB Data.
                prompt = unicode(_("Clip: %s   (%s of %s)"), 'utf8')
            else:
                prompt = _("Clip: %s   (%s of %s)")
            self.lblClip = wx.StaticText(self, -1, prompt % (' ', 0, len(self.clipList)))

            # Add a button for Previous
            self.btnPrevious = wx.Button(self, ID_BTNPREVIOUS, _("Previous"))
            self.btnPrevious.SetMinSize((10, self.btnPrevious.GetSize()[1]))
            self.btnPrevious.Bind(wx.EVT_BUTTON, self.OnChangeClip)
        # If we DO have a single object ...
        else:
            # ... then the Clip Label should be blank.  (The other label handles single Episodes and Clips)
            self.lblClip = wx.StaticText(self, -1, "")

        # Add a button for Pause/Play functioning
        self.btnPlayPause = wx.Button(self, ID_BTNPLAYPAUSE, _("Pause"))
        self.btnPlayPause.SetMinSize((10, self.btnPlayPause.GetSize()[1]))
        wx.EVT_BUTTON(self, ID_BTNPLAYPAUSE, self.OnPlayPause)

        # Add a button to Cancel the Playing of Clips
        self.btnCancel = wx.Button(self, ID_BTNCANCEL, _("Cancel"))
        self.btnCancel.SetMinSize((10, self.btnCancel.GetSize()[1]))
        wx.EVT_BUTTON(self, ID_BTNCANCEL, self.OnClose)

        # If we do NOT have a single object ...
        if self.singleObject == None:
            # Add a button for Next
            self.btnNext = wx.Button(self, ID_BTNNEXT, _("Next"))
            self.btnNext.SetMinSize((10, self.btnNext.GetSize()[1]))
            self.btnNext.Bind(wx.EVT_BUTTON, self.OnChangeClip)

        # Link to a method that handles window move attempts
        wx.EVT_MOVE(self, self.OnMove)

        # Define the layout differently depending on the Presentation Mode setting.
        if self.ControlObject.MenuWindow.menuBar.optionsmenu.IsChecked(MenuSetup.MENU_OPTIONS_PRESENT_ALL):
            box = wx.BoxSizer(wx.VERTICAL)
            box.Add((1, 5))
            box.Add(lblNowPlaying, 0, wx.ALIGN_LEFT | wx.LEFT | wx.RIGHT, 10)
            box.Add((1, 5))
            box.Add(self.lblCollection, 0, wx.ALIGN_LEFT | wx.LEFT | wx.RIGHT, 10)
            box.Add((1, 5))
            box.Add(self.lblClip, 0, wx.ALIGN_LEFT | wx.LEFT | wx.RIGHT, 10)
            box.Add((1, 5))
            btnSizer = wx.BoxSizer(wx.HORIZONTAL)
            btnSizer.Add(self.btnPrevious, 1, wx.ALIGN_LEFT | wx.LEFT | wx.RIGHT | wx.EXPAND, 5)
            btnSizer.Add(self.btnPlayPause, 1, wx.ALIGN_LEFT | wx.LEFT | wx.RIGHT | wx.EXPAND, 5)
            btnSizer.Add(self.btnCancel, 1, wx.ALIGN_RIGHT | wx.LEFT | wx.RIGHT | wx.EXPAND, 5)
            btnSizer.Add(self.btnNext, 1, wx.ALIGN_LEFT | wx.LEFT | wx.RIGHT | wx.EXPAND, 5)
            box.Add(btnSizer, 1, wx.EXPAND, 0)
            box.Add((1, 5))
        else:
            box = wx.BoxSizer(wx.HORIZONTAL)
            if self.singleObject == None:
                box.Add(self.btnPrevious, 1, wx.ALIGN_LEFT | wx.LEFT | wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 5)
            box.Add(self.btnPlayPause, 1, wx.ALIGN_LEFT | wx.LEFT | wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 5)
            box.Add(self.btnCancel, 1, wx.ALIGN_LEFT | wx.LEFT | wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 5)
            if self.singleObject == None:
                box.Add(self.btnNext, 1, wx.ALIGN_LEFT | wx.LEFT | wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 5)
            box.Add((10, 1), 0, wx.EXPAND)
            box.Add(lblNowPlaying, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL)
            box.Add((10,1), 1, wx.EXPAND)
            box.Add(self.lblCollection, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL)
            box.Add((10, 1), 1, wx.EXPAND)
            box.Add(self.lblClip, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL)
            box.Add((10, 1), 1, wx.EXPAND)

        self.SetSizer(box)
#        self.Fit()

        # Tell the Dialog to Lay out the widgets, and to adjust them automatically
        self.Layout()
        self.SetAutoLayout(True)

        # Now that the size is determined, let's reposition the dialog.
        if not self.ControlObject.MenuWindow.menuBar.optionsmenu.IsChecked(MenuSetup.MENU_OPTIONS_PRESENT_ALL):
            (left, top, width, height) = self.ControlObject.VideoWindow.GetRect()
        self.xPos = left
        self.yPos = top + height - self.GetSize()[1]
        self.SetPosition((self.xPos, self.yPos))

        # Point to the first clip in the list as the clip that should be played
        self.clipNowPlaying = 0

        # Add a Timer.  The timer checks to see if the clip that is playing has stopped, which
        # is the signal that it is time to load the next clip
        self.playAllClipsTimer = wx.Timer(self, ID_PLAYALLCLIPSTIMER)
        wx.EVT_TIMER(self, ID_PLAYALLCLIPSTIMER, self.OnTimer)

        # If there are clips to play, play them
        if len(self.clipList) > 0:
            # Initialize the flag that says a clip has started playing to TRUE or the first video will never load!
            self.HasStartedPlaying = True
            # 1.5 second additional delay hopefully gives a clip enough time to load and play.
            # If clips are getting skipped, this increment may need to be increased.
            self.playAllClipsTimer.Start(TIMER_INTERVAL + EXTRA_LOAD_TIME)
            # Show the Play All Clips Dialog
            self.Show()
        # If we have a single object ...
        elif singleObject != None:
            # Initialize the flag that says a clip has started playing to FALSE or the first video will not play!
            self.HasStartedPlaying = False
            # Start the timer, which will detect when the episode / clip is done.  Since the video is already loaded,
            # there's no need for additional time.
            self.playAllClipsTimer.Start(TIMER_INTERVAL)
            # Show the Play All Clips Dialog
            self.Show()
        else:
            # Hide the PlayAllClips Window
            self.Hide()
            # If there are no clips to play, display an error message.
            dlg = Dialogs.InfoDialog(None, _("This Collection has no Clips to play."))
            dlg.ShowModal()
            dlg.Destroy()
            self.ControlObject.Register(PlayAllClips = self)
            # We need to close the PlayAllClips Windows, but can't until this method is done processing.
            wx.CallAfter(self.Close)
예제 #7
0
 def _add_event_listeners(self):
     wx.EVT_ACTIVATE(self.control, self._wx_on_activate)
     wx.EVT_CLOSE(self.control, self._wx_on_close)
     wx.EVT_SIZE(self.control, self._wx_on_control_size)
     wx.EVT_MOVE(self.control, self._wx_on_control_move)
     wx.EVT_CHAR(self.control, self._wx_on_char)
예제 #8
0
 def __init__(self, ctrl):
     wx.EvtHandler.__init__(self)
     wx.EVT_MOVE(ctrl, self.OnMove)
     self.ctrl = ctrl
예제 #9
0
    def __init__(self, parent, ID, *args, **kw):
        # miscellaneous protected variables
        self._CurrentRenderer = None
        self._CurrentCamera = None
        self._CurrentZoom = 1.0
        self._CurrentLight = None

        self._ViewportCenterX = 0
        self._ViewportCenterY = 0

        self._Picker = vtkCellPicker()
        self._PickedActor = None
        self._PickedProperty = vtkProperty()
        self._PickedProperty.SetColor(1, 0, 0)
        self._PrePickedProperty = None

        # these record the previous mouse position
        self._LastX = 0
        self._LastY = 0

        # the current interaction mode (Rotate, Pan, Zoom, etc)
        self._Mode = None
        self._ActiveButton = None

        # private attributes
        self.__OldFocus = None

        # used by the LOD actors
        self._DesiredUpdateRate = 15
        self._StillUpdateRate = 0.0001

        # First do special handling of some keywords:
        # stereo, position, size, width, height, style

        stereo = 0

        if 'stereo' in kw:
            if kw['stereo']:
                stereo = 1
            del kw['stereo']

        position = wx.DefaultPosition

        if 'position' in kw:
            position = kw['position']
            del kw['position']

        size = wx.DefaultSize

        if 'size' in kw:
            size = kw['size']
            del kw['size']

        if 'width' in kw and 'height' in kw:
            size = (kw['width'], kw['height'])
            del kw['width']
            del kw['height']

        # wxWANTS_CHARS says to give us e.g. TAB
        # wxNO_FULL_REPAINT_ON_RESIZE cuts down resize flicker under GTK
        style = wx.WANTS_CHARS | wx.NO_FULL_REPAINT_ON_RESIZE

        if 'style' in kw:
            style = style | kw['style']
            del kw['style']

        # the enclosing frame must be shown under GTK or the windows
        #  don't connect together properly
        l = []
        p = parent
        while p:  # make a list of all parents
            l.append(p)
            p = p.GetParent()
        l.reverse()  # sort list into descending order
        for p in l:
            p.Show()

        # initialize the wxWindow
        baseClass.__init__(self, parent, ID, position, size, style)

        # create the RenderWindow and initialize it
        self._RenderWindow = vtkRenderWindow()
        try:
            self._RenderWindow.SetSize(size.width, size.height)
        except AttributeError:
            self._RenderWindow.SetSize(size[0], size[1])
        if stereo:
            self._RenderWindow.StereoCapableWindowOn()
            self._RenderWindow.SetStereoTypeToCrystalEyes()

        self.__Created = 0
        # Tell the RenderWindow to render inside the wxWindow.
        if self.GetHandle():
            self.__Created = 1
            self._RenderWindow.SetWindowInfo(str(self.GetHandle()))

        # refresh window by doing a Render
        wx.EVT_PAINT(self, self.OnPaint)
        # turn off background erase to reduce flicker
        wx.EVT_ERASE_BACKGROUND(self, lambda e: None)

        # Bind the events to the event converters
        wx.EVT_RIGHT_DOWN(self, self._OnButtonDown)
        wx.EVT_LEFT_DOWN(self, self._OnButtonDown)
        wx.EVT_MIDDLE_DOWN(self, self._OnButtonDown)
        wx.EVT_RIGHT_UP(self, self._OnButtonUp)
        wx.EVT_LEFT_UP(self, self._OnButtonUp)
        wx.EVT_MIDDLE_UP(self, self._OnButtonUp)
        wx.EVT_MOTION(self, self.OnMotion)

        wx.EVT_ENTER_WINDOW(self, self._OnEnterWindow)
        wx.EVT_LEAVE_WINDOW(self, self._OnLeaveWindow)

        wx.EVT_CHAR(self, self.OnChar)
        wx.EVT_KEY_DOWN(self, self.OnKeyDown)
        wx.EVT_KEY_UP(self, self.OnKeyUp)

        wx.EVT_SIZE(self, self._OnSize)
        wx.EVT_MOVE(self, self.OnMove)

        wx.EVT_SET_FOCUS(self, self.OnSetFocus)
        wx.EVT_KILL_FOCUS(self, self.OnKillFocus)