From 01e4c0c5a003e7024a0c782f86dd686102737822 Mon Sep 17 00:00:00 2001 From: danielhrisca Date: Wed, 11 Oct 2023 10:25:51 +0300 Subject: [PATCH] set dialog parents --- src/asammdf/gui/widgets/file.py | 2 +- src/asammdf/gui/widgets/list.py | 5 ++--- src/asammdf/gui/widgets/mdi_area.py | 8 ++++---- src/asammdf/gui/widgets/range_widget.py | 4 ++-- src/asammdf/gui/widgets/tree.py | 4 ++-- 5 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/asammdf/gui/widgets/file.py b/src/asammdf/gui/widgets/file.py index 26b052cab..95253bbd7 100644 --- a/src/asammdf/gui/widgets/file.py +++ b/src/asammdf/gui/widgets/file.py @@ -1058,7 +1058,7 @@ def load_channel_list(self, event=None, file_name=None, manually=False): if not info: return section, ok = QtWidgets.QInputDialog.getItem( - None, + self, "Select section", "Available sections:", list(info), diff --git a/src/asammdf/gui/widgets/list.py b/src/asammdf/gui/widgets/list.py index e57549646..083b8d51d 100644 --- a/src/asammdf/gui/widgets/list.py +++ b/src/asammdf/gui/widgets/list.py @@ -299,7 +299,7 @@ def open_menu(self, position): elif action.text() == "Set unit": selected_items = self.selectedItems() - unit, ok = QtWidgets.QInputDialog.getText(None, "Set new unit", "Unit:") + unit, ok = QtWidgets.QInputDialog.getText(self, "Set new unit", "Unit:") if ok: selected_items = self.selectedItems() @@ -313,7 +313,7 @@ def open_menu(self, position): elif action.text() == "Set precision": selected_items = self.selectedItems() - precision, ok = QtWidgets.QInputDialog.getInt(None, "Set new precision (float decimals)", "Precision:") + precision, ok = QtWidgets.QInputDialog.getInt(self, "Set new precision (float decimals)", "Precision:") if ok and 0 <= precision <= 15: for i in range(self.count()): @@ -378,7 +378,6 @@ def open_menu(self, position): class MinimalListWidget(QtWidgets.QListWidget): - itemsDeleted = QtCore.Signal(list) itemsDeleted = QtCore.Signal(list) itemsPasted = QtCore.Signal() diff --git a/src/asammdf/gui/widgets/mdi_area.py b/src/asammdf/gui/widgets/mdi_area.py index 321c0eba1..59c15c534 100644 --- a/src/asammdf/gui/widgets/mdi_area.py +++ b/src/asammdf/gui/widgets/mdi_area.py @@ -1221,7 +1221,7 @@ def _add_can_bus_trace_window(self, ranges=None): w.layout().setSpacing(1) def set_title(mdi): - name, ok = QtWidgets.QInputDialog.getText(None, "Set sub-plot title", "Title:") + name, ok = QtWidgets.QInputDialog.getText(self, "Set sub-plot title", "Title:") if ok and name: mdi.setWindowTitle(name) @@ -1443,7 +1443,7 @@ def _add_flexray_bus_trace_window(self, ranges=None): w.layout().setSpacing(1) def set_title(mdi): - name, ok = QtWidgets.QInputDialog.getText(None, "Set sub-plot title", "Title:") + name, ok = QtWidgets.QInputDialog.getText(self, "Set sub-plot title", "Title:") if ok and name: mdi.setWindowTitle(name) @@ -1494,7 +1494,7 @@ def _add_gps_window(self, signals): w.layout().setSpacing(1) def set_title(mdi): - name, ok = QtWidgets.QInputDialog.getText(None, "Set sub-plot title", "Title:") + name, ok = QtWidgets.QInputDialog.getText(self, "Set sub-plot title", "Title:") if ok and name: mdi.setWindowTitle(name) @@ -1759,7 +1759,7 @@ def _add_lin_bus_trace_window(self, ranges=None): w.layout().setSpacing(1) def set_title(mdi): - name, ok = QtWidgets.QInputDialog.getText(None, "Set sub-plot title", "Title:") + name, ok = QtWidgets.QInputDialog.getText(self, "Set sub-plot title", "Title:") if ok and name: mdi.setWindowTitle(name) diff --git a/src/asammdf/gui/widgets/range_widget.py b/src/asammdf/gui/widgets/range_widget.py index fb4029880..4abddeb0e 100644 --- a/src/asammdf/gui/widgets/range_widget.py +++ b/src/asammdf/gui/widgets/range_widget.py @@ -87,7 +87,7 @@ def value2_changed(self, text): def select_background_color(self, event=None): color = self.background_color_btn.palette().button().color() - color = QtWidgets.QColorDialog.getColor(color) + color = QtWidgets.QColorDialog.getColor(color, self) if color.isValid(): color = color.name() self.background_color = color @@ -96,7 +96,7 @@ def select_background_color(self, event=None): def select_font_color(self, event=None): color = self.font_color_btn.palette().button().color() - color = QtWidgets.QColorDialog.getColor(color) + color = QtWidgets.QColorDialog.getColor(color, self) if color.isValid(): color = color.name() self.font_color = color diff --git a/src/asammdf/gui/widgets/tree.py b/src/asammdf/gui/widgets/tree.py index 964afff44..02a1447c7 100644 --- a/src/asammdf/gui/widgets/tree.py +++ b/src/asammdf/gui/widgets/tree.py @@ -698,7 +698,7 @@ def keyPressEvent(self, event): else: color = QtGui.QColor("#ffffff") - color = QtWidgets.QColorDialog.getColor(color) + color = QtWidgets.QColorDialog.getColor(color, parent=self) if color.isValid(): for item in selected_items: if item.type() != item.Info: @@ -1225,7 +1225,7 @@ def open_menu(self): elif action_text == "Set unit": selected_items = self.selectedItems() - unit, ok = QtWidgets.QInputDialog.getText(None, "Set new unit", "Unit:") + unit, ok = QtWidgets.QInputDialog.getText(self, "Set new unit", "Unit:") if ok: for item in selected_items: