mirror of
https://github.com/tiqi-group/pydase.git
synced 2025-04-24 10:00:03 +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:
|
||||
|
||||
```python
|
||||
from pydase import DataService
|
||||
from pydase import DataService, Server
|
||||
|
||||
|
||||
class Device(DataService):
|
||||
|
||||
_current = 0.0
|
||||
_voltage = 0.0
|
||||
_power = False
|
||||
|
||||
@property
|
||||
def current(self):
|
||||
def current(self) -> float:
|
||||
# run code to get current
|
||||
return self._current
|
||||
|
||||
@current.setter
|
||||
def current(self, value):
|
||||
def current(self, value: float) -> None:
|
||||
# run code to set current
|
||||
self._current = value
|
||||
|
||||
@property
|
||||
def voltage(self):
|
||||
def voltage(self) -> float:
|
||||
# run code to get voltage
|
||||
return self._voltage
|
||||
|
||||
@voltage.setter
|
||||
def voltage(self, value):
|
||||
def voltage(self, value: float) -> None:
|
||||
# run code to set voltage
|
||||
self._voltage = value
|
||||
|
||||
@property
|
||||
def power(self):
|
||||
def power(self) -> bool:
|
||||
# run code to get power state
|
||||
return self._power
|
||||
|
||||
@power.setter
|
||||
def power(self, value):
|
||||
def power(self, value: bool) -> None:
|
||||
# run code to set power state
|
||||
self._power = value
|
||||
|
||||
def reset(self):
|
||||
def reset(self) -> None:
|
||||
self.current = 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.
|
||||
|
||||
### 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>}
|
||||
</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>
|
||||
);
|
||||
|
@ -1,13 +1,13 @@
|
||||
{
|
||||
"files": {
|
||||
"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",
|
||||
"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": [
|
||||
"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