Ejemplo n.º 1
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)
Ejemplo n.º 2
0
    def __init__(self, parent, log):
        """ initialize all interaction components: mouse, refresh rate, keyboard
        """
        #self.log = None # log
        wx.Panel.__init__(self, parent, log)

        self.Bind(wx.EVT_PAINT, self.OnPaint)
        wx.EVT_ERASE_BACKGROUND(self, self.OnEraseBackground)

        self.Bind(wx.EVT_LEFT_DOWN, self.OnMouseLeftDown)
        self.Bind(wx.EVT_LEFT_UP, self.OnMouseLeftUp)
        self.Bind(wx.EVT_MOTION, self.OnMouseMotion)
        self.position = (0, 0)
        self.ctx = None
        self.mousedown = False
        self.MOUSEX = 0
        self.MOUSEY = 0
Ejemplo n.º 3
0
 def bufferCreate(self, filename=None):
     """Create new buffer."""
     buffer = Buffer()
     panel = wx.Panel(parent=self.notebook, id=-1)
     wx.EVT_ERASE_BACKGROUND(panel, lambda x: x)
     editor = Editor(parent=panel)
     panel.editor = editor
     sizer = wx.BoxSizer(wx.VERTICAL)
     sizer.Add(editor.window, 1, wx.EXPAND)
     panel.SetSizer(sizer)
     panel.SetAutoLayout(True)
     sizer.Layout()
     buffer.addEditor(editor)
     buffer.open(filename)
     self.setEditor(editor)
     self.notebook.AddPage(page=panel, text=self.buffer.name, select=True)
     self.editor.setFocus()
Ejemplo n.º 4
0
    def __init__(self, aParent, imageFile, tiled):
        wx.Panel.__init__(self,
                          aParent,
                          -1,
                          style=wx.TAB_TRAVERSAL
                          | wx.NO_FULL_REPAINT_ON_RESIZE)
        self._frame = aParent
        self._imageFile = imageFile
        self._backgroundTiling = tiled
        # KEA 2001-07-27
        # Load the bitmap once and keep it around
        # this could fail, so should be a try/except.
        if imageFile is not None:
            self._bitmap = graphic.Bitmap(imageFile)
            wx.EVT_ERASE_BACKGROUND(self, self.onEraseBackground)

        wx.EVT_WINDOW_DESTROY(self, self._OnDestroy)
Ejemplo n.º 5
0
    def __init__(self, parent, id=wx.ID_ANY, *args, **kwargs):
        GLCanvas.__init__(self, parent, id, *args, **kwargs)

        wx.EVT_PAINT(self, self.OnPaint)
        wx.EVT_SIZE(self, self.OnResize)
        wx.EVT_ERASE_BACKGROUND(self, self.EraseBackground)

        self.init = 0
        self.SetCurrent()
        self.texBorder = self.LoadTexture(
            os.path.join(locationsettings.data_dir, 'images/border.png'))
        self.texFateBack = self.LoadTexture(
            os.path.join(locationsettings.data_dir, 'images/fate_back.jpg'))
        self.texDynastyBack = self.LoadTexture(
            os.path.join(locationsettings.data_dir, 'images/dynasty_back.jpg'))
        self.texCard = {}
        self.texGeneric = {}
