Python wx 模块,EVT_LEFT_DOWN 实例源码

我们从Python开源项目中,提取了以下47个代码示例,用于说明如何使用wx.EVT_LEFT_DOWN

项目:bonsu    作者:bonsudev    | 项目源码 | 文件源码
def BindEvents(self):
        self.Bind(wx.EVT_PAINT, self.OnPaint)
        self.Bind(wx.EVT_ERASE_BACKGROUND, lambda e: None)
        self.Bind(wx.EVT_RIGHT_DOWN, self.OnButtonDown)
        self.Bind(wx.EVT_LEFT_DOWN, self.OnButtonDown)
        self.Bind(wx.EVT_MIDDLE_DOWN, self.OnButtonDown)
        self.Bind(wx.EVT_RIGHT_UP, self.OnButtonUp)
        self.Bind(wx.EVT_LEFT_UP, self.OnButtonUp)
        self.Bind(wx.EVT_MIDDLE_UP, self.OnButtonUp)
        self.Bind(wx.EVT_MOUSEWHEEL, self.OnMouseWheel)
        self.Bind(wx.EVT_MOTION, self.OnMotion)
        self.Bind(wx.EVT_ENTER_WINDOW, self.OnEnter)
        self.Bind(wx.EVT_LEAVE_WINDOW, self.OnLeave)
        self.Bind(wx.EVT_CHAR, self.OnKeyDown)
        self.Bind(wx.EVT_KEY_UP, self.OnKeyUp)
        if wx.Platform == "__WXGTK__":
            # wxGTK requires that the window be created before you can
            # set its shape, so delay the call to SetWindowShape until
            # this event.
            self.Bind(wx.EVT_WINDOW_CREATE, self.OnWindowCreate)
        else:
            # On wxMSW and wxMac the window has already been created.
            self.Bind(wx.EVT_SIZE, self.OnSize)
        if _useCapture and hasattr(wx, 'EVT_MOUSE_CAPTURE_LOST'):
            self.Bind(wx.EVT_MOUSE_CAPTURE_LOST, self.OnMouseCaptureLost)
项目:PandasDataFrameGUI    作者:bluenote10    | 项目源码 | 文件源码
def __init__(self, parent, size, data, *args, **kwargs):

        wx.ListBox.__init__(self, parent, size, **kwargs)

        self.data = data

        self.InsertItems(data, 0)

        self.Bind(wx.EVT_LISTBOX, self.on_selection_changed)

        self.Bind(wx.EVT_LEFT_DOWN, self.on_left_down)

        self.Bind(wx.EVT_RIGHT_DOWN, self.on_right_down)
        self.Bind(wx.EVT_RIGHT_UP, self.on_right_up)
        self.Bind(wx.EVT_MOTION, self.on_move)

        self.index_iter = range(len(self.data))

        self.selected_items = [True] * len(self.data)
        self.index_mapping = list(range(len(self.data)))

        self.drag_start_index = None

        self.update_selection()
        self.SetFocus()
项目:fmc-dialer    作者:sguron    | 项目源码 | 文件源码
def OnMouseLeftDown(self, event):
        """
        Handles the ``wx.EVT_LEFT_DOWN`` event for :class:`ImageContainerBase`.

        :param `event`: a :class:`MouseEvent` event to be processed.
        """

        newSelection = -1
        event.Skip()

        # Support for collapse/expand
        style = self.GetParent().GetAGWWindowStyleFlag()

        tabIdx, where = self.HitTest(event.GetPosition())

        if where == IMG_OVER_IMG:
            self._nHoveredImgIdx = -1

        if tabIdx == -1:
            return

        self.GetParent().SetSelection(tabIdx)
项目:AppAutoViewer    作者:RealLau    | 项目源码 | 文件源码
def __init__(self, parent):
        """Constructor"""
        self.notUseDetaul = None
        wx.Panel.__init__(self, parent=parent, size = (500,800))
        B = wx.StaticBox(self, -1)
        BSizer = wx.StaticBoxSizer(B, wx.VERTICAL)
        self.imagesDir = os.path.join(".", "images")
        self.screenShotDir = os.path.join(".", "screenShot")
        self.defaultScreenShotImage = wx.Image(os.path.join(self.imagesDir, "default.png"), wx.BITMAP_TYPE_PNG).ConvertToBitmap()
        self.screenShot = wx.StaticBitmap(self,-1, self.defaultScreenShotImage)
        self.screenShot.Bind(wx.EVT_LEFT_DOWN, self.DrawOrReloadAll)
        self.statusBar = wx.StaticText(self, -1, "")
        BSizer.Add(self.statusBar)
        BSizer.Add(self.screenShot,5,wx.EXPAND, 5)
        self.SetSizer(BSizer)
        pub.subscribe(self.updateStatus, "update")
        pub.subscribe(self.DrawFromSelectedNode, "DrawFromSelectedNode")
        pub.subscribe(self.DoSwipeOrInput, "DoSwipeOrInput")
        self.hasDrew = False
项目:imagepy    作者:Image-Py    | 项目源码 | 文件源码
def __init__(self, parent, manager=None):
        attribList = attribs = (glcanvas.WX_GL_RGBA, glcanvas.WX_GL_DOUBLEBUFFER, glcanvas.WX_GL_DEPTH_SIZE, 24)
        glcanvas.GLCanvas.__init__(self, parent, -1, attribList=attribList)
        self.init = False
        self.context = glcanvas.GLContext(self)
        self.manager = self.manager = Manager() if manager is None else manager
        self.size = None

        self.SetBackgroundStyle(wx.BG_STYLE_PAINT)

        self.Bind(wx.EVT_SIZE, self.OnSize)
        self.Bind(wx.EVT_PAINT, self.OnPaint)
        self.Bind(wx.EVT_LEFT_DOWN, self.OnMouseDown)
        self.Bind(wx.EVT_LEFT_UP, self.OnMouseUp)
        self.Bind(wx.EVT_MOTION, self.OnMouseMotion)
        self.Bind(wx.EVT_MOUSEWHEEL, self.OnMouseWheel)
        self.lastx, self.lasty = None, None
        self.update = True
        #print('init===========')
项目:imagepy    作者:Image-Py    | 项目源码 | 文件源码
def buildToolsBar(parent, datas):    
    box = wx.BoxSizer( wx.HORIZONTAL )
    #toolsbar =  wx.ToolBar( parent, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TB_HORIZONTAL ) 
    toolsbar = wx.Panel( parent, wx.ID_ANY, 
                         wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )

    toolsbar.SetSizer( box )
    add_tools(toolsbar, datas[1][0][1], None)

    gifpath = os.path.join(root_dir, "tools/drop.gif")
    btn = wx.BitmapButton(toolsbar, wx.ID_ANY, make_bitmap(wx.Bitmap(gifpath)),
                          wx.DefaultPosition, (32, 32), wx.BU_AUTODRAW|wx.RAISED_BORDER)

    box.Add(btn)
    btn.Bind(wx.EVT_LEFT_DOWN, lambda x:menu_drop(parent, toolsbar, datas, btn, x))
    add_tools(toolsbar, datas[1][1][1])
    return toolsbar
