Changeset 1502
- Timestamp:
- 07/22/08 21:11:29 (5 weeks ago)
- Location:
- trunk/peppy
- Files:
-
- 4 modified
-
dired_menu.py (modified) (2 diffs)
-
hsi/hsi_major_mode_proxy.py (modified) (1 diff)
-
major.py (modified) (8 diffs)
-
yapsy/plugins.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/peppy/dired_menu.py
r1301 r1502 162 162 return [] 163 163 164 def attemptOpen(self, buffer ):164 def attemptOpen(self, buffer, url): 165 165 # use a copy of the url because don't want to change the buffer's url 166 166 # unless it turns out that we want to change the scheme 167 refcopy = vfs.get_reference(unicode( buffer.url))167 refcopy = vfs.get_reference(unicode(url)) 168 168 #print "url = %s" % str(refcopy) 169 169 if refcopy.scheme == "file" and vfs.exists(refcopy) and vfs.get_size(refcopy) > 0: … … 171 171 refcopy.scheme = "tar" 172 172 if vfs.exists(refcopy): 173 # OK, we do a bit of a trick here: rewrite the url in the174 # buffer object to changethe scheme to tar:175 buffer.url.scheme = "tar"173 # OK, we do a bit of a trick here: rewrite the url to change 174 # the scheme to tar: 175 url.scheme = "tar" 176 176 return (DiredMode, []) 177 177 return (None, []) -
trunk/peppy/hsi/hsi_major_mode_proxy.py
r1501 r1502 12 12 """HSI viewer plugin to register modes and user interface. 13 13 """ 14 def attemptOpen(self, buffer): 15 url = buffer.raw_url 14 def attemptOpen(self, buffer, url): 16 15 assert self.dprint("Trying to open url: %s" % repr(unicode(url))) 17 16 try: -
trunk/peppy/major.py
r1501 r1502 1198 1198 cls.dprint("checking plugin %s" % str(plugin.__class__.__mro__)) 1199 1199 cls.current_modes.extend(plugin.getMajorModes()) 1200 dprint("Currently active major modes: %s" % str(cls.current_modes))1200 cls.dprint("Currently active major modes: %s" % str(cls.current_modes)) 1201 1201 cls.ignored_modes = set() 1202 1202 … … 1209 1209 @classmethod 1210 1210 def ignoreMode(cls, mode): 1211 dprint("Ignoring mode %s" % mode)1211 cls.dprint("Ignoring mode %s" % mode) 1212 1212 cls.skipped_modes.add(mode) 1213 1213 1214 1214 @classmethod 1215 def match(cls, buffer, magic_size=None ):1215 def match(cls, buffer, magic_size=None, url=None): 1216 1216 app = wx.GetApp() 1217 1217 if magic_size is None: 1218 1218 magic_size = app.classprefs.magic_size 1219 if url is None: 1220 url = buffer.raw_url 1219 1221 1220 1222 plugins = app.plugin_manager.getActivePluginObjects() … … 1222 1224 1223 1225 # Try to match a specific protocol 1224 modes = cls.scanProtocol( buffer.raw_url)1226 modes = cls.scanProtocol(url) 1225 1227 cls.dprint("scanProtocol matches %s" % modes) 1226 1228 if modes: … … 1230 1232 # generate a list of possible modes 1231 1233 try: 1232 metadata = vfs.get_metadata( buffer.raw_url)1234 metadata = vfs.get_metadata(url) 1233 1235 except: 1234 1236 metadata = {'mimetype': None, … … 1237 1239 'description': None, 1238 1240 } 1239 modes, binary_modes = cls.scanURL( buffer.raw_url, metadata)1241 modes, binary_modes = cls.scanURL(url, metadata) 1240 1242 cls.dprint("scanURL matches %s (binary: %s) using metadata %s" % (modes, binary_modes, metadata)) 1241 1243 … … 1303 1305 # As a last resort to open a specific mode, attempt to open it 1304 1306 # with any third-party openers that have been registered 1305 mode = cls.attemptOpen(plugins, buffer )1307 mode = cls.attemptOpen(plugins, buffer, url) 1306 1308 cls.dprint("attemptOpen matches %s" % mode) 1307 1309 if mode: … … 1491 1493 1492 1494 @classmethod 1493 def attemptOpen(cls, plugins, buffer ):1495 def attemptOpen(cls, plugins, buffer, url): 1494 1496 """Use the mode's attemptOpen method to see if it recognizes the url. 1495 1497 … … 1501 1503 for plugin in plugins: 1502 1504 try: 1503 exact, generics = plugin.attemptOpen(buffer )1505 exact, generics = plugin.attemptOpen(buffer, url) 1504 1506 if exact: 1505 1507 return exact -
trunk/peppy/yapsy/plugins.py
r1235 r1502 310 310 return 311 311 312 def attemptOpen(self, buffer ):312 def attemptOpen(self, buffer, url): 313 313 """Last resort to major mode matching: attempting to open the url. 314 314 … … 319 319 320 320 buffer: the Buffer object to attempt to load 321 322 url: the user specified URL (which may be different from the buffer's 323 idea of what the URL is if the buffer already exists and we're trying 324 to create a new view using a different major mode) 321 325 322 326 @returns: tuple (exact, generic_list) where when exact is not None the
