runtui 0.1.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.
Files changed (188) hide show
  1. runtui-0.1.0/.gitignore +8 -0
  2. runtui-0.1.0/PKG-INFO +95 -0
  3. runtui-0.1.0/README.md +76 -0
  4. runtui-0.1.0/docs/__init__.md +30 -0
  5. runtui-0.1.0/docs/app.md +174 -0
  6. runtui-0.1.0/docs/backend/__init__.md +19 -0
  7. runtui-0.1.0/docs/backend/base.md +161 -0
  8. runtui-0.1.0/docs/backend/detect.md +27 -0
  9. runtui-0.1.0/docs/backend/unix.md +140 -0
  10. runtui-0.1.0/docs/backend/windows.md +94 -0
  11. runtui-0.1.0/docs/core/__init__.md +20 -0
  12. runtui-0.1.0/docs/core/event.md +319 -0
  13. runtui-0.1.0/docs/core/event_loop.md +120 -0
  14. runtui-0.1.0/docs/core/key_encode.md +88 -0
  15. runtui-0.1.0/docs/core/keys.md +144 -0
  16. runtui-0.1.0/docs/core/pty_process.md +116 -0
  17. runtui-0.1.0/docs/core/timer.md +102 -0
  18. runtui-0.1.0/docs/core/types.md +454 -0
  19. runtui-0.1.0/docs/core/unicode.md +104 -0
  20. runtui-0.1.0/docs/demo_app.md +212 -0
  21. runtui-0.1.0/docs/dialogs/__init__.md +17 -0
  22. runtui-0.1.0/docs/dialogs/base.md +53 -0
  23. runtui-0.1.0/docs/dialogs/file_open.md +50 -0
  24. runtui-0.1.0/docs/dialogs/file_save.md +56 -0
  25. runtui-0.1.0/docs/dialogs/form.md +59 -0
  26. runtui-0.1.0/docs/dialogs/message.md +63 -0
  27. runtui-0.1.0/docs/layout/__init__.md +21 -0
  28. runtui-0.1.0/docs/layout/absolute.md +51 -0
  29. runtui-0.1.0/docs/layout/base.md +35 -0
  30. runtui-0.1.0/docs/layout/box.md +90 -0
  31. runtui-0.1.0/docs/layout/dock.md +59 -0
  32. runtui-0.1.0/docs/layout/grid.md +74 -0
  33. runtui-0.1.0/docs/mouse/__init__.md +17 -0
  34. runtui-0.1.0/docs/mouse/cursor.md +55 -0
  35. runtui-0.1.0/docs/mouse/tracker.md +70 -0
  36. runtui-0.1.0/docs/rad/__init__.md +24 -0
  37. runtui-0.1.0/docs/rad/codegen.md +122 -0
  38. runtui-0.1.0/docs/rad/deserializer.md +119 -0
  39. runtui-0.1.0/docs/rad/design_surface.md +172 -0
  40. runtui-0.1.0/docs/rad/menu_editor.md +83 -0
  41. runtui-0.1.0/docs/rad/runner.md +55 -0
  42. runtui-0.1.0/docs/rad/schema.md +114 -0
  43. runtui-0.1.0/docs/rad/serializer.md +135 -0
  44. runtui-0.1.0/docs/rad_designer.md +344 -0
  45. runtui-0.1.0/docs/rendering/__init__.md +18 -0
  46. runtui-0.1.0/docs/rendering/buffer.md +152 -0
  47. runtui-0.1.0/docs/rendering/painter.md +211 -0
  48. runtui-0.1.0/docs/rendering/screen.md +117 -0
  49. runtui-0.1.0/docs/themes/__init__.md +24 -0
  50. runtui-0.1.0/docs/themes/black_white.md +44 -0
  51. runtui-0.1.0/docs/themes/dark.md +32 -0
  52. runtui-0.1.0/docs/themes/engine.md +87 -0
  53. runtui-0.1.0/docs/themes/github.md +48 -0
  54. runtui-0.1.0/docs/themes/gruvbox.md +49 -0
  55. runtui-0.1.0/docs/themes/high_contrast.md +56 -0
  56. runtui-0.1.0/docs/themes/legacy_system.md +58 -0
  57. runtui-0.1.0/docs/themes/light.md +73 -0
  58. runtui-0.1.0/docs/themes/nord.md +36 -0
  59. runtui-0.1.0/docs/themes/solarized.md +36 -0
  60. runtui-0.1.0/docs/themes/turbo_vision.md +92 -0
  61. runtui-0.1.0/docs/themes/vscode.md +57 -0
  62. runtui-0.1.0/docs/tui_os.md +563 -0
  63. runtui-0.1.0/docs/widgets/__init__.md +29 -0
  64. runtui-0.1.0/docs/widgets/base.md +230 -0
  65. runtui-0.1.0/docs/widgets/button.md +95 -0
  66. runtui-0.1.0/docs/widgets/calendar.md +50 -0
  67. runtui-0.1.0/docs/widgets/checkbox.md +59 -0
  68. runtui-0.1.0/docs/widgets/color_picker.md +48 -0
  69. runtui-0.1.0/docs/widgets/container.md +83 -0
  70. runtui-0.1.0/docs/widgets/context_menu.md +63 -0
  71. runtui-0.1.0/docs/widgets/dropdown.md +46 -0
  72. runtui-0.1.0/docs/widgets/image.md +59 -0
  73. runtui-0.1.0/docs/widgets/input.md +107 -0
  74. runtui-0.1.0/docs/widgets/label.md +92 -0
  75. runtui-0.1.0/docs/widgets/listbox.md +83 -0
  76. runtui-0.1.0/docs/widgets/menu.md +103 -0
  77. runtui-0.1.0/docs/widgets/password.md +48 -0
  78. runtui-0.1.0/docs/widgets/progressbar.md +65 -0
  79. runtui-0.1.0/docs/widgets/radio.md +99 -0
  80. runtui-0.1.0/docs/widgets/scrollbar.md +84 -0
  81. runtui-0.1.0/docs/widgets/static_image.md +97 -0
  82. runtui-0.1.0/docs/widgets/syntax.md +98 -0
  83. runtui-0.1.0/docs/widgets/terminal.md +155 -0
  84. runtui-0.1.0/docs/widgets/terminal_pipe.md +45 -0
  85. runtui-0.1.0/docs/widgets/textarea.md +162 -0
  86. runtui-0.1.0/docs/windows/__init__.md +18 -0
  87. runtui-0.1.0/docs/windows/taskbar.md +33 -0
  88. runtui-0.1.0/docs/windows/window.md +86 -0
  89. runtui-0.1.0/docs/windows/window_manager.md +176 -0
  90. runtui-0.1.0/examples/cal.py +39 -0
  91. runtui-0.1.0/examples/calc.py +257 -0
  92. runtui-0.1.0/examples/chatbox.py +615 -0
  93. runtui-0.1.0/examples/clock.py +185 -0
  94. runtui-0.1.0/examples/demo_app.py +245 -0
  95. runtui-0.1.0/examples/key_caps.py +184 -0
  96. runtui-0.1.0/examples/mine.py +318 -0
  97. runtui-0.1.0/examples/notes.py +441 -0
  98. runtui-0.1.0/examples/puzzle.py +199 -0
  99. runtui-0.1.0/examples/screenshot.py +431 -0
  100. runtui-0.1.0/examples/tui_os.md +133 -0
  101. runtui-0.1.0/images/demo.gif +0 -0
  102. runtui-0.1.0/pyproject.toml +33 -0
  103. runtui-0.1.0/requirements.txt +3 -0
  104. runtui-0.1.0/runtui/__init__.py +84 -0
  105. runtui-0.1.0/runtui/app.py +566 -0
  106. runtui-0.1.0/runtui/backend/__init__.py +1 -0
  107. runtui-0.1.0/runtui/backend/base.py +89 -0
  108. runtui-0.1.0/runtui/backend/detect.py +22 -0
  109. runtui-0.1.0/runtui/backend/unix.py +389 -0
  110. runtui-0.1.0/runtui/backend/windows.py +159 -0
  111. runtui-0.1.0/runtui/core/__init__.py +1 -0
  112. runtui-0.1.0/runtui/core/event.py +246 -0
  113. runtui-0.1.0/runtui/core/event_loop.py +102 -0
  114. runtui-0.1.0/runtui/core/key_encode.py +126 -0
  115. runtui-0.1.0/runtui/core/keys.py +127 -0
  116. runtui-0.1.0/runtui/core/pty_process.py +173 -0
  117. runtui-0.1.0/runtui/core/timer.py +91 -0
  118. runtui-0.1.0/runtui/core/types.py +303 -0
  119. runtui-0.1.0/runtui/core/unicode.py +93 -0
  120. runtui-0.1.0/runtui/dialogs/__init__.py +1 -0
  121. runtui-0.1.0/runtui/dialogs/base.py +94 -0
  122. runtui-0.1.0/runtui/dialogs/file_open.py +163 -0
  123. runtui-0.1.0/runtui/dialogs/file_save.py +37 -0
  124. runtui-0.1.0/runtui/dialogs/form.py +139 -0
  125. runtui-0.1.0/runtui/dialogs/message.py +70 -0
  126. runtui-0.1.0/runtui/layout/__init__.py +1 -0
  127. runtui-0.1.0/runtui/layout/absolute.py +43 -0
  128. runtui-0.1.0/runtui/layout/base.py +25 -0
  129. runtui-0.1.0/runtui/layout/box.py +112 -0
  130. runtui-0.1.0/runtui/layout/dock.py +65 -0
  131. runtui-0.1.0/runtui/layout/grid.py +63 -0
  132. runtui-0.1.0/runtui/mouse/__init__.py +1 -0
  133. runtui-0.1.0/runtui/mouse/cursor.py +39 -0
  134. runtui-0.1.0/runtui/mouse/tracker.py +78 -0
  135. runtui-0.1.0/runtui/rad/__init__.py +48 -0
  136. runtui-0.1.0/runtui/rad/codegen.py +210 -0
  137. runtui-0.1.0/runtui/rad/deserializer.py +165 -0
  138. runtui-0.1.0/runtui/rad/design_surface.py +365 -0
  139. runtui-0.1.0/runtui/rad/menu_editor.py +603 -0
  140. runtui-0.1.0/runtui/rad/runner.py +102 -0
  141. runtui-0.1.0/runtui/rad/schema.py +166 -0
  142. runtui-0.1.0/runtui/rad/serializer.py +119 -0
  143. runtui-0.1.0/runtui/rad_designer.py +540 -0
  144. runtui-0.1.0/runtui/rendering/__init__.py +1 -0
  145. runtui-0.1.0/runtui/rendering/buffer.py +135 -0
  146. runtui-0.1.0/runtui/rendering/painter.py +156 -0
  147. runtui-0.1.0/runtui/rendering/screen.py +128 -0
  148. runtui-0.1.0/runtui/themes/__init__.py +1 -0
  149. runtui-0.1.0/runtui/themes/black_white.py +124 -0
  150. runtui-0.1.0/runtui/themes/dark.py +131 -0
  151. runtui-0.1.0/runtui/themes/engine.py +64 -0
  152. runtui-0.1.0/runtui/themes/github.py +134 -0
  153. runtui-0.1.0/runtui/themes/gruvbox.py +131 -0
  154. runtui-0.1.0/runtui/themes/high_contrast.py +123 -0
  155. runtui-0.1.0/runtui/themes/legacy_system.py +131 -0
  156. runtui-0.1.0/runtui/themes/light.py +130 -0
  157. runtui-0.1.0/runtui/themes/nord.py +134 -0
  158. runtui-0.1.0/runtui/themes/solarized.py +134 -0
  159. runtui-0.1.0/runtui/themes/turbo_vision.py +160 -0
  160. runtui-0.1.0/runtui/themes/vscode.py +131 -0
  161. runtui-0.1.0/runtui/tui_os.py +1524 -0
  162. runtui-0.1.0/runtui/widgets/__init__.py +1 -0
  163. runtui-0.1.0/runtui/widgets/base.py +319 -0
  164. runtui-0.1.0/runtui/widgets/button.py +105 -0
  165. runtui-0.1.0/runtui/widgets/calendar.py +214 -0
  166. runtui-0.1.0/runtui/widgets/checkbox.py +91 -0
  167. runtui-0.1.0/runtui/widgets/color_picker.py +176 -0
  168. runtui-0.1.0/runtui/widgets/container.py +105 -0
  169. runtui-0.1.0/runtui/widgets/context_menu.py +174 -0
  170. runtui-0.1.0/runtui/widgets/dropdown.py +197 -0
  171. runtui-0.1.0/runtui/widgets/image.py +320 -0
  172. runtui-0.1.0/runtui/widgets/input.py +206 -0
  173. runtui-0.1.0/runtui/widgets/label.py +78 -0
  174. runtui-0.1.0/runtui/widgets/listbox.py +260 -0
  175. runtui-0.1.0/runtui/widgets/menu.py +295 -0
  176. runtui-0.1.0/runtui/widgets/password.py +70 -0
  177. runtui-0.1.0/runtui/widgets/progressbar.py +78 -0
  178. runtui-0.1.0/runtui/widgets/radio.py +126 -0
  179. runtui-0.1.0/runtui/widgets/scrollbar.py +271 -0
  180. runtui-0.1.0/runtui/widgets/static_image.py +161 -0
  181. runtui-0.1.0/runtui/widgets/syntax.py +692 -0
  182. runtui-0.1.0/runtui/widgets/terminal.py +705 -0
  183. runtui-0.1.0/runtui/widgets/terminal_pipe.py +800 -0
  184. runtui-0.1.0/runtui/widgets/textarea.py +1022 -0
  185. runtui-0.1.0/runtui/windows/__init__.py +1 -0
  186. runtui-0.1.0/runtui/windows/taskbar.py +98 -0
  187. runtui-0.1.0/runtui/windows/window.py +373 -0
  188. runtui-0.1.0/runtui/windows/window_manager.py +297 -0