项目:GRIPy    作者:giruenf    | 项目源码 | 文件源码
def set_selrange(self, sel=True, selmin=None, selmax=None):
        if sel:
            self.SetWindowStyle(wx.SL_SELRANGE)
            if selmin is None or selmax is None:
                raise Exception()
            else:
                self.SetSelection(selmin, selmax)
            self.Bind(wx.EVT_LEFT_DOWN, self.on_event)  
        else:
            self.ClearSel()
            if self.is_selrange():
                self.Unbind(wx.EVT_LEFT_DOWN, handler=self.on_event)
            self.SetWindowStyle(wx.SL_BOTTOM)       
            if selmin is None:
                raise Exception()
            super(RangeSlider, self).SetValue(selmin)
项目:Python-GUI-Programming-Cookbook-Second-Edition    作者:PacktPublishing    | 项目源码 | 文件源码
def __init__(self, parent):
        glcanvas.GLCanvas.__init__(self, parent, -1)        
        self.context = glcanvas.GLContext(self)
        self.init = False

        # Cube 3D start rotation
        self.last_X = self.x = 30
        self.last_Y = self.y = 30

        self.Bind(wx.EVT_SIZE, self.sizeCallback)
        self.Bind(wx.EVT_PAINT, self.paintCallback)
        self.Bind(wx.EVT_LEFT_DOWN, self.mouseDownCallback)
        self.Bind(wx.EVT_LEFT_UP, self.mouseUpCallback)
        self.Bind(wx.EVT_MOTION, self.mouseMotionCallback)
项目:Python-GUI-Programming-Cookbook-Second-Edition    作者:PacktPublishing    | 项目源码 | 文件源码
def __init__(self, parent):
        glcanvas.GLCanvas.__init__(self, parent, -1)        
        self.context = glcanvas.GLContext(self)
        self.init = False

        # Cube 3D start rotation
        self.last_X = self.x = 30
        self.last_Y = self.y = 30

        self.Bind(wx.EVT_SIZE, self.sizeCallback)
        self.Bind(wx.EVT_PAINT, self.paintCallback)
        self.Bind(wx.EVT_LEFT_DOWN, self.mouseDownCallback)
        self.Bind(wx.EVT_LEFT_UP, self.mouseUpCallback)
        self.Bind(wx.EVT_MOTION, self.mouseMotionCallback)
项目:Python-GUI-Programming-Cookbook-Second-Edition    作者:PacktPublishing    | 项目源码 | 文件源码
def __init__(self, parent):
        glcanvas.GLCanvas.__init__(self, parent, -1)
        self.init = False
        self.context = glcanvas.GLContext(self)         # <== this was missing when I wrote the book in 2015...

        # initial mouse position
        self.lastx = self.x = 30
        self.lasty = self.y = 30
        self.size = None
        self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)
        self.Bind(wx.EVT_SIZE, self.OnSize)
        self.Bind(wx.EVT_PAINT, self.OnPaint)
        self.Bind(wx.EVT_LEFT_DOWN, self.OnMouseDown)
        self.Bind(wx.EVT_LEFT_UP, self.OnMouseUp)
        self.Bind(wx.EVT_MOTION, self.OnMouseMotion)
项目:Python-GUI-Programming-Cookbook-Second-Edition    作者:PacktPublishing    | 项目源码 | 文件源码
def __init__(self, parent):
        glcanvas.GLCanvas.__init__(self, parent, -1)        
        self.context = glcanvas.GLContext(self)
        self.init = False

        # Cube 3D start rotation
        self.last_X = self.x = 30
        self.last_Y = self.y = 30

        self.Bind(wx.EVT_SIZE, self.sizeCallback)
        self.Bind(wx.EVT_PAINT, self.paintCallback)
        self.Bind(wx.EVT_LEFT_DOWN, self.mouseDownCallback)
        self.Bind(wx.EVT_LEFT_UP, self.mouseUpCallback)
        self.Bind(wx.EVT_MOTION, self.mouseMotionCallback)
项目:SpatialTool    作者:JRcard    | 项目源码 | 文件源码
def __init__(self, parent, obj=None, mouse_callback=None, select_callback=None):
        wx.Panel.__init__(self, parent)
        self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM)
        self.Bind(wx.EVT_PAINT, self.OnPaint)
        self.Bind(wx.EVT_LEFT_DOWN, self.OnMouseDown)
        self.Bind(wx.EVT_LEFT_UP, self.OnMouseUp)
        self.Bind(wx.EVT_RIGHT_DOWN, self.OnRightDown)
        self.Bind(wx.EVT_RIGHT_UP, self.OnMouseUp)
        self.Bind(wx.EVT_MOTION, self.OnMotion)
        self.Bind(wx.EVT_SIZE, self.OnSize)
        self.refresh_from_selection = False
        self.background_bitmap = None
        self.obj = obj
        self.selstart = self.selend = self.movepos = None
        self.moveSelection = False
        self.createSelection = False
        self.begin = 0
        if self.obj is not None:
            self.chnls = len(self.obj)
            self.end = self.obj.getDur(False)
        else:
            self.chnls = 1
            self.end = 1.0
        self.img = [[]]
        self.mouse_callback = mouse_callback
        self.select_callback = select_callback
        if sys.platform == "win32" or sys.platform.startswith("linux"):
            self.dcref = wx.BufferedPaintDC
        else:
            self.dcref = wx.PaintDC
        self.setImage()
        #FL 02/10/2017
        self.playCursorPos = 0
项目:stopgo    作者:notklaatu    | 项目源码 | 文件源码
def BindKeys(self,dbfile):
        '''
        Bind keyboard shortcuts for application.
        '''
        self.Bind(wx.EVT_MENU, lambda event, args=('MENU_DEL',dbfile): self.OnKeyDown(event,args), self.ditem)
        self.Bind(wx.EVT_MENU, lambda event, args=dbfile: self.Undo(event,args), self.zitem)
        self.Bind(wx.EVT_BUTTON, lambda event, args=('wx.WXK_SPACE',dbfile): self.OnKeyDown(event,args), self.bplay)
        self.Bind(wx.EVT_BUTTON, lambda event, args=(dbfile): self.CaptureCanvas(event,args), self.brec)

        self.panel3.Bind(wx.EVT_KEY_DOWN, lambda event, args=(dbfile): self.OnKeyDown(event, args))
        self.panel3.Bind(wx.EVT_LEFT_DOWN, self.OnMouseClick)
        self.Bind(wx.EVT_MENU, lambda event, args=(dbfile):self.OnQuit(event,args), self.qitem)
        self.Bind(wx.EVT_CLOSE, lambda event, args=(dbfile):self.OnQuit(event,args), self.qitem)
        self.Bind(wx.EVT_MENU, lambda event, args=(dbfile):self.OnRender(event,args), self.ritem)
项目:stopgo    作者:notklaatu    | 项目源码 | 文件源码
def BuildTimeline(self,dbfile):

        for child in self.panel3.GetChildren():
            logging.exception(child)
            child.Destroy()

        # the last frame is
        latestfram = self.cur.execute("SELECT * FROM Timeline ORDER BY Image DESC LIMIT 1")
        #latestfram = self.cur.execute("SELECT * FROM Timeline WHERE ID = (SELECT MAX(ID) FROM TABLE) AND Blackspot = 0");
        try:
            for entry in latestfram:
                self.framlog = int(entry[1].split('.')[0])
                self.framlog += 1
                logging.exception(self.framlog)
        except:
            logging.exception('Looking for last frame but did not find.')
            pass

        # timeline contains
        tbl_timeline = self.cur.execute("SELECT * FROM Timeline WHERE Blackspot=0")

        for entry in tbl_timeline:
            img = self.MakeThumbnail(os.path.join(self.imgdir, entry[1]), self.thumbsize)
            self.imageCtrl = wx.StaticBitmap(self.panel3, wx.ID_ANY, 
                                             wx.BitmapFromImage(img),name=entry[1]) 
            self.imageCtrl.SetBitmap(wx.BitmapFromImage(img))
            self.imageCtrl.Bind( wx.EVT_LEFT_DOWN, self.OnLeftClick )
            self.imageCtrl.Bind( wx.EVT_LEFT_UP, self.OnLeftRelease )

            logging.exception(self.imageCtrl.GetId() )
            self.hbox2.Add( self.imageCtrl, 0, wx.ALL, 5 )

        self.Layout()
        self.panel3.SetFocus()
        self.BindKeys(dbfile)

        self.hbox2.Layout()
        self.panel3.Refresh()
        self.panel3.Update()

        self.Refresh()
