lyrpy 2024.0.4__py3-none-any.whl → 2025.0.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of lyrpy might be problematic. Click here for more details.
- SRC/LIB/__init__.py +21 -0
- SRC/LIB/lyrpy/LUConst.py +358 -0
- {lyrpy → SRC/LIB/lyrpy}/LUDateTime.py +2 -4
- {lyrpy → SRC/LIB/lyrpy}/LUDecotators.py +2 -3
- {lyrpy → SRC/LIB/lyrpy}/LUDict.py +0 -1
- {lyrpy → SRC/LIB/lyrpy}/LUDoc.py +4 -3
- {lyrpy → SRC/LIB/lyrpy}/LUErrors.py +0 -1
- {lyrpy → SRC/LIB/lyrpy}/LUFile.py +115 -61
- {lyrpy → SRC/LIB/lyrpy}/LUFileUtils.py +60 -45
- {lyrpy → SRC/LIB/lyrpy}/LULog.py +267 -191
- {lyrpy → SRC/LIB/lyrpy}/LUObjects.py +4 -4
- {lyrpy → SRC/LIB/lyrpy}/LUObjectsYT.py +39 -22
- {lyrpy → SRC/LIB/lyrpy}/LUParserARG.py +2 -3
- {lyrpy → SRC/LIB/lyrpy}/LUParserINI.py +8 -3
- {lyrpy → SRC/LIB/lyrpy}/LUParserREG.py +5 -1
- {lyrpy → SRC/LIB/lyrpy}/LUQThread.py +6 -4
- {lyrpy → SRC/LIB/lyrpy}/LUQTimer.py +5 -5
- {lyrpy → SRC/LIB/lyrpy}/LUSheduler.py +24 -23
- SRC/LIB/lyrpy/LUTelegram.py +428 -0
- {lyrpy → SRC/LIB/lyrpy}/LUThread.py +7 -6
- {lyrpy → SRC/LIB/lyrpy}/LUTimer.py +5 -3
- {lyrpy → SRC/LIB/lyrpy}/LUVersion.py +4 -1
- {lyrpy → SRC/LIB/lyrpy}/LUYouTube.py +6 -7
- {lyrpy → SRC/LIB/lyrpy}/LUos.py +13 -3
- SRC/LIB/lyrpy/__init__.py +21 -0
- {lyrpy → SRC/LIB/lyrpy}/__main__.py +20 -19
- SRC/__init__.py +0 -0
- SRC/lyrpy/LUConsole.py +402 -0
- SRC/lyrpy/LUConst.py +358 -0
- SRC/lyrpy/LUDateTime.py +205 -0
- SRC/lyrpy/LUDecotators.py +417 -0
- SRC/lyrpy/LUDict.py +116 -0
- SRC/lyrpy/LUDoc.py +62 -0
- SRC/lyrpy/LUErrors.py +79 -0
- SRC/lyrpy/LUFile.py +1228 -0
- SRC/lyrpy/LUFileUtils.py +501 -0
- SRC/lyrpy/LULog.py +2324 -0
- SRC/lyrpy/LUNetwork.py +277 -0
- SRC/lyrpy/LUNumUtils.py +305 -0
- SRC/lyrpy/LUObjects.py +208 -0
- SRC/lyrpy/LUObjectsYT.py +846 -0
- SRC/lyrpy/LUParserARG.py +364 -0
- SRC/lyrpy/LUParserINI.py +376 -0
- SRC/lyrpy/LUParserREG.py +514 -0
- SRC/lyrpy/LUProc.py +110 -0
- SRC/lyrpy/LUQThread.py +141 -0
- SRC/lyrpy/LUQTimer.py +197 -0
- SRC/lyrpy/LUSheduler.py +941 -0
- SRC/lyrpy/LUStrDecode.py +223 -0
- SRC/lyrpy/LUStrUtils.py +633 -0
- SRC/lyrpy/LUSupport.py +124 -0
- SRC/lyrpy/LUTelegram.py +428 -0
- SRC/lyrpy/LUThread.py +177 -0
- SRC/lyrpy/LUTimer.py +141 -0
- SRC/lyrpy/LUVersion.py +383 -0
- SRC/lyrpy/LUYouTube.py +203 -0
- SRC/lyrpy/LUos.py +807 -0
- lyrpy/LUConst.py → SRC/lyrpy/LUsys.py +12 -10
- SRC/lyrpy/__init__.py +21 -0
- lyrpy/__init__.py → SRC/lyrpy/__main__.py +2 -3
- TESTS/__init__.py +0 -0
- TESTS/test_lyrpy.py +4 -0
- TESTS/test_main.py +10 -0
- __SRC/LIB/__init__.py +0 -0
- __SRC/LIB/lyrpy/LUConsole.py +402 -0
- __SRC/LIB/lyrpy/LUConst.py +358 -0
- __SRC/LIB/lyrpy/LUDateTime.py +205 -0
- __SRC/LIB/lyrpy/LUDecotators.py +417 -0
- __SRC/LIB/lyrpy/LUDict.py +116 -0
- __SRC/LIB/lyrpy/LUDoc.py +62 -0
- __SRC/LIB/lyrpy/LUErrors.py +79 -0
- __SRC/LIB/lyrpy/LUFile.py +1228 -0
- __SRC/LIB/lyrpy/LUFileUtils.py +501 -0
- __SRC/LIB/lyrpy/LULog.py +2324 -0
- __SRC/LIB/lyrpy/LUNetwork.py +277 -0
- __SRC/LIB/lyrpy/LUNumUtils.py +305 -0
- __SRC/LIB/lyrpy/LUObjects.py +208 -0
- __SRC/LIB/lyrpy/LUObjectsYT.py +846 -0
- __SRC/LIB/lyrpy/LUParserARG.py +364 -0
- __SRC/LIB/lyrpy/LUParserINI.py +376 -0
- __SRC/LIB/lyrpy/LUParserREG.py +514 -0
- __SRC/LIB/lyrpy/LUProc.py +110 -0
- __SRC/LIB/lyrpy/LUQThread.py +141 -0
- __SRC/LIB/lyrpy/LUQTimer.py +197 -0
- __SRC/LIB/lyrpy/LUSheduler.py +941 -0
- __SRC/LIB/lyrpy/LUStrDecode.py +223 -0
- __SRC/LIB/lyrpy/LUStrUtils.py +633 -0
- __SRC/LIB/lyrpy/LUSupport.py +124 -0
- __SRC/LIB/lyrpy/LUTelegram.py +428 -0
- __SRC/LIB/lyrpy/LUThread.py +177 -0
- __SRC/LIB/lyrpy/LUTimer.py +141 -0
- __SRC/LIB/lyrpy/LUVersion.py +383 -0
- __SRC/LIB/lyrpy/LUYouTube.py +203 -0
- __SRC/LIB/lyrpy/LUos.py +807 -0
- __SRC/LIB/lyrpy/LUsys.py +47 -0
- __SRC/LIB/lyrpy/__init__.py +21 -0
- __SRC/LIB/lyrpy/__main__.py +20 -0
- __SRC/__init__.py +0 -0
- ____src/__init__.py +0 -0
- ____src/lyrpy/LUConsole.py +402 -0
- ____src/lyrpy/LUConst.py +358 -0
- ____src/lyrpy/LUDateTime.py +205 -0
- ____src/lyrpy/LUDecotators.py +417 -0
- ____src/lyrpy/LUDict.py +116 -0
- ____src/lyrpy/LUDoc.py +62 -0
- ____src/lyrpy/LUErrors.py +79 -0
- ____src/lyrpy/LUFile.py +1228 -0
- ____src/lyrpy/LUFileUtils.py +501 -0
- ____src/lyrpy/LULog.py +2324 -0
- ____src/lyrpy/LUNetwork.py +277 -0
- ____src/lyrpy/LUNumUtils.py +305 -0
- ____src/lyrpy/LUObjects.py +208 -0
- ____src/lyrpy/LUObjectsYT.py +846 -0
- ____src/lyrpy/LUParserARG.py +364 -0
- ____src/lyrpy/LUParserINI.py +376 -0
- ____src/lyrpy/LUParserREG.py +514 -0
- ____src/lyrpy/LUProc.py +110 -0
- ____src/lyrpy/LUQThread.py +141 -0
- ____src/lyrpy/LUQTimer.py +197 -0
- ____src/lyrpy/LUSheduler.py +941 -0
- ____src/lyrpy/LUStrDecode.py +223 -0
- ____src/lyrpy/LUStrUtils.py +633 -0
- ____src/lyrpy/LUSupport.py +124 -0
- ____src/lyrpy/LUTelegram.py +428 -0
- ____src/lyrpy/LUThread.py +177 -0
- ____src/lyrpy/LUTimer.py +141 -0
- ____src/lyrpy/LUVersion.py +383 -0
- ____src/lyrpy/LUYouTube.py +203 -0
- ____src/lyrpy/LUos.py +807 -0
- ____src/lyrpy/LUsys.py +47 -0
- ____src/lyrpy/__init__.py +21 -0
- ____src/lyrpy/__main__.py +20 -0
- lyrpy-2025.0.2.dist-info/METADATA +21 -0
- lyrpy-2025.0.2.dist-info/RECORD +145 -0
- {lyrpy-2024.0.4.dist-info → lyrpy-2025.0.2.dist-info}/WHEEL +1 -1
- lyrpy-2025.0.2.dist-info/top_level.txt +2 -0
- lyrpy-2024.0.4.data/data/data/text.txt +0 -1
- lyrpy-2024.0.4.dist-info/METADATA +0 -44
- lyrpy-2024.0.4.dist-info/RECORD +0 -38
- lyrpy-2024.0.4.dist-info/top_level.txt +0 -1
- {lyrpy → SRC/LIB/lyrpy}/LUConsole.py +0 -0
- {lyrpy → SRC/LIB/lyrpy}/LUNetwork.py +0 -0
- {lyrpy → SRC/LIB/lyrpy}/LUNumUtils.py +0 -0
- {lyrpy → SRC/LIB/lyrpy}/LUProc.py +0 -0
- {lyrpy → SRC/LIB/lyrpy}/LUStrDecode.py +0 -0
- {lyrpy → SRC/LIB/lyrpy}/LUStrUtils.py +0 -0
- {lyrpy → SRC/LIB/lyrpy}/LUSupport.py +0 -0
- {lyrpy → SRC/LIB/lyrpy}/LUsys.py +0 -0
- {lyrpy-2024.0.4.dist-info → lyrpy-2025.0.2.dist-info/licenses}/LICENSE +0 -0
|
@@ -0,0 +1,514 @@
|
|
|
1
|
+
"""LUParserREG.py"""
|
|
2
|
+
# -*- coding: UTF-8 -*-
|
|
3
|
+
__annotations__ = """
|
|
4
|
+
=======================================================
|
|
5
|
+
Copyright (c) 2023
|
|
6
|
+
Author:
|
|
7
|
+
Lisitsin Y.R.
|
|
8
|
+
Project:
|
|
9
|
+
LU_PY
|
|
10
|
+
Python (LU)
|
|
11
|
+
Module:
|
|
12
|
+
LUParserREG.py
|
|
13
|
+
|
|
14
|
+
=======================================================
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
#------------------------------------------
|
|
18
|
+
# БИБЛИОТЕКИ python
|
|
19
|
+
#------------------------------------------
|
|
20
|
+
import enum
|
|
21
|
+
import platform
|
|
22
|
+
|
|
23
|
+
if platform.system() == 'Windows':
|
|
24
|
+
import winreg
|
|
25
|
+
#endif
|
|
26
|
+
|
|
27
|
+
#------------------------------------------
|
|
28
|
+
# БИБЛИОТЕКИ сторонние
|
|
29
|
+
#------------------------------------------
|
|
30
|
+
|
|
31
|
+
#------------------------------------------
|
|
32
|
+
# БИБЛИОТЕКА LU
|
|
33
|
+
#------------------------------------------
|
|
34
|
+
|
|
35
|
+
#----------------------------------------------------------
|
|
36
|
+
# HKEY_* Constants
|
|
37
|
+
#----------------------------------------------------------
|
|
38
|
+
"""
|
|
39
|
+
winreg.HKEY_CLASSES_ROOT
|
|
40
|
+
Registry entries subordinate to this key define types (or classes) of documents and the properties associated with those types. Shell and COM applications use the information stored under this key.
|
|
41
|
+
---------------------
|
|
42
|
+
winreg.HKEY_CURRENT_USER
|
|
43
|
+
Registry entries subordinate to this key define the preferences of the current user. These preferences include the settings of environment variables, data about program groups, colors, printers, network connections, and application preferences.
|
|
44
|
+
---------------------
|
|
45
|
+
winreg.HKEY_LOCAL_MACHINE
|
|
46
|
+
Registry entries subordinate to this key define the physical state of the computer, including data about the bus type, system memory, and installed hardware and software.
|
|
47
|
+
---------------------
|
|
48
|
+
winreg.HKEY_USERS
|
|
49
|
+
Registry entries subordinate to this key define the default user configuration for new users on the local computer and the user configuration for the current user.
|
|
50
|
+
---------------------
|
|
51
|
+
winreg.HKEY_PERFORMANCE_DATA
|
|
52
|
+
Registry entries subordinate to this key allow you to access performance data. The data is not actually stored in the registry; the registry functions cause the system to collect the data from its source.
|
|
53
|
+
---------------------
|
|
54
|
+
winreg.HKEY_CURRENT_CONFIG
|
|
55
|
+
Contains information about the current hardware profile of the local computer system.
|
|
56
|
+
---------------------
|
|
57
|
+
winreg.HKEY_DYN_DATA
|
|
58
|
+
This key is not used in versions of Windows after 98.
|
|
59
|
+
---------------------
|
|
60
|
+
"""
|
|
61
|
+
@enum.unique
|
|
62
|
+
class THKEYConst(enum.Enum):
|
|
63
|
+
"""THKEYConst"""
|
|
64
|
+
cHKCR = winreg.HKEY_CLASSES_ROOT
|
|
65
|
+
cHKCU = winreg.HKEY_CURRENT_USER
|
|
66
|
+
cHKLM = winreg.HKEY_LOCAL_MACHINE
|
|
67
|
+
cHKU = winreg.HKEY_USERS
|
|
68
|
+
cHKPD = winreg.HKEY_PERFORMANCE_DATA
|
|
69
|
+
cHKCC = winreg.HKEY_CURRENT_CONFIG
|
|
70
|
+
cHKDD = winreg.HKEY_DYN_DATA
|
|
71
|
+
#endclass
|
|
72
|
+
|
|
73
|
+
#---------------------------------------------------------
|
|
74
|
+
# Access Rights
|
|
75
|
+
#---------------------------------------------------------
|
|
76
|
+
"""
|
|
77
|
+
winreg.KEY_ALL_ACCESS
|
|
78
|
+
Combines the STANDARD_RIGHTS_REQUIRED, KEY_QUERY_VALUE, KEY_SET_VALUE, KEY_CREATE_SUB_KEY, KEY_ENUMERATE_SUB_KEYS, KEY_NOTIFY, and KEY_CREATE_LINK access rights.
|
|
79
|
+
---------------------
|
|
80
|
+
winreg.KEY_WRITE
|
|
81
|
+
Combines the STANDARD_RIGHTS_WRITE, KEY_SET_VALUE, and KEY_CREATE_SUB_KEY access rights.
|
|
82
|
+
---------------------
|
|
83
|
+
winreg.KEY_READ
|
|
84
|
+
Combines the STANDARD_RIGHTS_READ, KEY_QUERY_VALUE, KEY_ENUMERATE_SUB_KEYS, and KEY_NOTIFY values.
|
|
85
|
+
---------------------
|
|
86
|
+
winreg.KEY_EXECUTE
|
|
87
|
+
Equivalent to KEY_READ.
|
|
88
|
+
---------------------
|
|
89
|
+
winreg.KEY_QUERY_VALUE
|
|
90
|
+
Required to query the values of a registry key.
|
|
91
|
+
---------------------
|
|
92
|
+
winreg.KEY_SET_VALUE
|
|
93
|
+
Required to create, delete, or set a registry value.
|
|
94
|
+
---------------------
|
|
95
|
+
winreg.KEY_CREATE_SUB_KEY
|
|
96
|
+
Required to create a subkey of a registry key.
|
|
97
|
+
---------------------
|
|
98
|
+
winreg.KEY_ENUMERATE_SUB_KEYS
|
|
99
|
+
Required to enumerate the subkeys of a registry key.
|
|
100
|
+
---------------------
|
|
101
|
+
winreg.KEY_NOTIFY
|
|
102
|
+
Required to request change notifications for a registry key or for subkeys of a registry key.
|
|
103
|
+
---------------------
|
|
104
|
+
winreg.KEY_CREATE_LINK
|
|
105
|
+
Reserved for system use.
|
|
106
|
+
---------------------
|
|
107
|
+
"""
|
|
108
|
+
# @enum.unique
|
|
109
|
+
class TKEYAccess(enum.Enum):
|
|
110
|
+
"""TKEYAccess"""
|
|
111
|
+
kaALL_ACCESS = winreg.KEY_ALL_ACCESS
|
|
112
|
+
kaWRITE = winreg.KEY_WRITE
|
|
113
|
+
kaREAD = winreg.KEY_READ
|
|
114
|
+
kaEXECUTE = winreg.KEY_EXECUTE
|
|
115
|
+
kaQUERY_VALUE = winreg.KEY_QUERY_VALUE
|
|
116
|
+
kaSET_VALUE = winreg.KEY_SET_VALUE
|
|
117
|
+
kaCREATE_SUB_KEY = winreg.KEY_CREATE_SUB_KEY
|
|
118
|
+
kaENUMERATE_SUB_KEYS = winreg.KEY_ENUMERATE_SUB_KEYS
|
|
119
|
+
kaKEY_NOTIFY = winreg.KEY_NOTIFY
|
|
120
|
+
kaKEY_CREATE_LINK = winreg.KEY_CREATE_LINK
|
|
121
|
+
#endclass
|
|
122
|
+
|
|
123
|
+
#---------------------------------------------------------
|
|
124
|
+
# Value Types¶
|
|
125
|
+
# ---------------------------------------------------------
|
|
126
|
+
"""
|
|
127
|
+
winreg.REG_BINARY
|
|
128
|
+
Binary data in any form.
|
|
129
|
+
---------------------
|
|
130
|
+
winreg.REG_DWORD
|
|
131
|
+
32-bit number.
|
|
132
|
+
---------------------
|
|
133
|
+
winreg.REG_DWORD_LITTLE_ENDIAN
|
|
134
|
+
A 32-bit number in little-endian format. Equivalent to REG_DWORD.
|
|
135
|
+
---------------------
|
|
136
|
+
winreg.REG_DWORD_BIG_ENDIAN
|
|
137
|
+
A 32-bit number in big-endian format.
|
|
138
|
+
---------------------
|
|
139
|
+
winreg.REG_EXPAND_SZ
|
|
140
|
+
Null-terminated string containing references to environment variables (%PATH%).
|
|
141
|
+
---------------------
|
|
142
|
+
winreg.REG_LINK
|
|
143
|
+
A Unicode symbolic link.
|
|
144
|
+
---------------------
|
|
145
|
+
winreg.REG_MULTI_SZ
|
|
146
|
+
A sequence of null-terminated strings, terminated by two null characters. (Python handles this termination automatically.)
|
|
147
|
+
---------------------
|
|
148
|
+
winreg.REG_NONE
|
|
149
|
+
No defined value type.
|
|
150
|
+
---------------------
|
|
151
|
+
"""
|
|
152
|
+
# @enum.unique
|
|
153
|
+
class TValueTypes(enum.Enum):
|
|
154
|
+
"""TValueTypes"""
|
|
155
|
+
vtBINARY = winreg.REG_BINARY
|
|
156
|
+
vtDWORD = winreg.REG_DWORD
|
|
157
|
+
vtDWORD_LITTLE_ENDIAN = winreg.REG_DWORD_LITTLE_ENDIAN
|
|
158
|
+
vtDWORD_BIG_ENDIAN = winreg.REG_DWORD_BIG_ENDIAN
|
|
159
|
+
vtEXPAND_SZ = winreg.REG_EXPAND_SZ
|
|
160
|
+
vtLINK = winreg.REG_LINK
|
|
161
|
+
vtMULTI_SZ = winreg.REG_MULTI_SZ
|
|
162
|
+
vtNONE = winreg.REG_NONE
|
|
163
|
+
#endclass
|
|
164
|
+
|
|
165
|
+
#-------------------------------------------------------------------------------
|
|
166
|
+
# General Reestr Keys
|
|
167
|
+
#-------------------------------------------------------------------------------
|
|
168
|
+
RootKeyHKLM = winreg.HKEY_LOCAL_MACHINE
|
|
169
|
+
RootKeyHKCU = winreg.HKEY_CURRENT_USER
|
|
170
|
+
|
|
171
|
+
cHKLMSCCS = r'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet'
|
|
172
|
+
cHKLMSMWCV = r'HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion'
|
|
173
|
+
cHKLMSMWNTCV = r'HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion'
|
|
174
|
+
cHKCUSMWCV = r'HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion'
|
|
175
|
+
cHKCUSMWNTCV = r'HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion'
|
|
176
|
+
|
|
177
|
+
class TREGParser (object):
|
|
178
|
+
"""TREGParser"""
|
|
179
|
+
luClassName = 'TREGParser'
|
|
180
|
+
__annotations__ =\
|
|
181
|
+
"""
|
|
182
|
+
TREGParser - Работа с реестром windows
|
|
183
|
+
|
|
184
|
+
aReg = _winreg.ConnectRegistry(None,_winreg.HKEY_LOCAL_MACHINE)
|
|
185
|
+
|
|
186
|
+
"""
|
|
187
|
+
#--------------------------------------------------
|
|
188
|
+
# constructor
|
|
189
|
+
#--------------------------------------------------
|
|
190
|
+
def __init__ (self, **kwargs):
|
|
191
|
+
""" Constructor """
|
|
192
|
+
#beginfunction
|
|
193
|
+
super ().__init__ (**kwargs)
|
|
194
|
+
self.__Fhkey = 0
|
|
195
|
+
...
|
|
196
|
+
#endfunction
|
|
197
|
+
|
|
198
|
+
#--------------------------------------------------
|
|
199
|
+
# destructor
|
|
200
|
+
#--------------------------------------------------
|
|
201
|
+
def __del__ (self):
|
|
202
|
+
""" destructor """
|
|
203
|
+
#beginfunction
|
|
204
|
+
LClassName = self.__class__.__name__
|
|
205
|
+
s = '{} уничтожен'.format (LClassName)
|
|
206
|
+
# LULog.LoggerTOOLS_AddLevel (LULog.DEBUGTEXT, s)
|
|
207
|
+
#print (s)
|
|
208
|
+
#endfunction
|
|
209
|
+
|
|
210
|
+
#--------------------------------------------------
|
|
211
|
+
# @property hkey
|
|
212
|
+
#--------------------------------------------------
|
|
213
|
+
# getter
|
|
214
|
+
@property
|
|
215
|
+
def hkey(self):
|
|
216
|
+
#beginfunction
|
|
217
|
+
return self.__Fhkey
|
|
218
|
+
#endfunction
|
|
219
|
+
# setter
|
|
220
|
+
@hkey.setter
|
|
221
|
+
def hkey (self, AValue: int):
|
|
222
|
+
#beginfunction
|
|
223
|
+
self.__Fhkey = AValue
|
|
224
|
+
#endfunction
|
|
225
|
+
|
|
226
|
+
def CreateKeyReg (self, AHKEY: THKEYConst, ASection: str) -> bool:
|
|
227
|
+
"""CreateKeyReg"""
|
|
228
|
+
#beginfunction
|
|
229
|
+
# winreg.CreateKey (key, sub_key)
|
|
230
|
+
# Создает или открывает указанный ключ, возвращая объект дескриптора
|
|
231
|
+
# winreg.CreateKeyEx(key, sub_key, reserved=0, access=KEY_WRITE)
|
|
232
|
+
# Создает или открывает указанный ключ, возвращая объект дескриптора
|
|
233
|
+
self.hkey = None
|
|
234
|
+
try:
|
|
235
|
+
self.hkey = winreg.CreateKeyEx (AHKEY.value, ASection, 0, TKEYAccess.kaALL_ACCESS.value)
|
|
236
|
+
self.CloseKeyReg (self.hkey)
|
|
237
|
+
except FileNotFoundError as ERROR:
|
|
238
|
+
...
|
|
239
|
+
finally:
|
|
240
|
+
return not self.hkey is None
|
|
241
|
+
#endfunction
|
|
242
|
+
|
|
243
|
+
@staticmethod
|
|
244
|
+
def DeleteKeyReg (AHKEY: THKEYConst, ASection: str):
|
|
245
|
+
"""DeleteKeyReg"""
|
|
246
|
+
#beginfunction
|
|
247
|
+
# winreg.DeleteKey (key, sub_key)
|
|
248
|
+
# Удаляет указанный ключ.
|
|
249
|
+
# winreg.DeleteKeyEx (key, sub_key, access = KEY_WOW64_64KEY, reserved = 0)
|
|
250
|
+
# Удаляет указанный ключ.
|
|
251
|
+
LResult = False
|
|
252
|
+
try:
|
|
253
|
+
winreg.DeleteKey (AHKEY.value, ASection)
|
|
254
|
+
LResult = True
|
|
255
|
+
except FileNotFoundError as ERROR:
|
|
256
|
+
...
|
|
257
|
+
finally:
|
|
258
|
+
return LResult
|
|
259
|
+
#endfunction
|
|
260
|
+
|
|
261
|
+
def OpenKeyReg (self, AHKEY: THKEYConst, ASection: str):
|
|
262
|
+
"""OpenKeyReg"""
|
|
263
|
+
#beginfunction
|
|
264
|
+
#+winreg.OpenKey (key, sub_key, reserved = 0, access = KEY_READ)
|
|
265
|
+
# Открывает указанный ключ, возвращая объект дескриптора .
|
|
266
|
+
#+winreg.OpenKeyEx (key, sub_key, reserved = 0, access = KEY_READ)
|
|
267
|
+
# Открывает указанный ключ, возвращая объект дескриптора .
|
|
268
|
+
self.hkey = None
|
|
269
|
+
try:
|
|
270
|
+
self.hkey = winreg.OpenKeyEx (AHKEY.value, ASection, 0, TKEYAccess.kaALL_ACCESS.value)
|
|
271
|
+
except FileNotFoundError as ERROR:
|
|
272
|
+
...
|
|
273
|
+
finally:
|
|
274
|
+
return self.hkey
|
|
275
|
+
#endfunction
|
|
276
|
+
|
|
277
|
+
@staticmethod
|
|
278
|
+
def CloseKeyReg (Ahkey):
|
|
279
|
+
"""CloseKeyReg"""
|
|
280
|
+
#beginfunction
|
|
281
|
+
# winreg.CloseKey(hkey)
|
|
282
|
+
# Закрывает ранее открытый раздел реестра. HKEY аргумент указывает, ранее открытый ключ.
|
|
283
|
+
# Если hkey не закрыт с помощью этого метода (или через hkey.Close() ), он закрывается,
|
|
284
|
+
# когда объект hkey уничтожается Python.
|
|
285
|
+
LResult = False
|
|
286
|
+
if Ahkey:
|
|
287
|
+
winreg.CloseKey (Ahkey)
|
|
288
|
+
LResult = True
|
|
289
|
+
return LResult
|
|
290
|
+
#endfunction
|
|
291
|
+
|
|
292
|
+
def EnumKeyReg (self, AHKEY: THKEYConst, ASection: str) -> []:
|
|
293
|
+
"""EnumKeyReg"""
|
|
294
|
+
#beginfunction
|
|
295
|
+
# winreg.EnumKey (key, index)
|
|
296
|
+
# Нумеровывает подклавиши открытого ключа реестра,возвращая строку.
|
|
297
|
+
LInfo = self.QueryInfoKeyReg (AHKEY, ASection)
|
|
298
|
+
LList = []
|
|
299
|
+
if len(LInfo) > 0:
|
|
300
|
+
self.hkey = self.OpenKeyReg (AHKEY, ASection)
|
|
301
|
+
# LWork = EnumKey (self.hkey, 0)
|
|
302
|
+
for i in range (LInfo[0],LInfo[1]):
|
|
303
|
+
try:
|
|
304
|
+
LWork = winreg.EnumKey (self.hkey, i)
|
|
305
|
+
except OSError as ERROR:
|
|
306
|
+
LWork = ERROR.strerror
|
|
307
|
+
#LUErrors.LUFileError_FileNotExist as ERROR
|
|
308
|
+
...
|
|
309
|
+
finally:
|
|
310
|
+
...
|
|
311
|
+
LList.append(LWork)
|
|
312
|
+
self.CloseKeyReg (self.hkey)
|
|
313
|
+
return LList
|
|
314
|
+
#endfunction
|
|
315
|
+
|
|
316
|
+
def EnumValueReg (self, AHKEY: THKEYConst, ASection: str) -> []:
|
|
317
|
+
"""EnumValueReg"""
|
|
318
|
+
#beginfunction
|
|
319
|
+
#+winreg.EnumValue (key, index)
|
|
320
|
+
# Перечисляет значения открытого ключа реестра,возвращая кортеж.
|
|
321
|
+
LInfo = self.QueryInfoKeyReg (AHKEY, ASection)
|
|
322
|
+
LList = []
|
|
323
|
+
if len(LInfo) > 0:
|
|
324
|
+
self.hkey = self.OpenKeyReg (AHKEY, ASection)
|
|
325
|
+
for i in range (LInfo[0],LInfo[1]):
|
|
326
|
+
LList.append(winreg.EnumValue (self.hkey, i))
|
|
327
|
+
# LKeyName, LValue, LFormat = EnumValue (self.hkey, i)
|
|
328
|
+
self.CloseKeyReg (self.hkey)
|
|
329
|
+
return LList
|
|
330
|
+
#endfunction
|
|
331
|
+
|
|
332
|
+
def SaveKeyReg (self, AHKEY: THKEYConst, ASection: str, AFileName: str):
|
|
333
|
+
"""SaveKeyReg"""
|
|
334
|
+
#beginfunction
|
|
335
|
+
# winreg.SaveKey (key, file_name)
|
|
336
|
+
# Сохраняет указанный ключ и все его подклавиши в указанный файл.
|
|
337
|
+
self.hkey = self.OpenKeyReg (AHKEY, ASection)
|
|
338
|
+
if not self.hkey is None:
|
|
339
|
+
winreg.SaveKey (self.hkey, AFileName)
|
|
340
|
+
self.CloseKeyReg(self.hkey)
|
|
341
|
+
#endfunction
|
|
342
|
+
|
|
343
|
+
def LoadKeyReg (self, AHKEY: THKEYConst, ASection: str, AFileName: str):
|
|
344
|
+
"""LoadKeyReg"""
|
|
345
|
+
#beginfunction
|
|
346
|
+
# winreg.LoadKey(key, sub_key, file_name)
|
|
347
|
+
# Создает под-ключ под указанным ключом и сохраняет регистрационную информацию из указанного файла в этот под-ключ.
|
|
348
|
+
self.hkey = self.OpenKeyReg (AHKEY, ASection)
|
|
349
|
+
if not self.hkey is None:
|
|
350
|
+
winreg.LoadKey (self.hkey, ASection, AFileName)
|
|
351
|
+
self.CloseKeyReg(self.hkey)
|
|
352
|
+
#endfunction
|
|
353
|
+
|
|
354
|
+
def QueryValueReg (self, AHKEY: THKEYConst, ASection: str, AOption: str) -> ():
|
|
355
|
+
"""QueryValueReg"""
|
|
356
|
+
#beginfunction
|
|
357
|
+
#+winreg.QueryValue (key, sub_key)
|
|
358
|
+
# Возвращает безымянное значение для ключа,в виде строки.
|
|
359
|
+
#+winreg.QueryValueEx (key, value_name)
|
|
360
|
+
# Результат-кортеж из 2 пунктов:
|
|
361
|
+
# 0 - Значение элемента реестра.
|
|
362
|
+
# 1 - Целое число, указывающее тип реестра для этого значения
|
|
363
|
+
LResult = ''
|
|
364
|
+
self.hkey = self.OpenKeyReg (AHKEY, ASection)
|
|
365
|
+
if not self.hkey is None:
|
|
366
|
+
if len(AOption) > 0:
|
|
367
|
+
LResult = winreg.QueryValueEx (self.hkey, AOption)
|
|
368
|
+
else:
|
|
369
|
+
LResult = winreg.QueryValue (self.hkey, None)
|
|
370
|
+
self.CloseKeyReg(self.hkey)
|
|
371
|
+
return LResult
|
|
372
|
+
#endfunction
|
|
373
|
+
|
|
374
|
+
def QueryInfoKeyReg (self, AHKEY: THKEYConst, ASection: str) -> ():
|
|
375
|
+
"""QueryInfoKeyReg"""
|
|
376
|
+
#beginfunction
|
|
377
|
+
#+winreg.QueryInfoKey (key)
|
|
378
|
+
# Результат-кортеж из 3 пунктов:
|
|
379
|
+
LResult = ()
|
|
380
|
+
self.hkey = self.OpenKeyReg (AHKEY, ASection)
|
|
381
|
+
if not self.hkey is None:
|
|
382
|
+
LResult = winreg.QueryInfoKey (self.hkey)
|
|
383
|
+
self.CloseKeyReg(self.hkey)
|
|
384
|
+
return LResult
|
|
385
|
+
#endfunction
|
|
386
|
+
|
|
387
|
+
def DeleteValueReg (self, AHKEY: THKEYConst, ASection: str, AOption: str) -> bool:
|
|
388
|
+
"""SetValueReg"""
|
|
389
|
+
#beginfunction
|
|
390
|
+
# winreg.DeleteValue (key, value)
|
|
391
|
+
# Удаляет именованное значение из ключа реестра.
|
|
392
|
+
LResult = False
|
|
393
|
+
self.hkey = self.OpenKeyReg (AHKEY, ASection)
|
|
394
|
+
if not self.hkey is None:
|
|
395
|
+
winreg.DeleteValue (self.hkey, AOption)
|
|
396
|
+
self.CloseKeyReg(self.hkey)
|
|
397
|
+
LResult = True
|
|
398
|
+
return LResult
|
|
399
|
+
#endfunction
|
|
400
|
+
|
|
401
|
+
def SetValueReg (self, AHKEY: THKEYConst, ASection: str, AOption: str, AFormat: TValueTypes, Value: str):
|
|
402
|
+
"""SetValueReg"""
|
|
403
|
+
#beginfunction
|
|
404
|
+
# winreg.SetValue (key, sub_key, type, value)
|
|
405
|
+
# Сопоставляет стоимость с указанным ключом.
|
|
406
|
+
# winreg.SetValueEx (key, value_name, reserved, type, value)¶
|
|
407
|
+
# Хранит данные в поле значений открытого ключа реестра.
|
|
408
|
+
LResult = False
|
|
409
|
+
self.hkey = self.OpenKeyReg (AHKEY, ASection)
|
|
410
|
+
if not self.hkey is None:
|
|
411
|
+
winreg.SetValueEx (self.hkey, AOption, 0, AFormat.value, Value)
|
|
412
|
+
self.CloseKeyReg(self.hkey)
|
|
413
|
+
LResult = True
|
|
414
|
+
return LResult
|
|
415
|
+
#endfunction
|
|
416
|
+
|
|
417
|
+
def GetKeyReg (self, AHKEY: THKEYConst, ASection: str, AOption: str):
|
|
418
|
+
"""GetKeyReg"""
|
|
419
|
+
#beginfunction
|
|
420
|
+
return self.QueryValueReg (AHKEY, ASection, AOption)
|
|
421
|
+
#endfunction
|
|
422
|
+
|
|
423
|
+
def GetOptionsReg (self, AHKEY: THKEYConst, ASection: str) -> ():
|
|
424
|
+
"""QueryInfoKeyReg"""
|
|
425
|
+
#beginfunction
|
|
426
|
+
#+winreg.QueryInfoKey (key)
|
|
427
|
+
# Результат-кортеж из 3 пунктов:
|
|
428
|
+
LListKeyValue = self.EnumValueReg (AHKEY, ASection)
|
|
429
|
+
LList = []
|
|
430
|
+
for key in LListKeyValue:
|
|
431
|
+
LList.append(key[0])
|
|
432
|
+
return LList
|
|
433
|
+
#endfunction
|
|
434
|
+
|
|
435
|
+
def IsSection (self, AHKEY: THKEYConst, ASection: str) -> bool:
|
|
436
|
+
#beginfunction
|
|
437
|
+
LResult = False
|
|
438
|
+
self.hkey = self.OpenKeyReg (AHKEY, ASection)
|
|
439
|
+
if not self.hkey is None:
|
|
440
|
+
LResult = True
|
|
441
|
+
return LResult
|
|
442
|
+
#endfunction
|
|
443
|
+
|
|
444
|
+
def IsOption (self, AHKEY: THKEYConst, ASection: str, AOption: str) -> bool:
|
|
445
|
+
#beginfunction
|
|
446
|
+
LResult = False
|
|
447
|
+
self.hkey = self.OpenKeyReg (AHKEY, ASection)
|
|
448
|
+
if not self.hkey is None:
|
|
449
|
+
LList = self.GetOptionsReg (AHKEY, ASection)
|
|
450
|
+
if len (LList) > 0 and AOption in LList:
|
|
451
|
+
LResult = True
|
|
452
|
+
#endif
|
|
453
|
+
#endif
|
|
454
|
+
return LResult
|
|
455
|
+
#endfunction
|
|
456
|
+
#endclass
|
|
457
|
+
|
|
458
|
+
def SaveRegToFile_regedit (AFileName: str, AHKEY: THKEYConst, ASection: str):
|
|
459
|
+
"""SaveRegToFile"""
|
|
460
|
+
#beginfunction
|
|
461
|
+
# LWorkDir = LUFile.ExtractFileDir (AFileName)
|
|
462
|
+
LProgramName = 'regedit.exe'
|
|
463
|
+
LParamStr = ''
|
|
464
|
+
match AHKEY:
|
|
465
|
+
case THKEYConst.cHKLM:
|
|
466
|
+
s = 'HKEY_LOCAL_MACHINE'
|
|
467
|
+
LParamStr = '/ea'+' '+AFileName+' '+s+'\\'+ASection
|
|
468
|
+
case THKEYConst.cHKCU:
|
|
469
|
+
s = 'HKEY_CURRENT_USER'
|
|
470
|
+
LParamStr = '/ea'+' '+AFileName+' "'+s+'\\'+ASection+'"'
|
|
471
|
+
#endmatch
|
|
472
|
+
if len (LParamStr) > 0:
|
|
473
|
+
#print (LParamStr)
|
|
474
|
+
# Lregedit = subprocess.Popen ('C:\\Windows\\System32\\regedit.exe', LParamStr)
|
|
475
|
+
# Lregedit = subprocess.Popen ('regedit.exe', LParamStr)
|
|
476
|
+
# Lregedit = subprocess.Popen ('regedit.exe')
|
|
477
|
+
# os.system (command)
|
|
478
|
+
# os.startfile ('regedit.exe', LParamStr)
|
|
479
|
+
# os.startfile ('regedit.exe')
|
|
480
|
+
...
|
|
481
|
+
#endif
|
|
482
|
+
#endfunction
|
|
483
|
+
|
|
484
|
+
#---------------------------------------------------------
|
|
485
|
+
# CreateTREGParser
|
|
486
|
+
#---------------------------------------------------------
|
|
487
|
+
def CreateTREGParser () -> TREGParser:
|
|
488
|
+
"""CreateTREGParser"""
|
|
489
|
+
#beginfunction
|
|
490
|
+
return TREGParser ()
|
|
491
|
+
#endfunction
|
|
492
|
+
|
|
493
|
+
GREGParser = CreateTREGParser ()
|
|
494
|
+
|
|
495
|
+
#---------------------------------------------------------
|
|
496
|
+
# main
|
|
497
|
+
#---------------------------------------------------------
|
|
498
|
+
def main ():
|
|
499
|
+
#beginfunction
|
|
500
|
+
# print (tuple(THKEYConst))
|
|
501
|
+
# print (tuple(TKEYAccess))
|
|
502
|
+
# print (tuple(TValueTypes))
|
|
503
|
+
...
|
|
504
|
+
#endfunction
|
|
505
|
+
|
|
506
|
+
#---------------------------------------------------------
|
|
507
|
+
#
|
|
508
|
+
#---------------------------------------------------------
|
|
509
|
+
#beginmodule
|
|
510
|
+
if __name__ == '__main__':
|
|
511
|
+
main()
|
|
512
|
+
#endif
|
|
513
|
+
|
|
514
|
+
#endmodule
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"""LUProc.py"""
|
|
2
|
+
# -*- coding: UTF-8 -*-
|
|
3
|
+
__annotations__ = """
|
|
4
|
+
=======================================================
|
|
5
|
+
Copyright (c) 2023
|
|
6
|
+
Author:
|
|
7
|
+
Lisitsin Y.R.
|
|
8
|
+
Project:
|
|
9
|
+
LU_PY
|
|
10
|
+
Python (LU)
|
|
11
|
+
Module:
|
|
12
|
+
LUProc.py
|
|
13
|
+
|
|
14
|
+
=======================================================
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
#------------------------------------------
|
|
18
|
+
# БИБЛИОТЕКИ python
|
|
19
|
+
#------------------------------------------
|
|
20
|
+
import enum
|
|
21
|
+
|
|
22
|
+
#------------------------------------------
|
|
23
|
+
# БИБЛИОТЕКИ сторонние
|
|
24
|
+
#------------------------------------------
|
|
25
|
+
|
|
26
|
+
#------------------------------------------
|
|
27
|
+
# БИБЛИОТЕКИ LU
|
|
28
|
+
#------------------------------------------
|
|
29
|
+
|
|
30
|
+
cProcessWork = 'Main: Идет процесс обработки...'
|
|
31
|
+
cProcessStop = 'Main: Процесс обработки остановлен...'
|
|
32
|
+
cProcessSetup = 'Setup...'
|
|
33
|
+
cProcessAbout = 'About...'
|
|
34
|
+
cProcessHelp = 'Help...'
|
|
35
|
+
cProcessDeleteAll = 'DeleteAll...'
|
|
36
|
+
|
|
37
|
+
cProcessBegin = '********* Начало **********************************'
|
|
38
|
+
cProcessEnd = '********* Конец ***********************************'
|
|
39
|
+
|
|
40
|
+
mrOk = True
|
|
41
|
+
mrCancel = False
|
|
42
|
+
|
|
43
|
+
@enum.unique
|
|
44
|
+
class TStatApplication(enum.Enum):
|
|
45
|
+
"""TStatApplication"""
|
|
46
|
+
saRunning = enum.auto ()
|
|
47
|
+
saBreak = enum.auto ()
|
|
48
|
+
saMain = enum.auto ()
|
|
49
|
+
saDeleteAll = enum.auto ()
|
|
50
|
+
# saTest = enum.auto ()
|
|
51
|
+
# saSheduler = enum.auto ()
|
|
52
|
+
# saSetup = enum.auto ()
|
|
53
|
+
# saAbout = enum.auto ()
|
|
54
|
+
# saHelp = enum.auto ()
|
|
55
|
+
# saAction = enum.auto ()
|
|
56
|
+
# saSend = enum.auto ()
|
|
57
|
+
# saRefresh = enum.auto ()
|
|
58
|
+
# saViewLog = enum.auto ()
|
|
59
|
+
# saFree = enum.auto ()
|
|
60
|
+
# saStart = enum.auto ()
|
|
61
|
+
# saStop = enum.auto ()
|
|
62
|
+
# saAddWidget = enum.auto ()
|
|
63
|
+
#endclass
|
|
64
|
+
CStatApplication = {
|
|
65
|
+
TStatApplication.saRunning: 'saRunning',
|
|
66
|
+
TStatApplication.saBreak: 'saBreak',
|
|
67
|
+
TStatApplication.saMain: 'saMain',
|
|
68
|
+
TStatApplication.saDeleteAll: 'saDelteAll'
|
|
69
|
+
# TStatApplication.saTest: 'saTest',
|
|
70
|
+
# TStatApplication.saSheduler: 'saSheduler',
|
|
71
|
+
# TStatApplication.saSetup: 'saSetup',
|
|
72
|
+
# TStatApplication.saAbout: 'saAbout',
|
|
73
|
+
# TStatApplication.saHelp: 'saHelp',
|
|
74
|
+
# TStatApplication.saAction: 'saAction',
|
|
75
|
+
# TStatApplication.saSend: 'saSend',
|
|
76
|
+
# TStatApplication.saRefresh: 'saRefresh',
|
|
77
|
+
# TStatApplication.saViewLog: 'saViewLog',
|
|
78
|
+
# TStatApplication.saFree: 'saFree',
|
|
79
|
+
# TStatApplication.saStart: 'saStart',
|
|
80
|
+
# TStatApplication.saStop: 'saStop',
|
|
81
|
+
# TStatApplication.saAddWidget: 'saAddWidget'
|
|
82
|
+
}
|
|
83
|
+
@enum.unique
|
|
84
|
+
class TStatWidget(enum.Enum):
|
|
85
|
+
"""TStatApplication"""
|
|
86
|
+
swRunning = enum.auto ()
|
|
87
|
+
swBreak = enum.auto ()
|
|
88
|
+
#endclass
|
|
89
|
+
CStatWidget = {
|
|
90
|
+
TStatWidget.swRunning: 'swRunning',
|
|
91
|
+
TStatWidget.swBreak: 'swBreak'
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
#---------------------------------------------------------
|
|
95
|
+
# main
|
|
96
|
+
#---------------------------------------------------------
|
|
97
|
+
def main ():
|
|
98
|
+
#beginfunction
|
|
99
|
+
...
|
|
100
|
+
#endfunction
|
|
101
|
+
|
|
102
|
+
#---------------------------------------------------------
|
|
103
|
+
#
|
|
104
|
+
#---------------------------------------------------------
|
|
105
|
+
#beginmodule
|
|
106
|
+
if __name__ == "__main__":
|
|
107
|
+
main()
|
|
108
|
+
#endif
|
|
109
|
+
|
|
110
|
+
#endmodule
|