Fixed an issue in the file browser model caused some error message being shown upon startup in certain situations.

Wed, 19 Apr 2017 19:02:34 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 19 Apr 2017 19:02:34 +0200
changeset 5708
9b01b4004314
parent 5707
1273cd92a8f4
child 5709
f81d0eca2c62

Fixed an issue in the file browser model caused some error message being shown upon startup in certain situations.

APIs/Python3/eric6.api file | annotate | diff | comparison | revisions
Documentation/Help/source.qch file | annotate | diff | comparison | revisions
Documentation/Help/source.qhp file | annotate | diff | comparison | revisions
Documentation/Source/eric6.Utilities.__init__.html file | annotate | diff | comparison | revisions
UI/BrowserModel.py file | annotate | diff | comparison | revisions
Utilities/__init__.py file | annotate | diff | comparison | revisions
--- a/APIs/Python3/eric6.api	Tue Apr 18 19:22:54 2017 +0200
+++ b/APIs/Python3/eric6.api	Wed Apr 19 19:02:34 2017 +0200
@@ -9207,6 +9207,7 @@
 eric6.Utilities.html_encode?4(text, pattern=_escape)
 eric6.Utilities.html_udecode?4(text, pattern=_uunescape)
 eric6.Utilities.html_uencode?4(text, pattern=_uescape)
+eric6.Utilities.isDrive?4(path)
 eric6.Utilities.isExecutable?4(exe)
 eric6.Utilities.isinpath?4(file)
 eric6.Utilities.joinext?4(prefix, ext)
Binary file Documentation/Help/source.qch has changed
--- a/Documentation/Help/source.qhp	Tue Apr 18 19:22:54 2017 +0200
+++ b/Documentation/Help/source.qhp	Wed Apr 19 19:02:34 2017 +0200
@@ -16774,6 +16774,7 @@
       <keyword name="ircTimestamp" id="ircTimestamp" ref="eric6.Network.IRC.IrcUtilities.html#ircTimestamp" />
       <keyword name="isConfigured" id="isConfigured" ref="eric6.Preferences.__init__.html#isConfigured" />
       <keyword name="isCupsAvailable" id="isCupsAvailable" ref="eric6.WebBrowser.Tools.FilePrinter.html#isCupsAvailable" />
+      <keyword name="isDrive" id="isDrive" ref="eric6.Utilities.__init__.html#isDrive" />
       <keyword name="isExecutable" id="isExecutable" ref="eric6.Utilities.__init__.html#isExecutable" />
       <keyword name="isLinuxPlatform" id="isLinuxPlatform" ref="eric6.Globals.__init__.html#isLinuxPlatform" />
       <keyword name="isMacPlatform" id="isMacPlatform" ref="eric6.Globals.__init__.html#isMacPlatform" />
--- a/Documentation/Source/eric6.Utilities.__init__.html	Tue Apr 18 19:22:54 2017 +0200
+++ b/Documentation/Source/eric6.Utilities.__init__.html	Wed Apr 19 19:02:34 2017 +0200
@@ -175,6 +175,9 @@
 <td><a href="#html_uencode">html_uencode</a></td>
 <td>Function to correctly encode a unicode text for html.</td>
 </tr><tr>
+<td><a href="#isDrive">isDrive</a></td>
+<td>Function to check, if a path is a Windows drive.</td>
+</tr><tr>
 <td><a href="#isExecutable">isExecutable</a></td>
 <td>Function to check, if a file is executable.</td>
 </tr><tr>
@@ -1258,6 +1261,29 @@
 </dl>
 <div align="right"><a href="#top">Up</a></div>
 <hr /><hr />
+<a NAME="isDrive" ID="isDrive"></a>
+<h2>isDrive</h2>
+<b>isDrive</b>(<i>path</i>)
+<p>
+    Function to check, if a path is a Windows drive.
+</p><dl>
+<dt><i>path</i> (str)</dt>
+<dd>
+path name to be checked
+</dd>
+</dl><dl>
+<dt>Returns:</dt>
+<dd>
+flag indicating a Windows drive
+</dd>
+</dl><dl>
+<dt>Return Type:</dt>
+<dd>
+bool
+</dd>
+</dl>
+<div align="right"><a href="#top">Up</a></div>
+<hr /><hr />
 <a NAME="isExecutable" ID="isExecutable"></a>
 <h2>isExecutable</h2>
 <b>isExecutable</b>(<i>exe</i>)
--- a/UI/BrowserModel.py	Tue Apr 18 19:22:54 2017 +0200
+++ b/UI/BrowserModel.py	Wed Apr 19 19:02:34 2017 +0200
@@ -993,7 +993,8 @@
         BrowserItem.__init__(self, parent, dn)
         
         self.type_ = BrowserItemDirectory
-        if os.path.lexists(self._dirName) and os.path.islink(self._dirName):
+        if not Utilities.isDrive(self._dirName) and \
+           os.path.lexists(self._dirName) and os.path.islink(self._dirName):
             self.symlink = True
             self.icon = UI.PixmapCache.getSymlinkIcon("dirClosed.png")
         else:
--- a/Utilities/__init__.py	Tue Apr 18 19:22:54 2017 +0200
+++ b/Utilities/__init__.py	Wed Apr 19 19:02:34 2017 +0200
@@ -1037,6 +1037,24 @@
     @return flag indicating executable status (boolean)
     """
     return os.access(exe, os.X_OK)
+
+
+def isDrive(path):
+    """
+    Function to check, if a path is a Windows drive.
+    
+    @param path path name to be checked
+    @type str
+    @return flag indicating a Windows drive
+    @rtype bool
+    """
+    isDrive = False
+    drive, directory = os.path.splitdrive(path)
+    if drive and len(drive) == 2 and drive.endswith(":") and \
+       directory in ["", "\\", "/"]:
+        isDrive = True
+    
+    return isDrive
     
 
 def samepath(f1, f2):

eric ide

mercurial