Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions plottr/apps/inspectr.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,15 @@ def showContextMenu(self, position: QtCore.QPoint) -> None:
copy_action = menu.addAction(copy_icon, "Copy")

window = cast(QCodesDBInspector, self.window())
starAction: QtWidgets.QAction = window.starAction # type: ignore[has-type]
starAction: QtWidgets.QAction = window.starAction

starAction.setText('Star' if current_tag_char != self.tag_dict['star'] else 'Unstar')
menu.addAction(starAction)

crossAction: QtWidgets.QAction = window.crossAction # type: ignore[has-type]
crossAction.setText('Cross' if current_tag_char != self.tag_dict['cross'] else 'Uncross')
crossAction: QtWidgets.QAction = window.crossAction
crossAction.setText(
"Cross" if current_tag_char != self.tag_dict["cross"] else "Uncross"
)
menu.addAction(crossAction)

action = menu.exec_(self.mapToGlobal(position))
Expand Down
8 changes: 4 additions & 4 deletions plottr/data/datadict.py
Original file line number Diff line number Diff line change
Expand Up @@ -1409,23 +1409,23 @@ def combine_datadicts(*dicts: DataDict) -> Union[DataDictBase, DataDict]:
# axes in the return can be separated even if they match (caused
# by earlier mismatches)

ret = None
rettype = None
ret: Union[DataDictBase, None] = None
rettype: Union[type[DataDictBase], None] = None

for d in dicts:
if ret is None:
ret = d.copy()
rettype = type(d)

else:

# if we don't have a well defined number of records anymore,
# need to revert the type to DataDictBase
if hasattr(d, 'nrecords') and hasattr(ret, 'nrecords'):
if hasattr(d, "nrecords") and hasattr(ret, "nrecords"):
if d.nrecords() != ret.nrecords():
rettype = DataDictBase
else:
rettype = DataDictBase
assert rettype is not None
ret = rettype(**ret)

# First, parse the axes in the to-be-added ddict.
Expand Down
14 changes: 9 additions & 5 deletions plottr/node/autonode.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,26 @@ def connectFloatSpinbox(


class AutoNodeGui(AutoNodeGuiTemplate):

widgetConnection = {
int: connectIntegerSpinbox,
float: connectFloatSpinbox,
}

def __init__(self, parent: Optional[QtWidgets.QWidget] = None,
node: Optional[Node] = None):
def __init__(
self, parent: Optional[QtWidgets.QWidget] = None, node: Optional[Node] = None
):
super().__init__(parent)
layout = QtWidgets.QFormLayout()
self.setLayout(layout)

def addOption(self, name: str, specs: Dict[str, Any], confirm: bool) -> None:
optionType = specs.get('type', None)
optionType: type | None = specs.get("type", None)
widget = None
func = self.widgetConnection.get(optionType, None)
func = (
self.widgetConnection[optionType]
if optionType in self.widgetConnection.keys()
else None
)
if func is not None:
widget = func(self, name, specs, confirm)
layout = cast(QtWidgets.QFormLayout, self.layout())
Expand Down
10 changes: 3 additions & 7 deletions plottr/node/scaleunits.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
from enum import Enum, unique
from typing import Optional, Dict
from typing import Dict, Optional

try:
from qcodes.utils.plotting import find_scale_and_prefix
except ImportError:
# fallback for qcodes < 0.21
from plottr.utils.find_scale_and_prefix import find_scale_and_prefix
from qcodes.plotting import find_scale_and_prefix

from plottr import QtWidgets, Signal, Slot
from plottr.node import Node, NodeWidget, updateOption
from plottr.data.datadict import DataDictBase
from plottr.node import Node, NodeWidget, updateOption


@unique
Expand Down
1 change: 1 addition & 0 deletions plottr/plot/mpl/autoplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ def plotLine(self, plotItem: PlotItem) -> Optional[List[ScalarMappable]]:
assert len(plotItem.data) == 2
lbl = plotItem.labels[-1] if isinstance(plotItem.labels, list) and len(plotItem.labels) > 0 else ''
x, y = plotItem.data
assert plotItem.plotOptions is not None
return axes[0].plot(x, y, label=lbl, **plotItem.plotOptions)

def plotImage(self, plotItem: PlotItem) -> Optional[ScalarMappable]:
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ warn_unused_configs = true
warn_redundant_casts = true
no_implicit_optional = true
disallow_untyped_defs = true
plugins = "numpy.typing.mypy_plugin"
show_error_codes = true
enable_error_code = "ignore-without-code"

Expand Down
2 changes: 1 addition & 1 deletion test_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
qcodes
pytest
pytest-qt
mypy==1.13.0
mypy==1.20.2
PyQt5-stubs==5.15.6.0
pandas-stubs
watchdog
Loading