pyside6dom 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.
@@ -0,0 +1,203 @@
1
+ Copyright (c) 2026-present Christopher Andrew Topalian
2
+
3
+ Apache License
4
+ Version 2.0, January 2004
5
+ http://www.apache.org/licenses/
6
+
7
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
8
+
9
+ 1. Definitions.
10
+
11
+ "License" shall mean the terms and conditions for use, reproduction,
12
+ and distribution as defined by Sections 1 through 9 of this document.
13
+
14
+ "Licensor" shall mean the copyright owner or entity authorized by
15
+ the copyright owner that is granting the License.
16
+
17
+ "Legal Entity" shall mean the union of the acting entity and all
18
+ other entities that control, are controlled by, or are under common
19
+ control with that entity. For the purposes of this definition,
20
+ "control" means (i) the power, direct or indirect, to cause the
21
+ direction or management of such entity, whether by contract or
22
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
23
+ outstanding shares, or (iii) beneficial ownership of such entity.
24
+
25
+ "You" (or "Your") shall mean an individual or Legal Entity
26
+ exercising permissions granted by this License.
27
+
28
+ "Source" form shall mean the preferred form for making modifications,
29
+ including but not limited to software source code, documentation
30
+ source, and configuration files.
31
+
32
+ "Object" form shall mean any form resulting from mechanical
33
+ transformation or translation of a Source form, including but
34
+ not limited to compiled object code, generated documentation,
35
+ and conversions to other media types.
36
+
37
+ "Work" shall mean the work of authorship, whether in Source or
38
+ Object form, made available under the License, as indicated by a
39
+ copyright notice that is included in or attached to the work
40
+ (an example is provided in the Appendix below).
41
+
42
+ "Derivative Works" shall mean any work, whether in Source or Object
43
+ form, that is based on (or derived from) the Work and for which the
44
+ editorial revisions, annotations, elaborations, or other modifications
45
+ represent, as a whole, an original work of authorship. For the purposes
46
+ of this License, Derivative Works shall not include works that remain
47
+ separable from, or merely link (or bind by name) to the interfaces of,
48
+ the Work and Derivative Works thereof.
49
+
50
+ "Contribution" shall mean any work of authorship, including
51
+ the original version of the Work and any modifications or additions
52
+ to that Work or Derivative Works thereof, that is intentionally
53
+ submitted to Licensor for inclusion in the Work by the copyright owner
54
+ or by an individual or Legal Entity authorized to submit on behalf of
55
+ the copyright owner. For the purposes of this definition, "submitted"
56
+ means any form of electronic, verbal, or written communication sent
57
+ to the Licensor or its representatives, including but not limited to
58
+ communication on electronic mailing lists, source code control systems,
59
+ and issue tracking systems that are managed by, or on behalf of, the
60
+ Licensor for the purpose of discussing and improving the Work, but
61
+ excluding communication that is conspicuously marked or otherwise
62
+ designated in writing by the copyright owner as "Not a Contribution."
63
+
64
+ "Contributor" shall mean Licensor and any individual or Legal Entity
65
+ on behalf of whom a Contribution has been received by Licensor and
66
+ subsequently incorporated within the Work.
67
+
68
+ 2. Grant of Copyright License. Subject to the terms and conditions of
69
+ this License, each Contributor hereby grants to You a perpetual,
70
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
71
+ copyright license to reproduce, prepare Derivative Works of,
72
+ publicly display, publicly perform, sublicense, and distribute the
73
+ Work and such Derivative Works in Source or Object form.
74
+
75
+ 3. Grant of Patent License. Subject to the terms and conditions of
76
+ this License, each Contributor hereby grants to You a perpetual,
77
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
78
+ (except as stated in this section) patent license to make, have made,
79
+ use, offer to sell, sell, import, and otherwise transfer the Work,
80
+ where such license applies only to those patent claims licensable
81
+ by such Contributor that are necessarily infringed by their
82
+ Contribution(s) alone or by combination of their Contribution(s)
83
+ with the Work to which such Contribution(s) was submitted. If You
84
+ institute patent litigation against any entity (including a
85
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
86
+ or a Contribution incorporated within the Work constitutes direct
87
+ or contributory patent infringement, then any patent licenses
88
+ granted to You under this License for that Work shall terminate
89
+ as of the date such litigation is filed.
90
+
91
+ 4. Redistribution. You may reproduce and distribute copies of the
92
+ Work or Derivative Works thereof in any medium, with or without
93
+ modifications, and in Source or Object form, provided that You
94
+ meet the following conditions:
95
+
96
+ (a) You must give any other recipients of the Work or
97
+ Derivative Works a copy of this License; and
98
+
99
+ (b) You must cause any modified files to carry prominent notices
100
+ stating that You changed the files; and
101
+
102
+ (c) You must retain, in the Source form of any Derivative Works
103
+ that You distribute, all copyright, patent, trademark, and
104
+ attribution notices from the Source form of the Work,
105
+ excluding those notices that do not pertain to any part of
106
+ the Derivative Works; and
107
+
108
+ (d) If the Work includes a "NOTICE" text file as part of its
109
+ distribution, then any Derivative Works that You distribute must
110
+ include a readable copy of the attribution notices contained
111
+ within such NOTICE file, excluding those notices that do not
112
+ pertain to any part of the Derivative Works, in at least one
113
+ of the following places: within a NOTICE text file distributed
114
+ as part of the Derivative Works; within the Source form or
115
+ documentation, if provided along with the Derivative Works; or,
116
+ within a display generated by the Derivative Works, if and
117
+ wherever such third-party notices normally appear. The contents
118
+ of the NOTICE file are for informational purposes only and
119
+ do not modify the License. You may add Your own attribution
120
+ notices within Derivative Works that You distribute, alongside
121
+ or as an addendum to the NOTICE text from the Work, provided
122
+ that such additional attribution notices cannot be construed
123
+ as modifying the License.
124
+
125
+ You may add Your own copyright statement to Your modifications and
126
+ may provide additional or different license terms and conditions
127
+ for use, reproduction, or distribution of Your modifications, or
128
+ for any such Derivative Works as a whole, provided Your use,
129
+ reproduction, and distribution of the Work otherwise complies with
130
+ the conditions stated in this License.
131
+
132
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
133
+ any Contribution intentionally submitted for inclusion in the Work
134
+ by You to the Licensor shall be under the terms and conditions of
135
+ this License, without any additional terms or conditions.
136
+ Notwithstanding the above, nothing herein shall supersede or modify
137
+ the terms of any separate license agreement you may have executed
138
+ with Licensor regarding such Contributions.
139
+
140
+ 6. Trademarks. This License does not grant permission to use the trade
141
+ names, trademarks, service marks, or product names of the Licensor,
142
+ except as required for reasonable and customary use in describing the
143
+ origin of the Work and reproducing the content of the NOTICE file.
144
+
145
+ 7. Disclaimer of Warranty. Unless required by applicable law or
146
+ agreed to in writing, Licensor provides the Work (and each
147
+ Contributor provides its Contributions) on an "AS IS" BASIS,
148
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
149
+ implied, including, without limitation, any warranties or conditions
150
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
151
+ PARTICULAR PURPOSE. You are solely responsible for determining the
152
+ appropriateness of using or redistributing the Work and assume any
153
+ risks associated with Your exercise of permissions under this License.
154
+
155
+ 8. Limitation of Liability. In no event and under no legal theory,
156
+ whether in tort (including negligence), contract, or otherwise,
157
+ unless required by applicable law (such as deliberate and grossly
158
+ negligent acts) or agreed to in writing, shall any Contributor be
159
+ liable to You for damages, including any direct, indirect, special,
160
+ incidental, or consequential damages of any character arising as a
161
+ result of this License or out of the use or inability to use the
162
+ Work (including but not limited to damages for loss of goodwill,
163
+ work stoppage, computer failure or malfunction, or any and all
164
+ other commercial damages or losses), even if such Contributor
165
+ has been advised of the possibility of such damages.
166
+
167
+ 9. Accepting Warranty or Additional Liability. While redistributing
168
+ the Work or Derivative Works thereof, You may choose to offer,
169
+ and charge a fee for, acceptance of support, warranty, indemnity,
170
+ or other liability obligations and/or rights consistent with this
171
+ License. However, in accepting such obligations, You may act only
172
+ on Your own behalf and on Your sole responsibility, not on behalf
173
+ of any other Contributor, and only if You agree to indemnify,
174
+ defend, and hold each Contributor harmless for any liability
175
+ incurred by, or claims asserted against, such Contributor by reason
176
+ of your accepting any such warranty or additional liability.
177
+
178
+ END OF TERMS AND CONDITIONS
179
+
180
+ APPENDIX: How to apply the Apache License to your work.
181
+
182
+ To apply the Apache License to your work, attach the following
183
+ boilerplate notice, with the fields enclosed by brackets "[]"
184
+ replaced with your own identifying information. (Don't include
185
+ the brackets!) The text should be enclosed in the appropriate
186
+ comment syntax for the file format. We also recommend that a
187
+ file or class name and description of purpose be included on the
188
+ same "printed page" as the copyright notice for easier
189
+ identification within third-party archives.
190
+
191
+ Copyright (c) 2026-present Christopher Andrew Topalian
192
+
193
+ Licensed under the Apache License, Version 2.0 (the "License");
194
+ you may not use this file except in compliance with the License.
195
+ You may obtain a copy of the License at
196
+
197
+ http://www.apache.org/licenses/LICENSE-2.0
198
+
199
+ Unless required by applicable law or agreed to in writing, software
200
+ distributed under the License is distributed on an "AS IS" BASIS,
201
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
202
+ See the License for the specific language governing permissions and
203
+ limitations under the License.
@@ -0,0 +1,134 @@
1
+ Metadata-Version: 2.4
2
+ Name: pyside6dom
3
+ Version: 0.1.0
4
+ Summary: A web-style Document Object Model (DOM) interface for building PySide6 desktop applications.
5
+ Author: Christopher Andrew Topalian
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/ChristopherAndrewTopalian/pyside6dom
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Operating System :: OS Independent
10
+ Classifier: Topic :: Software Development :: User Interfaces
11
+ Classifier: Intended Audience :: Education
12
+ Requires-Python: >=3.7
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENSE
15
+ Requires-Dist: PySide6>=6.0.0
16
+ Dynamic: license-file
17
+
18
+ # PySide6DOM
19
+ **Bring the simplicity of the Web DOM to Python PySide6 Desktop Applications.**
20
+
21
+ # Installation
22
+ ```bash
23
+ pip install pyside6dom
24
+ ```
25
+
26
+ **PySide6DOM** bridges the gap between web development and systems programming. It wraps the raw power of the PySide6 (C++/Qt) rendering engine inside the familiar, intuitive Document Object Model (DOM) paradigm used by JavaScript and HTML.
27
+
28
+ If you know how to build a web page using `createElement`, `getElementById`, and `appendChild`, you already know how to build high-performance, standalone Python desktop applications.
29
+
30
+ ### 🌟 Why Use PySide6DOM?
31
+
32
+ * **Zero HTML Parsing:** This is not a web view or a browser wrapper. It generates native C++/Qt desktop widgets using Python, ensuring maximum performance.
33
+ * **Familiar Syntax:** Uses lightweight helper functions modeled directly after the web DOM (`ce()` for create element, `ge()` for get element, `ba()` for body append).
34
+ * **Rapid Prototyping:** Build user interfaces in seconds without getting bogged down in complex object-oriented boilerplate.
35
+ * **Educational Bridge:** The perfect stepping stone for web developers transitioning into local hardware control, computer vision, and systems engineering.
36
+
37
+ ---
38
+
39
+ ### 📂 Repository Structure
40
+
41
+ This repository includes two learning paths:
42
+
43
+ * **`001_pyside6dom/` (Modular / Production Ready):** Separates the heavy GUI engine into a background module (`pyside6dom_modular.py`) so your main application script remains incredibly clean.
44
+ * **`002_pyside6dom_single_file/` (Training Wheels):** Contains everything in a single script, allowing you to see exactly how the DOM wrappers interact with the raw PySide6 classes under the hood.
45
+
46
+ ---
47
+
48
+ ### 🚀 The Code: Web Logic meets Python Power
49
+
50
+ Look how clean and intuitive building a native desktop app becomes. No complex classes, no confusing layout managers - just straightforward DOM logic.
51
+
52
+ ```python
53
+ from pyside6dom import ce, ge, ba, init_window, run_app
54
+
55
+ # Initialize the Application
56
+ init_window("Telemetry Station", width=440, height=520)
57
+
58
+ # Create a Header (createElement)
59
+ header = ce("text")
60
+ header.id = "main_heading"
61
+ header.textContent = "Telemetry Link Online"
62
+ header.style("font-size: 18px; font-weight: bold; margin-bottom: 10px;")
63
+ ba(header) # (appendChild)
64
+
65
+ # Create an Input Field
66
+ command_input = ce("input")
67
+ command_input.id = "user_input"
68
+ command_input.placeholder = "Enter station parameter..."
69
+ ba(command_input)
70
+
71
+ # Create an Interactive Button
72
+ submit_btn = ce("button")
73
+ submit_btn.textContent = "Transmit Command"
74
+
75
+ # Define what happens on click
76
+ def handle_click():
77
+ txt = ge("user_input").value
78
+ print(f"Transmitting Data: {txt}")
79
+
80
+ submit_btn.onclick = handle_click
81
+ ba(submit_btn)
82
+
83
+ # Launch the App
84
+ run_app()
85
+
86
+ ```
87
+
88
+ ---
89
+
90
+ ### 🛠️ Core API Reference
91
+
92
+ | Function | Web Equivalent | Description |
93
+ | --- | --- | --- |
94
+ | `ce(tag)` | `document.createElement()` | Creates a new native widget. Supports: `"button"`, `"text"`, `"input"`, `"slider"`, `"div"`, `"scroll_div"`. |
95
+ | `ge(id)` | `document.getElementById()` | Retrieves a previously created element by its unique `.id` property. |
96
+ | `ba(element)` | `document.body.appendChild()` | Appends the element to the main application window (or a specific parent container). |
97
+
98
+ ---
99
+
100
+ **Created by Christopher Andrew Topalian**
101
+
102
+ *College of Scripting Music & Science*
103
+
104
+ > *Disclaimer: This is an independent open-source educational project. "PySide" and "Qt" are registered trademarks of The Qt Company. This project is not affiliated with, endorsed by, or sponsored by The Qt Company.*
105
+
106
+ ---
107
+
108
+ ### How to Download this GitHub Repository
109
+ 1. Click the green Code Button on this github page
110
+ 2. Choose Download ZIP
111
+ 3. Save the Zip File
112
+ 4. Extract All
113
+
114
+ ---
115
+
116
+ Hapy Scripting :-)
117
+
118
+ ---
119
+
120
+ //----//
121
+
122
+ // Dedicated to God the Father
123
+
124
+ // Copyright (c) 2026-present Christopher Andrew Topalian
125
+
126
+ // Apache License
127
+ Version 2.0, January 2004
128
+ http://www.apache.org/licenses/
129
+
130
+ // https://github.com/ChristopherTopalian
131
+ // https://github.com/ChristopherAndrewTopalian
132
+
133
+ // https://sites.google.com/view/CollegeOfScripting
134
+
@@ -0,0 +1,117 @@
1
+ # PySide6DOM
2
+ **Bring the simplicity of the Web DOM to Python PySide6 Desktop Applications.**
3
+
4
+ # Installation
5
+ ```bash
6
+ pip install pyside6dom
7
+ ```
8
+
9
+ **PySide6DOM** bridges the gap between web development and systems programming. It wraps the raw power of the PySide6 (C++/Qt) rendering engine inside the familiar, intuitive Document Object Model (DOM) paradigm used by JavaScript and HTML.
10
+
11
+ If you know how to build a web page using `createElement`, `getElementById`, and `appendChild`, you already know how to build high-performance, standalone Python desktop applications.
12
+
13
+ ### 🌟 Why Use PySide6DOM?
14
+
15
+ * **Zero HTML Parsing:** This is not a web view or a browser wrapper. It generates native C++/Qt desktop widgets using Python, ensuring maximum performance.
16
+ * **Familiar Syntax:** Uses lightweight helper functions modeled directly after the web DOM (`ce()` for create element, `ge()` for get element, `ba()` for body append).
17
+ * **Rapid Prototyping:** Build user interfaces in seconds without getting bogged down in complex object-oriented boilerplate.
18
+ * **Educational Bridge:** The perfect stepping stone for web developers transitioning into local hardware control, computer vision, and systems engineering.
19
+
20
+ ---
21
+
22
+ ### 📂 Repository Structure
23
+
24
+ This repository includes two learning paths:
25
+
26
+ * **`001_pyside6dom/` (Modular / Production Ready):** Separates the heavy GUI engine into a background module (`pyside6dom_modular.py`) so your main application script remains incredibly clean.
27
+ * **`002_pyside6dom_single_file/` (Training Wheels):** Contains everything in a single script, allowing you to see exactly how the DOM wrappers interact with the raw PySide6 classes under the hood.
28
+
29
+ ---
30
+
31
+ ### 🚀 The Code: Web Logic meets Python Power
32
+
33
+ Look how clean and intuitive building a native desktop app becomes. No complex classes, no confusing layout managers - just straightforward DOM logic.
34
+
35
+ ```python
36
+ from pyside6dom import ce, ge, ba, init_window, run_app
37
+
38
+ # Initialize the Application
39
+ init_window("Telemetry Station", width=440, height=520)
40
+
41
+ # Create a Header (createElement)
42
+ header = ce("text")
43
+ header.id = "main_heading"
44
+ header.textContent = "Telemetry Link Online"
45
+ header.style("font-size: 18px; font-weight: bold; margin-bottom: 10px;")
46
+ ba(header) # (appendChild)
47
+
48
+ # Create an Input Field
49
+ command_input = ce("input")
50
+ command_input.id = "user_input"
51
+ command_input.placeholder = "Enter station parameter..."
52
+ ba(command_input)
53
+
54
+ # Create an Interactive Button
55
+ submit_btn = ce("button")
56
+ submit_btn.textContent = "Transmit Command"
57
+
58
+ # Define what happens on click
59
+ def handle_click():
60
+ txt = ge("user_input").value
61
+ print(f"Transmitting Data: {txt}")
62
+
63
+ submit_btn.onclick = handle_click
64
+ ba(submit_btn)
65
+
66
+ # Launch the App
67
+ run_app()
68
+
69
+ ```
70
+
71
+ ---
72
+
73
+ ### 🛠️ Core API Reference
74
+
75
+ | Function | Web Equivalent | Description |
76
+ | --- | --- | --- |
77
+ | `ce(tag)` | `document.createElement()` | Creates a new native widget. Supports: `"button"`, `"text"`, `"input"`, `"slider"`, `"div"`, `"scroll_div"`. |
78
+ | `ge(id)` | `document.getElementById()` | Retrieves a previously created element by its unique `.id` property. |
79
+ | `ba(element)` | `document.body.appendChild()` | Appends the element to the main application window (or a specific parent container). |
80
+
81
+ ---
82
+
83
+ **Created by Christopher Andrew Topalian**
84
+
85
+ *College of Scripting Music & Science*
86
+
87
+ > *Disclaimer: This is an independent open-source educational project. "PySide" and "Qt" are registered trademarks of The Qt Company. This project is not affiliated with, endorsed by, or sponsored by The Qt Company.*
88
+
89
+ ---
90
+
91
+ ### How to Download this GitHub Repository
92
+ 1. Click the green Code Button on this github page
93
+ 2. Choose Download ZIP
94
+ 3. Save the Zip File
95
+ 4. Extract All
96
+
97
+ ---
98
+
99
+ Hapy Scripting :-)
100
+
101
+ ---
102
+
103
+ //----//
104
+
105
+ // Dedicated to God the Father
106
+
107
+ // Copyright (c) 2026-present Christopher Andrew Topalian
108
+
109
+ // Apache License
110
+ Version 2.0, January 2004
111
+ http://www.apache.org/licenses/
112
+
113
+ // https://github.com/ChristopherTopalian
114
+ // https://github.com/ChristopherAndrewTopalian
115
+
116
+ // https://sites.google.com/view/CollegeOfScripting
117
+
@@ -0,0 +1,29 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "pyside6dom"
7
+ version = "0.1.0"
8
+ authors = [
9
+ { name="Christopher Andrew Topalian" }
10
+ ]
11
+ description = "A web-style Document Object Model (DOM) interface for building PySide6 desktop applications."
12
+ readme = "README.md"
13
+ requires-python = ">=3.7"
14
+ license = { text = "Apache-2.0" }
15
+ classifiers = [
16
+ "Programming Language :: Python :: 3",
17
+ "Operating System :: OS Independent",
18
+ "Topic :: Software Development :: User Interfaces",
19
+ "Intended Audience :: Education",
20
+ ]
21
+ dependencies = [
22
+ "PySide6>=6.0.0"
23
+ ]
24
+
25
+ [project.urls]
26
+ "Homepage" = "https://github.com/ChristopherAndrewTopalian/pyside6dom"
27
+
28
+ [tool.setuptools]
29
+ packages = ["pyside6dom"]
@@ -0,0 +1,161 @@
1
+ # pyside6dom.py
2
+
3
+ import sys
4
+ from PySide6.QtWidgets import (
5
+ QApplication, QWidget, QVBoxLayout, QPushButton,
6
+ QLineEdit, QLabel, QSlider, QScrollArea
7
+ )
8
+ from PySide6.QtCore import Qt
9
+
10
+ _dom_registry = {}
11
+ _app_instance = None
12
+ _root_window = None
13
+ _main_container = None
14
+
15
+ class DOMElement:
16
+ def __init__(self, tag, qt_widget):
17
+ self.tag = tag
18
+ self.raw = qt_widget
19
+ self._id = ""
20
+ self._children = []
21
+
22
+ @property
23
+ def id(self): return self._id
24
+
25
+ @id.setter
26
+ def id(self, value):
27
+ self._id = value
28
+ _dom_registry[value] = self
29
+
30
+ @property
31
+ def textContent(self):
32
+ if hasattr(self.raw, "text"): return self.raw.text()
33
+ return ""
34
+
35
+ @textContent.setter
36
+ def textContent(self, value):
37
+ if hasattr(self.raw, "setText"): self.raw.setText(str(value))
38
+
39
+ @property
40
+ def value(self):
41
+ if isinstance(self.raw, QLineEdit): return self.raw.text()
42
+ elif isinstance(self.raw, QSlider): return self.raw.value() / 10.0
43
+ return None
44
+
45
+ @value.setter
46
+ def value(self, val):
47
+ if isinstance(self.raw, QLineEdit): self.raw.setText(str(val))
48
+ elif isinstance(self.raw, QSlider): self.raw.setValue(int(float(val) * 10))
49
+
50
+ @property
51
+ def placeholder(self):
52
+ return self.raw.placeholderText() if hasattr(self.raw, "placeholderText") else ""
53
+
54
+ @placeholder.setter
55
+ def placeholder(self, text):
56
+ if hasattr(self.raw, "setPlaceholderText"): self.raw.setPlaceholderText(str(text))
57
+
58
+ @property
59
+ def onclick(self): return None
60
+
61
+ @onclick.setter
62
+ def onclick(self, callback_func):
63
+ if hasattr(self.raw, "clicked"): self.raw.clicked.connect(callback_func)
64
+
65
+ @property
66
+ def oninput(self): return None
67
+
68
+ @oninput.setter
69
+ def oninput(self, callback_func):
70
+ if isinstance(self.raw, QLineEdit):
71
+ self.raw.textChanged.connect(lambda text: callback_func(text))
72
+ elif isinstance(self.raw, QSlider):
73
+ self.raw.valueChanged.connect(lambda val: callback_func(val / 10.0))
74
+
75
+ def style(self, css_string):
76
+ self.raw.setStyleSheet(css_string)
77
+
78
+
79
+ def ce(tag):
80
+ tag = tag.lower()
81
+ if tag == "button":
82
+ w = QPushButton()
83
+ w.setStyleSheet("padding: 8px 14px; background-color: #2b2b2b; color: white; border-radius: 4px;")
84
+ return DOMElement(tag, w)
85
+ elif tag in ("text", "p", "span", "h1"):
86
+ w = QLabel()
87
+ w.setStyleSheet("color: #ffffff; font-size: 14px;")
88
+ return DOMElement(tag, w)
89
+ elif tag == "input":
90
+ w = QLineEdit()
91
+ w.setStyleSheet("padding: 6px; background-color: #1a1a1a; color: white; border: 1px solid #444;")
92
+ return DOMElement(tag, w)
93
+ elif tag == "slider":
94
+ w = QSlider(Qt.Orientation.Horizontal)
95
+ w.setMinimum(0)
96
+ w.setMaximum(100)
97
+ return DOMElement(tag, w)
98
+ elif tag == "div":
99
+ w = QWidget()
100
+ layout = QVBoxLayout(w)
101
+ layout.setAlignment(Qt.AlignmentFlag.AlignTop)
102
+ layout.setContentsMargins(5, 5, 5, 5)
103
+ elem = DOMElement(tag, w)
104
+ elem.layout = layout
105
+ return elem
106
+ elif tag == "scroll_div":
107
+ scroll = QScrollArea()
108
+ scroll.setWidgetResizable(True)
109
+ content = QWidget()
110
+ layout = QVBoxLayout(content)
111
+ layout.setAlignment(Qt.AlignmentFlag.AlignTop)
112
+ scroll.setWidget(content)
113
+ elem = DOMElement(tag, scroll)
114
+ elem.layout = layout
115
+ return elem
116
+ raise ValueError(f"Unknown tag: {tag}")
117
+
118
+ def ge(element_id):
119
+ return _dom_registry.get(element_id, None)
120
+
121
+ def ba(child, parent=None):
122
+ target = parent if parent is not None else _main_container
123
+ if hasattr(target, "layout") and target.layout is not None:
124
+ target.layout.addWidget(child.raw)
125
+ elif isinstance(target, QVBoxLayout):
126
+ target.addWidget(child.raw)
127
+
128
+ def init_window(title="App Window", width=420, height=500):
129
+ global _app_instance, _root_window, _main_container
130
+ _app_instance = QApplication(sys.argv)
131
+ _app_instance.setStyle("Fusion")
132
+ _root_window = QWidget()
133
+ _root_window.setWindowTitle(title)
134
+ _root_window.resize(width, height)
135
+ _root_window.setStyleSheet("background-color: rgb(30, 30, 30);")
136
+ _main_layout = QVBoxLayout(_root_window)
137
+ _main_container = ce("scroll_div")
138
+ _main_layout.addWidget(_main_container.raw)
139
+
140
+ def run_app():
141
+ _root_window.show()
142
+ sys.exit(_app_instance.exec())
143
+
144
+ ####
145
+
146
+ # Dedicated to God the Father
147
+ # (c) Copyright 2026 Christopher Andrew Topalian
148
+ #
149
+ # Licensed under the Apache License, Version 2.0 (the "License");
150
+ # you may not use this file except in compliance with the License.
151
+ # You may obtain a copy of the License at
152
+ #
153
+ # http://www.apache.org/licenses/LICENSE-2.0
154
+ #
155
+ # College of Scripting Music & Science
156
+ #
157
+ # GitHub: https://github.com/ChristopherAndrewTopalian
158
+ #
159
+ # GitHub: https://github.com/ChristopherTopalian
160
+ # Google Sites: https://sites.google.com/view/CollegeOfScripting
161
+
@@ -0,0 +1,134 @@
1
+ Metadata-Version: 2.4
2
+ Name: pyside6dom
3
+ Version: 0.1.0
4
+ Summary: A web-style Document Object Model (DOM) interface for building PySide6 desktop applications.
5
+ Author: Christopher Andrew Topalian
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/ChristopherAndrewTopalian/pyside6dom
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Operating System :: OS Independent
10
+ Classifier: Topic :: Software Development :: User Interfaces
11
+ Classifier: Intended Audience :: Education
12
+ Requires-Python: >=3.7
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENSE
15
+ Requires-Dist: PySide6>=6.0.0
16
+ Dynamic: license-file
17
+
18
+ # PySide6DOM
19
+ **Bring the simplicity of the Web DOM to Python PySide6 Desktop Applications.**
20
+
21
+ # Installation
22
+ ```bash
23
+ pip install pyside6dom
24
+ ```
25
+
26
+ **PySide6DOM** bridges the gap between web development and systems programming. It wraps the raw power of the PySide6 (C++/Qt) rendering engine inside the familiar, intuitive Document Object Model (DOM) paradigm used by JavaScript and HTML.
27
+
28
+ If you know how to build a web page using `createElement`, `getElementById`, and `appendChild`, you already know how to build high-performance, standalone Python desktop applications.
29
+
30
+ ### 🌟 Why Use PySide6DOM?
31
+
32
+ * **Zero HTML Parsing:** This is not a web view or a browser wrapper. It generates native C++/Qt desktop widgets using Python, ensuring maximum performance.
33
+ * **Familiar Syntax:** Uses lightweight helper functions modeled directly after the web DOM (`ce()` for create element, `ge()` for get element, `ba()` for body append).
34
+ * **Rapid Prototyping:** Build user interfaces in seconds without getting bogged down in complex object-oriented boilerplate.
35
+ * **Educational Bridge:** The perfect stepping stone for web developers transitioning into local hardware control, computer vision, and systems engineering.
36
+
37
+ ---
38
+
39
+ ### 📂 Repository Structure
40
+
41
+ This repository includes two learning paths:
42
+
43
+ * **`001_pyside6dom/` (Modular / Production Ready):** Separates the heavy GUI engine into a background module (`pyside6dom_modular.py`) so your main application script remains incredibly clean.
44
+ * **`002_pyside6dom_single_file/` (Training Wheels):** Contains everything in a single script, allowing you to see exactly how the DOM wrappers interact with the raw PySide6 classes under the hood.
45
+
46
+ ---
47
+
48
+ ### 🚀 The Code: Web Logic meets Python Power
49
+
50
+ Look how clean and intuitive building a native desktop app becomes. No complex classes, no confusing layout managers - just straightforward DOM logic.
51
+
52
+ ```python
53
+ from pyside6dom import ce, ge, ba, init_window, run_app
54
+
55
+ # Initialize the Application
56
+ init_window("Telemetry Station", width=440, height=520)
57
+
58
+ # Create a Header (createElement)
59
+ header = ce("text")
60
+ header.id = "main_heading"
61
+ header.textContent = "Telemetry Link Online"
62
+ header.style("font-size: 18px; font-weight: bold; margin-bottom: 10px;")
63
+ ba(header) # (appendChild)
64
+
65
+ # Create an Input Field
66
+ command_input = ce("input")
67
+ command_input.id = "user_input"
68
+ command_input.placeholder = "Enter station parameter..."
69
+ ba(command_input)
70
+
71
+ # Create an Interactive Button
72
+ submit_btn = ce("button")
73
+ submit_btn.textContent = "Transmit Command"
74
+
75
+ # Define what happens on click
76
+ def handle_click():
77
+ txt = ge("user_input").value
78
+ print(f"Transmitting Data: {txt}")
79
+
80
+ submit_btn.onclick = handle_click
81
+ ba(submit_btn)
82
+
83
+ # Launch the App
84
+ run_app()
85
+
86
+ ```
87
+
88
+ ---
89
+
90
+ ### 🛠️ Core API Reference
91
+
92
+ | Function | Web Equivalent | Description |
93
+ | --- | --- | --- |
94
+ | `ce(tag)` | `document.createElement()` | Creates a new native widget. Supports: `"button"`, `"text"`, `"input"`, `"slider"`, `"div"`, `"scroll_div"`. |
95
+ | `ge(id)` | `document.getElementById()` | Retrieves a previously created element by its unique `.id` property. |
96
+ | `ba(element)` | `document.body.appendChild()` | Appends the element to the main application window (or a specific parent container). |
97
+
98
+ ---
99
+
100
+ **Created by Christopher Andrew Topalian**
101
+
102
+ *College of Scripting Music & Science*
103
+
104
+ > *Disclaimer: This is an independent open-source educational project. "PySide" and "Qt" are registered trademarks of The Qt Company. This project is not affiliated with, endorsed by, or sponsored by The Qt Company.*
105
+
106
+ ---
107
+
108
+ ### How to Download this GitHub Repository
109
+ 1. Click the green Code Button on this github page
110
+ 2. Choose Download ZIP
111
+ 3. Save the Zip File
112
+ 4. Extract All
113
+
114
+ ---
115
+
116
+ Hapy Scripting :-)
117
+
118
+ ---
119
+
120
+ //----//
121
+
122
+ // Dedicated to God the Father
123
+
124
+ // Copyright (c) 2026-present Christopher Andrew Topalian
125
+
126
+ // Apache License
127
+ Version 2.0, January 2004
128
+ http://www.apache.org/licenses/
129
+
130
+ // https://github.com/ChristopherTopalian
131
+ // https://github.com/ChristopherAndrewTopalian
132
+
133
+ // https://sites.google.com/view/CollegeOfScripting
134
+
@@ -0,0 +1,9 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ pyside6dom/__init__.py
5
+ pyside6dom.egg-info/PKG-INFO
6
+ pyside6dom.egg-info/SOURCES.txt
7
+ pyside6dom.egg-info/dependency_links.txt
8
+ pyside6dom.egg-info/requires.txt
9
+ pyside6dom.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ PySide6>=6.0.0
@@ -0,0 +1 @@
1
+ pyside6dom
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+