项目:stopgo    作者:notklaatu    | 项目源码 | 文件源码
def TakeSnapshot(self,e,args):

        logging.exception('CAPTURE')
        if self.camset == 1:
            self.framlog += 1

            #print(self.camhero)#DEBUG
            vidcap = vlc.libvlc_video_take_snapshot(self.player,0,os.path.join(self.imgdir, str(self.framlog).zfill(3)+'.png'),0,0)
            self.cur.execute('INSERT INTO Timeline VALUES(Null,?,?)', (str(self.framlog).zfill(3)+'.png',0))
            # add graphically to timeline
            img = self.MakeThumbnail(os.path.join(self.imgdir, str(self.framlog).zfill(3)+'.png'), self.thumbsize)
            self.imageCtrl = wx.StaticBitmap(self.panel3, wx.ID_ANY, wx.BitmapFromImage(img),name=str(self.framlog).zfill(3)+'.png') 
            self.imageCtrl.SetBitmap(wx.BitmapFromImage(img))
            self.imageCtrl.Bind( wx.EVT_LEFT_DOWN, self.OnLeftClick )
            self.imageCtrl.Bind( wx.EVT_LEFT_UP, self.OnLeftRelease )
            logging.exception(self.imageCtrl.GetId() )
            self.hbox2.Add( self.imageCtrl, 0, wx.ALL, 5 )

            # scroll right 100% to get close to new frame
            self.panel3.Scroll(self.thumbsize,0)
            self.Layout()
            # draw new frame
            self.hbox2.Layout()
            self.panel3.Refresh()
            # scroll WAY right again to show frame
            self.panel3.Scroll(200,0)
            # send the shot to onion skin
            img = os.path.join(self.imgdir, str(self.framlog).zfill(3)+'.png')
            self.OnionSkin(img)
            logging.exception(self.framlog)

        else:
            dlg = wx.MessageDialog(self, 'Please select your camera first.','',wx.OK | wx.ICON_ERROR)
            val = dlg.ShowModal()
            if val == wx.ID_OK:
                dlg.Destroy()
            if val == wx.ID_CANCEL:
                dlg.Destroy()

        self.player.play()
        self.brec.SetBitmapLabel(self.brecicon)
项目:fmc-dialer    作者:sguron    | 项目源码 | 文件源码
def OnMouseLeftDown(self, event):
        """
        Handles the ``wx.EVT_LEFT_DOWN`` event for :class:`ImageContainer`.

        :param `event`: a :class:`MouseEvent` event to be processed.
        """

        ImageContainerBase.OnMouseLeftDown(self, event)
        event.Skip()
项目:bonsu    作者:bonsudev    | 项目源码 | 文件源码
def __init__(self, parent, id=wx.ID_ANY, style=wx.ALIGN_LEFT, size=(-1,-1), spinfunc=None):
        wx.Panel.__init__(self, parent)
        self.hbox = wx.BoxSizer(wx.HORIZONTAL)
        self.buttonP = wx.Button(self, -1, label="+", size=size)
        self.buttonM = wx.Button(self, -1, label="-", size=size)
        self.buttonP.Bind(wx.EVT_BUTTON, self.OnP)
        self.buttonM.Bind(wx.EVT_BUTTON, self.OnM)
        self.repeatTimerP = wx.Timer(self)
        self.repeatTimerM = wx.Timer(self)
        self.Bind(wx.EVT_TIMER, self.RepeatValueP, self.repeatTimerP)
        self.Bind(wx.EVT_TIMER, self.RepeatValueM, self.repeatTimerM)
        self.buttonP.Bind(wx.EVT_LEFT_DOWN, self.OnButPDown)
        self.buttonM.Bind(wx.EVT_LEFT_DOWN, self.OnButMDown)
        self.buttonP.Bind(wx.EVT_LEFT_UP, self.OnButPUp)
        self.buttonM.Bind(wx.EVT_LEFT_UP, self.OnButMUp)
        self.hbox.Add(self.buttonM, 0)
        self.hbox.Add(self.buttonP, 0)
        self.SetSizer(self.hbox)
        self.Fit()
        self.Layout()
        self.Show()
        self.max = 0
        self.min = 0
        self.range = 0
        self.value = 0
        self.SpinFunc = spinfunc
        self.n = 1
        self.t1 = time()
        self.t2 = time()
项目:laplacian-meshes    作者:bmershon    | 项目源码 | 文件源码
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.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)
项目:pyjam    作者:10se1ucgo    | 项目源码 | 文件源码
def __init__(self, parent, file):
        super(WaveformPlot, self).__init__(parent=parent, title="pyjam Waveform Viewer",
                                           style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)

        self.file = file

        self.plot = plot.PlotCanvas(self)
        self.plot.canvas.Bind(wx.EVT_LEFT_DOWN, self.lmb_down)
        self.plot.canvas.Bind(wx.EVT_LEFT_UP, self.lmb_up)
        self.plot.canvas.Bind(wx.EVT_MOTION, self.mouse_motion)
        self.plot.EnableAxesValues = (True, False, False, False)
        self.plot.EnableGrid = (True, False)
        self.plot.AbsScale = (True, False)
        self.plot.EnableAntiAliasing = True

        self.panel = WaveformPanel(self)

        sizer = wx.BoxSizer(wx.HORIZONTAL)
        sizer.Add(self.plot, 1, wx.EXPAND, 0)
        sizer.Add(self.panel, 0, wx.EXPAND, 0)
        self.SetSizerAndFit(sizer)
        self.SetSize(800, self.GetSize()[1])
        self.SetMinSize(self.GetSize())

        self.player = wx.media.MediaCtrl(parent=self, style=wx.SIMPLE_BORDER)

        self.volume = 25
        self.selected = np.array([0.0, 0.0])
        self.maximum = 0.0
        self.minimum = 0.0
        self.selection_drawn = False
        self.resized = False

        self.timer = wx.Timer(self)

        self.Bind(wx.EVT_SIZE, self.on_size)
        self.Bind(wx.EVT_TIMER, self.on_timer)
        self.Bind(wx.EVT_IDLE, self.on_idle)
        self.Bind(wx.EVT_CLOSE, self.on_exit)

        self.load()
项目:pyDataView    作者:edwardsmith999    | 项目源码 | 文件源码
def __init__(self, parent, gap=12, *args, **kwargs):
        wx.Slider.__init__(self, parent, *args, **kwargs)
        self.gap = gap
        self.parent = self.GetParent() 
        self.Bind(wx.EVT_LEFT_DOWN, self.OnClick)
