amigent 1.2.0__tar.gz → 1.3.0__tar.gz
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.
- {amigent-1.2.0/src/amigent.egg-info → amigent-1.3.0}/PKG-INFO +52 -4
- {amigent-1.2.0 → amigent-1.3.0}/README.md +51 -3
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/__init__.py +1 -1
- amigent-1.3.0/src/amigent/adf.py +124 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/amiga/Amigent-Update +20 -0
- amigent-1.3.0/src/amigent/amiga/bin/amigent-monitor +0 -0
- amigent-1.3.0/src/amigent/amiga/bin/amigent-monitor.info +0 -0
- amigent-1.3.0/src/amigent/amiga/bin/amigentd +0 -0
- amigent-1.3.0/src/amigent/amiga/bin/amigentd.000 +0 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/amigentd.py +170 -13
- amigent-1.3.0/src/amigent/aminet.py +128 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/channel.py +205 -7
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/files.py +2 -1
- amigent-1.3.0/src/amigent/follow.py +98 -0
- amigent-1.3.0/src/amigent/install.py +258 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/lzh.py +23 -8
- amigent-1.3.0/src/amigent/notes.py +90 -0
- amigent-1.3.0/src/amigent/others.py +111 -0
- amigent-1.3.0/src/amigent/pack.py +164 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/screenfeed.py +17 -3
- amigent-1.3.0/src/amigent/screentext.py +186 -0
- amigent-1.3.0/src/amigent/server.py +1821 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/setup.py +32 -1
- amigent-1.3.0/src/amigent/system.py +61 -0
- amigent-1.3.0/src/amigent/uptime.py +90 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/viewer.py +23 -23
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/watch.py +4 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/web/fleet.js +1 -1
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/web/locales/cs.json +2 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/web/locales/da.json +2 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/web/locales/de.json +2 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/web/locales/en.json +2 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/web/locales/es.json +2 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/web/locales/fi.json +2 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/web/locales/fr.json +2 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/web/locales/hu.json +2 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/web/locales/it.json +2 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/web/locales/pl.json +2 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/web/locales/sk.json +2 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/web/locales/sv.json +2 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/web/viewer.js +8 -2
- {amigent-1.2.0 → amigent-1.3.0/src/amigent.egg-info}/PKG-INFO +52 -4
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent.egg-info/SOURCES.txt +20 -0
- amigent-1.3.0/tests/test_adf.py +123 -0
- amigent-1.3.0/tests/test_deflate_c.py +88 -0
- {amigent-1.2.0 → amigent-1.3.0}/tests/test_fast.py +20 -0
- amigent-1.3.0/tests/test_follow.py +46 -0
- amigent-1.3.0/tests/test_hold.py +145 -0
- amigent-1.3.0/tests/test_others.py +42 -0
- amigent-1.3.0/tests/test_outdated_pc.py +32 -0
- {amigent-1.2.0 → amigent-1.3.0}/tests/test_protocol2.py +13 -0
- {amigent-1.2.0 → amigent-1.3.0}/tests/test_screenfeed.py +26 -0
- amigent-1.3.0/tests/test_unpack_safety.py +34 -0
- {amigent-1.2.0 → amigent-1.3.0}/tests/test_update.py +21 -0
- amigent-1.3.0/tests/test_v13.py +731 -0
- {amigent-1.2.0 → amigent-1.3.0}/tests/test_viewer.py +29 -0
- amigent-1.2.0/src/amigent/amiga/bin/amigentd +0 -0
- amigent-1.2.0/src/amigent/amiga/bin/amigentd.000 +0 -0
- amigent-1.2.0/src/amigent/server.py +0 -753
- {amigent-1.2.0 → amigent-1.3.0}/LICENSE +0 -0
- {amigent-1.2.0 → amigent-1.3.0}/pyproject.toml +0 -0
- {amigent-1.2.0 → amigent-1.3.0}/setup.cfg +0 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/amiga/Amigent-Update.info +0 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/amiga/amigent-repair +0 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/amiga/amigent-repair.info +0 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/amiga/amigent-scan +0 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/amiga/amigent-update.rexx +0 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/amiga/bin/Amigent.info +0 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/amiga/bin/amigent-status +0 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/amiga/bin/amigent-status.info +0 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/amiga/bin/amigentd.info +0 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/amiga/menu-add.rexx +0 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/amigactl.py +0 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/client.py +0 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/desktop.py +0 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/doctor.py +0 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/errors.py +0 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/fleet.py +0 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/inventory.py +0 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/legacy.py +0 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/locks.py +0 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/machines.py +0 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/macos/Amigent.swift +0 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/macos/Amigent.zip +0 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/net.py +0 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/paths.py +0 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/pictures.py +0 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/planar.py +0 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/platform_util.py +0 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/power.py +0 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/roster.py +0 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/secret.py +0 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/serve.py +0 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/tls.py +0 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/transfer.py +0 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/web/amigent.icns +0 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/web/amigent.ico +0 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/web/fleet.css +0 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/web/fleet.html +0 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/web/icon.png +0 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/web/icon.svg +0 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/web/index.html +0 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/web/viewer.css +0 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent/webserver.py +0 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent.egg-info/dependency_links.txt +0 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent.egg-info/entry_points.txt +0 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent.egg-info/requires.txt +0 -0
- {amigent-1.2.0 → amigent-1.3.0}/src/amigent.egg-info/top_level.txt +0 -0
- {amigent-1.2.0 → amigent-1.3.0}/tests/test_amigactl.py +0 -0
- {amigent-1.2.0 → amigent-1.3.0}/tests/test_amigentd.py +0 -0
- {amigent-1.2.0 → amigent-1.3.0}/tests/test_channel.py +0 -0
- {amigent-1.2.0 → amigent-1.3.0}/tests/test_errors.py +0 -0
- {amigent-1.2.0 → amigent-1.3.0}/tests/test_fleet.py +0 -0
- {amigent-1.2.0 → amigent-1.3.0}/tests/test_inventory.py +0 -0
- {amigent-1.2.0 → amigent-1.3.0}/tests/test_lzh.py +0 -0
- {amigent-1.2.0 → amigent-1.3.0}/tests/test_machines.py +0 -0
- {amigent-1.2.0 → amigent-1.3.0}/tests/test_net.py +0 -0
- {amigent-1.2.0 → amigent-1.3.0}/tests/test_pause.py +0 -0
- {amigent-1.2.0 → amigent-1.3.0}/tests/test_planar.py +0 -0
- {amigent-1.2.0 → amigent-1.3.0}/tests/test_power.py +0 -0
- {amigent-1.2.0 → amigent-1.3.0}/tests/test_secret.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: amigent
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.3.0
|
|
4
4
|
Summary: Complete remote control for a real Amiga, by AI or manually, tuned for slow Amigas and slow networks
|
|
5
5
|
Author: Andreas Wendorf (Akustikrausch)
|
|
6
6
|
License-Expression: MIT
|
|
@@ -58,6 +58,12 @@ any moment.
|
|
|
58
58
|
|
|
59
59
|

