MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / __init__

Method __init__

lib/matplotlib/backends/backend_qt.py:981–1023  ·  view source on GitHub ↗
(self, targetfig, parent)

Source from the content-addressed store, hash-verified

979
980class SubplotToolQt(QtWidgets.QDialog):
981 def __init__(self, targetfig, parent):
982 super().__init__(parent)
983 self.setWindowIcon(QtGui.QIcon(
984 str(cbook._get_data_path("images/matplotlib.png"))))
985 self.setObjectName("SubplotTool")
986 self._spinboxes = {}
987 main_layout = QtWidgets.QHBoxLayout()
988 self.setLayout(main_layout)
989 for group, spinboxes, buttons in [
990 ("Borders",
991 ["top", "bottom", "left", "right"],
992 [("Export values", self._export_values)]),
993 ("Spacings",
994 ["hspace", "wspace"],
995 [("Tight layout", self._tight_layout),
996 ("Reset", self._reset),
997 ("Close", self.close)])]:
998 layout = QtWidgets.QVBoxLayout()
999 main_layout.addLayout(layout)
1000 box = QtWidgets.QGroupBox(group)
1001 layout.addWidget(box)
1002 inner = QtWidgets.QFormLayout(box)
1003 for name in spinboxes:
1004 self._spinboxes[name] = spinbox = QtWidgets.QDoubleSpinBox()
1005 spinbox.setRange(0, 1)
1006 spinbox.setDecimals(3)
1007 spinbox.setSingleStep(0.005)
1008 spinbox.setKeyboardTracking(False)
1009 spinbox.valueChanged.connect(self._on_value_changed)
1010 inner.addRow(name, spinbox)
1011 layout.addStretch(1)
1012 for name, method in buttons:
1013 button = QtWidgets.QPushButton(name)
1014 # Don't trigger on <enter>, which is used to input values.
1015 button.setAutoDefault(False)
1016 button.clicked.connect(method)
1017 layout.addWidget(button)
1018 if name == "Close":
1019 button.setFocus()
1020 self._figure = targetfig
1021 self._defaults = {}
1022 self._export_values_dialog = None
1023 self.update_from_current_subplotpars()
1024
1025 def update_from_current_subplotpars(self):
1026 self._defaults = {spinbox: getattr(self._figure.subplotpars, name)

Callers

nothing calls this directly

Calls 3

__init__Method · 0.45
connectMethod · 0.45

Tested by

no test coverage detected