项目:Turrican2Editor    作者:GitExl    | 项目源码 | 文件源码
def __init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.NO_BORDER):
        wx.Panel.__init__(self, parent, id=id, pos=pos, size=size, style=style)

        self.Viewport = wx.Panel(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.NO_BORDER)
        self.Scrollbar = wx.ScrollBar(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.SB_VERTICAL)

        sizer = wx.BoxSizer(wx.HORIZONTAL)
        sizer.Add(self.Viewport, 1, wx.EXPAND, 0)
        sizer.Add(self.Scrollbar, 0, wx.EXPAND, 0)

        self.SetSizer(sizer)
        self.Layout()
        sizer.Fit(self)

        self._presenter = Presenter.from_window(self.Viewport.GetHandle(), config.SCALE)

        self._graphics = None
        self._font = None
        self._entities = None

        self._selected_index = -1

        self.Viewport.Bind(wx.EVT_PAINT, self.paint)
        self.Viewport.Bind(wx.EVT_SIZE, self.resize)
        self.Viewport.Bind(wx.EVT_MOUSEWHEEL, self.mouse_wheel)
        self.Viewport.Bind(wx.EVT_LEFT_DOWN, self.mouse_left_down)
        self.Scrollbar.Bind(wx.EVT_SCROLL, self.scroll)
项目:Turrican2Editor    作者:GitExl    | 项目源码 | 文件源码
def __init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.NO_BORDER):
        wx.Panel.__init__(self, parent, id=id, pos=pos, size=size, style=style)

        self.Viewport = wx.Panel(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.NO_BORDER)
        self.Scrollbar = wx.ScrollBar(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.SB_VERTICAL)

        sizer = wx.BoxSizer(wx.HORIZONTAL)
        sizer.Add(self.Viewport, 1, wx.EXPAND, 0)
        sizer.Add(self.Scrollbar, 0, wx.EXPAND, 0)

        self.SetSizer(sizer)
        self.Layout()
        sizer.Fit(self)

        self.Scrollbar.SetScrollbar(0, 0, 0, 0)

        self._presenter = Presenter.from_window(self.Viewport.GetHandle(), config.SCALE)
        self._camera = Camera(0, 0, 0, 0)

        self._tilemap = None
        self._tileset = None
        self._select_start = None
        self._select_end = None

        self._show_collision = False

        self.Viewport.Bind(wx.EVT_PAINT, self.paint)
        self.Viewport.Bind(wx.EVT_SIZE, self.resize)
        self.Viewport.Bind(wx.EVT_MOUSEWHEEL, self.mouse_wheel)
        self.Viewport.Bind(wx.EVT_LEFT_DOWN, self.mouse_left_down)
        self.Viewport.Bind(wx.EVT_LEFT_UP, self.mouse_left_up)
        self.Viewport.Bind(wx.EVT_MOTION, self.mouse_move)
        self.Scrollbar.Bind(wx.EVT_SCROLL, self.scroll)
项目:beremiz    作者:nucleron    | 项目源码 | 文件源码
def __init__(self, parent, size):
        wx.Panel.__init__(self, parent, size=size)
        self.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown)
        self.Bind(wx.EVT_LEFT_UP, self.OnLeftUp)
        self.Bind(wx.EVT_MOTION, self.OnMotion)
        self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)
        self.Bind(wx.EVT_PAINT, self.OnPaint)
        self.Bind(wx.EVT_SIZE, self.OnResize)

        self.ThumbPosition = 0.  # -1 <= ThumbPosition <= 1
        self.ThumbScrollingStartPos = None
项目:beremiz    作者:nucleron    | 项目源码 | 文件源码
def ShowInstanceChoicePopup(self):
        self.InstanceChoice.SetFocusFromKbd()
        size = self.InstanceChoice.GetSize()
        event = wx.MouseEvent(wx.EVT_LEFT_DOWN._getEvtType())
        event.x = size.width / 2
        event.y = size.height / 2
        event.SetEventObject(self.InstanceChoice)
        # event = wx.KeyEvent(wx.EVT_KEY_DOWN._getEvtType())
        # event.m_keyCode = wx.WXK_SPACE
        self.InstanceChoice.GetEventHandler().ProcessEvent(event)
项目:beremiz    作者:nucleron    | 项目源码 | 文件源码
def __init__(self, parent, window, items=[]):
        """
        Constructor
        @param parent: Parent wx.Window of DebugVariableText
        @param window: Reference to the Debug Variable Panel
        @param items: List of DebugVariableItem displayed by Viewer
        """
        DebugVariableViewer.__init__(self, window, items)

        wx.Panel.__init__(self, parent)
        # Set panel background colour
        self.SetBackgroundColour(wx.WHITE)
        # Define panel drop target
        self.SetDropTarget(DebugVariableTextDropTarget(self, window))

        # Bind events
        self.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown)
        self.Bind(wx.EVT_LEFT_UP, self.OnLeftUp)
        self.Bind(wx.EVT_LEFT_DCLICK, self.OnLeftDClick)
        self.Bind(wx.EVT_ENTER_WINDOW, self.OnEnter)
        self.Bind(wx.EVT_LEAVE_WINDOW, self.OnLeave)
        self.Bind(wx.EVT_SIZE, self.OnResize)
        self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)
        self.Bind(wx.EVT_PAINT, self.OnPaint)

        # Define panel min size for parent sizer layout
        self.SetMinSize(wx.Size(0, 25))

        # Add buttons to Viewer
        for bitmap, callback in [("force", self.OnForceButton),
                                 ("release", self.OnReleaseButton),
                                 ("delete_graph", self.OnCloseButton)]:
            self.Buttons.append(GraphButton(0, 0, bitmap, callback))
项目:beremiz    作者:nucleron    | 项目源码 | 文件源码
def __init__(self, parent, choices=None, dropDownClick=True,
                 element_path=None, **therest):
        """
        Constructor works just like wx.TextCtrl except you can pass in a
        list of choices.  You can also change the choice list at any time
        by calling setChoices.
        """

        therest['style'] = wx.TE_PROCESS_ENTER | therest.get('style', 0)

        wx.TextCtrl.__init__(self, parent, **therest)

        # Some variables
        self._dropDownClick = dropDownClick
        self._lastinsertionpoint = None
        self._hasfocus = False

        self._screenheight = wx.SystemSettings.GetMetric(wx.SYS_SCREEN_Y)
        self.element_path = element_path

        self.listbox = None

        self.SetChoices(choices)

        # gp = self
        # while ( gp != None ) :
        #    gp.Bind ( wx.EVT_MOVE , self.onControlChanged, gp )
        #    gp.Bind ( wx.EVT_SIZE , self.onControlChanged, gp )
        #    gp = gp.GetParent()

        self.Bind(wx.EVT_KILL_FOCUS, self.OnControlChanged)
        self.Bind(wx.EVT_TEXT_ENTER, self.OnControlChanged)
        self.Bind(wx.EVT_TEXT, self.OnEnteredText)
        self.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)

        # If need drop down on left click
        if dropDownClick:
            self.Bind(wx.EVT_LEFT_DOWN, self.OnClickToggleDown)
            self.Bind(wx.EVT_LEFT_UP, self.OnClickToggleUp)