Ejemplo n.º 6
0
    def __init__(self, parent, id, getCfgGui):
        style = wx.FULL_REPAINT_ON_RESIZE
        wx.Window.__init__(self, parent, id, style = style)

        self.getCfgGui = getCfgGui

        # pages, i.e., [wx.Window, name] lists. note that 'name' must be an
        # Unicode string.
        self.pages = []

        # index of selected page
        self.selected = -1

        # index of first visible tab
        self.firstTab = 0

        # how much padding to leave horizontally at the ends of the
        # control, and within each tab
        self.paddingX = 10

        # starting Y-pos of text in labels
        self.textY = 5

        # width of a single tab
        self.tabWidth = 150

        # width, height, spacing, y-pos of arrows
        self.arrowWidth = 8
        self.arrowHeight = 13
        self.arrowSpacing = 3
        self.arrowY = 5

        # initialized in OnPaint since we don't know our height yet
        self.font = None
        self.boldFont = None

        self.SetMinSize(wx.Size(
                self.paddingX * 2 + self.arrowWidth * 2 + self.arrowSpacing +\
                    self.tabWidth + 5,
                TAB_BAR_HEIGHT))

        wx.EVT_LEFT_DOWN(self, self.OnLeftDown)
        wx.EVT_LEFT_DCLICK(self, self.OnLeftDown)
        wx.EVT_SIZE(self, self.OnSize)
        wx.EVT_PAINT(self, self.OnPaint)
        wx.EVT_ERASE_BACKGROUND(self, self.OnEraseBackground)
Ejemplo n.º 7
0
 def bufferCreate(self, filename=None):
     """Create new buffer."""
     self.bufferDestroy()
     buffer = Buffer()
     self.panel = panel = wx.Panel(parent=self, id=-1)
     wx.EVT_ERASE_BACKGROUND(panel, lambda x: x)
     editor = Editor(parent=panel)
     panel.editor = editor
     sizer = wx.BoxSizer(wx.VERTICAL)
     sizer.Add(editor.window, 1, wx.EXPAND)
     panel.SetSizer(sizer)
     panel.SetAutoLayout(True)
     sizer.Layout()
     buffer.addEditor(editor)
     buffer.open(filename)
     self.setEditor(editor)
     self.editor.setFocus()
     self.SendSizeEvent()
Ejemplo n.º 8
0
    def __init__(self, parent, size=wx.DefaultSize):
        glcanvas.GLCanvas.__init__(self, parent, -1, size=size, style=wx.WANTS_CHARS)
        # wxWANTS_CHARS to get arrow keys on Windows

        self.init = False
        self.m_w, self.m_h = 0,0
        
        self.zoomChanged = 1
        self.m_doViewportChange = 1
        self.m_sx, self.m_sy = 1,1
        self.m_tx, self.m_ty = 0,0
        
        # initial mouse position
        #seb self.lastx = self.x = 30
        #seb self.lasty = self.y = 30
        wx.EVT_ERASE_BACKGROUND(self, self.OnEraseBackground)
        wx.EVT_SIZE(self, self.OnSize)
        wx.EVT_PAINT(self, self.OnPaint)
Ejemplo n.º 9
0
    def __init__(self,
                 parent,
                 id=wx.ID_ANY,
                 pos=wx.DefaultPosition,
                 size=wx.DefaultSize):
        """BorderCtrl constructor."""

        wx.Window.__init__(self, parent, id, pos, size, STYLE)

        self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM)
        self.SetDoubleBuffered(True)

        # Members, Initializations
        self.Reset(size)

        # Bind the events related to our control
        wx.EVT_PAINT(self, self.OnPaint)
        wx.EVT_ERASE_BACKGROUND(self, lambda event: None)
Ejemplo n.º 10
0
    def __init__(self,parent,portfolio,matrix):
        self.m_id = wx.NewId()
        wx.Frame.__init__(self,parent,self.m_id, "", size = ( 640,480), style = wx.DEFAULT_FRAME_STYLE|wx.NO_FULL_REPAINT_ON_RESIZE)
        iTrade_wxFrame.__init__(self,parent, 'main')

        self.m_portfolio = portfolio
        self.m_matrix = matrix

        self.m_market = self.m_portfolio.market()

        self.initIndice()

        # Set Lang
        self.SetLang(bDuringInit=True)

        self.m_bookId = wx.NewId()
        self.m_book = iTradeMainNotebookWindow(self, self.m_bookId, page=-1, portfolio=self.m_portfolio,matrix=self.m_matrix)

        # link to other windows
        self.m_hOperation = None
        self.m_hMoney = None
        self.m_hAlerts = None
        self.m_hView = None
        self.m_hProperty = None
        self.m_hCurrency = None

        wx.EVT_CLOSE(self, self.OnCloseWindow)
        wx.EVT_WINDOW_DESTROY(self, self.OnDestroyWindow)

        # Build the main menu
        self.buildMenu()

        # Toolbar
        self.m_toolbar = iTradeMainToolbar(self, wx.NewId())

        wx.EVT_SIZE(self, self.OnSize)
        wx.EVT_ERASE_BACKGROUND(self,self.OnEraseBackground)

        # refresh full view after window init finished
        EVT_POSTINIT(self, self.OnPostInit)
        wx.PostEvent(self,PostInitEvent())

        # last
        self.Show(True)
