Skip to content

Commit

Permalink
Allow wildcards in autodiscovery patterns (#268)
Browse files Browse the repository at this point in the history
  • Loading branch information
jziolkowski authored Sep 12, 2024
1 parent 9afa865 commit 8c28848
Show file tree
Hide file tree
Showing 48 changed files with 1,187 additions and 486 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ jobs:

- uses: psf/black@stable
with:
options: "--check --verbose -S -l 100"
options: "--check -S -l 100"

- uses: py-actions/flake8@v2
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ check-and-fix: isort black flake8
dev-setup:
python3 -m venv $(VENV_DIR)
$(VENV_DIR)/bin/pip install --upgrade pip wheel setuptools
$(VENV_DIR)/bin/pip install -r requirements_dev.txt -r requirements.txt
$(VENV_DIR)/bin/pip install -r requirements_dev.txt


3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
paho_mqtt>=1.4
paho_mqtt>=1.4,<2
PyQt5>=5.14.2,<6
pydantic==2.5.2
4 changes: 3 additions & 1 deletion requirements_dev.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
black==22.10.0
-r requirements.txt
black==24.3.0
flake8==5.0.4
isort==5.10.1
pytest==7.4.3
24 changes: 8 additions & 16 deletions tdmgr/GUI/console.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
import os
from datetime import datetime

from PyQt5.QtCore import (
QDir,
QEvent,
QRegExp,
QSize,
QStringListModel,
Qt,
QTime,
pyqtSignal,
pyqtSlot,
)
from PyQt5.QtCore import QDir, QEvent, QRegExp, QSize, QStringListModel, Qt, pyqtSignal, pyqtSlot
from PyQt5.QtGui import QColor, QFont, QIcon, QSyntaxHighlighter, QTextCharFormat
from PyQt5.QtWidgets import (
QComboBox,
Expand All @@ -28,6 +18,7 @@
)

from tdmgr.GUI.widgets import GroupBoxV, HLayout, VLayout, console_font
from tdmgr.util import Message
from tdmgr.util.commands import commands


Expand Down Expand Up @@ -120,11 +111,12 @@ def command_changed(self, text):
if text == "":
self.command.completer().setModel(QStringListModel(sorted(commands)))

@pyqtSlot(str, str, bool)
def consoleAppend(self, topic, msg, retained=False):
if self.device.matches(topic):
tstamp = QTime.currentTime().toString("HH:mm:ss")
self.console.appendPlainText(f"[{tstamp}] {topic} {msg}")
@pyqtSlot(Message)
def consoleAppend(self, msg: Message):
if self.device.matches(msg.topic):
self.console.appendPlainText(
f"[{msg.timestamp.strftime('%X')}] {msg.topic} {msg.payload}"
)

def eventFilter(self, obj, e):
if obj == self.command and e.type() == QEvent.KeyPress:
Expand Down
6 changes: 2 additions & 4 deletions tdmgr/GUI/delegates/devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
RSSI_LOW,
RSSI_MEDIUM,
)
from tdmgr.models.common import DeviceRoles
from tdmgr.models.roles import DeviceRoles


@dataclass
Expand Down Expand Up @@ -270,9 +270,7 @@ def draw_shutters_state(self, p: QPainter, target_rect: QRect, shutter_pos_data:
position = (
'CLOSED'
if shutter_state['Position'] == 0
else 'OPEN'
if shutter_state['Position'] == 100
else shutter_state['Position']
else 'OPEN' if shutter_state['Position'] == 100 else shutter_state['Position']
)

arrow_direction = {-1: ARROW_DN, 1: ARROW_UP}
Expand Down
Loading

0 comments on commit 8c28848

Please sign in to comment.