项目:beremiz    作者:nucleron    | 项目源码 | 文件源码
def GenerateMethodButtonSizer(self):
        normal_bt_font = wx.Font(faces["size"] / 3,    wx.DEFAULT, wx.NORMAL, wx.NORMAL, faceName=faces["helv"])
        mouseover_bt_font = wx.Font(faces["size"] / 3, wx.DEFAULT, wx.NORMAL, wx.NORMAL, faceName=faces["helv"], underline=True)

        msizer = wx.BoxSizer(wx.HORIZONTAL)

        for confnode_method in self.Controler.ConfNodeMethods:
            if "method" in confnode_method and confnode_method.get("shown", True):
                button = GenBitmapTextButton(self.Editor,
                                             bitmap=GetBitmap(confnode_method.get("bitmap", "Unknown")),
                                             label=confnode_method["name"],
                                             style=wx.NO_BORDER)
                button.SetFont(normal_bt_font)
                button.SetToolTipString(confnode_method["tooltip"])
                if confnode_method.get("push", False):
                    button.Bind(wx.EVT_LEFT_DOWN, self.GetButtonCallBackFunction(confnode_method["method"], True))
                else:
                    button.Bind(wx.EVT_BUTTON, self.GetButtonCallBackFunction(confnode_method["method"]), button)
                # a fancy underline on mouseover

                def setFontStyle(b, s):
                    def fn(event):
                        b.SetFont(s)
                        b.Refresh()
                        event.Skip()
                    return fn
                button.Bind(wx.EVT_ENTER_WINDOW, setFontStyle(button, mouseover_bt_font))
                button.Bind(wx.EVT_LEAVE_WINDOW, setFontStyle(button, normal_bt_font))
                # hack to force size to mini
                if not confnode_method.get("enabled", True):
                    button.Disable()
                msizer.AddWindow(button, flag=wx.ALIGN_CENTER)
        return msizer
项目:imagepy    作者:Image-Py    | 项目源码 | 文件源码
def __init__(self, parent):
        wx.TextCtrl.__init__(self, parent, wx.TE_RIGHT)
        wx.TextCtrl.Bind(self, wx.EVT_KEY_UP, self.ontext)
        wx.TextCtrl.Bind(self, wx.EVT_LEFT_DOWN, self.oncolor)
项目:imagepy    作者:Image-Py    | 项目源码 | 文件源码
def build_tools(parent, toolspath):
    global host
    host = parent
    ## get tool datas from the loader.build_tools(toolspath)
    ## then generate toolsbar
    datas = loader.build_tools(toolspath)
    toolsbar = buildToolsBar(parent, datas)
    gifpath = os.path.join(root_dir, "tools/drop.gif")
    #btn = wx.BitmapButton(parent, wx.ID_ANY, wx.Bitmap(gifpath), wx.DefaultPosition, (30,30), wx.BU_AUTODRAW)
    #btn.Bind(wx.EVT_LEFT_DOWN, lambda x:menu_drop(parent, toolsbar, datas, btn, x))   
    return toolsbar#, btn
项目:imagepy    作者:Image-Py    | 项目源码 | 文件源码
def f(plg, e):
    ##! TODO: What's this? for wx.EVT_LEFT_DOWN
    plg.start()
    #print e.GetEventObject().SetBackgroundColour( 
    #    wx.SystemSettings.GetColour( wx.SYS_COLOUR_HIGHLIGHT ) )
    if isinstance(plg, Tool): 
        e.Skip()
项目:procrustes    作者:bmershon    | 项目源码 | 文件源码
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.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)
项目:MechWarfareScoring    作者:artanz    | 项目源码 | 文件源码
def __init__( self, parent, id, server, mech ):
        wx.StaticText.__init__( self, parent )

        self.ScoreServer = server
        self.Mech = mech
        self.Bind( wx.EVT_LEFT_DOWN, self.LeftClick )
        self.Bind( wx.EVT_RIGHT_DOWN, self.RightClick )
项目:MechWarfareScoring    作者:artanz    | 项目源码 | 文件源码
def __init__( self, parent, id, match ):
            wx.StaticText.__init__( self, parent )

            self.Match = match
            self.Bind( wx.EVT_LEFT_DOWN, self.LeftClick )
            self.Bind( wx.EVT_RIGHT_DOWN, self.RightClick )
项目:baroness    作者:ulrichknecht    | 项目源码 | 文件源码
def __init__(self, parent):
        wx.Panel.__init__(self, parent, id=wx.ID_ANY, pos=(0, 0), size=(480, 320))
        self.bitmap_1 = wx.StaticBitmap(self, wx.ID_ANY, wx.Bitmap("./gui/start.png", wx.BITMAP_TYPE_ANY), pos=(0, 0))
        if not settings.hideGuiList:
            self.Bind(wx.EVT_LEFT_DOWN, parent.onStart)
            self.bitmap_1.Bind(wx.EVT_LEFT_DOWN, parent.onStart)