Ejemplo n.º 11
0
    def __init__(self,
                 parent,
                 id=wx.ID_ANY,
                 pos=wx.DefaultPosition,
                 size=wx.DefaultSize,
                 ann=None):
        """
        Constructor.

        Non-wxpython related parameters:

        @param ann (Annotation) the annotation to be represented.

        The size is representing the available area to draw the annotation.
        The member _pxsec must be fixed for the annotation to draw inside this
        area. It represents the number of pixels required for 1 second.

        """
        self._pointctrl1 = None
        self._pointctrl2 = None
        self._labelctrl = None
        self._pxsec = 0  # the number of pixels to represent 1 second of time

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

        # Members, Initializations
        self._ann = None
        if ann is not None:
            self.SetAnn(ann)
        self.Reset(size)

        # Bind the events related to our control
        wx.EVT_PAINT(self, self.OnPaint)
        wx.EVT_ERASE_BACKGROUND(self, lambda event: None)
        wx.EVT_MOUSE_EVENTS(self, self.OnMouseEvents)

        #spEVT_POINT_LEFT(self, self.OnPointEdit)
        #spEVT_RESIZING(self,   self.OnPointResizing)
        #spEVT_RESIZED(self,    self.OnPointResized)
        spEVT_MOVING(self, self.OnPointMoving)
Ejemplo n.º 12
0
    def __init__(self,parent):
        glcanvas.GLCanvas.__init__(self, parent, -1)
        self.init = False
        self.width = 0
        self.height = 0

        self.zoom = 50.0
        self.minZoom = 5.0
        self.maxZoom = 400.0
        self.lookingAtX = 0
        self.lookingAtY = 0
        self.lookingAtZ = 0
        self.viewAngleSky = 50.0
        self.viewAngleFloor = 90.0
        self.angleSpeed = 3.0

        self.viewX = 0
        self.viewY = 0
        self.viewZ = 0
        
        self.point = Numeric.zeros((1,4),typecode=Numeric.Float)
        
        self.clearCache()

        self.frustum = []
        self.viewMatrixInv = Numeric.identity(4,Numeric.Float)
        self.modelMatrix = None
        self.currentModelView = None

        self.redrawRequested = False
        self.preprocessed = False
        self.preprocessing = False
        
        wx.EVT_ERASE_BACKGROUND(self, self.OnEraseBackground)
        wx.EVT_SIZE(self, self.OnSize)
        wx.EVT_PAINT(self, self.OnPaint)
        wx.EVT_LEFT_DOWN(self, self.OnMouseDown)
        wx.EVT_LEFT_UP(self, self.OnMouseUp)
        wx.EVT_MOTION(self, self.OnMouseMotion)
        wx.EVT_MOUSEWHEEL(self, self.OnMouseWheel)
        wx.EVT_KEY_DOWN(self, self.OnKeyDown)
	wx.EVT_KEY_UP(self,self.OnKeyUp)
