src/eric7/Utilities/__init__.py

branch
eric7-maintenance
changeset 9940
a57c188857e9
parent 9725
b9a29a7aa820
parent 9846
f5a17960408a
child 10079
0222a480e93d
equal deleted inserted replaced
9833:9308099b7d38 9940:a57c188857e9
32 qVersion, 32 qVersion,
33 ) 33 )
34 34
35 from eric7 import Preferences 35 from eric7 import Preferences
36 from eric7.EricWidgets.EricApplication import ericApp 36 from eric7.EricWidgets.EricApplication import ericApp
37 37 from eric7.SystemUtilities import DesktopUtilities, OSUtilities
38 # TODO: remove these with release 23.4
39 # imports from eric7.SystemUtilities are for backward compatibility
40 from eric7.Globals import ( # __IGNORE_FLAKES_WARNING__
41 desktopName,
42 getConfig,
43 getConfigDir,
44 getPythonExecutable,
45 getPythonLibraryDirectory,
46 getPythonScriptsDirectory,
47 sessionType,
48 setConfigDir,
49 toBool,
50 )
51 from eric7.SystemUtilities import DesktopUtilities
52 from eric7.SystemUtilities.FileSystemUtilities import ( # __IGNORE_FLAKES_WARNING__
53 absolutePath,
54 absoluteUniversalPath,
55 compactPath,
56 direntries,
57 findVolume,
58 fromNativeSeparators,
59 getDirs,
60 getExecutablePath,
61 getExecutablePaths,
62 getWindowsExecutablePath,
63 isDrive,
64 isExecutable,
65 isinpath,
66 joinext,
67 normabsjoinpath,
68 normcaseabspath,
69 normcasepath,
70 normjoinpath,
71 relativeUniversalPath,
72 samefilepath,
73 samepath,
74 splitPath,
75 startswithPath,
76 toNativeSeparators,
77 )
78 from eric7.SystemUtilities.OSUtilities import ( # __IGNORE_FLAKES_WARNING__
79 getEnvironmentEntry,
80 hasEnvironmentEntry,
81 getHomeDir,
82 getRealName,
83 getUserName,
84 getRealName,
85 isLinuxPlatform,
86 isMacPlatform,
87 isWindowsPlatform,
88 win32_getRealName,
89 win32_GetUserName,
90 win32_Kill,
91 )
92 from eric7.SystemUtilities.PythonUtilities import ( # __IGNORE_FLAKES_WARNING__
93 determinePythonVersion,
94 getPythonLibPath,
95 getPythonVersion,
96 )
97 from eric7.SystemUtilities.QtUtilities import ( # __IGNORE_FLAKES_WARNING__
98 checkPyside,
99 generatePyQtToolPath,
100 generatePySideToolPath,
101 generateQtToolName,
102 getPyQt6ModulesDirectory,
103 getPyQtToolsPath,
104 getQtBinariesPath,
105 getQtMacBundle,
106 prepareQtMacBundle,
107 qVersionTuple,
108 )
109 from eric7.UI.Info import Program, Version 38 from eric7.UI.Info import Program, Version
110 39
111 40
112 def __showwarning(message, category, filename, lineno, file=None, line=""): 41 def __showwarning(message, category, filename, lineno, file=None, line=""):
113 """ 42 """
1013 if fn is None: 942 if fn is None:
1014 fn = "not_available" 943 fn = "not_available"
1015 return fn 944 return fn
1016 elif code in ["H", "%H"]: 945 elif code in ["H", "%H"]:
1017 # home directory 946 # home directory
1018 return getHomeDir() 947 return OSUtilities.getHomeDir()
1019 elif code in ["L", "%L"]: 948 elif code in ["L", "%L"]:
1020 # line of the cursor of the current editor 949 # line of the cursor of the current editor
1021 aw = ericApp().getObject("ViewManager").activeWindow() 950 aw = ericApp().getObject("ViewManager").activeWindow()
1022 if aw is None: 951 if aw is None:
1023 line = 0 952 line = 0
1038 else: 967 else:
1039 text = aw.selectedText() 968 text = aw.selectedText()
1040 return text 969 return text
1041 elif code in ["U", "%U"]: 970 elif code in ["U", "%U"]:
1042 # username 971 # username
1043 un = getUserName() 972 un = OSUtilities.getUserName()
1044 if un is None: 973 if un is None:
1045 return code 974 return code
1046 else: 975 else:
1047 return un 976 return un
1048 elif code in ["%", "%%"]: 977 elif code in ["%", "%%"]:
1206 @type str 1135 @type str
1207 @return string with distribution infos 1136 @return string with distribution infos
1208 @rtype str 1137 @rtype str
1209 """ 1138 """
1210 info = [] 1139 info = []
1211 if isLinuxPlatform(): 1140 if OSUtilities.isLinuxPlatform():
1212 releaseList = glob.glob("/etc/*-release") 1141 releaseList = glob.glob("/etc/*-release")
1213 if releaseList: 1142 if releaseList:
1214 info.append("Distribution Info:") 1143 info.append("Distribution Info:")
1215 for rfile in releaseList: 1144 for rfile in releaseList:
1216 try: 1145 try:

eric ide

mercurial