mirror of
https://github.com/tiqi-group/pydase.git
synced 2025-04-24 18:10:02 +02:00
Merge pull request #19 from tiqi-group/14-spin-box-buttons-not-working
Removes buttons from number components.
This commit is contained in:
commit
cb94068faf
24
README.md
24
README.md
@ -52,48 +52,54 @@ To use pydase, you'll first need to create a class that inherits from `DataServi
|
|||||||
Here's an example:
|
Here's an example:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from pydase import DataService
|
from pydase import DataService, Server
|
||||||
|
|
||||||
|
|
||||||
class Device(DataService):
|
class Device(DataService):
|
||||||
|
|
||||||
_current = 0.0
|
_current = 0.0
|
||||||
_voltage = 0.0
|
_voltage = 0.0
|
||||||
_power = False
|
_power = False
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def current(self):
|
def current(self) -> float:
|
||||||
# run code to get current
|
# run code to get current
|
||||||
return self._current
|
return self._current
|
||||||
|
|
||||||
@current.setter
|
@current.setter
|
||||||
def current(self, value):
|
def current(self, value: float) -> None:
|
||||||
# run code to set current
|
# run code to set current
|
||||||
self._current = value
|
self._current = value
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def voltage(self):
|
def voltage(self) -> float:
|
||||||
# run code to get voltage
|
# run code to get voltage
|
||||||
return self._voltage
|
return self._voltage
|
||||||
|
|
||||||
@voltage.setter
|
@voltage.setter
|
||||||
def voltage(self, value):
|
def voltage(self, value: float) -> None:
|
||||||
# run code to set voltage
|
# run code to set voltage
|
||||||
self._voltage = value
|
self._voltage = value
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def power(self):
|
def power(self) -> bool:
|
||||||
# run code to get power state
|
# run code to get power state
|
||||||
return self._power
|
return self._power
|
||||||
|
|
||||||
@power.setter
|
@power.setter
|
||||||
def power(self, value):
|
def power(self, value: bool) -> None:
|
||||||
# run code to set power state
|
# run code to set power state
|
||||||
self._power = value
|
self._power = value
|
||||||
|
|
||||||
def reset(self):
|
def reset(self) -> None:
|
||||||
self.current = 0.0
|
self.current = 0.0
|
||||||
self.voltage = 0.0
|
self.voltage = 0.0
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
service = Device()
|
||||||
|
Server(service).run()
|
||||||
```
|
```
|
||||||
|
|
||||||
In the above example, we define a Device class that extends DataService. We define a few properties (current, voltage, power) and their getter and setter methods.
|
In the above example, we define a Device class that extends DataService. We define a few properties (current, voltage, power) and their getter and setter methods.
|
||||||
|
|
||||||
### Running the Server
|
### Running the Server
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 33 KiB |
@ -294,16 +294,6 @@ export const NumberComponent = React.memo((props: NumberComponentProps) => {
|
|||||||
/>
|
/>
|
||||||
{unit && <InputGroup.Text>{unit}</InputGroup.Text>}
|
{unit && <InputGroup.Text>{unit}</InputGroup.Text>}
|
||||||
</InputGroup>
|
</InputGroup>
|
||||||
{!readOnly && (
|
|
||||||
<div className="d-flex flex-column">
|
|
||||||
<Button className="numberComponentButton" variant="outline-secondary">
|
|
||||||
+
|
|
||||||
</Button>
|
|
||||||
<Button className="numberComponentButton" variant="outline-secondary">
|
|
||||||
-
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
{
|
{
|
||||||
"files": {
|
"files": {
|
||||||
"main.css": "/static/css/main.398bc7f8.css",
|
"main.css": "/static/css/main.398bc7f8.css",
|
||||||
"main.js": "/static/js/main.1adac645.js",
|
"main.js": "/static/js/main.c348625e.js",
|
||||||
"index.html": "/index.html",
|
"index.html": "/index.html",
|
||||||
"main.398bc7f8.css.map": "/static/css/main.398bc7f8.css.map",
|
"main.398bc7f8.css.map": "/static/css/main.398bc7f8.css.map",
|
||||||
"main.1adac645.js.map": "/static/js/main.1adac645.js.map"
|
"main.c348625e.js.map": "/static/js/main.c348625e.js.map"
|
||||||
},
|
},
|
||||||
"entrypoints": [
|
"entrypoints": [
|
||||||
"static/css/main.398bc7f8.css",
|
"static/css/main.398bc7f8.css",
|
||||||
"static/js/main.1adac645.js"
|
"static/js/main.c348625e.js"
|
||||||
]
|
]
|
||||||
}
|
}
|
@ -1 +1 @@
|
|||||||
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site displaying a pydase UI."/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>pydase App</title><script defer="defer" src="/static/js/main.1adac645.js"></script><link href="/static/css/main.398bc7f8.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
|
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site displaying a pydase UI."/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>pydase App</title><script defer="defer" src="/static/js/main.c348625e.js"></script><link href="/static/css/main.398bc7f8.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
src/pydase/frontend/static/js/main.c348625e.js.map
Normal file
1
src/pydase/frontend/static/js/main.c348625e.js.map
Normal file
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user