forked from M-Labs/kirdy
Compare commits
2 Commits
3125e7cff0
...
ebe668ded7
Author | SHA1 | Date | |
---|---|---|---|
ebe668ded7 | |||
dda15ac2ea |
@ -67,7 +67,6 @@
|
||||
propagatedBuildInputs =
|
||||
[ pkgs.qt6.qtbase ]
|
||||
++ (with pkgs.python3Packages; [
|
||||
aenum
|
||||
numpy
|
||||
pyqtgraph
|
||||
pyqt6
|
||||
@ -101,7 +100,7 @@
|
||||
buildInputs = with pkgs; [
|
||||
rust openocd dfu-util glibc
|
||||
] ++ (with python3Packages; [
|
||||
numpy matplotlib pyqtgraph setuptools pyqt6 qasync pglive aenum sipyco
|
||||
numpy matplotlib pyqtgraph setuptools pyqt6 qasync pglive sipyco
|
||||
]);
|
||||
shellHook=
|
||||
''
|
||||
|
@ -4,10 +4,23 @@ import json
|
||||
import logging
|
||||
import time
|
||||
from threading import Thread
|
||||
from aenum import StrEnum, NoAlias
|
||||
from enum import StrEnum, EnumType
|
||||
import queue
|
||||
import asyncio
|
||||
|
||||
|
||||
class NoAlias(EnumType):
|
||||
def __call__(cls, value=None, *args, **kwargs):
|
||||
if args == () and kwargs == {} and not isinstance(value, cls):
|
||||
raise TypeError("NoAlias enumerations cannot be looked up by value")
|
||||
return super().__call__(value, *args, **kwargs)
|
||||
|
||||
|
||||
class NoAliasStrEnum(StrEnum, metaclass=NoAlias):
|
||||
"""StrEnum that cannot be looked up by value."""
|
||||
pass
|
||||
|
||||
|
||||
class _dt(StrEnum):
|
||||
ip_settings = "ip_settings"
|
||||
temp_adc_filter = "temp_adc_filter"
|
||||
@ -20,10 +33,10 @@ class State(StrEnum):
|
||||
connected = "connected"
|
||||
|
||||
class CmdList:
|
||||
class tec_set_i(StrEnum, settings=NoAlias):
|
||||
class tec_set_i(NoAliasStrEnum):
|
||||
_target = "tec_set_i"
|
||||
tec_set_i = _dt.f32
|
||||
class device(StrEnum, settings=NoAlias):
|
||||
class device(NoAliasStrEnum):
|
||||
_target = "device_cmd"
|
||||
SetIPSettings = _dt.ip_settings
|
||||
SetPdFinGain = _dt.f32
|
||||
@ -37,7 +50,7 @@ class CmdList:
|
||||
LoadFlashSettings = _dt.none
|
||||
HardReset = _dt.none
|
||||
|
||||
class ld(StrEnum, settings=NoAlias):
|
||||
class ld(NoAliasStrEnum):
|
||||
_target = "laser_diode_cmd"
|
||||
SetDefaultPowerOn = _dt.bool
|
||||
PowerUp = _dt.none
|
||||
@ -51,7 +64,7 @@ class CmdList:
|
||||
SetLdPwrLimit = _dt.f32
|
||||
ClearAlarm = _dt.none
|
||||
|
||||
class thermostat(StrEnum, settings=NoAlias):
|
||||
class thermostat(NoAliasStrEnum):
|
||||
_target = "thermostat_cmd"
|
||||
SetDefaultPowerOn = _dt.bool,
|
||||
PowerUp = _dt.f32,
|
||||
|
@ -10,7 +10,6 @@ description = "Python utilities for the Sinara 1550 Kirdy"
|
||||
urls.Repository = "https://git.m-labs.hk/M-Labs/kirdy"
|
||||
license = {text = "GPLv3"}
|
||||
dependencies = [
|
||||
"aenum >= 3.1.15",
|
||||
"numpy >= 2.0.0",
|
||||
"pyqtgraph >= 0.13.7",
|
||||
"pyqt6 >= 6.8.0",
|
||||
|
Loading…
x
Reference in New Issue
Block a user