项目:baroness    作者:ulrichknecht    | 项目源码 | 文件源码
def __init__(self, parent):
        wx.Panel.__init__(self, parent, id=wx.ID_ANY, pos=(0, 0), size=(480, 320))
        self.bitmap_1 = wx.StaticBitmap(self, wx.ID_ANY, wx.Bitmap("./gui/sorry.png", wx.BITMAP_TYPE_ANY), pos=(0, 0))
        self.bitmap_1.Bind(wx.EVT_LEFT_DOWN, parent.onExit)
        self.label_1 = wx.StaticText(self, wx.ID_ANY, 'bla blub', pos=(100,100))
        self.label_1.SetFont(wx.Font(30, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans"))
项目:baroness    作者:ulrichknecht    | 项目源码 | 文件源码
def __init__(self, parent):
        wx.Panel.__init__(self, parent, id=wx.ID_ANY, pos=(0, 0), size=(480, 320))
        self.bitmap_1 = wx.StaticBitmap(self, wx.ID_ANY, wx.Bitmap("./gui/rfid.png", wx.BITMAP_TYPE_ANY), pos=(0, 0))
        self.bitmap_1.Bind(wx.EVT_LEFT_DOWN, parent.onExit)
        self.label_1 = wx.StaticText(self, wx.ID_ANY, 'bla blub', pos=(100,100), size=(100,220))
        self.label_1.SetFont(wx.Font(30, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans"))
项目:baroness    作者:ulrichknecht    | 项目源码 | 文件源码
def __init__(self, parent):
        wx.Panel.__init__(self, parent, id=wx.ID_ANY, pos=(0, 0), size=(480, 320))

        self.bitmap_1 = wx.StaticBitmap(self, wx.ID_ANY, wx.Bitmap("./gui/products.png", wx.BITMAP_TYPE_ANY), pos=(0, 0))

        products = get_products()
        buttonids = []
        i = 0
        for product in products:
            if product.isshown:
                #480x320
                self.but = wx.Button(self, id=wx.ID_ANY, label=product.name + u"\n" + u"%0.2f" % product.price, pos=((i%4)*120, int(i/4)*120), size=(120, 120))
                self.but.SetBackgroundColour((255-((i+int(i/4))*20 % 40), (160+((i+int(i/4))*50 % 100)), 0))
                #self.but.SetForegroundColour("#006699")
                self.but.SetFont(wx.Font(23, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans"))
                self.but.Bind(wx.EVT_LEFT_DOWN, parent.onProduct, id=self.but.Id)
                i += 1

        if not settings.onlyOneDrink:
            self.b_less = wx.Button(self, id = wx.ID_ANY, label=u"-", pos=(0,250), size=(120, 70))
            self.b_less.SetFont(wx.Font(60, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans"))
            self.b_less.Bind(wx.EVT_LEFT_DOWN, self.onLess, id=self.b_less.Id)

            self.l_amount = wx.StaticText(self, wx.ID_ANY, "%2d" % 0, pos=(137, 245), style=wx.ALIGN_CENTER)
            self.l_amount.SetFont(wx.Font(50, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans"))

            self.b_more = wx.Button(self, id = wx.ID_ANY, label=u"+", pos=(240,250), size=(120, 70))
            self.b_more.SetFont(wx.Font(60, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans"))
            self.b_more.Bind(wx.EVT_LEFT_DOWN, self.onMore, id=self.b_more.Id)

        self.b_exit = wx.Button(self, id = wx.ID_ANY, label=u"x", pos=(360,250), size=(120, 70))
        self.b_exit.SetFont(wx.Font(30, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans"))
        self.b_exit.Bind(wx.EVT_LEFT_DOWN, parent.onExit, id=self.b_exit.Id)

        if i <= 4:
            self.l_user = wx.StaticText(self, wx.ID_ANY, "todo", pos=(20,170), style=wx.ALIGN_CENTER)
        else:
            self.l_user = wx.StaticText(self, wx.ID_ANY, "todo", pos=((i%4)*120+20,170), style=wx.ALIGN_CENTER)
        self.l_user.SetFont(wx.Font(25, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans"))
项目:baroness    作者:ulrichknecht    | 项目源码 | 文件源码
def __init__(self, parent):
        wx.Panel.__init__(self, parent, id=wx.ID_ANY, pos=(0, 0), size=(480, 320))
        self.parent = parent
        self.bitmap_1 = wx.StaticBitmap(self, wx.ID_ANY, wx.Bitmap("./gui/users.png", wx.BITMAP_TYPE_ANY), pos=(0, 0))

        users = get_users()
        self.names = list()
        for user in users:
            if user.isshown and not user.onlyrfid:
                self.names.append(user.longname)

        self.but_names = list()
    self.position = 0
    self.lines = 4
    self.items = len(self.names) 

    for i in range(self.lines):
            #480x320
            self.but = wx.lib.platebtn.PlateButton(self, label=self.names[self.position+i] if self.position+i < len(self.names) else "", pos=(3, 3+i*80),
                                                   style=wx.BU_EXACTFIT | wx.lib.platebtn.PB_STYLE_SQUARE)
            self.but.SetSize((365, 74))

            self.but.SetBackgroundColour((255-(i*20 % 40), (160+(i*50 % 100)), 0))
            #self.but.SetForegroundColour("#006699")
            self.but.SetPressColor(wx.Colour(255,255,255,0))
            self.but.SetFont(wx.Font(25, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans"))
            self.but.Bind(wx.EVT_LEFT_DOWN, parent.onUser, id=self.but.Id)
            self.but_names.append(self.but)

        self.b_up = wx.Button(self, id=wx.ID_ANY, label=u"\u25B2", pos=(374, 0), size=(106, 106))
        self.b_up.SetFont(wx.Font(20, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans"))
        self.b_up.Bind(wx.EVT_LEFT_DOWN, self.on_up, id=self.b_up.Id)

        self.b_down = wx.Button(self, id=wx.ID_ANY, label=u"\u25BC", pos=(374, 214), size=(106, 106))
        self.b_down.SetFont(wx.Font(20, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans"))
        self.b_down.Bind(wx.EVT_LEFT_DOWN, self.on_down, id=self.b_down.Id)

        self.b_exit = wx.Button(self, id=wx.ID_ANY, label="X", pos=(374, 107), size=(106, 106))
        self.b_exit.SetFont(wx.Font(20, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans"))
        self.b_exit.Bind(wx.EVT_LEFT_DOWN, parent.onExit, id=self.b_exit.Id)
        self.Layout()
项目:ML    作者:saurabhsuman47    | 项目源码 | 文件源码
def __init__(self, parent):
        wx.Panel.__init__(self, parent = parent)
        file_drop_target = FileDropTarget(self)
        lbl = wx.StaticText(self, label="Drag Transactions File here:")
        self.fileTextCtrl = wx.TextCtrl(self, style=wx.TE_MULTILINE|wx.VSCROLL|wx.TE_READONLY)
        self.fileTextCtrl.SetDropTarget(file_drop_target)
        button = wx.Button(self, label = "Process File")
        button.Bind(wx.EVT_LEFT_DOWN, self.process_file)
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(lbl, 1, wx.ALL, 5)
        sizer.Add(self.fileTextCtrl, 10, wx.EXPAND|wx.ALL, 10)
        sizer.Add(button, 1, wx.ALIGN_CENTER, 5)
        self.SetSizer(sizer)
        self.text = ""
项目:GRIPy    作者:giruenf    | 项目源码 | 文件源码
def on_event(self, event):
        if event.GetEventType() == wx.EVT_LEFT_DOWN.typeId:
            if self.is_selrange():
                val = self.get_position(event) 
                if val < self.GetValue():
                    self.SetSelection(val, self.GetSelEnd())
                elif val > self.GetValue():    
                    self.SetSelection(self.GetSelStart(), val)
                self.send_change()    
            else:      
                event.Skip()
        elif event.GetEventType() == wx.EVT_SLIDER.typeId:
            self.send_change()
项目:GRIPy    作者:giruenf    | 项目源码 | 文件源码
def __init__(self, wx_parent, view_object):
        super(PlotLabel, self).__init__(wx_parent)
        self.track_view_object = view_object
        self._title = None
        self._visual_objects = []
        self.SetBackgroundColour('white')
        self.SetSizer(wx.BoxSizer(wx.VERTICAL))  
        self.Bind(wx.EVT_LEFT_DOWN, self._on_press)
        self.Bind(wx.EVT_MIDDLE_DOWN, self._on_press)
        self.Bind(wx.EVT_RIGHT_DOWN, self._on_press)
        self._selected = False
项目:SpatialTool    作者:JRcard    | 项目源码 | 文件源码
def __init__(self, parent, pos=(0,0), size=(100,100), numSpeakers=2):
        wx.Panel.__init__(self, parent, pos=pos, size=size)
        self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM)

        self.audio = vars.getVars("Audio")
        self.pos = None
        self.size = size
        self.currentCircle = None
        self.currentSpeaker = None
        self.isAList = False
        self.catch = False
        self.catchSpeaker = False
        self.shift = False
        self.alt = False
        self.s = False
        self.numSpeakers = numSpeakers # FL 29/05/17

        #OSC Variables
        self.incs = [0, 0, 0, 0]
        self.absPos = [0, 0, 0, 0] # FL 04/09/2017
        self.mode2 = False # FL 04/09/2017

        # Creation des cercles/sources
        self.blueCircle = Source(self.size[0]*BLUE_START[0], self.size[1]*BLUE_START[1], CIRCLE_RADIUS) 
        self.redCircle = Source(self.size[0]*RED_START[0], self.size[1]*RED_START[1], CIRCLE_RADIUS)


        speakers = []
        for i in range(self.numSpeakers):
            setup = vars.getVars("Speakers_setup")
            x, y = self.size[0]*setup[i][0], self.size[1]*setup[i][1] #FL 02/09/2017
            speakers.append(Speaker(x, y, SPEAKER_RADIUS))
        vars.setVars("Speakers", speakers)

#        print vars.getVars("Speakers")[0].c
        self.speakerAdjusted() # FL 29/05/17

        # méthode pour les controles
        self.Bind(wx.EVT_PAINT, self.onPaint)
        self.Bind(wx.EVT_LEFT_DOWN, self.onLeftDown)
        self.Bind(wx.EVT_LEFT_UP, self.onLeftUp)
        self.Bind(wx.EVT_RIGHT_DOWN, self.onRightDown)
        self.Bind(wx.EVT_MOTION, self.onMotion)

        self.Bind(wx.EVT_KEY_DOWN, self.onKeyDown)
        self.Bind(wx.EVT_KEY_UP, self.onKeyUp)

        self.on_timer()
项目:fmc-dialer    作者:sguron    | 项目源码 | 文件源码
def __init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize,
                 style=0, agwStyle=0, name="ImageContainer"):
        """
        Default class constructor.

        :param `parent`: parent window. Must not be ``None``;
        :param `id`: window identifier. A value of -1 indicates a default value;
        :param `pos`: the control position. A value of (-1, -1) indicates a default position,
         chosen by either the windowing system or wxPython, depending on platform;
        :param `size`: the control size. A value of (-1, -1) indicates a default size,
         chosen by either the windowing system or wxPython, depending on platform;
        :param `style`: the underlying :class:`Panel` window style;
        :param `agwStyle`: the AGW-specific window style. This can be a combination of the
         following bits:

         =========================== =========== ==================================================
         Window Styles               Hex Value   Description
         =========================== =========== ==================================================
         ``INB_BOTTOM``                      0x1 Place labels below the page area. Available only for :class:`FlatImageBook`.
         ``INB_LEFT``                        0x2 Place labels on the left side. Available only for :class:`FlatImageBook`.
         ``INB_RIGHT``                       0x4 Place labels on the right side.
         ``INB_TOP``                         0x8 Place labels above the page area.
         ``INB_BORDER``                     0x10 Draws a border around :class:`LabelBook` or :class:`FlatImageBook`.
         ``INB_SHOW_ONLY_TEXT``             0x20 Shows only text labels and no images. Available only for :class:`LabelBook`.
         ``INB_SHOW_ONLY_IMAGES``           0x40 Shows only tab images and no label texts. Available only for :class:`LabelBook`.
         ``INB_FIT_BUTTON``                 0x80 Displays a pin button to show/hide the book control.
         ``INB_DRAW_SHADOW``               0x100 Draw shadows below the book tabs. Available only for :class:`LabelBook`.
         ``INB_USE_PIN_BUTTON``            0x200 Displays a pin button to show/hide the book control.
         ``INB_GRADIENT_BACKGROUND``       0x400 Draws a gradient shading on the tabs background. Available only for :class:`LabelBook`.
         ``INB_WEB_HILITE``                0x800 On mouse hovering, tabs behave like html hyperlinks. Available only for :class:`LabelBook`.
         ``INB_NO_RESIZE``                0x1000 Don't allow resizing of the tab area.
         ``INB_FIT_LABELTEXT``            0x2000 Will fit the tab area to the longest text (or text+image if you have images) in all the tabs.
         ``INB_BOLD_TAB_SELECTION``       0x4000 Show the selected tab text using a bold font.
         =========================== =========== ==================================================

        :param `name`: the window name.
        """

        ImageContainerBase.__init__(self, parent, id, pos, size, style, agwStyle, name)

        self.Bind(wx.EVT_PAINT, self.OnPaint)
        self.Bind(wx.EVT_SIZE, self.OnSize)
        self.Bind(wx.EVT_LEFT_DOWN, self.OnMouseLeftDown)
        self.Bind(wx.EVT_LEFT_UP, self.OnMouseLeftUp)
        self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)
        self.Bind(wx.EVT_MOTION, self.OnMouseMove)
        self.Bind(wx.EVT_LEAVE_WINDOW, self.OnMouseLeaveWindow)
项目:beremiz    作者:nucleron    | 项目源码 | 文件源码
def GenerateSearchResultsTreeBranch(self, root, infos):
        to_delete = []
        if infos["name"] == "body":
            item_name = "%d:" % infos["data"][1][0]
        else:
            item_name = infos["name"]

        self.SearchResultsTree.SetItemText(root, item_name)
        self.SearchResultsTree.SetPyData(root, infos["data"])
        self.SearchResultsTree.SetItemBackgroundColour(root, wx.WHITE)
        self.SearchResultsTree.SetItemTextColour(root, wx.BLACK)
        if infos["type"] is not None:
            if infos["type"] == ITEM_POU:
                self.SearchResultsTree.SetItemImage(root, self.TreeImageDict[self.ParentWindow.Controler.GetPouType(infos["name"])])
            else:
                self.SearchResultsTree.SetItemImage(root, self.TreeImageDict[infos["type"]])

        text = None
        if infos["text"] is not None:
            text = infos["text"]
            start, end = infos["data"][1:3]
            text_lines = infos["text"].splitlines()
            start_idx = start[1]
            end_idx = reduce(lambda x, y: x + y, map(lambda x: len(x) + 1, text_lines[:end[0] - start[0]]), end[1] + 1)
            style = wx.TextAttr(wx.BLACK, wx.Colour(206, 204, 247))
        elif infos["type"] is not None and infos["matches"] > 1:
            text = _("(%d matches)") % infos["matches"]
            start_idx, end_idx = 0, len(text)
            style = wx.TextAttr(wx.Colour(0, 127, 174))

        if text is not None:
            text_ctrl_style = wx.BORDER_NONE | wx.TE_READONLY | wx.TE_RICH2
            if wx.Platform != '__WXMSW__' or len(text.splitlines()) > 1:
                text_ctrl_style |= wx.TE_MULTILINE
            text_ctrl = wx.TextCtrl(id=-1, parent=self.SearchResultsTree, pos=wx.Point(0, 0),
                                    value=text, style=text_ctrl_style)
            width, height = text_ctrl.GetTextExtent(text)
            text_ctrl.SetClientSize(wx.Size(width + 1, height))
            text_ctrl.SetBackgroundColour(self.SearchResultsTree.GetBackgroundColour())
            text_ctrl.Bind(wx.EVT_LEFT_DOWN, self.GetTextCtrlClickFunction(root))
            text_ctrl.Bind(wx.EVT_LEFT_DCLICK, self.GetTextCtrlDClickFunction(root))
            text_ctrl.SetInsertionPoint(0)
            text_ctrl.SetStyle(start_idx, end_idx, style)
            self.SearchResultsTree.SetItemWindow(root, text_ctrl)

        if wx.VERSION >= (2, 6, 0):
            item, root_cookie = self.SearchResultsTree.GetFirstChild(root)
        else:
            item, root_cookie = self.SearchResultsTree.GetFirstChild(root, 0)
        for child in infos["children"]:
            if item is None:
                item = self.SearchResultsTree.AppendItem(root, "")
                item, root_cookie = self.SearchResultsTree.GetNextChild(root, root_cookie)
            self.GenerateSearchResultsTreeBranch(item, child)
            item, root_cookie = self.SearchResultsTree.GetNextChild(root, root_cookie)
项目:beremiz    作者:nucleron    | 项目源码 | 文件源码
def __init__(self, parent, folder, filter=None, editable=True):
        wx.Panel.__init__(self, parent, style=wx.TAB_TRAVERSAL)

        main_sizer = wx.BoxSizer(wx.VERTICAL)

        self.Tree = wx.TreeCtrl(self,
                                style=(wx.TR_HAS_BUTTONS |
                                       wx.TR_SINGLE |
                                       wx.SUNKEN_BORDER |
                                       wx.TR_HIDE_ROOT |
                                       wx.TR_LINES_AT_ROOT |
                                       wx.TR_EDIT_LABELS))
        if wx.Platform == '__WXMSW__':
            self.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnTreeItemExpanded, self.Tree)
            self.Tree.Bind(wx.EVT_LEFT_DOWN, self.OnTreeLeftDown)
        else:
            self.Bind(wx.EVT_TREE_ITEM_EXPANDED, self.OnTreeItemExpanded, self.Tree)
        self.Bind(wx.EVT_TREE_ITEM_COLLAPSED, self.OnTreeItemCollapsed, self.Tree)
        self.Bind(wx.EVT_TREE_BEGIN_LABEL_EDIT, self.OnTreeBeginLabelEdit, self.Tree)
        self.Bind(wx.EVT_TREE_END_LABEL_EDIT, self.OnTreeEndLabelEdit, self.Tree)
        main_sizer.AddWindow(self.Tree, 1, flag=wx.GROW)

        if filter is not None:
            self.Filter = wx.ComboBox(self, style=wx.CB_READONLY)
            self.Bind(wx.EVT_COMBOBOX, self.OnFilterChanged, self.Filter)
            main_sizer.AddWindow(self.Filter, flag=wx.GROW)
        else:
            self.Filter = None

        self.SetSizer(main_sizer)

        self.Folder = folder
        self.Editable = editable

        self.TreeImageList = wx.ImageList(16, 16)
        self.TreeImageDict = {}
        for item_type, bitmap in [(DRIVE, "tree_drive"),
                                  (FOLDER, "tree_folder"),
                                  (FILE, "tree_file")]:
            self.TreeImageDict[item_type] = self.TreeImageList.Add(GetBitmap(bitmap))
        self.Tree.SetImageList(self.TreeImageList)

        self.Filters = {}
        if self.Filter is not None:
            filter_parts = filter.split("|")
            for idx in xrange(0, len(filter_parts), 2):
                if filter_parts[idx + 1] == "*.*":
                    self.Filters[filter_parts[idx]] = ""
                else:
                    self.Filters[filter_parts[idx]] = filter_parts[idx + 1].replace("*", "")
                self.Filter.Append(filter_parts[idx])
                if idx == 0:
                    self.Filter.SetStringSelection(filter_parts[idx])

            self.CurrentFilter = self.Filters[self.Filter.GetStringSelection()]
        else:
            self.CurrentFilter = ""
项目:imagepy    作者:Image-Py    | 项目源码 | 文件源码
def __init__( self, parent ):
        wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = "Plugins Tree", 
                            pos = wx.DefaultPosition, size = wx.Size( 452,300 ), 
                            style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL )
        logopath = os.path.join(root_dir, 'data/logo.ico')
        self.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_3DLIGHT ) )
        self.SetIcon(wx.Icon(logopath, wx.BITMAP_TYPE_ICO))
        self.SetSizeHints( wx.DefaultSize, wx.DefaultSize )
        bSizer1 = wx.BoxSizer( wx.HORIZONTAL )

        self.tre_plugins = wx.TreeCtrl( self, wx.ID_ANY, wx.DefaultPosition, 
                                        wx.DefaultSize, wx.TR_DEFAULT_STYLE )
        self.tre_plugins.SetMinSize( wx.Size( 200,-1 ) )

        bSizer1.Add( self.tre_plugins, 0, wx.ALL|wx.EXPAND, 5 )
        bSizer3 = wx.BoxSizer( wx.VERTICAL )
        bSizer4 = wx.BoxSizer( wx.HORIZONTAL )

        self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, "Plugin Infomation:",
                                            wx.DefaultPosition, wx.DefaultSize, 0 )
        self.m_staticText2.Wrap( -1 )
        bSizer4.Add( self.m_staticText2, 0, wx.ALL, 5 )

        self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, "[SourceCode]", 
                                            wx.DefaultPosition, wx.DefaultSize, 0 )
        self.m_staticText3.Wrap( -1 )
        self.m_staticText3.SetForegroundColour(
            wx.SystemSettings.GetColour( wx.SYS_COLOUR_HIGHLIGHT ) )

        bSizer4.Add( self.m_staticText3, 0, wx.ALL, 5 )
        bSizer3.Add( bSizer4, 0, wx.EXPAND, 5 )

        self.txt_info = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, 
                                     wx.DefaultPosition, wx.DefaultSize, wx.TE_MULTILINE )
        bSizer3.Add( self.txt_info, 1, wx.ALL|wx.EXPAND, 5 )


        bSizer1.Add( bSizer3, 1, wx.EXPAND, 5 )
        self.SetSizer( bSizer1 )
        self.Layout()

        self.Centre( wx.BOTH )

        # Connect Events
        self.tre_plugins.Bind( wx.EVT_TREE_ITEM_ACTIVATED, self.on_run )
        self.tre_plugins.Bind( wx.EVT_TREE_SEL_CHANGED, self.on_select )
        self.m_staticText3.Bind( wx.EVT_LEFT_DOWN, self.on_source )
        self.plg = None
        self.load()
项目:imagepy    作者:Image-Py    | 项目源码 | 文件源码
def __init__( self, parent ):
        wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = "Tools Tree", 
                            pos = wx.DefaultPosition, size = wx.Size( 452,300 ), 
                            style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL )
        logopath = os.path.join(root_dir, 'data/logo.ico')
        self.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_3DLIGHT ) )
        self.SetIcon(wx.Icon(logopath, wx.BITMAP_TYPE_ICO))
        self.SetSizeHints( wx.DefaultSize, wx.DefaultSize )
        bSizer1 = wx.BoxSizer( wx.HORIZONTAL )

        self.tre_plugins = wx.TreeCtrl( self, wx.ID_ANY, wx.DefaultPosition, 
                                        wx.DefaultSize, wx.TR_DEFAULT_STYLE )
        self.tre_plugins.SetMinSize( wx.Size( 200,-1 ) )

        bSizer1.Add( self.tre_plugins, 0, wx.ALL|wx.EXPAND, 5 )
        bSizer3 = wx.BoxSizer( wx.VERTICAL )
        bSizer4 = wx.BoxSizer( wx.HORIZONTAL )

        self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, "Tool Infomation:", 
                                            wx.DefaultPosition, wx.DefaultSize, 0 )
        self.m_staticText2.Wrap( -1 )
        bSizer4.Add( self.m_staticText2, 0, wx.ALL, 5 )

        self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, "[SourceCode]", 
                                            wx.DefaultPosition, wx.DefaultSize, 0 )
        self.m_staticText3.Wrap( -1 )
        self.m_staticText3.SetForegroundColour( 
            wx.SystemSettings.GetColour( wx.SYS_COLOUR_HIGHLIGHT ) )

        bSizer4.Add( self.m_staticText3, 0, wx.ALL, 5 )
        bSizer3.Add( bSizer4, 0, wx.EXPAND, 5 )

        self.txt_info = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, 
                                     wx.DefaultPosition, wx.DefaultSize, wx.TE_MULTILINE )
        bSizer3.Add( self.txt_info, 1, wx.ALL|wx.EXPAND, 5 )


        bSizer1.Add( bSizer3, 1, wx.EXPAND, 5 )
        self.SetSizer( bSizer1 )
        self.Layout()

        self.Centre( wx.BOTH )

        # Connect Events
        self.tre_plugins.Bind( wx.EVT_TREE_ITEM_ACTIVATED, self.on_run )
        self.tre_plugins.Bind( wx.EVT_TREE_SEL_CHANGED, self.on_select )
        self.m_staticText3.Bind( wx.EVT_LEFT_DOWN, self.on_source )
        self.plg = None
        self.load()