Ejemplo n.º 13
0
    def __init__(self,
                 parent,
                 image=None,
                 id=1,
                 size=wx.DefaultSize,
                 pos=wx.DefaultPosition,
                 style=0):
        wx.PyWindow.__init__(self,
                             parent,
                             id=id,
                             size=size,
                             pos=pos,
                             style=style | wx.FULL_REPAINT_ON_RESIZE)
        self.bg = wx.Brush(parent.GetBackgroundColour())
        self._bufbmp = None

        wx.EVT_ERASE_BACKGROUND(self, lambda evt: None)
        wx.EVT_PAINT(self, self.OnPaint)

        self.SetImage(image)
Ejemplo n.º 14
0
    def create_control(self, parent):
        """ Creates the underlying wxPython window used for the notebook.
        """
        # Create the correct type of window based on whether or not it should
        # be scrollable:
        if self.scrollable:
            self.control = control = TraitsUIScrolledPanel(parent)
            control.SetScrollRate(6, 6)
            control.SetSize(wx.Size(0, 0))
        else:
            self.control = control = TraitsUIPanel(parent, -1)

        control._image_slice = getattr(parent, '_image_slice', None)
        control.SetSizer(ThemedVerticalNotebookSizer(self))

        # Set up the painting event handlers:
        wx.EVT_ERASE_BACKGROUND(control, self._erase_background)
        wx.EVT_PAINT(control, self._paint)

        return control
Ejemplo n.º 15
0
 def __init__(self, parent, realParent):
     attribList = (glcanvas.WX_GL_RGBA, glcanvas.WX_GL_DOUBLEBUFFER,
                   glcanvas.WX_GL_DEPTH_SIZE, 24,
                   glcanvas.WX_GL_STENCIL_SIZE, 8)
     glcanvas.GLCanvas.__init__(self, parent, attribList=attribList)
     self.parent = realParent
     self.context = glcanvas.GLContext(self)
     wx.EVT_PAINT(self, self.OnPaint)
     wx.EVT_SIZE(self, self.OnSize)
     wx.EVT_ERASE_BACKGROUND(self, self.OnEraseBackground)
     wx.EVT_LEFT_DOWN(self, self.OnMouseLeftDown)
     wx.EVT_MOTION(self, self.OnMouseMotion)
     wx.EVT_MOUSEWHEEL(self, self.OnMouseWheel)
     self.yaw = 30
     self.pitch = 60
     self.zoom = self.parent.machineSize.x / 2 + 10
     self.offsetX = 0
     self.offsetY = 0
     self.view3D = False
     self.allowDrag = False
Ejemplo n.º 16
0
    def init(self, parent):
        """ Finishes initializing the editor by creating the underlying toolkit
            widget.
        """
        factory = self.factory
        evaluate = factory.evaluate
        if evaluate is None:
            handler = self.object.trait(self.name).handler
            evaluate = getattr(handler, 'evaluate', None)
            if evaluate is None:
                evaluate = _Identity()
        self.evaluate = evaluate
        self.sync_value(factory.evaluate_name, 'evaluate', 'from')

        padding_x = padding_y = 0
        if factory.theme is not None:
            slice = self.image_slice
            padding_x = slice.xleft + slice.xright
            padding_y = slice.xtop + slice.xbottom

        self.control = control = wx.Window(
            parent,
            -1,
            size=wx.Size(padding_x + 70, padding_y + 20),
            style=wx.FULL_REPAINT_ON_RESIZE | wx.WANTS_CHARS)

        self._text_size = None

        # Set up the painting event handlers:
        wx.EVT_ERASE_BACKGROUND(control, self._erase_background)
        wx.EVT_PAINT(control, self._on_paint)
        wx.EVT_CHAR(control, self._inactive_key_entered)

        # Handle 'focus' events:
        wx.EVT_SET_FOCUS(control, self._set_focus)
        wx.EVT_LEFT_UP(control, self._set_focus)

        # Handle 'resize' events:
        wx.EVT_SIZE(control, self._resize)

        self.set_tooltip()
