togax-xml-layout-plugin
XML unofficial Toga layout parser
Installation
pip install togax-xml-layout-plugin
Reason
Give developers the ability to define layouts in XML outside code. Also giving the final users the possibility to customize app layout without changing code.
Example
layout.xml
<MainWindow>
<SplitContainer>
<ScrollContainer>
<Box style="direction: column; padding: 10;">
<!-- OptionContainer -->
<OptionContainer id="container">
<OptionItem text="1">
<Box style="direction: column; padding: 10;">
<!-- ImageView -->
<Label>ImageView</Label>
<ImageView>
<Image src="resources/srtranslator.png" />
</ImageView>
<!-- WebView -->
<Label>WebView</Label>
<WebView url="https://beeware.org" style=" height: 500;" />
<!-- Canvas -->
<Label>Canvas</Label>
<Canvas style="height: 100;" />
</Box>
</OptionItem>
<OptionItem text="2">
<Box style="direction: column; padding: 10;">
<!-- DetailedList -->
<Label>DetailedList</Label>
<DetailedList>
<accessors>
<item>title</item>
<item>subtitle</item>
<item>icon</item>
</accessors>
<data>
<item>
<title>HEY 1</title>
<subtitle>Selection Item 1</subtitle>
</item>
<item>
<title>HEY 2</title>
<subtitle>Selection Item 2</subtitle>
</item>
<item>
<title>HEY 3</title>
<subtitle>Selection Item 3</subtitle>
</item>
</data>
</DetailedList>
<!-- Table -->
<Label>Table</Label>
<Table>
<headings>
<item>name</item>
<item>Age</item>
</headings>
<data>
<item>
<name>HEY 1</name>
<age>Selection Item 1</age>
</item>
<item>
<name>HEY 2</name>
<age>Selection Item 2</age>
</item>
<item>
<name>HEY 3</name>
<age>Selection Item 3</age>
</item>
</data>
</Table>
</Box>
</OptionItem>
</OptionContainer>
</Box>
</ScrollContainer>
<ScrollContainer>
<Box style="direction: column; padding: 10;">
<!-- ActivityIndicator -->
<Label>ActivityIndicator</Label>
<ActivityIndicator running="true" />
<!-- ProgressBar -->
<Label>ProgressBar</Label>
<ProgressBar value="10" max="30" />
<!-- Divider -->
<Label>Divider</Label>
<Divider />
<!-- MultilineTextInput -->
<Label>MultilineTextInput</Label>
<MultilineTextInput
value="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." />
<!-- TextInput -->
<Label>TextInput</Label>
<TextInput value="Lorem ipsum dolor sit amet" />
<!-- NumberInput -->
<Label>NumberInput</Label>
<NumberInput value="1000" />
<!-- PasswordInput -->
<Label>PasswordInput</Label>
<PasswordInput />
<!-- Button -->
<Label>Button</Label>
<Button on_press=".test_button">Button</Button>
<!-- Slider -->
<Label>Slider</Label>
<Slider value="50" min="0" max="100" />
<!-- Switch -->
<Switch value="true">Switch</Switch>
<!-- Selection -->
<Label>Selection</Label>
<Selection>
<items>
<item>Selection Item 1</item>
<item>Selection Item 2</item>
<item>Selection Item 3</item>
</items>
</Selection>
<!-- Selection with dictionaries -->
<Label>Selection with dictionaries</Label>
<Selection>
<items>
<item>
<name>HEY 1</name>
<value>Selection Item 1</value>
</item>
<item>
<name>HEY 2</name>
<value>Selection Item 2</value>
</item>
<item>
<name>HEY 3</name>
<value>Selection Item 3</value>
</item>
</items>
</Selection>
</Box>
</ScrollContainer>
</SplitContainer>
</MainWindow>
app.py
import toga
from togax_xml_layout import parse_layout
class App(toga.App):
def startup(self):
with open(f"{self.paths.app}/resources/layout.xml", "r") as f:
self.main_window = parse_layout(self, f.read())
self.main_window.show()
def test_button(self, widget):
print("clicked")
Metadata
Release files for togax-xml-layout-plugin 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| togax-xml-layout-plugin-0.0.3.tar.gz | 4.5 kB | Without provenance | Details for togax-xml-layout-plugin-0.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| togax_xml_layout_plugin-0.0.3-py3-none-any.whl | Python 3 | none | any | Details for togax_xml_layout_plugin-0.0.3-py3-none-any.whl |
Total release size: 9.5 kB
Release files / togax-xml-layout-plugin-0.0.3.tar.gz
| Download URL | togax-xml-layout-plugin-0.0.3.tar.gz |
|---|---|
| Size | 4.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
beaf0567db10a511c12b38ace87453c4dbabb2b525d5541af32f33a0fb15bf4c
|
|
BLAKE2b-256 checksum How to use checksums |
8cf61edd8e7d53eeafedeabd3e291022150f8f2f06f4aacac1626a3b41c92388
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|
Release files / togax_xml_layout_plugin-0.0.3-py3-none-any.whl
| Download URL | togax_xml_layout_plugin-0.0.3-py3-none-any.whl |
|---|---|
| Size | 5.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ea07bfbfa55423beb922c102f79aaccb6ac341533667ac2480c9ef7c15b427b1
|
|
BLAKE2b-256 checksum How to use checksums |
e7c03515fb9ce5e0afd93fa48fdbc3b92cd6c738724030a6c25dc78b6dc637d5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|
Security for togax-xml-layout-plugin 0.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.