add about device
This commit is contained in:
parent
4b9e326034
commit
2cd9977dce
@ -3,3 +3,15 @@ VERSION = "0.1.0-dev"
|
||||
BUILD_DATE = "dev"
|
||||
GIT_HASH = "dev"
|
||||
DEVICE_MODEL = "Raspberry Pi"
|
||||
|
||||
|
||||
def get_device_model() -> str:
|
||||
for path in ("/proc/device-tree/model", "/sys/firmware/devicetree/base/model"):
|
||||
try:
|
||||
with open(path, "rb") as f:
|
||||
raw = f.read().strip(b"\x00").strip()
|
||||
if raw:
|
||||
return raw.decode("utf-8", errors="replace")
|
||||
except OSError:
|
||||
continue
|
||||
return DEVICE_MODEL
|
||||
|
||||
@ -213,7 +213,7 @@ class SettingsScreen(QWidget):
|
||||
info.addWidget(self._info_row("Версия", build_info.VERSION))
|
||||
info.addWidget(self._info_row("Сборка", build_info.BUILD_DATE))
|
||||
info.addWidget(self._info_row("Коммит", build_info.GIT_HASH))
|
||||
info.addWidget(self._info_row("Устройство", build_info.DEVICE_MODEL))
|
||||
info.addWidget(self._info_row("Устройство", build_info.get_device_model()))
|
||||
|
||||
layout.addLayout(info)
|
||||
layout.addStretch(1)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user