Extended the error report to send the desktop environment in use (Linux only).

Mon, 14 May 2018 19:40:29 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Mon, 14 May 2018 19:40:29 +0200
changeset 6289
f481df37413c
parent 6288
67ae52179c8b
child 6290
bf4624957d2d

Extended the error report to send the desktop environment in use (Linux only).

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.Globals.__init__.html file | annotate | diff | comparison | revisions
Globals/__init__.py file | annotate | diff | comparison | revisions
Utilities/__init__.py file | annotate | diff | comparison | revisions
--- a/APIs/Python3/eric6.api	Sun May 13 14:58:23 2018 +0200
+++ b/APIs/Python3/eric6.api	Mon May 14 19:40:29 2018 +0200
@@ -1672,6 +1672,7 @@
 eric6.Globals.compatibility_fixes.load_sourceAsStr?4(*args)
 eric6.Globals.compatibility_fixes.open?4(filein, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True)
 eric6.Globals.configDir?7
+eric6.Globals.desktopName?4()
 eric6.Globals.findPythonInterpreters?4(pyVersion)
 eric6.Globals.getConfigDir?4()
 eric6.Globals.getPyQt5ModulesDirectory?4()
Binary file Documentation/Help/source.qch has changed
--- a/Documentation/Help/source.qhp	Sun May 13 14:58:23 2018 +0200
+++ b/Documentation/Help/source.qhp	Mon May 14 19:40:29 2018 +0200
@@ -18535,6 +18535,7 @@
       <keyword name="decodeBytes" id="decodeBytes" ref="eric6.Utilities.__init__.html#decodeBytes" />
       <keyword name="decodeString" id="decodeString" ref="eric6.Utilities.__init__.html#decodeString" />
       <keyword name="decryptData" id="decryptData" ref="eric6.Utilities.crypto.py3AES.html#decryptData" />
+      <keyword name="desktopName" id="desktopName" ref="eric6.Globals.__init__.html#desktopName" />
       <keyword name="determinePyQtVariant" id="determinePyQtVariant" ref="eric6.install.html#determinePyQtVariant" />
       <keyword name="determinePythonVersion" id="determinePythonVersion" ref="eric6.Utilities.__init__.html#determinePythonVersion" />
       <keyword name="direntries" id="direntries" ref="eric6.Utilities.__init__.html#direntries" />
--- a/Documentation/Source/eric6.Globals.__init__.html	Sun May 13 14:58:23 2018 +0200
+++ b/Documentation/Source/eric6.Globals.__init__.html	Mon May 14 19:40:29 2018 +0200
@@ -37,6 +37,9 @@
 <td><a href="#checkBlacklistedVersions">checkBlacklistedVersions</a></td>
 <td>Module functions to check for blacklisted versions of the prerequisites.</td>
 </tr><tr>
+<td><a href="#desktopName">desktopName</a></td>
+<td>Function to determine the name of the desktop environment used (Linux only).</td>
+</tr><tr>
 <td><a href="#findPythonInterpreters">findPythonInterpreters</a></td>
 <td>Module function for searching a Python interpreter.</td>
 </tr><tr>
@@ -109,6 +112,25 @@
 </dl>
 <div align="right"><a href="#top">Up</a></div>
 <hr /><hr />
+<a NAME="desktopName" ID="desktopName"></a>
+<h2>desktopName</h2>
+<b>desktopName</b>(<i></i>)
+<p>
+    Function to determine the name of the desktop environment used
+    (Linux only).
+</p><dl>
+<dt>Returns:</dt>
+<dd>
+name of the desktop environment
+</dd>
+</dl><dl>
+<dt>Return Type:</dt>
+<dd>
+str
+</dd>
+</dl>
+<div align="right"><a href="#top">Up</a></div>
+<hr /><hr />
 <a NAME="findPythonInterpreters" ID="findPythonInterpreters"></a>
 <h2>findPythonInterpreters</h2>
 <b>findPythonInterpreters</b>(<i>pyVersion</i>)
--- a/Globals/__init__.py	Sun May 13 14:58:23 2018 +0200
+++ b/Globals/__init__.py	Mon May 14 19:40:29 2018 +0200
@@ -43,7 +43,7 @@
     
     @return flag indicating Windows platform (boolean)
     """
-    return sys.platform.startswith("win")
+    return sys.platform.startswith(("win", "cygwin"))
 
 
 def isMacPlatform():
@@ -64,6 +64,32 @@
     return sys.platform.startswith("linux")
 
 
+def desktopName():
+    """
+    Function to determine the name of the desktop environment used
+    (Linux only).
+    
+    @return name of the desktop environment
+    @rtype str
+    """
+    if not isLinuxPlatform():
+        return ""
+    
+    currDesktop = os.environ.get("XDG_CURRENT_DESKTOP", "")
+    if currDesktop:
+        return currDesktop
+    
+    currDesktop = os.environ.get("XDG_SESSION_DESKTOP", "")
+    if currDesktop:
+        return currDesktop
+    
+    currDesktop = os.environ.get("GDMSESSION", "")
+    if currDesktop:
+        return currDesktop
+    
+    return ""
+
+
 def checkBlacklistedVersions():
     """
     Module functions to check for blacklisted versions of the prerequisites.
--- a/Utilities/__init__.py	Sun May 13 14:58:23 2018 +0200
+++ b/Utilities/__init__.py	Mon May 14 19:40:29 2018 +0200
@@ -63,9 +63,10 @@
 
 # import these methods into the Utilities namespace
 from Globals import (  # __IGNORE_WARNING__
-    isWindowsPlatform, isLinuxPlatform, isMacPlatform, getConfigDir,
-    setConfigDir, getPythonModulesDirectory, getPyQt5ModulesDirectory,
-    getQtBinariesPath, getPyQtToolsPath, qVersionTuple)
+    isWindowsPlatform, isLinuxPlatform, isMacPlatform, desktopName,
+    getConfigDir, setConfigDir, getPythonModulesDirectory,
+    getPyQt5ModulesDirectory, getQtBinariesPath, getPyQtToolsPath,
+    qVersionTuple)
 
 from E5Gui.E5Application import e5App
 
@@ -1849,6 +1850,10 @@
         Program, Version, linesep * 2)
     info += "Platform: {0}{1}{2}{3}".format(
         sys.platform, linesep, sys.version, linesep)
+    desktop = desktopName()
+    if desktop:
+        info += linesep
+        info += "Desktop: {0}{1}".format(desktop, linesep)
     
     return info
 

eric ide

mercurial