Bobss commited on
Commit
7c651d5
·
verified ·
1 Parent(s): 28ff1e5

Publish hello_watcher 0.1.0

Browse files
Files changed (9) hide show
  1. .gitattributes +0 -35
  2. .gitignore +12 -0
  3. README.md +17 -6
  4. app.json +11 -0
  5. app.py +21 -0
  6. icon.svg +11 -0
  7. index.html +0 -19
  8. style.css +0 -28
  9. ui.py +64 -0
.gitattributes DELETED
@@ -1,35 +0,0 @@
1
- *.7z filter=lfs diff=lfs merge=lfs -text
2
- *.arrow filter=lfs diff=lfs merge=lfs -text
3
- *.bin filter=lfs diff=lfs merge=lfs -text
4
- *.bz2 filter=lfs diff=lfs merge=lfs -text
5
- *.ckpt filter=lfs diff=lfs merge=lfs -text
6
- *.ftz filter=lfs diff=lfs merge=lfs -text
7
- *.gz filter=lfs diff=lfs merge=lfs -text
8
- *.h5 filter=lfs diff=lfs merge=lfs -text
9
- *.joblib filter=lfs diff=lfs merge=lfs -text
10
- *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
- *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
- *.model filter=lfs diff=lfs merge=lfs -text
13
- *.msgpack filter=lfs diff=lfs merge=lfs -text
14
- *.npy filter=lfs diff=lfs merge=lfs -text
15
- *.npz filter=lfs diff=lfs merge=lfs -text
16
- *.onnx filter=lfs diff=lfs merge=lfs -text
17
- *.ot filter=lfs diff=lfs merge=lfs -text
18
- *.parquet filter=lfs diff=lfs merge=lfs -text
19
- *.pb filter=lfs diff=lfs merge=lfs -text
20
- *.pickle filter=lfs diff=lfs merge=lfs -text
21
- *.pkl filter=lfs diff=lfs merge=lfs -text
22
- *.pt filter=lfs diff=lfs merge=lfs -text
23
- *.pth filter=lfs diff=lfs merge=lfs -text
24
- *.rar filter=lfs diff=lfs merge=lfs -text
25
- *.safetensors filter=lfs diff=lfs merge=lfs -text
26
- saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
- *.tar.* filter=lfs diff=lfs merge=lfs -text
28
- *.tar filter=lfs diff=lfs merge=lfs -text
29
- *.tflite filter=lfs diff=lfs merge=lfs -text
30
- *.tgz filter=lfs diff=lfs merge=lfs -text
31
- *.wasm filter=lfs diff=lfs merge=lfs -text
32
- *.xz filter=lfs diff=lfs merge=lfs -text
33
- *.zip filter=lfs diff=lfs merge=lfs -text
34
- *.zst filter=lfs diff=lfs merge=lfs -text
35
- *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
.gitignore ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ __pycache__/
2
+ *.py[cod]
3
+ .venv/
4
+ .pytest_cache/
5
+ .mypy_cache/
6
+ .ruff_cache/
7
+ build/
8
+ dist/
9
+ *.egg-info/
10
+ .env
11
+ .env.*
12
+ !.env.example
README.md CHANGED
@@ -1,10 +1,21 @@
1
  ---
2
- title: WatcherRobot-hello Watcher
3
- emoji: 🏢
4
- colorFrom: yellow
5
- colorTo: yellow
6
  sdk: static
7
- pinned: false
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ title: "Hello Watcher"
 
 
 
3
  sdk: static
 
4
  ---
5
 