|
|
60
60
|
|
|
61
|
+
Programs that open their own screen, such as SysInfo on the chipset next to a
|
|
62
|
+
graphics-card Workbench, show up as they are. The list at the top brings any
|
|
63
|
+
screen to the front, from the PC.
|
|
64
|
+
|
|
65
|
+

|
|
66
|
+
|
|
61
67
|
## Installation
|
|
62
68
|
|
|
63
69
|
### On the Amiga
|
|
@@ -94,6 +100,33 @@ Amiga key.
|
|
|
94
100
|
|
|
95
101
|
Without an AI agent: see the [manual installation](https://github.com/akustikrausch/amigent/blob/main/docs/GUIDE.md#manual-installation).
|
|
96
102
|
|
|
103
|
+
### Updating
|
|
104
|
+
|
|
105
|
+
Amigent has two halves, amigentd on the Amiga and the program on your PC or
|
|
106
|
+
Mac. Update both; either order works.
|
|
107
|
+
|
|
108
|
+
Paste this into your AI agent:
|
|
109
|
+
|
|
110
|
+
Update Amigent for me, both halves: run "pipx upgrade amigent" on this
|
|
111
|
+
computer, then "amigent-setup --update" for the amigentd on my Amiga.
|
|
112
|
+
Then tell me to restart you, so you get the new tools.
|
|
113
|
+
|
|
114
|
+
Or in a terminal:
|
|
115
|
+
|
|
116
|
+
pipx upgrade amigent
|
|
117
|
+
amigent-setup --update
|
|
118
|
+
|
|
119
|
+
Then restart your AI app and the remote desktop, so they run the new version.
|
|
120
|
+
|
|
121
|
+
Updated the Amiga first, at the Amiga? Unpack the new archive from the
|
|
122
|
+
[releases](https://github.com/akustikrausch/amigent/releases) or Aminet and
|
|
123
|
+
double-click *Amigent-Update* in its drawer. Then give your agent the same
|
|
124
|
+
prompt as above, or run `pipx upgrade amigent` on the PC and restart the AI app. From 1.3.0 on, the PC notices a newer
|
|
125
|
+
amigentd and says so, in the agent's answers and in the remote desktop.
|
|
126
|
+
|
|
127
|
+
Key, encryption and the start line stay as they are. One side alone keeps
|
|
128
|
+
working as before; the new features need both.
|
|
129
|
+
|
|
97
130
|
## What you need
|
|
98
131
|
|
|
99
132
|
- An Amiga with AmigaOS 2.04 or newer, any CPU from the 68000 on, a network connection
|
|
@@ -106,6 +139,8 @@ Without an AI agent: see the [manual installation](https://github.com/akustikrau
|
|
|
106
139
|
"Install the game from my Downloads folder and add it to the Games menu."
|
|
107
140
|
"Copy the demo to the Amiga and start it."
|
|
108
141
|
"Open the remote desktop."
|
|
142
|
+
"Install the newest HippoPlayer from Aminet, so I can take it back if it doesn't work."
|
|
143
|
+
"Build my program, run it on the Amiga and show me its debug output."
|
|
109
144
|
|
|
110
145
|
## Made for slow machines and slow wires
|
|
111
146
|
|
|
@@ -122,6 +157,13 @@ feel quick, for the AI agent and for you at the mouse:
|
|
|
122
157
|
and costs the Amiga only a few percent of its CPU.
|
|
123
158
|
- **Files go in one go.** Whole folders travel in a single stream, and files
|
|
124
159
|
that are already there stay where they are.
|
|
160
|
+
- **Text where text is enough.** The AI agent reads what programs write on
|
|
161
|
+
the screen as text, a few hundred bytes, and takes a picture only of the
|
|
162
|
+
part where it needs one. It waits on the Amiga itself for a window or a
|
|
163
|
+
line of text instead of looking again and again.
|
|
164
|
+
- **Packed when the Amiga is fast.** With an accelerator behind a slow
|
|
165
|
+
network, replies, files and screen tiles travel packed; a slow CPU on a
|
|
166
|
+
fast network stays unpacked. Amigent measures both and decides.
|
|
125
167
|
|
|
126
168
|
Measured with a 640×256 Workbench screen:
|
|
127
169
|
|
|
@@ -144,9 +186,13 @@ All numbers, how they were taken and how to repeat them are in
|
|
|
144
186
|
- **New address after a restart?** Amigent finds the Amiga again by itself. It
|
|
145
187
|
takes only the one that proves to be yours.
|
|
146
188
|
- **Several Amigas?** `amigent-fleet` shows them side by side with a preview.
|
|
147
|
-
- **
|
|
148
|
-
|
|
149
|
-
|
|
189
|
+
- **Watching from the Amiga?** `amigent-monitor` in the Amigent folder opens a
|
|
190
|
+
window there that lists, line by line, what the agent is doing.
|
|
191
|
+
- **Trying out software?** The agent can record an installation and take it
|
|
192
|
+
back completely, and fetch programs from Aminet straight from the PC.
|
|
193
|
+
- **Developing for the Amiga?** The agent builds and runs your program and
|
|
194
|
+
reads its kprintf and Enforcer output, and keeps a copy of a growing log on
|
|
195
|
+
the PC that survives a crash.
|
|
150
196
|
- **Running a test or a benchmark?** *Pause the picture* in the remote desktop
|
|
151
197
|
(or `PAUSE` by ARexx) gives the Amiga's CPU back to it for a while; mouse,
|
|
152
198
|
keys and files keep working.
|
|
@@ -154,6 +200,8 @@ All numbers, how they were taken and how to repeat them are in
|
|
|
154
200
|
- **Safe at home.** A key keeps other computers on the network out, and the
|
|
155
201
|
connection can be encrypted. Don't open the Amiga to the internet.
|
|
156
202
|
|
|
203
|
+
<p align="center"><img src="https://raw.githubusercontent.com/akustikrausch/amigent/main/docs/screenshots/monitor.png" width="772" alt="amigent-monitor on the Amiga: the agent's tool calls, commands and screen reads line by line, next to link, traffic and memory figures"></p>
|
|
204
|
+
|
|
157
205
|
More in the [guide](https://github.com/akustikrausch/amigent/blob/main/docs/GUIDE.md) and the [FAQ](https://github.com/akustikrausch/amigent/blob/main/docs/FAQ.md).
|
|
158
206
|
|
|
159
207
|
## License
|
|
@@ -30,6 +30,12 @@ any moment.
|
|
|
30
30
|
|
|
31
31
|

|
|
32
32
|
|
|
33
|
+
Programs that open their own screen, such as SysInfo on the chipset next to a
|
|
34
|
+
graphics-card Workbench, show up as they are. The list at the top brings any
|
|
35
|
+
screen to the front, from the PC.
|
|
36
|
+
|
|
37
|
+

|
|
38
|
+
|
|
33
39
|
## Installation
|
|
34
40
|
|
|
35
41
|
### On the Amiga
|
|
@@ -66,6 +72,33 @@ Amiga key.
|
|
|
66
72
|
|
|
67
73
|
Without an AI agent: see the [manual installation](https://github.com/akustikrausch/amigent/blob/main/docs/GUIDE.md#manual-installation).
|
|
68
74
|
|
|
75
|
+
### Updating
|
|
76
|
+
|
|
77
|
+
Amigent has two halves, amigentd on the Amiga and the program on your PC or
|
|
78
|
+
Mac. Update both; either order works.
|
|
79
|
+
|
|
80
|
+
Paste this into your AI agent:
|
|
81
|
+
|
|
82
|
+
Update Amigent for me, both halves: run "pipx upgrade amigent" on this
|
|
83
|
+
computer, then "amigent-setup --update" for the amigentd on my Amiga.
|
|
84
|
+
Then tell me to restart you, so you get the new tools.
|
|
85
|
+
|
|
86
|
+
Or in a terminal:
|
|
87
|
+
|
|
88
|
+
pipx upgrade amigent
|
|
89
|
+
amigent-setup --update
|
|
90
|
+
|
|
91
|
+
Then restart your AI app and the remote desktop, so they run the new version.
|
|
92
|
+
|
|
93
|
+
Updated the Amiga first, at the Amiga? Unpack the new archive from the
|
|
94
|
+
[releases](https://github.com/akustikrausch/amigent/releases) or Aminet and
|
|
95
|
+
double-click *Amigent-Update* in its drawer. Then give your agent the same
|
|
96
|
+
prompt as above, or run `pipx upgrade amigent` on the PC and restart the AI app. From 1.3.0 on, the PC notices a newer
|
|
97
|
+
amigentd and says so, in the agent's answers and in the remote desktop.
|
|
98
|
+
|
|
99
|
+
Key, encryption and the start line stay as they are. One side alone keeps
|
|
100
|
+
working as before; the new features need both.
|
|
101
|
+
|
|
69
102
|
## What you need
|
|
70
103
|
|
|
71
104
|
- An Amiga with AmigaOS 2.04 or newer, any CPU from the 68000 on, a network connection
|
|
@@ -78,6 +111,8 @@ Without an AI agent: see the [manual installation](https://github.com/akustikrau
|
|
|
78
111
|
"Install the game from my Downloads folder and add it to the Games menu."
|
|
79
112
|
"Copy the demo to the Amiga and start it."
|
|
80
113
|
"Open the remote desktop."
|
|
114
|
+
"Install the newest HippoPlayer from Aminet, so I can take it back if it doesn't work."
|
|
115
|
+
"Build my program, run it on the Amiga and show me its debug output."
|
|
81
116
|
|
|
82
117
|
## Made for slow machines and slow wires
|
|
83
118
|
|
|
@@ -94,6 +129,13 @@ feel quick, for the AI agent and for you at the mouse:
|
|
|
94
129
|
and costs the Amiga only a few percent of its CPU.
|
|
95
130
|
- **Files go in one go.** Whole folders travel in a single stream, and files
|
|
96
131
|
that are already there stay where they are.
|
|
132
|
+
- **Text where text is enough.** The AI agent reads what programs write on
|
|
133
|
+
the screen as text, a few hundred bytes, and takes a picture only of the
|
|
134
|
+
part where it needs one. It waits on the Amiga itself for a window or a
|
|
135
|
+
line of text instead of looking again and again.
|
|
136
|
+
- **Packed when the Amiga is fast.** With an accelerator behind a slow
|
|
137
|
+
network, replies, files and screen tiles travel packed; a slow CPU on a
|
|
138
|
+
fast network stays unpacked. Amigent measures both and decides.
|
|
97
139
|
|
|
98
140
|
Measured with a 640×256 Workbench screen:
|
|
99
141
|
|
|
@@ -116,9 +158,13 @@ All numbers, how they were taken and how to repeat them are in
|
|
|
116
158
|
- **New address after a restart?** Amigent finds the Amiga again by itself. It
|
|
117
159
|
takes only the one that proves to be yours.
|
|
118
160
|
- **Several Amigas?** `amigent-fleet` shows them side by side with a preview.
|
|
119
|
-
- **
|
|
120
|
-
|
|
121
|
-
|
|
161
|
+
- **Watching from the Amiga?** `amigent-monitor` in the Amigent folder opens a
|
|
162
|
+
window there that lists, line by line, what the agent is doing.
|
|
163
|
+
- **Trying out software?** The agent can record an installation and take it
|
|
164
|
+
back completely, and fetch programs from Aminet straight from the PC.
|
|
165
|
+
- **Developing for the Amiga?** The agent builds and runs your program and
|
|
166
|
+
reads its kprintf and Enforcer output, and keeps a copy of a growing log on
|
|
167
|
+
the PC that survives a crash.
|
|
122
168
|
- **Running a test or a benchmark?** *Pause the picture* in the remote desktop
|
|
123
169
|
(or `PAUSE` by ARexx) gives the Amiga's CPU back to it for a while; mouse,
|
|
124
170
|
keys and files keep working.
|
|
@@ -126,6 +172,8 @@ All numbers, how they were taken and how to repeat them are in
|
|
|
126
172
|
- **Safe at home.** A key keeps other computers on the network out, and the
|
|
127
173
|
connection can be encrypted. Don't open the Amiga to the internet.
|
|
128
174
|
|
|
175
|
+
<p align="center"><img src="https://raw.githubusercontent.com/akustikrausch/amigent/main/docs/screenshots/monitor.png" width="772" alt="amigent-monitor on the Amiga: the agent's tool calls, commands and screen reads line by line, next to link, traffic and memory figures"></p>
|
|
176
|
+
|
|
129
177
|
More in the [guide](https://github.com/akustikrausch/amigent/blob/main/docs/GUIDE.md) and the [FAQ](https://github.com/akustikrausch/amigent/blob/main/docs/FAQ.md).
|
|
130
178
|
|
|
131
179
|
## License
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"""Files out of an Amiga disk image (.adf, gzipped .adz), on the PC.
|
|
2
|
+
|
|
3
|
+
AmigaDOS floppies use 512-byte blocks: 1760 (DD) or 3520 (HD). The root
|
|
4
|
+
block sits in the middle; directories keep a 72-entry hash table of header
|
|
5
|
+
blocks with chains, a file header lists its data blocks (more in extension
|
|
6
|
+
blocks), and data blocks carry a 24-byte header in OFS and none in FFS.
|
|
7
|
+
Disks in a custom format (most bootable games) can't be read this way.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
|
|
12
|
+
import gzip
|
|
13
|
+
import struct
|
|
14
|
+
|
|
15
|
+
BSIZE = 512
|
|
16
|
+
T_HEADER, T_DATA, T_LIST = 2, 8, 16
|
|
17
|
+
ST_ROOT, ST_USERDIR, ST_FILE = 1, 2, -3
|
|
18
|
+
HT_SIZE = 72
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class AdfError(ValueError):
|
|
22
|
+
pass
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def _longs(block: bytes) -> tuple:
|
|
26
|
+
return struct.unpack(">128l", block)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def _name(block: bytes) -> str:
|
|
30
|
+
n = min(block[432], 30)
|
|
31
|
+
return block[433:433 + n].decode("iso-8859-1")
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class Disk:
|
|
35
|
+
def __init__(self, image: bytes):
|
|
36
|
+
if image[:2] == b"\x1f\x8b":
|
|
37
|
+
image = gzip.decompress(image)
|
|
38
|
+
if len(image) not in (1760 * BSIZE, 3520 * BSIZE):
|
|
39
|
+
raise AdfError(f"{len(image)} bytes is not an 880 KB or 1.76 MB disk image")
|
|
40
|
+
if image[:3] != b"DOS":
|
|
41
|
+
raise AdfError("not an AmigaDOS disk (custom format, as many games use): "
|
|
42
|
+
"write it to a floppy instead")
|
|
43
|
+
self.image = image
|
|
44
|
+
self.blocks = len(image) // BSIZE
|
|
45
|
+
self.ffs = bool(image[3] & 1)
|
|
46
|
+
self.root = self.blocks // 2
|
|
47
|
+
if _longs(self.block(self.root))[127] != ST_ROOT:
|
|
48
|
+
raise AdfError("the root block is not where it should be")
|
|
49
|
+
|
|
50
|
+
def block(self, n: int) -> bytes:
|
|
51
|
+
if not 2 <= n < self.blocks:
|
|
52
|
+
raise AdfError(f"block {n} is outside the disk")
|
|
53
|
+
return self.image[n * BSIZE:(n + 1) * BSIZE]
|
|
54
|
+
|
|
55
|
+
@property
|
|
56
|
+
def label(self) -> str:
|
|
57
|
+
return _name(self.block(self.root))
|
|
58
|
+
|
|
59
|
+
def entries(self, dir_block: int) -> list[int]:
|
|
60
|
+
"""Header blocks of everything in a directory, following the hash chains."""
|
|
61
|
+
out, seen = [], set()
|
|
62
|
+
for key in _longs(self.block(dir_block))[6:6 + HT_SIZE]:
|
|
63
|
+
while key and key not in seen:
|
|
64
|
+
seen.add(key)
|
|
65
|
+
out.append(key)
|
|
66
|
+
key = _longs(self.block(key))[124]
|
|
67
|
+
return out
|
|
68
|
+
|
|
69
|
+
def file_data(self, header: int) -> bytes:
|
|
70
|
+
b = self.block(header)
|
|
71
|
+
size = _longs(b)[81]
|
|
72
|
+
keys: list[int] = []
|
|
73
|
+
ext, hops = header, 0
|
|
74
|
+
while ext:
|
|
75
|
+
blk = _longs(self.block(ext))
|
|
76
|
+
count = blk[2]
|
|
77
|
+
keys += [blk[77 - i] for i in range(min(count, HT_SIZE))]
|
|
78
|
+
ext = blk[126]
|
|
79
|
+
hops += 1
|
|
80
|
+
if hops > self.blocks:
|
|
81
|
+
raise AdfError("extension block loop")
|
|
82
|
+
data = bytearray()
|
|
83
|
+
# Some OFS disks hold files written without the data block headers (FFS style);
|
|
84
|
+
# the block count tells: 512 bytes a block instead of 488.
|
|
85
|
+
raw_style = self.ffs or (keys and _longs(self.block(keys[0]))[0] != T_DATA
|
|
86
|
+
and len(keys) == (size + BSIZE - 1) // BSIZE)
|
|
87
|
+
for key in keys:
|
|
88
|
+
raw = self.block(key)
|
|
89
|
+
if raw_style:
|
|
90
|
+
data += raw
|
|
91
|
+
else:
|
|
92
|
+
l = _longs(raw)
|
|
93
|
+
if l[0] != T_DATA:
|
|
94
|
+
raise AdfError(f"block {key} is not a data block")
|
|
95
|
+
data += raw[24:24 + max(0, min(l[3], BSIZE - 24))]
|
|
96
|
+
if len(data) < size:
|
|
97
|
+
raise AdfError(f"file at block {header} is shorter than its size says")
|
|
98
|
+
return bytes(data[:size])
|
|
99
|
+
|
|
100
|
+
def walk(self, dir_block: int | None = None, prefix: str = "",
|
|
101
|
+
seen: set[int] | None = None) -> dict[str, bytes]:
|
|
102
|
+
"""{path: data} of every file below a directory (the root by default)."""
|
|
103
|
+
out: dict[str, bytes] = {}
|
|
104
|
+
dir_block = self.root if dir_block is None else dir_block
|
|
105
|
+
seen = set() if seen is None else seen
|
|
106
|
+
if dir_block in seen:
|
|
107
|
+
raise AdfError(f"directory at block {dir_block} contains itself")
|
|
108
|
+
seen.add(dir_block)
|
|
109
|
+
for key in self.entries(dir_block):
|
|
110
|
+
b = self.block(key)
|
|
111
|
+
l = _longs(b)
|
|
112
|
+
name = _name(b)
|
|
113
|
+
if not name or "/" in name or name in (".", ".."):
|
|
114
|
+
continue
|
|
115
|
+
path = prefix + name
|
|
116
|
+
if l[127] == ST_USERDIR:
|
|
117
|
+
out.update(self.walk(key, path + "/", seen))
|
|
118
|
+
elif l[127] == ST_FILE:
|
|
119
|
+
out[path] = self.file_data(key)
|
|
120
|
+
return out
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
def extract_all(image: bytes) -> dict[str, bytes]:
|
|
124
|
+
return Disk(image).walk()
|
|
@@ -23,6 +23,26 @@ If NOT EXISTS $build
|
|
|
23
23
|
Skip done
|
|
24
24
|
EndIf
|
|
25
25
|
Echo "Installing $build from this drawer."
|
|
26
|
+
; amigent-status and amigent-monitor go to the Amigent folder; icons only when missing
|
|
27
|
+
Set home SYS:amigent
|
|
28
|
+
If EXISTS ENVARC:amigent-home
|
|
29
|
+
Set home `Type ENVARC:amigent-home`
|
|
30
|
+
EndIf
|
|
31
|
+
If EXISTS "$home"
|
|
32
|
+
If EXISTS amigent-status
|
|
33
|
+
Copy amigent-status "$home/" QUIET
|
|
34
|
+
EndIf
|
|
35
|
+
If EXISTS amigent-monitor
|
|
36
|
+
Copy amigent-monitor "$home/" QUIET
|
|
37
|
+
EndIf
|
|
38
|
+
If NOT EXISTS "$home/amigent-status.info"
|
|
39
|
+
Copy amigent-status.info "$home/" QUIET
|
|
40
|
+
EndIf
|
|
41
|
+
If NOT EXISTS "$home/amigent-monitor.info"
|
|
42
|
+
Copy amigent-monitor.info "$home/" QUIET
|
|
43
|
+
EndIf
|
|
44
|
+
EndIf
|
|
45
|
+
UnSet home
|
|
26
46
|
Copy $build C:amigentd.new QUIET
|
|
27
47
|
Run >NIL: RexxMast >NIL:
|
|
28
48
|
Wait 1
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -9,11 +9,12 @@ import socket
|
|
|
9
9
|
import ssl
|
|
10
10
|
import struct
|
|
11
11
|
import time
|
|
12
|
+
import zlib
|
|
12
13
|
from collections import deque
|
|
13
14
|
|
|
14
15
|
from PIL import Image
|
|
15
16
|
|
|
16
|
-
from . import tls
|
|
17
|
+
from . import pack, tls
|
|
17
18
|
from .planar import HAM, HAS_PALETTE, Chunky, Planes, PlanarError
|
|
18
19
|
from .planar import header as planar_header
|
|
19
20
|
from .secret import load_key
|
|
@@ -25,6 +26,9 @@ CMD_AUTH, CMD_CLIENT, CMD_PAUSE = 17, 18, 19
|
|
|
25
26
|
PAUSE_PROTOCOL = 4 # INFO tells the seconds of screen pause left, PAUSE sets them
|
|
26
27
|
RGB_AREA = 512 * 512 # FRAME_RGB answers regions of up to this many pixels
|
|
27
28
|
FRAME_PLANAR = 2 | 4 # FRAME arg bits: planes or chunky tiles, all methods; PROTOCOL.md "planar"
|
|
29
|
+
FRAME_DEFLATE = {1: 8, 2: 16} # FRAME arg bits, protocol 5: tiles may come deflated (fast, best)
|
|
30
|
+
DEFLATED = 32 # tile method bit: the data are a raw deflate stream of what the other bits say
|
|
31
|
+
PACK_PROTOCOL = 5
|
|
28
32
|
|
|
29
33
|
RAWKEYS = {
|
|
30
34
|
"space": 0x40, "backspace": 0x41, "tab": 0x42, "enter": 0x43, "return": 0x44,
|
|
@@ -47,6 +51,8 @@ PALETTE = bytes(c for v in range(256) for c in (_LUT["r"][v], _LUT["g"][v], _LUT
|
|
|
47
51
|
_BYTE = [bytes((v,)) for v in range(256)]
|
|
48
52
|
|
|
49
53
|
|
|
54
|
+
DRAG_STEP = 8 # px per relative step: small enough that mouse acceleration stays out
|
|
55
|
+
|
|
50
56
|
class AmigentdError(Exception):
|
|
51
57
|
pass
|
|
52
58
|
|
|
@@ -119,6 +125,7 @@ class Amigentd:
|
|
|
119
125
|
self._buttons = 0
|
|
120
126
|
self._last_used = 0.0
|
|
121
127
|
self.protocol = 0
|
|
128
|
+
self.policy: pack.Policy | None = None
|
|
122
129
|
self.flags = 0
|
|
123
130
|
self.paused_until = 0.0 # monotonic end of the screen pause, as INFO last told
|
|
124
131
|
self.listeners: list = [] # called as listener("size", (w, h)) or ("tiles", [...])
|
|
@@ -327,9 +334,17 @@ class Amigentd:
|
|
|
327
334
|
start = time.perf_counter()
|
|
328
335
|
count = struct.unpack(">I", (yield 4))[0]
|
|
329
336
|
size += 4
|
|
337
|
+
deflated = False
|
|
330
338
|
for _ in range(count):
|
|
331
339
|
x, y, w, h, method, n = struct.unpack(">HHHHBI", (yield 13))
|
|
332
340
|
data = yield n
|
|
341
|
+
deflated = deflated or bool(method & DEFLATED)
|
|
342
|
+
if method & DEFLATED:
|
|
343
|
+
try:
|
|
344
|
+
data = zlib.decompress(data, -15)
|
|
345
|
+
except zlib.error as e:
|
|
346
|
+
raise AmigentdError(f"tile at {x},{y}: bad packed data ({e})") from e
|
|
347
|
+
method &= ~DEFLATED
|
|
333
348
|
try:
|
|
334
349
|
surface.apply(x, y, w, h, method, data)
|
|
335
350
|
except PlanarError as e:
|
|
@@ -337,7 +352,10 @@ class Amigentd:
|
|
|
337
352
|
size += 13 + n
|
|
338
353
|
take((x, y, w, h, surface.tile(x, y, w, h) if isinstance(surface, Chunky) else data))
|
|
339
354
|
self.received += size
|
|
340
|
-
|
|
355
|
+
elapsed = time.perf_counter() - start
|
|
356
|
+
if not deflated and self.policy: # the line itself, not the Amiga's packing
|
|
357
|
+
self.policy.note(size, elapsed)
|
|
358
|
+
return count, size, elapsed
|
|
341
359
|
|
|
342
360
|
def _planar_reply(self, take):
|
|
343
361
|
"""Format 1: the planes, maybe a palette, then tiles."""
|
|
@@ -506,7 +524,16 @@ class Amigentd:
|
|
|
506
524
|
return self._retry(call)
|
|
507
525
|
|
|
508
526
|
def frame_arg(self, force: bool) -> int:
|
|
509
|
-
|
|
527
|
+
arg = int(force) | (FRAME_PLANAR if self.planar else 0)
|
|
528
|
+
if self.planar and self.protocol >= PACK_PROTOCOL:
|
|
529
|
+
arg |= FRAME_DEFLATE.get(self.packing().level(), 0)
|
|
530
|
+
return arg
|
|
531
|
+
|
|
532
|
+
def packing(self) -> pack.Policy:
|
|
533
|
+
"""The Amiga's packing policy, shared with the command channel that learns its rates."""
|
|
534
|
+
if self.policy is None:
|
|
535
|
+
self.policy = pack.policy_for(self.host)
|
|
536
|
+
return self.policy
|
|
510
537
|
|
|
511
538
|
def capture(self, x: int = 0, y: int = 0, w: int | None = None,
|
|
512
539
|
h: int | None = None) -> Image.Image:
|
|
@@ -526,7 +553,20 @@ class Amigentd:
|
|
|
526
553
|
return self._paint()
|
|
527
554
|
|
|
528
555
|
def move(self, x: int, y: int) -> None:
|
|
529
|
-
|
|
556
|
+
"""Put the pointer at x, y; points off the screen go to its nearest edge
|
|
557
|
+
(a window partly outside the screen gives such coordinates)."""
|
|
558
|
+
x, y = int(x), int(y)
|
|
559
|
+
w, h = self.width, self.height # of the last picture: another screen may be in front now
|
|
560
|
+
if w and h and (x >= w or y >= h) and self.protocol >= 2:
|
|
561
|
+
try:
|
|
562
|
+
front = next((s for s in self.screens() if s["front"]), None)
|
|
563
|
+
if front:
|
|
564
|
+
w, h = front["width"], front["height"]
|
|
565
|
+
except (AmigentdError, OSError):
|
|
566
|
+
pass
|
|
567
|
+
hi_x = w - 1 if w else 0xFFFF
|
|
568
|
+
hi_y = h - 1 if h else 0xFFFF
|
|
569
|
+
self._ok(CMD_MOVE, 0, max(0, min(x, hi_x)), max(0, min(y, hi_y)))
|
|
530
570
|
|
|
531
571
|
def button(self, name: str, down: bool) -> None:
|
|
532
572
|
mask = BUTTONS[name]
|
|
@@ -558,15 +598,74 @@ class Amigentd:
|
|
|
558
598
|
self.button(button, False)
|
|
559
599
|
time.sleep(0.05)
|
|
560
600
|
|
|
561
|
-
def drag(self, x1: int, y1: int, x2: int, y2: int, button: str = "left"
|
|
601
|
+
def drag(self, x1: int, y1: int, x2: int, y2: int, button: str = "left",
|
|
602
|
+
relative: bool | None = None) -> None:
|
|
603
|
+
"""relative=True: the way there only as mouse movement in small steps, for
|
|
604
|
+
programs that follow the mouse themselves (ProTracker 4 moves its window only so).
|
|
605
|
+
relative=False: one jump of the pointer, as before 1.3.0.
|
|
606
|
+
None (default): mouse movement, then a jump to the exact end if the pointer
|
|
607
|
+
isn't there. A single jump (IECLASS_NEWPOINTERPOS) puts the pointer at the end
|
|
608
|
+
but window drag bars and size gadgets on OS 3.2 stay put: they follow mouse
|
|
609
|
+
movement (RAWMOUSE) with the button held, as menus and icons need not."""
|
|
610
|
+
if relative is None:
|
|
611
|
+
if not self._sock:
|
|
612
|
+
self._retry(lambda: None) # connect: the protocol decides
|
|
613
|
+
if self.protocol < 2:
|
|
614
|
+
relative = False # no mouse deltas before protocol 2
|
|
615
|
+
dx, dy = x2 - x1, y2 - y1
|
|
616
|
+
if relative is not False:
|
|
617
|
+
dx, dy = self.calibrate_walk(x1, y1, dx, dy)
|
|
562
618
|
self.move(x1, y1)
|
|
563
619
|
time.sleep(0.05)
|
|
564
620
|
self.button(button, True)
|
|
565
|
-
time.sleep(0.
|
|
566
|
-
|
|
621
|
+
time.sleep(0.1)
|
|
622
|
+
if relative is False:
|
|
623
|
+
self.move(x2, y2)
|
|
624
|
+
else:
|
|
625
|
+
self.walk_relative(dx, dy)
|
|
626
|
+
time.sleep(0.05)
|
|
627
|
+
at = self.pointer()
|
|
628
|
+
if relative is None and (at is None or abs(at[0] - x2) > 1 or abs(at[1] - y2) > 1):
|
|
629
|
+
self.move(x2, y2) # icons and menus go by where the pointer is
|
|
567
630
|
time.sleep(0.05)
|
|
568
631
|
self.button(button, False)
|
|
569
632
|
|
|
633
|
+
def calibrate_walk(self, x: int, y: int, dx: int, dy: int, rounds: int = 3) -> tuple[int, int]:
|
|
634
|
+
"""The distance to walk so that the pointer really covers dx, dy.
|
|
635
|
+
|
|
636
|
+
Mouse acceleration depends on the step size and isn't the same across and
|
|
637
|
+
down, so no fixed factor fits. Walk the way with the button up from the start,
|
|
638
|
+
see where the pointer got, scale, try again. While a drag bar or size gadget
|
|
639
|
+
is held, Intuition's pointer position can't be trusted for a correction; the
|
|
640
|
+
same steps without the button cover the same distance. Unchanged when the
|
|
641
|
+
pointer position can't be read (amigentd before 1.3.0)."""
|
|
642
|
+
want_x, want_y = dx, dy
|
|
643
|
+
if self.pointer() is None:
|
|
644
|
+
return want_x, want_y
|
|
645
|
+
for _ in range(rounds):
|
|
646
|
+
self.move(x, y)
|
|
647
|
+
time.sleep(0.05)
|
|
648
|
+
start = self.pointer()
|
|
649
|
+
if start is None:
|
|
650
|
+
return want_x, want_y
|
|
651
|
+
self.walk_relative(dx, dy)
|
|
652
|
+
time.sleep(0.05)
|
|
653
|
+
end = self.pointer()
|
|
654
|
+
if end is None:
|
|
655
|
+
return want_x, want_y
|
|
656
|
+
got_x, got_y = end[0] - start[0], end[1] - start[1]
|
|
657
|
+
if abs(got_x - want_x) <= 1 and abs(got_y - want_y) <= 1:
|
|
658
|
+
break
|
|
659
|
+
if got_x and want_x:
|
|
660
|
+
dx = round(dx * want_x / got_x)
|
|
661
|
+
elif want_x and not got_x:
|
|
662
|
+
dx = want_x # stuck at an edge: keep it plain
|
|
663
|
+
if got_y and want_y:
|
|
664
|
+
dy = round(dy * want_y / got_y)
|
|
665
|
+
elif want_y and not got_y:
|
|
666
|
+
dy = want_y
|
|
667
|
+
return dx, dy
|
|
668
|
+
|
|
570
669
|
# protocol 2: screens, true colour, relative mouse, the GUI as data
|
|
571
670
|
|
|
572
671
|
def _need(self, version: int) -> None:
|
|
@@ -576,9 +675,9 @@ class Amigentd:
|
|
|
576
675
|
raise AmigentdError(f"amigentd on the Amiga speaks protocol {self.protocol}, this needs "
|
|
577
676
|
f"{version}; run amigent-setup --update")
|
|
578
677
|
|
|
579
|
-
def _text(self, cmd: int) -> list[list[str]]:
|
|
678
|
+
def _text(self, cmd: int, a: int = 0, b: int = 0, arg: int = 0) -> list[list[str]]:
|
|
580
679
|
def call():
|
|
581
|
-
self._send(cmd)
|
|
680
|
+
self._send(cmd, arg, a, b)
|
|
582
681
|
size = struct.unpack(">I", self._exact(4))[0]
|
|
583
682
|
return self._exact(size).decode("iso-8859-1")
|
|
584
683
|
|
|
@@ -624,18 +723,67 @@ class Amigentd:
|
|
|
624
723
|
(left, top))
|
|
625
724
|
return picture
|
|
626
725
|
|
|
726
|
+
def pointer(self) -> tuple[int, int] | None:
|
|
727
|
+
"""Where Intuition has the pointer on the front screen, or None from an
|
|
728
|
+
amigentd before 1.3.0."""
|
|
729
|
+
for f in self._text(CMD_UITREE, arg=1):
|
|
730
|
+
if f[0] == "S" and len(f) >= 8:
|
|
731
|
+
return int(f[6]), int(f[7])
|
|
732
|
+
return None
|
|
733
|
+
|
|
734
|
+
def mickeys_per_pixel(self) -> tuple[float, float]:
|
|
735
|
+
"""Mouse counts per screen pixel. Intuition counts chipset screens in hires
|
|
736
|
+
interlace units: lores takes two across, a screen without interlace two down,
|
|
737
|
+
superhires half. Graphics card screens count one to one."""
|
|
738
|
+
if not self.planar or not self.width or not self.height:
|
|
739
|
+
return 1.0, 1.0
|
|
740
|
+
fx = 2.0 if self.width <= 400 else 0.5 if self.width >= 1000 else 1.0
|
|
741
|
+
fy = 2.0 if self.height < 360 else 1.0
|
|
742
|
+
return fx, fy
|
|
743
|
+
|
|
744
|
+
def walk_relative(self, dx: int, dy: int) -> None:
|
|
745
|
+
"""A distance in screen pixels as mouse movement in small steps."""
|
|
746
|
+
fx, fy = self.mickeys_per_pixel()
|
|
747
|
+
dx, dy = round(dx * fx), round(dy * fy)
|
|
748
|
+
steps = max(1, -(-max(abs(dx), abs(dy)) // DRAG_STEP))
|
|
749
|
+
done_x = done_y = 0
|
|
750
|
+
for i in range(1, steps + 1):
|
|
751
|
+
sx, sy = dx * i // steps - done_x, dy * i // steps - done_y
|
|
752
|
+
self.move_relative(sx, sy)
|
|
753
|
+
done_x, done_y = done_x + sx, done_y + sy
|
|
754
|
+
time.sleep(0.03)
|
|
755
|
+
|
|
756
|
+
def settle_pointer(self, x: int, y: int, rounds: int = 6) -> tuple[int, int] | None:
|
|
757
|
+
"""Correct mouse acceleration: read where the pointer is and walk the rest.
|
|
758
|
+
Returns where it ended, or None when amigentd can't tell."""
|
|
759
|
+
at = None
|
|
760
|
+
for _ in range(rounds):
|
|
761
|
+
time.sleep(0.05)
|
|
762
|
+
at = self.pointer()
|
|
763
|
+
if at is None or (abs(at[0] - x) <= 1 and abs(at[1] - y) <= 1):
|
|
764
|
+
return at
|
|
765
|
+
self.walk_relative(x - at[0], y - at[1])
|
|
766
|
+
return at
|
|
767
|
+
|
|
627
768
|
def move_relative(self, dx: int, dy: int) -> None:
|
|
628
769
|
"""Mouse movement as deltas, for programs that ignore where the pointer is put."""
|
|
629
770
|
self._need(2)
|
|
630
771
|
self._ok(CMD_MOVE_REL, 0, dx & 0xFFFF, dy & 0xFFFF)
|
|
631
772
|
|
|
632
|
-
def ui_tree(self) -> list[dict]:
|
|
633
|
-
"""
|
|
773
|
+
def ui_tree(self, handle: int = 0) -> list[dict]:
|
|
774
|
+
"""A screen (the front one by default), its windows and their gadgets, with
|
|
775
|
+
screen coordinates. amigentd before 1.3.0, or a handle that has gone, answers
|
|
776
|
+
with the front screen: the screen item's handle tells."""
|
|
634
777
|
items = []
|
|
635
|
-
for f in self._text(CMD_UITREE):
|
|
778
|
+
for f in self._text(CMD_UITREE, handle >> 16, handle & 0xFFFF):
|
|
636
779
|
if f[0] == "S" and len(f) >= 5:
|
|
780
|
+
# from amigentd 1.3.0 a sixth field: m a menu is open, h windows are held back
|
|
781
|
+
hold = f[5][:1] if len(f) >= 6 else ""
|
|
637
782
|
items.append({"kind": "screen", "handle": int(f[1], 16), "width": int(f[2]),
|
|
638
|
-
"height": int(f[3]), "title": f[4]
|
|
783
|
+
"height": int(f[3]), "title": f[4],
|
|
784
|
+
"held": {"m": "menu", "h": "held"}.get(hold, "")})
|
|
785
|
+
if len(f) >= 8: # from amigentd 1.3.0: where Intuition has the pointer
|
|
786
|
+
items[-1]["mouse"] = (int(f[6]), int(f[7]))
|
|
639
787
|
elif f[0] == "W" and len(f) >= 8:
|
|
640
788
|
items.append({"kind": "window", "id": f[1], "x": int(f[2]), "y": int(f[3]),
|
|
641
789
|
"w": int(f[4]), "h": int(f[5]), "active": "a" in f[6],
|
|
@@ -646,6 +794,15 @@ class Amigentd:
|
|
|
646
794
|
"disabled": "d" in f[8], "selected": "s" in f[8], "label": f[9]})
|
|
647
795
|
return items
|
|
648
796
|
|
|
797
|
+
def held(self) -> str:
|
|
798
|
+
"""What holds Intuition up: "menu" (one is open), "held" (new windows wait, as
|
|
799
|
+
behind a popup left open) or "" for nothing, or for an amigentd before 1.3.0."""
|
|
800
|
+
return next((i["held"] for i in self.ui_tree() if i["kind"] == "screen"), "")
|
|
801
|
+
|
|
802
|
+
def right_held(self) -> bool:
|
|
803
|
+
"""Is the right button down because this client pressed it?"""
|
|
804
|
+
return bool(self._buttons & 2)
|
|
805
|
+
|
|
649
806
|
def menus(self) -> list[dict]:
|
|
650
807
|
"""Menu strip of the active window with the boxes where titles and items appear."""
|
|
651
808
|
items = []
|