File: Browser.py

package info (click to toggle)
spe 0.8.2a%2Brepack-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 4,812 kB
  • ctags: 6,555
  • sloc: python: 45,491; makefile: 146; sh: 2
file content (30 lines) | stat: -rwxr-xr-x 885 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import wx
import os
import _spe.info as info

class Browser(wx.GenericDirCtrl) :
    def __init__ (self, parent, id, init_path=''):
        wx.GenericDirCtrl.__init__(self,parent,id,
            dir     = init_path,
            #size=(200,225),
            filter  = info.WILDCARD_EXTENDED,
            style   = wx.DIRCTRL_SHOW_FILTERS)
        self.dir    = init_path
        self.tree   = self.GetTreeCtrl()
        self.home   = os.path.dirname(info.INFO['userPath'])
        self.tree.Bind(wx.EVT_LEFT_DCLICK, self.onClick)
        self.tree.Bind(wx.EVT_RIGHT_DOWN, self.onClick)
        
    def update(self):
        self.SetPath(self.dir)
        
    #onClick
    def onClick (self, event) :
        event.Skip()
        path    = self.GetFilePath()
        if os.path.isfile(path): 
            self.open(path)
            
    def open(self, fname) : 
        pass