6
+ # Hello Watcher
7
+
8
+ WatcheRobot 第一个示例应用:启动后弹出本地确认窗口,确认你的桌面机器人已准备好。
9
+
10
+ - Application ID: `hello_watcher`
11
+ - Author: 胡大娘
12
+
13
+ ## Develop
14
+
15
+ ```powershell
16
+ watcherobot app check .
17
+ watcherobot app run .
18
+ watcherobot app publish .
19
+ ```
20
+
21
+ Run the Application through the SDK Daemon. Do not execute `app.py` directly.
app.json ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema_version": 1,
3
+ "id": "hello_watcher",
4
+ "name": "Hello Watcher",
5
+ "version": "0.1.0",
6
+ "requires_watcherobot": ">=0.1.1a4,<0.2",
7
+ "dependencies": [],
8
+ "description": "WatcheRobot 第一个示例应用:启动后弹出本地确认窗口,确认你的桌面机器人已准备好。",
9
+ "author": "胡大娘",
10
+ "icon": "icon.svg"
11
+ }
app.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """WatcheRobot Application entrypoint with its own local UI."""
2
+
3
+ import asyncio
4
+
5
+ from ui import WelcomeWindow
6
+ from watcherobot.application import ApplicationContext
7
+
8
+
9
+ async def main() -> None:
10
+ async with ApplicationContext.from_environment() as app:
11
+ window = WelcomeWindow()
12
+ app.logger.info("Application UI started: %s", app.app_id)
13
+ try:
14
+ while window.is_open:
15
+ window.pump()
16
+ await asyncio.sleep(0.03)
17
+ finally:
18
+ window.close()
19
+
20
+
21
+ asyncio.run(main())
icon.svg ADDED
index.html DELETED
@@ -1,19 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
style.css DELETED
@@ -1,28 +0,0 @@
1
- body {
2
- padding: 2rem;
3
- font-family: -apple-system, BlinkMacSystemFont, "Arial", sans-serif;
4
- }
5
-
6
- h1 {
7
- font-size: 16px;
8
- margin-top: 0;
9
- }
10
-
11
- p {
12
- color: rgb(107, 114, 128);
13
- font-size: 15px;
14
- margin-bottom: 10px;
15
- margin-top: 5px;
16
- }
17
-
18
- .card {
19
- max-width: 620px;
20
- margin: 0 auto;
21
- padding: 16px;
22
- border: 1px solid lightgray;
23
- border-radius: 16px;
24
- }
25
-
26
- .card p:last-child {
27
- margin-bottom: 0;
28
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ui.py ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Simple native confirmation UI for a WatcheRobot Application."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import tkinter as tk
6
+ from tkinter import ttk
7
+
8
+
9
+ class WelcomeWindow:
10
+ """Show that the Application was created and started successfully."""
11
+
12
+ def __init__(self) -> None:
13
+ self._is_open = True
14
+ self._root = tk.Tk()
15
+ self._root.title("应用已启动 - WatcheRobot")
16
+ self._root.geometry("560x320")
17
+ self._root.minsize(480, 280)
18
+ self._root.protocol("WM_DELETE_WINDOW", self.close)
19
+
20
+ container = ttk.Frame(self._root, padding=36)
21
+ container.pack(fill="both", expand=True)
22
+
23
+ ttk.Label(
24
+ container,
25
+ text="你的桌面机器人应用已准备好",
26
+ font=("Microsoft YaHei UI", 22, "bold"),
27
+ ).pack(anchor="w")
28
+ ttk.Label(
29
+ container,
30
+ text="欢迎使用 WatcheRobot SDK",
31
+ font=("Microsoft YaHei UI", 14),
32
+ ).pack(anchor="w", pady=(12, 0))
33
+ ttk.Label(
34
+ container,
35
+ text="接下来只要告诉 AI 你想让机器人做什么,就可以继续开发。",
36
+ wraplength=460,
37
+ ).pack(anchor="w", pady=(28, 0))
38
+ ttk.Button(container, text="我知道了", command=self.close).pack(
39
+ anchor="e", pady=(28, 0)
40
+ )
41
+
42
+ @property
43
+ def is_open(self) -> bool:
44
+ return self._is_open
45
+
46
+ def pump(self) -> None:
47
+ """Process one native UI event cycle without blocking asyncio."""
48
+
49
+ if not self._is_open:
50
+ return
51
+ try:
52
+ self._root.update_idletasks()
53
+ self._root.update()
54
+ except tk.TclError:
55
+ self._is_open = False
56
+
57
+ def close(self) -> None:
58
+ if not self._is_open:
59
+ return
60
+ self._is_open = False
61
+ try:
62
+ self._root.destroy()
63
+ except tk.TclError:
64
+ pass