@@ -0,0 +1,8 @@
1
+ __pycache__/
2
+ *.pyc
3
+ *.pyo
4
+ *.pyd
5
+ .pytest_cache/
6
+ dist/
7
+ build/
8
+ *.egg-info/
runtui-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,95 @@
1
+ Metadata-Version: 2.4
2
+ Name: runtui
3
+ Version: 0.1.0
4
+ Summary: Modern pure-Python cross-platform TUI framework with RAD designer, themes, mouse support, embedded terminals, and rich widgets
5
+ Project-URL: Homepage, https://github.com/erickrus/runtui
6
+ Project-URL: Repository, https://github.com/erickrus/runtui
7
+ Project-URL: Bug Tracker, https://github.com/erickrus/runtui/issues
8
+ Project-URL: Documentation, https://github.com/erickrus/runtui#readme
9
+ Author-email: Erickrus <hyinghao@gmail.com>
10
+ License: MIT
11
+ Keywords: curses-alternative,mouse,rad,terminal-ui,tui,widgets
12
+ Classifier: Environment :: Console
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Topic :: Software Development :: User Interfaces
17
+ Requires-Python: >=3.8
18
+ Description-Content-Type: text/markdown
19
+
20
+ # RunTUI — Modern Terminal UI Framework for Python
21
+
22
+ *Build beautiful, interactive, mouse-aware terminal applications in pure Python — no curses, no ncurses, no external dependencies.*
23
+
24
+ <p align="center">
25
+ <img src="https://github.com/Erickrus/runtui/blob/main/images/demo.gif?raw=true" alt="runtui in action — animated demo">
26
+ </p>
27
+
28
+ `runtui` is a full-featured, cross-platform **TUI (Text User Interface)** library written in **100% pure Python**.
29
+ It brings modern desktop-like experience into your terminal: windows, dialogs, forms, image rendering, embedded terminals, mouse support, theming, layout managers and even a **visual RAD (Rapid Application Development) designer**.
30
+
31
+ Works seamlessly on **Linux**, **macOS**, and **Windows**
32
+
33
+ ## ✨ Highlights
34
+
35
+ - Pure Python — zero compiled dependencies
36
+ - Cross-platform (Linux, macOS, Windows)
37
+ - Rich set of **widgets** — Button, Input, Password, TextArea, Dropdown, ListBox, CheckBox, Radio, Calendar, ColorPicker, ProgressBar, Image, **real Terminal**, etc.
38
+ - Multiple **layout** engines: Absolute, Box, Dock, Grid
39
+ - Theme engine with built-in themes: Dark, Light, Nord, Solarized, Turbo Vision / Borland style
40
+ - Mouse support (click, drag, scroll, hover)
41
+ - Window manager with floating & tiled windows + taskbar
42
+ - Dialogs: MessageBox, File Open/Save, Custom Forms
43
+ - **Visual RAD designer** (`rad_designer.py`) — drag & drop UI building + code generation
44
+ - Embedded **terminal** widget with PTY support (run vim, htop, bash, python REPL, … inside your app!)
45
+ - Clean event loop, timers, key bindings, context menus
46
+
47
+ ## Installation
48
+
49
+ ```bash
50
+ git clone https://github.com/Erickrus/runtui.git
51
+ cd runtui
52
+ pip install -e .
53
+ # or
54
+ pip install .
55
+ ```
56
+
57
+ More examples in the [`examples/`](examples/) folder:
58
+
59
+ - `cal.py` — Calendar
60
+ - `calc.py` — Calculator
61
+ - `chatbox.py` — LLM Chat App
62
+ - `clock.py` — A basic clock program
63
+ - `demo_app.py` — widget showcase
64
+ - `mine.py` - window's mine game
65
+ - `notes.py` — mac os like personal notes
66
+ - `rad_designer.py` — visual designer (very cool!)
67
+ - `puzzle.py` — mac os like puzzle game
68
+ - `tui_os.py` — tui desktop / OS-like interface
69
+
70
+ It is highly recommended to run everything inside `tui_os.py` by browse these python files in Finder.
71
+
72
+
73
+ ## Why choose runtui over other TUI libraries?
74
+
75
+ | Feature | runtui | Textual | urwid | py_cui | rich + textual |
76
+ |-----------------------------|-------------|-------------|------------|------------|----------------|
77
+ | Pure Python | ✓ | ✓ | ✓ | ✓ | ✓ |
78
+ | Cross-platform (good) | ✓ | ✓ | △ | ✓ | ✓ |
79
+ | Mouse support | ✓ | ✓ | ✗ | ✓ | ✓ |
80
+ | Built-in themes | ✓ (many) | ✓ (CSS) | ✗ | ✗ | ✓ |
81
+ | Embedded terminal widget | ✓ (PTY) | ✗ | ✗ | ✗ | ✗ |
82
+ | Visual RAD designer | ✓ | ✗ | ✗ | ✗ | ✗ |
83
+ | Image rendering | ✓ | ✓ | ✗ | ✗ | ✓ |
84
+ | Floating windows + taskbar | ✓ | △ | ✗ | ✗ | ✗ |
85
+ | LLM Chat App | ✓ | ✗ | ✗ | ✗ | ✗ |
86
+
87
+
88
+ ## License
89
+
90
+ MIT
91
+
92
+ ---
93
+
94
+ Made with ❤️ in the terminal
95
+ Start building your next TUI masterpiece today!
runtui-0.1.0/README.md ADDED
@@ -0,0 +1,76 @@
1
+ # RunTUI — Modern Terminal UI Framework for Python
2
+
3
+ *Build beautiful, interactive, mouse-aware terminal applications in pure Python — no curses, no ncurses, no external dependencies.*
4
+
5
+ <p align="center">
6
+ <img src="https://github.com/Erickrus/runtui/blob/main/images/demo.gif?raw=true" alt="runtui in action — animated demo">
7
+ </p>
8
+
9
+ `runtui` is a full-featured, cross-platform **TUI (Text User Interface)** library written in **100% pure Python**.
10
+ It brings modern desktop-like experience into your terminal: windows, dialogs, forms, image rendering, embedded terminals, mouse support, theming, layout managers and even a **visual RAD (Rapid Application Development) designer**.
11
+
12
+ Works seamlessly on **Linux**, **macOS**, and **Windows**
13
+
14
+ ## ✨ Highlights
15
+
16
+ - Pure Python — zero compiled dependencies
17
+ - Cross-platform (Linux, macOS, Windows)
18
+ - Rich set of **widgets** — Button, Input, Password, TextArea, Dropdown, ListBox, CheckBox, Radio, Calendar, ColorPicker, ProgressBar, Image, **real Terminal**, etc.
19
+ - Multiple **layout** engines: Absolute, Box, Dock, Grid
20
+ - Theme engine with built-in themes: Dark, Light, Nord, Solarized, Turbo Vision / Borland style
21
+ - Mouse support (click, drag, scroll, hover)
22
+ - Window manager with floating & tiled windows + taskbar
23
+ - Dialogs: MessageBox, File Open/Save, Custom Forms
24
+ - **Visual RAD designer** (`rad_designer.py`) — drag & drop UI building + code generation
25
+ - Embedded **terminal** widget with PTY support (run vim, htop, bash, python REPL, … inside your app!)
26
+ - Clean event loop, timers, key bindings, context menus
27
+
28
+ ## Installation
29
+
30
+ ```bash
31
+ git clone https://github.com/Erickrus/runtui.git
32
+ cd runtui
33
+ pip install -e .
34
+ # or
35
+ pip install .
36
+ ```
37
+
38
+ More examples in the [`examples/`](examples/) folder:
39
+
40
+ - `cal.py` — Calendar
41
+ - `calc.py` — Calculator
42
+ - `chatbox.py` — LLM Chat App
43
+ - `clock.py` — A basic clock program
44
+ - `demo_app.py` — widget showcase
45
+ - `mine.py` - window's mine game
46
+ - `notes.py` — mac os like personal notes
47
+ - `rad_designer.py` — visual designer (very cool!)
48
+ - `puzzle.py` — mac os like puzzle game
49
+ - `tui_os.py` — tui desktop / OS-like interface
50
+
51
+ It is highly recommended to run everything inside `tui_os.py` by browse these python files in Finder.
52
+
53
+
54
+ ## Why choose runtui over other TUI libraries?
55
+
56
+ | Feature | runtui | Textual | urwid | py_cui | rich + textual |
57
+ |-----------------------------|-------------|-------------|------------|------------|----------------|
58
+ | Pure Python | ✓ | ✓ | ✓ | ✓ | ✓ |
59
+ | Cross-platform (good) | ✓ | ✓ | △ | ✓ | ✓ |
60
+ | Mouse support | ✓ | ✓ | ✗ | ✓ | ✓ |
61
+ | Built-in themes | ✓ (many) | ✓ (CSS) | ✗ | ✗ | ✓ |
62
+ | Embedded terminal widget | ✓ (PTY) | ✗ | ✗ | ✗ | ✗ |
63
+ | Visual RAD designer | ✓ | ✗ | ✗ | ✗ | ✗ |
64
+ | Image rendering | ✓ | ✓ | ✗ | ✗ | ✓ |
65
+ | Floating windows + taskbar | ✓ | △ | ✗ | ✗ | ✗ |
66
+ | LLM Chat App | ✓ | ✗ | ✗ | ✗ | ✗ |
67
+
68
+
69
+ ## License
70
+
71
+ MIT
72
+
73
+ ---
74
+
75
+ Made with ❤️ in the terminal
76
+ Start building your next TUI masterpiece today!
@@ -0,0 +1,30 @@
1
+ # runtui Package
2
+
3
+ The main runtui package exports the core classes and widgets for building terminal user interfaces.
4
+
5
+ ## Exports
6
+
7
+ The following classes and functions are exported from the main package:
8
+
9
+ | Name | Module | Description |
10
+ |------|--------|-------------|
11
+ | `App` | `app` | Main application class for running TUI applications |
12
+ | `Window` | `windows.window` | Top-level window widget with title bar and chrome |
13
+ | `MenuBar` | `widgets.menu` | Top-level menu bar widget |
14
+ | `Menu` | `widgets.menu` | Dropdown menu container |
15
+ | `MenuItem` | `widgets.menu` | Individual menu item |
16
+ | `RadioGroup` | `widgets.radio` | Group container for radio buttons |
17
+
18
+ ## Usage
19
+
20
+ ```python
21
+ from runtui import App, Window
22
+
23
+ class MyApp(App):
24
+ def on_ready(self):
25
+ window = Window(title="My Window")
26
+ self.add_window(window)
27
+
28
+ app = MyApp()
29
+ app.run()
30
+ ```
@@ -0,0 +1,174 @@
1
+ # app.py - Application Class
2
+
3
+ The main application class that manages the terminal UI lifecycle, event loop, and rendering.
4
+
5
+ ---
6
+
7
+ ## Class: `Desktop`
8
+
9
+ Desktop background widget that fills with a checkerboard pattern.
10
+
11
+ ### Methods
12
+
13
+ #### `paint`
14
+ ```python
15
+ def paint(self, painter: Painter) -> None
16
+ ```
17
+ Draw the desktop background with alternating character pattern.
18
+
19
+ ---
20
+
21
+ ## Class: `App`
22
+
23
+ The base class for runtui applications. Handles terminal setup, event processing, and rendering.
24
+
25
+ ### Constructor
26
+
27
+ ```python
28
+ def __init__(self, theme: str = "turbo_vision") -> None
29
+ ```
30
+
31
+ **Parameters:**
32
+
33
+ | Parameter | Type | Default | Description |
34
+ |-----------|------|---------|-------------|
35
+ | `theme` | `str` | `"turbo_vision"` | Theme name to use |
36
+
37
+ ### Available Themes
38
+
39
+ - `"turbo_vision"` - Classic DOS-era look (default)
40
+ - `"github"` - GitHub-inspired light theme
41
+ - `"vscode"` - VS Code dark theme
42
+ - `"gruvbox"` - Gruvbox dark theme
43
+ - `"high_contrast"` - High contrast accessibility
44
+ - `"legacy_system"` - DOS/BIOS theme
45
+ - `"black_white"` - Monochrome theme
46
+ - `"dark"` - Dark theme
47
+ - `"light"` - Light theme
48
+ - `"nord"` - Nord color scheme
49
+ - `"solarized"` - Solarized theme
50
+
51
+ ### Properties
52
+
53
+ #### `running`
54
+ ```python
55
+ @property
56
+ def running(self) -> bool
57
+ ```
58
+ Returns `True` if the application is currently running.
59
+
60
+ ### Methods
61
+
62
+ #### `run`
63
+ ```python
64
+ def run(self) -> None
65
+ ```
66
+ Start the application main loop. Blocks until `quit()` is called.
67
+
68
+ #### `quit`
69
+ ```python
70
+ def quit(self) -> None
71
+ ```
72
+ Stop the application and restore the terminal to normal mode.
73
+
74
+ #### `on_ready`
75
+ ```python
76
+ def on_ready(self) -> None
77
+ ```
78
+ Callback called after the application is initialized and ready. Override this method to set up your UI.
79
+
80
+ #### `add_window`
81
+ ```python
82
+ def add_window(self, window: Window) -> None
83
+ ```
84
+ Add a window to the desktop.
85
+
86
+ **Parameters:**
87
+ - `window` (`Window`): The window to add
88
+
89
+ #### `remove_window`
90
+ ```python
91
+ def remove_window(self, window: Window) -> None
92
+ ```
93
+ Remove a window from the desktop.
94
+
95
+ **Parameters:**
96
+ - `window` (`Window`): The window to remove
97
+
98
+ #### `set_menu`
99
+ ```python
100
+ def set_menu(self, menu_bar: MenuBar) -> None
101
+ ```
102
+ Set the application menu bar.
103
+
104
+ **Parameters:**
105
+ - `menu_bar` (`MenuBar`): The menu bar widget to use
106
+
107
+ #### `invalidate_all`
108
+ ```python
109
+ def invalidate_all(self) -> None
110
+ ```
111
+ Force a full repaint of the screen.
112
+
113
+ #### `set_theme`
114
+ ```python
115
+ def set_theme(self, name: str) -> None
116
+ ```
117
+ Change the active theme.
118
+
119
+ **Parameters:**
120
+ - `name` (`str`): Theme name to activate
121
+
122
+ #### `call_later`
123
+ ```python
124
+ def call_later(self, delay: float, callback: Callable[[], None]) -> TimerHandle | None
125
+ ```
126
+ Schedule a callback to be executed after a delay.
127
+
128
+ **Parameters:**
129
+ - `delay` (`float`): Delay in seconds
130
+ - `callback` (`Callable[[], None]`): The function to call
131
+
132
+ **Returns:** `TimerHandle | None` - Handle to cancel the timer
133
+
134
+ #### `set_interval`
135
+ ```python
136
+ def set_interval(self, interval: float, callback: Callable[[], None]) -> TimerHandle | None
137
+ ```
138
+ Start a repeating timer.
139
+
140
+ **Parameters:**
141
+ - `interval` (`float`): Interval in seconds
142
+ - `callback` (`Callable[[], None]`): Function to call on each tick
143
+
144
+ **Returns:** `TimerHandle | None` - Handle to stop the timer
145
+
146
+ ### Global Key Bindings
147
+
148
+ | Key | Action |
149
+ |-----|--------|
150
+ | Ctrl+Q | Quit application |
151
+ | Alt+Tab | Cycle to next window |
152
+ | Alt+Shift+Tab | Cycle to previous window |
153
+ | Tab | Focus next widget |
154
+ | Shift+Tab | Focus previous widget |
155
+ | F10 | Activate menu bar |
156
+
157
+ ### Usage
158
+
159
+ ```python
160
+ from runtui import App, Window, Label
161
+
162
+ class MyApp(App):
163
+ def __init__(self):
164
+ super().__init__(theme="turbo_vision")
165
+
166
+ def on_ready(self):
167
+ window = Window(title="My App")
168
+ window.set_content(Label("Hello, World!"))
169
+ self.add_window(window)
170
+
171
+ if __name__ == "__main__":
172
+ app = MyApp()
173
+ app.run()
174
+ ```
@@ -0,0 +1,19 @@
1
+ # backend Package
2
+
3
+ Terminal backend abstraction layer for cross-platform terminal I/O.
4
+
5
+ ## Modules
6
+
7
+ | Module | Description |
8
+ |--------|-------------|
9
+ | `base` | Abstract backend interface |
10
+ | `detect` | Platform detection to select the appropriate backend |
11
+ | `unix` | Unix (Linux/macOS) terminal backend |
12
+ | `windows` | Windows terminal backend |
13
+
14
+ ## Platform Support
15
+
16
+ The backend automatically detects the platform and selects the appropriate implementation:
17
+
18
+ - **Unix**: Uses ANSI escape sequences, termios, and select()
19
+ - **Windows**: Uses VT100 sequences via Windows Terminal / ConEmu with Win32 Console API fallback
@@ -0,0 +1,161 @@
1
+ # base.py - Backend Interface
2
+
3
+ Abstract backend interface for terminal I/O.
4
+
5
+ ---
6
+
7
+ ## Class: `Backend`
8
+
9
+ Abstract interface for terminal backends.
10
+
11
+ ### Abstract Methods
12
+
13
+ #### `init`
14
+ ```python
15
+ @abstractmethod
16
+ def init(self) -> None
17
+ ```
18
+ Enter raw mode, alternate screen, and enable mouse tracking.
19
+
20
+ #### `shutdown`
21
+ ```python
22
+ @abstractmethod
23
+ def shutdown(self) -> None
24
+ ```
25
+ Restore terminal to original state.
26
+
27
+ #### `get_size`
28
+ ```python
29
+ @abstractmethod
30
+ def get_size(self) -> tuple[int, int]
31
+ ```
32
+ Get the terminal size.
33
+
34
+ **Returns:** `tuple[int, int]` - (columns, rows)
35
+
36
+ #### `read_input`
37
+ ```python
38
+ @abstractmethod
39
+ def read_input(self) -> bytes
40
+ ```
41
+ Read available raw bytes from terminal input (non-blocking).
42
+
43
+ **Returns:** `bytes` - Raw input bytes, or empty bytes if nothing available
44
+
45
+ #### `decode_input`
46
+ ```python
47
+ @abstractmethod
48
+ def decode_input(self, raw: bytes) -> list[Event]
49
+ ```
50
+ Parse raw bytes into Event objects.
51
+
52
+ **Parameters:**
53
+ - `raw` (`bytes`): Raw input bytes
54
+
55
+ **Returns:** `list[Event]` - Decoded events
56
+
57
+ #### `write`
58
+ ```python
59
+ @abstractmethod
60
+ def write(self, data: str) -> None
61
+ ```
62
+ Write string data (including escape sequences) to terminal.
63
+
64
+ **Parameters:**
65
+ - `data` (`str`): Data to write
66
+
67
+ #### `flush`
68
+ ```python
69
+ @abstractmethod
70
+ def flush(self) -> None
71
+ ```
72
+ Flush output buffer to terminal.
73
+
74
+ #### `set_cursor_position`
75
+ ```python
76
+ @abstractmethod
77
+ def set_cursor_position(self, x: int, y: int) -> None
78
+ ```
79
+ Move cursor to position (x, y) where (0, 0) is top-left.
80
+
81
+ **Parameters:**
82
+ - `x` (`int`): Column position
83
+ - `y` (`int`): Row position
84
+
85
+ #### `set_cursor_visible`
86
+ ```python
87
+ @abstractmethod
88
+ def set_cursor_visible(self, visible: bool) -> None
89
+ ```
90
+ Show or hide the hardware cursor.
91
+
92
+ **Parameters:**
93
+ - `visible` (`bool`): True to show, False to hide
94
+
95
+ #### `color_support`
96
+ ```python
97
+ @abstractmethod
98
+ def color_support(self) -> ColorDepth
99
+ ```
100
+ Detect the terminal's color depth capability.
101
+
102
+ **Returns:** `ColorDepth` - The detected color depth
103
+
104
+ ### PTY Methods
105
+
106
+ #### `register_pty_fd`
107
+ ```python
108
+ def register_pty_fd(self, fd: int, callback: Callable[[bytes], None]) -> None
109
+ ```
110
+ Register a PTY master fd to be polled alongside stdin.
111
+
112
+ **Parameters:**
113
+ - `fd` (`int`): PTY master file descriptor
114
+ - `callback` (`Callable[[bytes], None]`): Callback for received data
115
+
116
+ #### `unregister_pty_fd`
117
+ ```python
118
+ def unregister_pty_fd(self, fd: int) -> None
119
+ ```
120
+ Remove a previously registered PTY fd.
121
+
122
+ **Parameters:**
123
+ - `fd` (`int`): PTY master file descriptor
124
+
125
+ ### Terminal Escape Helpers
126
+
127
+ #### `enter_alternate_screen`
128
+ ```python
129
+ def enter_alternate_screen(self) -> None
130
+ ```
131
+ Switch to the alternate screen buffer.
132
+
133
+ #### `leave_alternate_screen`
134
+ ```python
135
+ def leave_alternate_screen(self) -> None
136
+ ```
137
+ Return to the main screen buffer.
138
+
139
+ #### `enable_mouse`
140
+ ```python
141
+ def enable_mouse(self) -> None
142
+ ```
143
+ Enable SGR any-event mouse tracking.
144
+
145
+ #### `disable_mouse`
146
+ ```python
147
+ def disable_mouse(self) -> None
148
+ ```
149
+ Disable mouse tracking.
150
+
151
+ #### `clear_screen`
152
+ ```python
153
+ def clear_screen(self) -> None
154
+ ```
155
+ Clear the screen.
156
+
157
+ #### `reset_attributes`
158
+ ```python
159
+ def reset_attributes(self) -> None
160
+ ```
161
+ Reset all text attributes to default.
@@ -0,0 +1,27 @@
1
+ # backend/detect.md - Platform Detection
2
+
3
+ Auto-detect platform and create appropriate backend.
4
+
5
+ ---
6
+
7
+ ## Functions
8
+
9
+ ### `create_backend`
10
+
11
+ ```python
12
+ def create_backend() -> Backend
13
+ ```
14
+
15
+ Create the appropriate backend for the current platform.
16
+
17
+ **Returns:** `Backend` - A platform-appropriate backend instance
18
+
19
+ ### Platform Detection Logic
20
+
21
+ | Platform | Backend |
22
+ |----------|---------|
23
+ | Linux | `UnixBackend` |
24
+ | Darwin (macOS) | `UnixBackend` |
25
+ | FreeBSD | `UnixBackend` |
26
+ | Windows | `WindowsBackend` |
27
+ | Other | `UnixBackend` (fallback) |