Changeset 191

Show
Ignore:
Timestamp:
Thu Nov 8 14:54:19 2007
Author:
manatlan
Message:

- rob w. patch for the d'n'd on win with recent gtk

Files:

Legend:

Unmodified
Added
Removed
Modified
  • trunk/jbrout.py

    r188 r191  
    2077 2077  
    2078 2078     def on_btn_addFolder_drag_data_received(self, widget, *args):  
    2079           # should only be called on *nix platforms ;-)  
    2080           def get_file_path_from_dnd_dropped_uri(uri):  
      2079  
      2080         #def get_file_path_from_dnd_dropped_uri(uri):  
      2081         #    path = urllib.url2pathname(uri) # escape special chars  
      2082         #    path = path.strip('\r\n\x00') # remove \r\n and NULL  
      2083         #  
      2084         #    # get the path to file  
      2085         #    if path.startswith('file:\\\\\\'): # windows  
      2086         #        path = path[8:] # 8 is len('file:///')  
      2087         #    elif path.startswith('file://'): # nautilus, rox  
      2088         #        path = path[7:] # 7 is len('file://')  
      2089         #    elif path.startswith('file:'): # xffm  
      2090         #        path = path[5:] # 5 is len('file:')  
      2091         #    return unicode(path)  
      2092  
      2093         def get_file_path_from_dnd_dropped_uri(uri):    # rob wallace was here  
      2094             if sys.platform[:3].lower()=="win":  
      2095                 if uri.startswith('file:///'):  
      2096                     uri = uri[8:] # 8 is len('file:///')  
      2097                 elif uri.startswith('file:\\\\\\'):  
      2098                     uri = uri[8:] # 8 is len('file:///')  
      2099             else:  
      2100                 if uri.startswith('file:///'): # nautilus, rox  
      2101                     uri = uri[7:] # 7 is len('file://')  
      2102                 elif uri.startswith('file:'): # xffm  
      2103                     uri = uri[5:] # 5 is len('file:')  
    2081 2104             path = urllib.url2pathname(uri) # escape special chars  
    2082 2105             path = path.strip('\r\n\x00') # remove \r\n and NULL  
    2083    
    2084               # get the path to file  
    2085               if path.startswith('file:\\\\\\'): # windows  
    2086                   path = path[8:] # 8 is len('file:///')  
    2087               elif path.startswith('file://'): # nautilus, rox  
    2088                   path = path[7:] # 7 is len('file://')  
    2089               elif path.startswith('file:'): # xffm  
    2090                   path = path[5:] # 5 is len('file:')  
    2091 2106             return unicode(path)  
    2092 2107  
      2108  
    2093 2109         context, x, y, selection, info, time = args  
    2094 2110  
     
    2103 2119                 list.append(path)  
    2104 2120  
    2105           # old way  
    2106           #----------------------------------  
    2107           #~ list=[]  
    2108           #~ for uri in selection.data.strip().split("\n"):  
    2109               #~ if uri[:7]=="file://":  
    2110                   #~ file = uri[7:].strip()  
    2111                   #~ file = file.encode(sys.getfilesystemencoding())  
    2112                   #~ file = urllib.unquote_plus(file)  
    2113                   #~ file = file.decode(sys.getfilesystemencoding())  
    2114                   #~ if os.path.isdir(file):  
    2115                       #~ list.append(file)  
    2116 2121         if list:  
    2117 2122             self.on_drop_folders_from_os(self.treeviewdb.get_model(),list)