Ejemplo n.º 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 = MouseSphericalCamera(self.size.x, self.size.y)
        self.camera = MousePolarCamera(self.size.width, self.size.height)

        #Main state variables
        self.MousePos = [0, 0]
        self.bbox = BBox3D()

        #Face mesh variables and manipulation variables
        self.mesh = None
        self.meshCentroid = None
        self.displayMeshFaces = True
        self.displayMeshEdges = False
        self.displayBoundary = False
        self.displayMeshVertices = True
        self.displayVertexNormals = False
        self.displayFaceNormals = False
        self.useLighting = True
        self.useTexture = 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)
Ejemplo n.º 18
0
    def __init__ ( self, parent, theme, text = '', border=False ):
        """ Initializes the object.
        """
        self._theme = theme
        self._border = border
        if theme is not None:
            self._image_slice = theme.image_slice

        super( ImageText, self ).__init__( parent, -1,
                                           style = wx.FULL_REPAINT_ON_RESIZE )

        self._text_size = None
        self._text      = text

        # Set up the painting event handlers:
        wx.EVT_ERASE_BACKGROUND( self, self._erase_background )
        wx.EVT_PAINT( self, self._on_paint )

        size = self.GetMinSize()
        self.SetMinSize( size )
        self.SetSize( size )
Ejemplo n.º 19
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._buttonSize = 64

        self._animationList = []
        self.glReleaseList = []
        self._refreshQueued = False
        self._idleCalled = False

        wx.EVT_PAINT(self, self._OnGuiPaint)
        wx.EVT_SIZE(self, self._OnSize)
        wx.EVT_ERASE_BACKGROUND(self, self._OnEraseBackground)
        wx.EVT_LEFT_DOWN(self, self._OnGuiMouseDown)
        wx.EVT_LEFT_DCLICK(self, self._OnGuiMouseDown)
        wx.EVT_LEFT_UP(self, self._OnGuiMouseUp)
        wx.EVT_RIGHT_DOWN(self, self._OnGuiMouseDown)
        wx.EVT_RIGHT_DCLICK(self, self._OnGuiMouseDown)
        wx.EVT_RIGHT_UP(self, self._OnGuiMouseUp)
        wx.EVT_MIDDLE_DOWN(self, self._OnGuiMouseDown)
        wx.EVT_MIDDLE_DCLICK(self, self._OnGuiMouseDown)
        wx.EVT_MIDDLE_UP(self, self._OnGuiMouseUp)
        wx.EVT_MOTION(self, self._OnGuiMouseMotion)
        wx.EVT_KEY_DOWN(self, self._OnGuiKeyDown)
        wx.EVT_KEY_UP(self, self._OnGuiKeyUp)
        wx.EVT_KILL_FOCUS(self, self.OnFocusLost)
        wx.EVT_IDLE(self, self._OnIdle)
Ejemplo n.º 20
0
    def __init__(self, parent, coverSong, SSMPlot):
        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.coverSong = coverSong
        self.SSMPlot = SSMPlot
        #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]])

        #Set up OpenGL vertex buffer for points and colors
        self.YVBO = vbo.VBO(np.array(self.coverSong.Y, dtype='float32'))
        self.YColorsVBO = vbo.VBO(
            np.array(self.coverSong.YColors, dtype='float32'))

        #Point cloud and playing information
        self.DrawEdges = False
        self.Playing = 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)
Ejemplo n.º 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.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)
Ejemplo n.º 22
0
    def __init__(self,
                 parent,
                 id=wx.ID_ANY,
                 pos=wx.DefaultPosition,
                 size=wx.DefaultSize):

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

        self._value = 0  # time in milliseconds
        self._leftmargin = 10
        self._rightmargin = 10
        self._topmargin = 1
        self._bottommargin = 1

        if size:
            self.__initialSize(size)

        # Bind the events related to our control
        wx.EVT_PAINT(self, self.OnPaint)
        wx.EVT_ERASE_BACKGROUND(self, lambda event: None)
