windows-mcp 0.5.6__py3-none-any.whl → 0.5.8__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.
- windows_mcp/__main__.py +314 -312
- windows_mcp/analytics.py +175 -150
- windows_mcp/desktop/config.py +20 -20
- windows_mcp/desktop/service.py +457 -457
- windows_mcp/desktop/views.py +57 -57
- windows_mcp/tree/config.py +50 -50
- windows_mcp/tree/service.py +600 -466
- windows_mcp/tree/utils.py +21 -21
- windows_mcp/tree/views.py +115 -115
- windows_mcp/uia/__init__.py +4 -0
- windows_mcp/uia/controls.py +4781 -0
- windows_mcp/uia/core.py +3269 -0
- windows_mcp/uia/enums.py +1963 -0
- windows_mcp/uia/events.py +83 -0
- windows_mcp/uia/patterns.py +2106 -0
- windows_mcp/watchdog/__init__.py +1 -0
- windows_mcp/watchdog/event_handlers.py +51 -0
- windows_mcp/watchdog/service.py +188 -0
- {windows_mcp-0.5.6.dist-info → windows_mcp-0.5.8.dist-info}/METADATA +5 -5
- windows_mcp-0.5.8.dist-info/RECORD +26 -0
- windows_mcp-0.5.6.dist-info/RECORD +0 -17
- {windows_mcp-0.5.6.dist-info → windows_mcp-0.5.8.dist-info}/WHEEL +0 -0
- {windows_mcp-0.5.6.dist-info → windows_mcp-0.5.8.dist-info}/entry_points.txt +0 -0
- {windows_mcp-0.5.6.dist-info → windows_mcp-0.5.8.dist-info}/licenses/LICENSE.md +0 -0
windows_mcp/desktop/views.py
CHANGED
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
from windows_mcp.tree.views import TreeState
|
|
2
|
-
from dataclasses import dataclass
|
|
3
|
-
from tabulate import tabulate
|
|
4
|
-
from typing import Optional
|
|
5
|
-
from PIL.Image import Image
|
|
6
|
-
from enum import Enum
|
|
7
|
-
|
|
8
|
-
class Browser(Enum):
|
|
9
|
-
CHROME='Chrome'
|
|
10
|
-
EDGE='Edge'
|
|
11
|
-
FIREFOX='Firefox'
|
|
12
|
-
|
|
13
|
-
class Status(Enum):
|
|
14
|
-
MAXIMIZED='Maximized'
|
|
15
|
-
MINIMIZED='Minimized'
|
|
16
|
-
NORMAL='Normal'
|
|
17
|
-
HIDDEN='Hidden'
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
@dataclass
|
|
21
|
-
class App:
|
|
22
|
-
name:str
|
|
23
|
-
depth:int
|
|
24
|
-
status:Status
|
|
25
|
-
size:'Size'
|
|
26
|
-
handle: int
|
|
27
|
-
process_id:int
|
|
28
|
-
|
|
29
|
-
def to_row(self):
|
|
30
|
-
return [self.name, self.depth, self.status.value, self.size.width, self.size.height, self.handle]
|
|
31
|
-
|
|
32
|
-
@dataclass
|
|
33
|
-
class Size:
|
|
34
|
-
width:int
|
|
35
|
-
height:int
|
|
36
|
-
|
|
37
|
-
def to_string(self):
|
|
38
|
-
return f'({self.width},{self.height})'
|
|
39
|
-
|
|
40
|
-
@dataclass
|
|
41
|
-
class DesktopState:
|
|
42
|
-
apps:list[App]
|
|
43
|
-
active_app:Optional[App]
|
|
44
|
-
screenshot:Image|None
|
|
45
|
-
tree_state:TreeState
|
|
46
|
-
|
|
47
|
-
def active_app_to_string(self):
|
|
48
|
-
if self.active_app is None:
|
|
49
|
-
return 'No active app found'
|
|
50
|
-
headers = ["Name", "Depth", "Status", "Width", "Height", "Handle"]
|
|
51
|
-
return tabulate([self.active_app.to_row()], headers=headers, tablefmt="simple")
|
|
52
|
-
|
|
53
|
-
def apps_to_string(self):
|
|
54
|
-
if not self.apps:
|
|
55
|
-
return 'No apps running in background'
|
|
56
|
-
headers = ["Name", "Depth", "Status", "Width", "Height", "Handle"]
|
|
57
|
-
rows = [app.to_row() for app in self.apps]
|
|
1
|
+
from windows_mcp.tree.views import TreeState
|
|
2
|
+
from dataclasses import dataclass
|
|
3
|
+
from tabulate import tabulate
|
|
4
|
+
from typing import Optional
|
|
5
|
+
from PIL.Image import Image
|
|
6
|
+
from enum import Enum
|
|
7
|
+
|
|
8
|
+
class Browser(Enum):
|
|
9
|
+
CHROME='Chrome'
|
|
10
|
+
EDGE='Edge'
|
|
11
|
+
FIREFOX='Firefox'
|
|
12
|
+
|
|
13
|
+
class Status(Enum):
|
|
14
|
+
MAXIMIZED='Maximized'
|
|
15
|
+
MINIMIZED='Minimized'
|
|
16
|
+
NORMAL='Normal'
|
|
17
|
+
HIDDEN='Hidden'
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@dataclass
|
|
21
|
+
class App:
|
|
22
|
+
name:str
|
|
23
|
+
depth:int
|
|
24
|
+
status:Status
|
|
25
|
+
size:'Size'
|
|
26
|
+
handle: int
|
|
27
|
+
process_id:int
|
|
28
|
+
|
|
29
|
+
def to_row(self):
|
|
30
|
+
return [self.name, self.depth, self.status.value, self.size.width, self.size.height, self.handle]
|
|
31
|
+
|
|
32
|
+
@dataclass
|
|
33
|
+
class Size:
|
|
34
|
+
width:int
|
|
35
|
+
height:int
|
|
36
|
+
|
|
37
|
+
def to_string(self):
|
|
38
|
+
return f'({self.width},{self.height})'
|
|
39
|
+
|
|
40
|
+
@dataclass
|
|
41
|
+
class DesktopState:
|
|
42
|
+
apps:list[App]
|
|
43
|
+
active_app:Optional[App]
|
|
44
|
+
screenshot:Image|None
|
|
45
|
+
tree_state:TreeState
|
|
46
|
+
|
|
47
|
+
def active_app_to_string(self):
|
|
48
|
+
if self.active_app is None:
|
|
49
|
+
return 'No active app found'
|
|
50
|
+
headers = ["Name", "Depth", "Status", "Width", "Height", "Handle"]
|
|
51
|
+
return tabulate([self.active_app.to_row()], headers=headers, tablefmt="simple")
|
|
52
|
+
|
|
53
|
+
def apps_to_string(self):
|
|
54
|
+
if not self.apps:
|
|
55
|
+
return 'No apps running in background'
|
|
56
|
+
headers = ["Name", "Depth", "Status", "Width", "Height", "Handle"]
|
|
57
|
+
rows = [app.to_row() for app in self.apps]
|
|
58
58
|
return tabulate(rows, headers=headers, tablefmt="simple")
|
windows_mcp/tree/config.py
CHANGED
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
INTERACTIVE_CONTROL_TYPE_NAMES=set([
|
|
2
|
-
'ButtonControl',
|
|
3
|
-
'ListItemControl',
|
|
4
|
-
'MenuItemControl',
|
|
5
|
-
'EditControl',
|
|
6
|
-
'CheckBoxControl',
|
|
7
|
-
'RadioButtonControl',
|
|
8
|
-
'ComboBoxControl',
|
|
9
|
-
'HyperlinkControl',
|
|
10
|
-
'SplitButtonControl',
|
|
11
|
-
'TabItemControl',
|
|
12
|
-
'TreeItemControl',
|
|
13
|
-
'DataItemControl',
|
|
14
|
-
'HeaderItemControl',
|
|
15
|
-
'TextBoxControl',
|
|
16
|
-
'SpinnerControl',
|
|
17
|
-
'ScrollBarControl'
|
|
18
|
-
])
|
|
19
|
-
|
|
20
|
-
DOCUMENT_CONTROL_TYPE_NAMES=set([
|
|
21
|
-
'DocumentControl'
|
|
22
|
-
])
|
|
23
|
-
|
|
24
|
-
STRUCTURAL_CONTROL_TYPE_NAMES = set([
|
|
25
|
-
'PaneControl',
|
|
26
|
-
'GroupControl',
|
|
27
|
-
'CustomControl'
|
|
28
|
-
])
|
|
29
|
-
|
|
30
|
-
INFORMATIVE_CONTROL_TYPE_NAMES=set([
|
|
31
|
-
'TextControl',
|
|
32
|
-
'ImageControl',
|
|
33
|
-
'StatusBarControl',
|
|
34
|
-
# 'ProgressBarControl',
|
|
35
|
-
# 'ToolTipControl',
|
|
36
|
-
# 'TitleBarControl',
|
|
37
|
-
# 'SeparatorControl',
|
|
38
|
-
# 'HeaderControl',
|
|
39
|
-
# 'HeaderItemControl',
|
|
40
|
-
])
|
|
41
|
-
|
|
42
|
-
DEFAULT_ACTIONS=set([
|
|
43
|
-
'Click',
|
|
44
|
-
'Press',
|
|
45
|
-
'Jump',
|
|
46
|
-
'Check',
|
|
47
|
-
'Uncheck',
|
|
48
|
-
'Double Click'
|
|
49
|
-
])
|
|
50
|
-
|
|
1
|
+
INTERACTIVE_CONTROL_TYPE_NAMES=set([
|
|
2
|
+
'ButtonControl',
|
|
3
|
+
'ListItemControl',
|
|
4
|
+
'MenuItemControl',
|
|
5
|
+
'EditControl',
|
|
6
|
+
'CheckBoxControl',
|
|
7
|
+
'RadioButtonControl',
|
|
8
|
+
'ComboBoxControl',
|
|
9
|
+
'HyperlinkControl',
|
|
10
|
+
'SplitButtonControl',
|
|
11
|
+
'TabItemControl',
|
|
12
|
+
'TreeItemControl',
|
|
13
|
+
'DataItemControl',
|
|
14
|
+
'HeaderItemControl',
|
|
15
|
+
'TextBoxControl',
|
|
16
|
+
'SpinnerControl',
|
|
17
|
+
'ScrollBarControl'
|
|
18
|
+
])
|
|
19
|
+
|
|
20
|
+
DOCUMENT_CONTROL_TYPE_NAMES=set([
|
|
21
|
+
'DocumentControl'
|
|
22
|
+
])
|
|
23
|
+
|
|
24
|
+
STRUCTURAL_CONTROL_TYPE_NAMES = set([
|
|
25
|
+
'PaneControl',
|
|
26
|
+
'GroupControl',
|
|
27
|
+
'CustomControl'
|
|
28
|
+
])
|
|
29
|
+
|
|
30
|
+
INFORMATIVE_CONTROL_TYPE_NAMES=set([
|
|
31
|
+
'TextControl',
|
|
32
|
+
'ImageControl',
|
|
33
|
+
'StatusBarControl',
|
|
34
|
+
# 'ProgressBarControl',
|
|
35
|
+
# 'ToolTipControl',
|
|
36
|
+
# 'TitleBarControl',
|
|
37
|
+
# 'SeparatorControl',
|
|
38
|
+
# 'HeaderControl',
|
|
39
|
+
# 'HeaderItemControl',
|
|
40
|
+
])
|
|
41
|
+
|
|
42
|
+
DEFAULT_ACTIONS=set([
|
|
43
|
+
'Click',
|
|
44
|
+
'Press',
|
|
45
|
+
'Jump',
|
|
46
|
+
'Check',
|
|
47
|
+
'Uncheck',
|
|
48
|
+
'Double Click'
|
|
49
|
+
])
|
|
50
|
+
|
|
51
51
|
THREAD_MAX_RETRIES = 3
|