Changeset 34

Show
Ignore:
Timestamp:
09/24/07 12:17:23 (1 year ago)
Author:
steve
Message:

Implements opening another directory via O
Implements reloading of files via R

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • mactorii.py

    r33 r34  
    3131images = dict() 
    3232baselines = [] 
    33  
     33unloaded = None 
    3434renderables = None 
    3535 
     
    5555 
    5656display_picture = None 
     57 
     58root = None 
    5759 
    5860def on_mouse_motion(x,y,dx,dy): 
     
    103105        global display_picture 
    104106        global win 
     107        global files 
     108        global unloaded 
     109        global root 
    105110         
    106111        if symbol == key.LEFT: 
     
    158163                         
    159164                        display_picture = pyglet_image.ImageData(im.size[0],im.size[1],"RGB",im.tostring()) 
    160                          
     165         
     166        if symbol == key.O: 
     167                dirname = tkFileDialog.askdirectory(parent=root,initialdir="~",title='Please select a directory') 
     168 
     169                if len(dirname ) > 0: 
     170                        import dircache 
     171                        ls = dircache.listdir(dirname) 
     172                        ls = list(ls) 
     173                        dircache.annotate(dirname, ls) 
     174 
     175                        files = ["%s%s%s"%(dirname,os.path.sep,e) for e in ls if not e.endswith('/')] 
     176                        unloaded = list(files) 
     177                         
     178                        images = dict() 
     179                                 
     180        if symbol == key.R: 
     181                unloaded = list(files) 
     182                images = dict() 
     183                 
    161184def strip_width(): 
    162185        """returns the width of the strip in pixels""" 
     
    337360        global fps_display 
    338361        global display_picture 
     362        global unloaded 
     363        global root 
    339364                 
    340365        # order is important here. window_setup must be setup first! Likewise with font 
     
    344369        root = Tkinter.Tk() 
    345370        root.withdraw() 
     371         
    346372        if (sys.platform != "win32") and hasattr(sys, 'frozen'): 
    347373                root.tk.call('console', 'hide')