eric7/Utilities/__init__.py

branch
eric7
changeset 8346
c2b5cca019a1
parent 8318
962bce857696
child 8356
68ec9c3d4de5
equal deleted inserted replaced
8345:b2e19966263a 8346:c2b5cca019a1
51 51
52 # import these methods into the Utilities namespace 52 # import these methods into the Utilities namespace
53 from Globals import ( # __IGNORE_WARNING__ 53 from Globals import ( # __IGNORE_WARNING__
54 isWindowsPlatform, isLinuxPlatform, isMacPlatform, desktopName, 54 isWindowsPlatform, isLinuxPlatform, isMacPlatform, desktopName,
55 getConfigDir, setConfigDir, getPythonLibraryDirectory, 55 getConfigDir, setConfigDir, getPythonLibraryDirectory,
56 getPythonModulesDirectory, # TODO: eric7: delete this line
57 getPyQt5ModulesDirectory, getQtBinariesPath, getPyQtToolsPath, 56 getPyQt5ModulesDirectory, getQtBinariesPath, getPyQtToolsPath,
58 qVersionTuple) 57 qVersionTuple)
59 58
60 from E5Gui.E5Application import e5App 59 from E5Gui.E5Application import e5App
61 60
1597 else: 1596 else:
1598 return match.start() 1597 return match.start()
1599 1598
1600 1599
1601 ############################################################################### 1600 ###############################################################################
1602 # functions for environment handling 1601 ## functions for environment handling
1603 ############################################################################### 1602 ###############################################################################
1604 1603
1605 1604
1606 def getEnvironmentEntry(key, default=None): 1605 def getEnvironmentEntry(key, default=None):
1607 """ 1606 """
1649 entries = [e for e in QProcess.systemEnvironment() 1648 entries = [e for e in QProcess.systemEnvironment()
1650 if filterRe.search(e) is not None] 1649 if filterRe.search(e) is not None]
1651 return len(entries) > 0 1650 return len(entries) > 0
1652 1651
1653 ############################################################################### 1652 ###############################################################################
1654 # Qt utility functions below 1653 ## Qt utility functions below
1655 ############################################################################### 1654 ###############################################################################
1656 1655
1657 1656
1658 def generateQtToolName(toolname): 1657 def generateQtToolName(toolname):
1659 """ 1658 """
1722 newArgs += args 1721 newArgs += args
1723 1722
1724 return ("open", newArgs) 1723 return ("open", newArgs)
1725 1724
1726 ############################################################################### 1725 ###############################################################################
1727 # PyQt utility functions below 1726 ## PyQt utility functions below
1728 ############################################################################### 1727 ###############################################################################
1729 1728
1730 1729
1731 def generatePyQtToolPath(toolname, alternatives=None): 1730 def generatePyQtToolPath(toolname, alternatives=None):
1732 """ 1731 """
1757 exe = ex_ 1756 exe = ex_
1758 1757
1759 return exe 1758 return exe
1760 1759
1761 ############################################################################### 1760 ###############################################################################
1762 # PySide2/PySide6 utility functions below 1761 ## PySide2/PySide6 utility functions below
1763 ############################################################################### 1762 ###############################################################################
1764 1763
1765 1764
1766 def generatePySideToolPath(toolname, variant=2): 1765 def generatePySideToolPath(toolname, variant=2):
1767 """ 1766 """
1827 proc.start(interpreter, args) 1826 proc.start(interpreter, args)
1828 finished = proc.waitForFinished(30000) 1827 finished = proc.waitForFinished(30000)
1829 return finished and proc.exitCode() == 0 1828 return finished and proc.exitCode() == 0
1830 1829
1831 ############################################################################### 1830 ###############################################################################
1832 # Other utility functions below 1831 ## Other utility functions below
1833 ############################################################################### 1832 ###############################################################################
1834 1833
1835 1834
1836 def generateVersionInfo(linesep='\n'): 1835 def generateVersionInfo(linesep='\n'):
1837 """ 1836 """
1855 1854
1856 info = ["Version Numbers:"] 1855 info = ["Version Numbers:"]
1857 1856
1858 info.append(" Python {0}, {1}".format(sys.version.split()[0], sizeStr)) 1857 info.append(" Python {0}, {1}".format(sys.version.split()[0], sizeStr))
1859 info.append(" Qt {0}".format(qVersion())) 1858 info.append(" Qt {0}".format(qVersion()))
1860 info.append(" PyQt {0}".format(PYQT_VERSION_STR)) 1859 info.append(" PyQt6 {0}".format(PYQT_VERSION_STR))
1861 try: 1860 try:
1862 from PyQt6 import QtChart 1861 from PyQt6 import QtCharts
1863 info.append(" PyQtChart {0}".format(QtChart.PYQT_CHART_VERSION_STR)) 1862 info.append(" PyQt6-Charts {0}".format(
1863 QtCharts.PYQT_CHART_VERSION_STR))
1864 except (ImportError, AttributeError): 1864 except (ImportError, AttributeError):
1865 info.append(" PyQtChart not installed") 1865 info.append(" PyQt6-Charts not installed")
1866 try: 1866 try:
1867 from PyQt6 import QtWebEngine 1867 from PyQt6 import QtWebEngine
1868 info.append(" PyQtWebEngine {0}".format( 1868 info.append(" PyQt6-WebEngine {0}".format(
1869 QtWebEngine.PYQT_WEBENGINE_VERSION_STR)) 1869 QtWebEngine.PYQT_WEBENGINE_VERSION_STR))
1870 except (ImportError, AttributeError): 1870 except (ImportError, AttributeError):
1871 info.append(" PyQtWebEngine not installed") 1871 info.append(" PyQt6-WebEngine not installed")
1872 info.append(" QScintilla {0}".format(QSCINTILLA_VERSION_STR)) 1872 info.append(" QScintilla {0}".format(QSCINTILLA_VERSION_STR))
1873 info.append(" sip {0}".format(sip_version_str)) 1873 info.append(" sip {0}".format(sip_version_str))
1874 with contextlib.suppress(ImportError): 1874 with contextlib.suppress(ImportError):
1875 from PyQt6 import QtWebEngineWidgets # __IGNORE_WARNING__ 1875 from PyQt6 import QtWebEngineWidgets # __IGNORE_WARNING__
1876 from WebBrowser.Tools import WebBrowserTools 1876 from WebBrowser.Tools import WebBrowserTools
1988 sysPath.remove("") 1988 sysPath.remove("")
1989 1989
1990 return sysPath 1990 return sysPath
1991 1991
1992 ############################################################################### 1992 ###############################################################################
1993 # posix compatibility functions below 1993 ## posix compatibility functions below
1994 ############################################################################### 1994 ###############################################################################
1995 1995
1996 # None right now 1996 # None right now
1997 1997
1998 ############################################################################### 1998 ###############################################################################
1999 # win32 compatibility functions below 1999 ## win32 compatibility functions below
2000 ############################################################################### 2000 ###############################################################################
2001 2001
2002 2002
2003 def win32_Kill(pid): 2003 def win32_Kill(pid):
2004 """ 2004 """

eric ide

mercurial