Ejemplo n.º 23
0
    def __init__(self, parent, image, previewwindow=None, id=1, resultsize=(100,100), size=wx.DefaultSize, pos=wx.DefaultPosition, style=0):
        wx.ScrolledWindow.__init__(self, parent, id=id, size=size, pos=pos, style=style|wx.FULL_REPAINT_ON_RESIZE)
        self.previewwindow=previewwindow
        self.bg=wx.Brush(wx.WHITE)
        self.parentbg=wx.Brush(parent.GetBackgroundColour())
        self._bufbmp=None

        self.anchors=None
        
        wx.EVT_ERASE_BACKGROUND(self, lambda evt: None)
        wx.EVT_PAINT(self, self.OnPaint)

        self.image=image
        self.origimage=image
        self.setresultsize(resultsize)

        # cursors for outside, inside, on selection, pressing bad mouse button
        self.cursors=[wx.StockCursor(c) for c in (wx.CURSOR_ARROW, wx.CURSOR_HAND, wx.CURSOR_SIZING, wx.CURSOR_NO_ENTRY)]
        self.clickpoint=None 
        wx.EVT_MOTION(self, self.OnMotion)
        wx.EVT_LEFT_DOWN(self, self.OnLeftDown)
        wx.EVT_LEFT_UP(self, self.OnLeftUp)
Ejemplo n.º 24
0
    def __init__(self, parent):  #, log):
        self.log = None  # log
        wx.Panel.__init__(self, parent, -1)

        self.Bind(wx.EVT_PAINT, self.OnPaint)
        wx.EVT_ERASE_BACKGROUND(self, self.OnEraseBackground)

        self.Bind(wx.EVT_LEFT_UP, self.OnMouseLeftUp)
        self.Bind(wx.EVT_LEFT_DOWN, self.OnMouseLeftDown)
        self.Bind(wx.EVT_RIGHT_UP, self.OnMouseRightUp)
        self.Bind(wx.EVT_RIGHT_DOWN, self.OnMouseRightDown)
        self.Bind(wx.EVT_MOTION, self.OnMouseMotion)
        self.position = (0, 0)
        self.mouseleftdown = False
        self.mouserightdown = False

        self.game = GameManager()
        self.game.initialize_world("SceneData\\Level0.png")

        self.timer = wx.Timer(self)
        self.Bind(wx.EVT_TIMER, self.OnTimer, self.timer)
        self.timer.Start(40)  # 1000 = 1 seconde
Ejemplo n.º 25
0
    def _create_control(self, parent):
        """ Create the toolkit-specific control that represents the widget. """

        # The background image (it is tiled).
        image = self.image.create_image()
        self._bmp = image.ConvertToBitmap()

        sizer = wx.BoxSizer(wx.VERTICAL)
        panel = wx.Panel(parent, -1, style=wx.CLIP_CHILDREN | wx.SIMPLE_BORDER)
        panel.SetSizer(sizer)
        panel.SetAutoLayout(True)

        # Create a suitable font.
        self._font = new_font_like(wx.NORMAL_FONT, family=wx.SWISS)

        width, height = self._get_preferred_size(self.text, self._font)
        panel.SetMinSize((width, height))

        wx.EVT_PAINT(panel, self._on_paint_background)
        wx.EVT_ERASE_BACKGROUND(panel, self._on_erase_background)

        return panel
Ejemplo n.º 26
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)
Ejemplo n.º 27
0
 def __init__(self, parent):
     attribList = (glcanvas.WX_GL_RGBA, glcanvas.WX_GL_DOUBLEBUFFER,
                   glcanvas.WX_GL_DEPTH_SIZE, 24,
                   glcanvas.WX_GL_STENCIL_SIZE, 8)
     glcanvas.GLCanvas.__init__(self, parent, attribList=attribList)
     self.parent = parent
     self.context = glcanvas.GLContext(self)
     wx.EVT_PAINT(self, self.OnPaint)
     wx.EVT_SIZE(self, self.OnSize)
     wx.EVT_ERASE_BACKGROUND(self, self.OnEraseBackground)
     wx.EVT_MOTION(self, self.OnMouseMotion)
     wx.EVT_MOUSEWHEEL(self, self.OnMouseWheel)
     self.yaw = 30
     self.pitch = 60
     self.zoom = 300
     self.offsetX = 0
     self.offsetY = 0
     self.view3D = True
     self.gcodeDisplayList = None
     self.gcodeDisplayListMade = None
     self.gcodeDisplayListCount = 0
     self.objColor = [[1.0, 0.8, 0.6, 1.0], [0.2, 1.0, 0.1, 1.0],
                      [1.0, 0.2, 0.1, 1.0], [0.1, 0.2, 1.0, 1.0]]
