Beispiel #1
0
 def setUrl(self, url):
     """If URL is a file:// URL, store the filename of it as base
     directory for the "save as" dialog."""
     self.basedir = ""
     if url and url.startswith("file://"):
         urlparts = urlparse.urlsplit(url)
         path = get_os_filename(urlparts[2])
         if os.path.exists(path):
             self.basedir = path
Beispiel #2
0
 def setUrl (self, url):
     """If URL is a file:// URL, store the filename of it as base
     directory for the "save as" dialog."""
     self.basedir = ""
     if url and url.startswith("file://"):
         urlparts = urlparse.urlsplit(url)
         path = get_os_filename(urlparts[2])
         if os.path.exists(path):
             self.basedir = path
Beispiel #3
0
 def can_view_parent_source (self, url_data):
     """Determine if parent URL source can be retrieved."""
     if not url_data.valid:
         return False
     parent = url_data.parent_url
     if not parent:
         return False
     # Directory contents are dynamically generated, so it makes
     # no sense in viewing/editing them.
     if parent.startswith(u"file:"):
         path = urlparse.urlsplit(parent)[2]
         return not os.path.isdir(get_os_filename(path))
     if parent.startswith((u"ftp:", u"ftps:")):
         path = urlparse.urlsplit(parent)[2]
         return bool(path) and not path.endswith(u'/')
     # Only HTTP left
     return parent.startswith((u"http:", u"https:"))
Beispiel #4
0
 def can_view_parent_source(self, url_data):
     """Determine if parent URL source can be retrieved."""
     if not url_data.valid:
         return False
     parent = url_data.parent_url
     if not parent:
         return False
     # Directory contents are dynamically generated, so it makes
     # no sense in viewing/editing them.
     if parent.startswith(u"file:"):
         path = urlparse.urlsplit(parent)[2]
         return not os.path.isdir(get_os_filename(path))
     if parent.startswith((u"ftp:", u"ftps:")):
         path = urlparse.urlsplit(parent)[2]
         return bool(path) and not path.endswith(u'/')
     # Only HTTP left
     return parent.startswith((u"http:", u"https:"))