Ejemplo n.º 28
0
	def __init__(self, parent, projectPlannerWindow):
		attribList = (glcanvas.WX_GL_RGBA, glcanvas.WX_GL_DOUBLEBUFFER, glcanvas.WX_GL_DEPTH_SIZE, 24, glcanvas.WX_GL_STENCIL_SIZE, 8)
		glcanvas.GLCanvas.__init__(self, parent, attribList = attribList)
		self.parent = projectPlannerWindow
		self.context = glcanvas.GLContext(self)
		wx.EVT_PAINT(self, self.OnPaint)
		wx.EVT_SIZE(self, self.OnSize)
		wx.EVT_ERASE_BACKGROUND(self, self.OnEraseBackground)
		wx.EVT_LEFT_DOWN(self, self.OnMouseLeftDown)
		wx.EVT_MOTION(self, self.OnMouseMotion)
		wx.EVT_MOUSEWHEEL(self, self.OnMouseWheel)
		self.yaw = 30
		self.pitch = 60
		self.offsetX = 0
		self.offsetY = 0
		self.view3D = self.parent.alwaysAutoPlace
		if self.view3D:
			self.zoom = 300
		else:
			self.zoom = self.parent.machineSize[0] / 2 + 10
		self.allowDrag = False

		self.objColor = profile.getPreferenceColour('model_colour')
Ejemplo n.º 29
0
 def __init__(
         self,
         parent,
         id=-1,
         text=wx.EmptyString,  #text in the ticker
         fgcolor=wx.BLACK,  #text/foreground color
         bgcolor=wx.WHITE,  #background color
         start=True,  #if True, the ticker starts immediately
         ppf=2,  #pixels per frame
         fps=20,  #frames per second
         direction="rtl",  #direction of ticking, rtl or ltr
         pos=wx.DefaultPosition,
         size=wx.DefaultSize,
         style=wx.NO_BORDER,
         name="Ticker"):
     wx.PyControl.__init__(self,
                           parent,
                           id=id,
                           pos=pos,
                           size=size,
                           style=style,
                           name=name)
     self.timer = wx.Timer(owner=self)
     self._extent = (-1, -1)  #cache value for the GetTextExtent call
     self._offset = 0
     self._fps = fps  #frames per second
     self._ppf = ppf  #pixels per frame
     self.SetDirection(direction)
     self.SetText(text)
     self.SetInitialSize(size)
     self.SetForegroundColour(fgcolor)
     self.SetBackgroundColour(bgcolor)
     wx.EVT_TIMER(self, -1, self.OnTick)
     wx.EVT_PAINT(self, self.OnPaint)
     wx.EVT_ERASE_BACKGROUND(self, self.OnErase)
     if start:
         self.Start()
Ejemplo n.º 30
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 = MouseSphericalCamera(self.size.x, self.size.y)
        self.camera = MousePolarCamera(self.size.width, self.size.height)
        
        #Skeleton animation variables
        self.skeleton = Skeleton()
        self.animator = SkeletonAnimator(self.skeleton)
        self.animationState = 0
        self.animating = False
        
        #Main state variables
        self.MousePos = [0, 0]
        self.initiallyResized = False

        self.bbox = np.array([[-1, -1, -1], [1, 1, 1]])
        random.seed()
        
        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)