We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
ExportDialog Drawn Off Screen
Depending on the size of the scene the export dialog box can be drawn off or partially off screen. This is due to an implementation of the `show` command that allows moving the box to negative pixel indices.

Problem Code:
https://github.com/pyqtgraph/pyqtgraph/blob/a5f48ec5b58a10260195f1424309f7374a85ece7/pyqtgraph/GraphicsScene/exportDialog.py#L57-L62

To fix this, the position calculation can be clipped using `max`, and the `setGeometry` command can be changed to `move` to account for the size of the window's frame.

Potential Fix:
```python
        if not self.shown:
            self.shown = True
            vcenter = self.scene.getViewWidget().geometry().center()
            x = max(0, int(vcenter.x() - self.width() / 2))
            y = max(0, int(vcenter.y() - self.height() / 2))
            self.move(x, y)
```

I can't say I understand the motivation for moving the dialog box in the first place, but atleast with this modification the dialog box is always accessible with the mouse.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `pyqtgraph/GraphicsScene/exportDialog.py`
Content:
```
1 from .. import exporters as exporters
2 from .. import functions as fn
3 from ..graphicsItems.PlotItem import PlotItem
4 from ..graphicsItems.ViewBox import ViewBox
5 from ..Qt import QtCore, QtWidgets
6 
7 from . import exportDialogTemplate_generic as ui_template
8 
9 class FormatExportListWidgetItem(QtWidgets.QListWidgetItem):
10     def __init__(self, expClass, *args, **kwargs):
11         QtWidgets.QListWidgetItem.__init__(self, *args, **kwargs)
12         self.expClass = expClass
13 
14 
15 class ExportDialog(QtWidgets.QWidget):
16     def __init__(self, scene):
17         QtWidgets.QWidget.__init__(self)
18         self.setVisible(False)
19         self.setWindowTitle("Export")
20         self.shown = False
21         self.currentExporter = None
22         self.scene = scene
23 
24         self.selectBox = QtWidgets.QGraphicsRectItem()
25         self.selectBox.setPen(fn.mkPen('y', width=3, style=QtCore.Qt.PenStyle.DashLine))
26         self.selectBox.hide()
27         self.scene.addItem(self.selectBox)
28         
29         self.ui = ui_template.Ui_Form()
30         self.ui.setupUi(self)
31         
32         self.ui.closeBtn.clicked.connect(self.close)
33         self.ui.exportBtn.clicked.connect(self.exportClicked)
34         self.ui.copyBtn.clicked.connect(self.copyClicked)
35         self.ui.itemTree.currentItemChanged.connect(self.exportItemChanged)
36         self.ui.formatList.currentItemChanged.connect(self.exportFormatChanged)
37         
38 
39     def show(self, item=None):
40         if item is not None:
41             ## Select next exportable parent of the item originally clicked on
42             while not isinstance(item, ViewBox) and not isinstance(item, PlotItem) and item is not None:
43                 item = item.parentItem()
44             ## if this is a ViewBox inside a PlotItem, select the parent instead.
45             if isinstance(item, ViewBox) and isinstance(item.parentItem(), PlotItem):
46                 item = item.parentItem()
47             self.updateItemList(select=item)
48         self.setVisible(True)
49         self.activateWindow()
50         self.raise_()
51         self.selectBox.setVisible(True)
52         
53         if not self.shown:
54             self.shown = True
55             vcenter = self.scene.getViewWidget().geometry().center()
56             self.setGeometry(int(vcenter.x() - self.width() / 2),
57                              int(vcenter.y() - self.height() / 2),
58                              self.width(), self.height())
59         
60     def updateItemList(self, select=None):
61         self.ui.itemTree.clear()
62         si = QtWidgets.QTreeWidgetItem(["Entire Scene"])
63         si.gitem = self.scene
64         self.ui.itemTree.addTopLevelItem(si)
65         self.ui.itemTree.setCurrentItem(si)
66         si.setExpanded(True)
67         for child in self.scene.items():
68             if child.parentItem() is None:
69                 self.updateItemTree(child, si, select=select)
70                 
71     def updateItemTree(self, item, treeItem, select=None):
72         si = None
73         if isinstance(item, ViewBox):
74             si = QtWidgets.QTreeWidgetItem(['ViewBox'])
75         elif isinstance(item, PlotItem):
76             si = QtWidgets.QTreeWidgetItem(['Plot'])
77             
78         if si is not None:
79             si.gitem = item
80             treeItem.addChild(si)
81             treeItem = si
82             if si.gitem is select:
83                 self.ui.itemTree.setCurrentItem(si)
84             
85         for ch in item.childItems():
86             self.updateItemTree(ch, treeItem, select=select)
87         
88             
89     def exportItemChanged(self, item, prev):
90         if item is None:
91             return
92         if item.gitem is self.scene:
93             newBounds = self.scene.views()[0].viewRect()
94         else:
95             newBounds = item.gitem.sceneBoundingRect()
96         self.selectBox.setRect(newBounds)
97         self.selectBox.show()
98         self.updateFormatList()
99         
100     def updateFormatList(self):
101         current = self.ui.formatList.currentItem()
102 
103         self.ui.formatList.clear()
104         gotCurrent = False
105         for exp in exporters.listExporters():
106             item = FormatExportListWidgetItem(exp, QtCore.QCoreApplication.translate('Exporter', exp.Name))
107             self.ui.formatList.addItem(item)
108             if item == current:
109                 self.ui.formatList.setCurrentRow(self.ui.formatList.count() - 1)
110                 gotCurrent = True
111                 
112         if not gotCurrent:
113             self.ui.formatList.setCurrentRow(0)
114         
115     def exportFormatChanged(self, item, prev):
116         if item is None:
117             self.currentExporter = None
118             self.ui.paramTree.clear()
119             return
120         expClass = item.expClass
121         exp = expClass(item=self.ui.itemTree.currentItem().gitem)
122 
123         params = exp.parameters()
124 
125         if params is None:
126             self.ui.paramTree.clear()
127         else:
128             self.ui.paramTree.setParameters(params)
129         self.currentExporter = exp
130         self.ui.copyBtn.setEnabled(exp.allowCopy)
131         
132     def exportClicked(self):
133         self.selectBox.hide()
134         self.currentExporter.export()
135         
136     def copyClicked(self):
137         self.selectBox.hide()
138         self.currentExporter.export(copy=True)
139         
140     def close(self):
141         self.selectBox.setVisible(False)
142         self.setVisible(False)
143 
144     def closeEvent(self, event):
145         self.close()
146         super().closeEvent(event)
147
```

Path: `pyqtgraph/GraphicsScene/exportDialogTemplate_generic.py`
Content:
```
1 # Form implementation generated from reading ui file '../pyqtgraph/GraphicsScene/exportDialogTemplate.ui'
2 #
3 # Created by: PyQt6 UI code generator 6.1.0
4 #
5 # WARNING: Any manual changes made to this file will be lost when pyuic6 is
6 # run again.  Do not edit this file unless you know what you are doing.
7 
8 
9 from ..Qt import QtCore, QtGui, QtWidgets
10 
11 
12 class Ui_Form(object):
13     def setupUi(self, Form):
14         Form.setObjectName("Form")
15         Form.resize(241, 367)
16         self.gridLayout = QtWidgets.QGridLayout(Form)
17         self.gridLayout.setSpacing(0)
18         self.gridLayout.setObjectName("gridLayout")
19         self.label = QtWidgets.QLabel(Form)
20         self.label.setObjectName("label")
21         self.gridLayout.addWidget(self.label, 0, 0, 1, 3)
22         self.itemTree = QtWidgets.QTreeWidget(Form)
23         self.itemTree.setObjectName("itemTree")
24         self.itemTree.headerItem().setText(0, "1")
25         self.itemTree.header().setVisible(False)
26         self.gridLayout.addWidget(self.itemTree, 1, 0, 1, 3)
27         self.label_2 = QtWidgets.QLabel(Form)
28         self.label_2.setObjectName("label_2")
29         self.gridLayout.addWidget(self.label_2, 2, 0, 1, 3)
30         self.formatList = QtWidgets.QListWidget(Form)
31         self.formatList.setObjectName("formatList")
32         self.gridLayout.addWidget(self.formatList, 3, 0, 1, 3)
33         self.exportBtn = QtWidgets.QPushButton(Form)
34         self.exportBtn.setObjectName("exportBtn")
35         self.gridLayout.addWidget(self.exportBtn, 6, 1, 1, 1)
36         self.closeBtn = QtWidgets.QPushButton(Form)
37         self.closeBtn.setObjectName("closeBtn")
38         self.gridLayout.addWidget(self.closeBtn, 6, 2, 1, 1)
39         self.paramTree = ParameterTree(Form)
40         self.paramTree.setColumnCount(2)
41         self.paramTree.setObjectName("paramTree")
42         self.paramTree.headerItem().setText(0, "1")
43         self.paramTree.header().setVisible(False)
44         self.gridLayout.addWidget(self.paramTree, 5, 0, 1, 3)
45         self.label_3 = QtWidgets.QLabel(Form)
46         self.label_3.setObjectName("label_3")
47         self.gridLayout.addWidget(self.label_3, 4, 0, 1, 3)
48         self.copyBtn = QtWidgets.QPushButton(Form)
49         self.copyBtn.setObjectName("copyBtn")
50         self.gridLayout.addWidget(self.copyBtn, 6, 0, 1, 1)
51 
52         self.retranslateUi(Form)
53         QtCore.QMetaObject.connectSlotsByName(Form)
54 
55     def retranslateUi(self, Form):
56         _translate = QtCore.QCoreApplication.translate
57         Form.setWindowTitle(_translate("Form", "Export"))
58         self.label.setText(_translate("Form", "Item to export:"))
59         self.label_2.setText(_translate("Form", "Export format"))
60         self.exportBtn.setText(_translate("Form", "Export"))
61         self.closeBtn.setText(_translate("Form", "Close"))
62         self.label_3.setText(_translate("Form", "Export options"))
63         self.copyBtn.setText(_translate("Form", "Copy"))
64 from ..parametertree import ParameterTree
65
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/pyqtgraph/GraphicsScene/exportDialog.py b/pyqtgraph/GraphicsScene/exportDialog.py
--- a/pyqtgraph/GraphicsScene/exportDialog.py
+++ b/pyqtgraph/GraphicsScene/exportDialog.py
@@ -49,13 +49,12 @@
         self.activateWindow()
         self.raise_()
         self.selectBox.setVisible(True)
-        
         if not self.shown:
             self.shown = True
             vcenter = self.scene.getViewWidget().geometry().center()
-            self.setGeometry(int(vcenter.x() - self.width() / 2),
-                             int(vcenter.y() - self.height() / 2),
-                             self.width(), self.height())
+            x = max(0, int(vcenter.x() - self.width() / 2))
+            y = max(0, int(vcenter.y() - self.height() / 2))
+            self.move(x, y)
         
     def updateItemList(self, select=None):
         self.ui.itemTree.clear()
diff --git a/pyqtgraph/GraphicsScene/exportDialogTemplate_generic.py b/pyqtgraph/GraphicsScene/exportDialogTemplate_generic.py
--- a/pyqtgraph/GraphicsScene/exportDialogTemplate_generic.py
+++ b/pyqtgraph/GraphicsScene/exportDialogTemplate_generic.py
@@ -5,7 +5,6 @@
 # WARNING: Any manual changes made to this file will be lost when pyuic6 is
 # run again.  Do not edit this file unless you know what you are doing.
 
-
 from ..Qt import QtCore, QtGui, QtWidgets

{"golden_diff": "diff --git a/pyqtgraph/GraphicsScene/exportDialog.py b/pyqtgraph/GraphicsScene/exportDialog.py\n--- a/pyqtgraph/GraphicsScene/exportDialog.py\n+++ b/pyqtgraph/GraphicsScene/exportDialog.py\n@@ -49,13 +49,12 @@\n         self.activateWindow()\n         self.raise_()\n         self.selectBox.setVisible(True)\n-        \n         if not self.shown:\n             self.shown = True\n             vcenter = self.scene.getViewWidget().geometry().center()\n-            self.setGeometry(int(vcenter.x() - self.width() / 2),\n-                             int(vcenter.y() - self.height() / 2),\n-                             self.width(), self.height())\n+            x = max(0, int(vcenter.x() - self.width() / 2))\n+            y = max(0, int(vcenter.y() - self.height() / 2))\n+            self.move(x, y)\n         \n     def updateItemList(self, select=None):\n         self.ui.itemTree.clear()\ndiff --git a/pyqtgraph/GraphicsScene/exportDialogTemplate_generic.py b/pyqtgraph/GraphicsScene/exportDialogTemplate_generic.py\n--- a/pyqtgraph/GraphicsScene/exportDialogTemplate_generic.py\n+++ b/pyqtgraph/GraphicsScene/exportDialogTemplate_generic.py\n@@ -5,7 +5,6 @@\n # WARNING: Any manual changes made to this file will be lost when pyuic6 is\n # run again.  Do not edit this file unless you know what you are doing.\n \n-\n from ..Qt import QtCore, QtGui, QtWidgets\n", "issue": "ExportDialog Drawn Off Screen\nDepending on the size of the scene the export dialog box can be drawn off or partially off screen. This is due to an implementation of the `show` command that allows moving the box to negative pixel indices.\r\n\r\nProblem Code:\r\nhttps://github.com/pyqtgraph/pyqtgraph/blob/a5f48ec5b58a10260195f1424309f7374a85ece7/pyqtgraph/GraphicsScene/exportDialog.py#L57-L62\r\n\r\nTo fix this, the position calculation can be clipped using `max`, and the `setGeometry` command can be changed to `move` to account for the size of the window's frame.\r\n\r\nPotential Fix:\r\n```python\r\n        if not self.shown:\r\n            self.shown = True\r\n            vcenter = self.scene.getViewWidget().geometry().center()\r\n            x = max(0, int(vcenter.x() - self.width() / 2))\r\n            y = max(0, int(vcenter.y() - self.height() / 2))\r\n            self.move(x, y)\r\n```\r\n\r\nI can't say I understand the motivation for moving the dialog box in the first place, but atleast with this modification the dialog box is always accessible with the mouse.\n", "before_files": [{"content": "from .. import exporters as exporters\nfrom .. import functions as fn\nfrom ..graphicsItems.PlotItem import PlotItem\nfrom ..graphicsItems.ViewBox import ViewBox\nfrom ..Qt import QtCore, QtWidgets\n\nfrom . import exportDialogTemplate_generic as ui_template\n\nclass FormatExportListWidgetItem(QtWidgets.QListWidgetItem):\n    def __init__(self, expClass, *args, **kwargs):\n        QtWidgets.QListWidgetItem.__init__(self, *args, **kwargs)\n        self.expClass = expClass\n\n\nclass ExportDialog(QtWidgets.QWidget):\n    def __init__(self, scene):\n        QtWidgets.QWidget.__init__(self)\n        self.setVisible(False)\n        self.setWindowTitle(\"Export\")\n        self.shown = False\n        self.currentExporter = None\n        self.scene = scene\n\n        self.selectBox = QtWidgets.QGraphicsRectItem()\n        self.selectBox.setPen(fn.mkPen('y', width=3, style=QtCore.Qt.PenStyle.DashLine))\n        self.selectBox.hide()\n        self.scene.addItem(self.selectBox)\n        \n        self.ui = ui_template.Ui_Form()\n        self.ui.setupUi(self)\n        \n        self.ui.closeBtn.clicked.connect(self.close)\n        self.ui.exportBtn.clicked.connect(self.exportClicked)\n        self.ui.copyBtn.clicked.connect(self.copyClicked)\n        self.ui.itemTree.currentItemChanged.connect(self.exportItemChanged)\n        self.ui.formatList.currentItemChanged.connect(self.exportFormatChanged)\n        \n\n    def show(self, item=None):\n        if item is not None:\n            ## Select next exportable parent of the item originally clicked on\n            while not isinstance(item, ViewBox) and not isinstance(item, PlotItem) and item is not None:\n                item = item.parentItem()\n            ## if this is a ViewBox inside a PlotItem, select the parent instead.\n            if isinstance(item, ViewBox) and isinstance(item.parentItem(), PlotItem):\n                item = item.parentItem()\n            self.updateItemList(select=item)\n        self.setVisible(True)\n        self.activateWindow()\n        self.raise_()\n        self.selectBox.setVisible(True)\n        \n        if not self.shown:\n            self.shown = True\n            vcenter = self.scene.getViewWidget().geometry().center()\n            self.setGeometry(int(vcenter.x() - self.width() / 2),\n                             int(vcenter.y() - self.height() / 2),\n                             self.width(), self.height())\n        \n    def updateItemList(self, select=None):\n        self.ui.itemTree.clear()\n        si = QtWidgets.QTreeWidgetItem([\"Entire Scene\"])\n        si.gitem = self.scene\n        self.ui.itemTree.addTopLevelItem(si)\n        self.ui.itemTree.setCurrentItem(si)\n        si.setExpanded(True)\n        for child in self.scene.items():\n            if child.parentItem() is None:\n                self.updateItemTree(child, si, select=select)\n                \n    def updateItemTree(self, item, treeItem, select=None):\n        si = None\n        if isinstance(item, ViewBox):\n            si = QtWidgets.QTreeWidgetItem(['ViewBox'])\n        elif isinstance(item, PlotItem):\n            si = QtWidgets.QTreeWidgetItem(['Plot'])\n            \n        if si is not None:\n            si.gitem = item\n            treeItem.addChild(si)\n            treeItem = si\n            if si.gitem is select:\n                self.ui.itemTree.setCurrentItem(si)\n            \n        for ch in item.childItems():\n            self.updateItemTree(ch, treeItem, select=select)\n        \n            \n    def exportItemChanged(self, item, prev):\n        if item is None:\n            return\n        if item.gitem is self.scene:\n            newBounds = self.scene.views()[0].viewRect()\n        else:\n            newBounds = item.gitem.sceneBoundingRect()\n        self.selectBox.setRect(newBounds)\n        self.selectBox.show()\n        self.updateFormatList()\n        \n    def updateFormatList(self):\n        current = self.ui.formatList.currentItem()\n\n        self.ui.formatList.clear()\n        gotCurrent = False\n        for exp in exporters.listExporters():\n            item = FormatExportListWidgetItem(exp, QtCore.QCoreApplication.translate('Exporter', exp.Name))\n            self.ui.formatList.addItem(item)\n            if item == current:\n                self.ui.formatList.setCurrentRow(self.ui.formatList.count() - 1)\n                gotCurrent = True\n                \n        if not gotCurrent:\n            self.ui.formatList.setCurrentRow(0)\n        \n    def exportFormatChanged(self, item, prev):\n        if item is None:\n            self.currentExporter = None\n            self.ui.paramTree.clear()\n            return\n        expClass = item.expClass\n        exp = expClass(item=self.ui.itemTree.currentItem().gitem)\n\n        params = exp.parameters()\n\n        if params is None:\n            self.ui.paramTree.clear()\n        else:\n            self.ui.paramTree.setParameters(params)\n        self.currentExporter = exp\n        self.ui.copyBtn.setEnabled(exp.allowCopy)\n        \n    def exportClicked(self):\n        self.selectBox.hide()\n        self.currentExporter.export()\n        \n    def copyClicked(self):\n        self.selectBox.hide()\n        self.currentExporter.export(copy=True)\n        \n    def close(self):\n        self.selectBox.setVisible(False)\n        self.setVisible(False)\n\n    def closeEvent(self, event):\n        self.close()\n        super().closeEvent(event)\n", "path": "pyqtgraph/GraphicsScene/exportDialog.py"}, {"content": "# Form implementation generated from reading ui file '../pyqtgraph/GraphicsScene/exportDialogTemplate.ui'\n#\n# Created by: PyQt6 UI code generator 6.1.0\n#\n# WARNING: Any manual changes made to this file will be lost when pyuic6 is\n# run again.  Do not edit this file unless you know what you are doing.\n\n\nfrom ..Qt import QtCore, QtGui, QtWidgets\n\n\nclass Ui_Form(object):\n    def setupUi(self, Form):\n        Form.setObjectName(\"Form\")\n        Form.resize(241, 367)\n        self.gridLayout = QtWidgets.QGridLayout(Form)\n        self.gridLayout.setSpacing(0)\n        self.gridLayout.setObjectName(\"gridLayout\")\n        self.label = QtWidgets.QLabel(Form)\n        self.label.setObjectName(\"label\")\n        self.gridLayout.addWidget(self.label, 0, 0, 1, 3)\n        self.itemTree = QtWidgets.QTreeWidget(Form)\n        self.itemTree.setObjectName(\"itemTree\")\n        self.itemTree.headerItem().setText(0, \"1\")\n        self.itemTree.header().setVisible(False)\n        self.gridLayout.addWidget(self.itemTree, 1, 0, 1, 3)\n        self.label_2 = QtWidgets.QLabel(Form)\n        self.label_2.setObjectName(\"label_2\")\n        self.gridLayout.addWidget(self.label_2, 2, 0, 1, 3)\n        self.formatList = QtWidgets.QListWidget(Form)\n        self.formatList.setObjectName(\"formatList\")\n        self.gridLayout.addWidget(self.formatList, 3, 0, 1, 3)\n        self.exportBtn = QtWidgets.QPushButton(Form)\n        self.exportBtn.setObjectName(\"exportBtn\")\n        self.gridLayout.addWidget(self.exportBtn, 6, 1, 1, 1)\n        self.closeBtn = QtWidgets.QPushButton(Form)\n        self.closeBtn.setObjectName(\"closeBtn\")\n        self.gridLayout.addWidget(self.closeBtn, 6, 2, 1, 1)\n        self.paramTree = ParameterTree(Form)\n        self.paramTree.setColumnCount(2)\n        self.paramTree.setObjectName(\"paramTree\")\n        self.paramTree.headerItem().setText(0, \"1\")\n        self.paramTree.header().setVisible(False)\n        self.gridLayout.addWidget(self.paramTree, 5, 0, 1, 3)\n        self.label_3 = QtWidgets.QLabel(Form)\n        self.label_3.setObjectName(\"label_3\")\n        self.gridLayout.addWidget(self.label_3, 4, 0, 1, 3)\n        self.copyBtn = QtWidgets.QPushButton(Form)\n        self.copyBtn.setObjectName(\"copyBtn\")\n        self.gridLayout.addWidget(self.copyBtn, 6, 0, 1, 1)\n\n        self.retranslateUi(Form)\n        QtCore.QMetaObject.connectSlotsByName(Form)\n\n    def retranslateUi(self, Form):\n        _translate = QtCore.QCoreApplication.translate\n        Form.setWindowTitle(_translate(\"Form\", \"Export\"))\n        self.label.setText(_translate(\"Form\", \"Item to export:\"))\n        self.label_2.setText(_translate(\"Form\", \"Export format\"))\n        self.exportBtn.setText(_translate(\"Form\", \"Export\"))\n        self.closeBtn.setText(_translate(\"Form\", \"Close\"))\n        self.label_3.setText(_translate(\"Form\", \"Export options\"))\n        self.copyBtn.setText(_translate(\"Form\", \"Copy\"))\nfrom ..parametertree import ParameterTree\n", "path": "pyqtgraph/GraphicsScene/exportDialogTemplate_generic.py"}], "after_files": [{"content": "from .. import exporters as exporters\nfrom .. import functions as fn\nfrom ..graphicsItems.PlotItem import PlotItem\nfrom ..graphicsItems.ViewBox import ViewBox\nfrom ..Qt import QtCore, QtWidgets\n\nfrom . import exportDialogTemplate_generic as ui_template\n\nclass FormatExportListWidgetItem(QtWidgets.QListWidgetItem):\n    def __init__(self, expClass, *args, **kwargs):\n        QtWidgets.QListWidgetItem.__init__(self, *args, **kwargs)\n        self.expClass = expClass\n\n\nclass ExportDialog(QtWidgets.QWidget):\n    def __init__(self, scene):\n        QtWidgets.QWidget.__init__(self)\n        self.setVisible(False)\n        self.setWindowTitle(\"Export\")\n        self.shown = False\n        self.currentExporter = None\n        self.scene = scene\n\n        self.selectBox = QtWidgets.QGraphicsRectItem()\n        self.selectBox.setPen(fn.mkPen('y', width=3, style=QtCore.Qt.PenStyle.DashLine))\n        self.selectBox.hide()\n        self.scene.addItem(self.selectBox)\n        \n        self.ui = ui_template.Ui_Form()\n        self.ui.setupUi(self)\n        \n        self.ui.closeBtn.clicked.connect(self.close)\n        self.ui.exportBtn.clicked.connect(self.exportClicked)\n        self.ui.copyBtn.clicked.connect(self.copyClicked)\n        self.ui.itemTree.currentItemChanged.connect(self.exportItemChanged)\n        self.ui.formatList.currentItemChanged.connect(self.exportFormatChanged)\n        \n\n    def show(self, item=None):\n        if item is not None:\n            ## Select next exportable parent of the item originally clicked on\n            while not isinstance(item, ViewBox) and not isinstance(item, PlotItem) and item is not None:\n                item = item.parentItem()\n            ## if this is a ViewBox inside a PlotItem, select the parent instead.\n            if isinstance(item, ViewBox) and isinstance(item.parentItem(), PlotItem):\n                item = item.parentItem()\n            self.updateItemList(select=item)\n        self.setVisible(True)\n        self.activateWindow()\n        self.raise_()\n        self.selectBox.setVisible(True)\n        if not self.shown:\n            self.shown = True\n            vcenter = self.scene.getViewWidget().geometry().center()\n            x = max(0, int(vcenter.x() - self.width() / 2))\n            y = max(0, int(vcenter.y() - self.height() / 2))\n            self.move(x, y)\n        \n    def updateItemList(self, select=None):\n        self.ui.itemTree.clear()\n        si = QtWidgets.QTreeWidgetItem([\"Entire Scene\"])\n        si.gitem = self.scene\n        self.ui.itemTree.addTopLevelItem(si)\n        self.ui.itemTree.setCurrentItem(si)\n        si.setExpanded(True)\n        for child in self.scene.items():\n            if child.parentItem() is None:\n                self.updateItemTree(child, si, select=select)\n                \n    def updateItemTree(self, item, treeItem, select=None):\n        si = None\n        if isinstance(item, ViewBox):\n            si = QtWidgets.QTreeWidgetItem(['ViewBox'])\n        elif isinstance(item, PlotItem):\n            si = QtWidgets.QTreeWidgetItem(['Plot'])\n            \n        if si is not None:\n            si.gitem = item\n            treeItem.addChild(si)\n            treeItem = si\n            if si.gitem is select:\n                self.ui.itemTree.setCurrentItem(si)\n            \n        for ch in item.childItems():\n            self.updateItemTree(ch, treeItem, select=select)\n        \n            \n    def exportItemChanged(self, item, prev):\n        if item is None:\n            return\n        if item.gitem is self.scene:\n            newBounds = self.scene.views()[0].viewRect()\n        else:\n            newBounds = item.gitem.sceneBoundingRect()\n        self.selectBox.setRect(newBounds)\n        self.selectBox.show()\n        self.updateFormatList()\n        \n    def updateFormatList(self):\n        current = self.ui.formatList.currentItem()\n\n        self.ui.formatList.clear()\n        gotCurrent = False\n        for exp in exporters.listExporters():\n            item = FormatExportListWidgetItem(exp, QtCore.QCoreApplication.translate('Exporter', exp.Name))\n            self.ui.formatList.addItem(item)\n            if item == current:\n                self.ui.formatList.setCurrentRow(self.ui.formatList.count() - 1)\n                gotCurrent = True\n                \n        if not gotCurrent:\n            self.ui.formatList.setCurrentRow(0)\n        \n    def exportFormatChanged(self, item, prev):\n        if item is None:\n            self.currentExporter = None\n            self.ui.paramTree.clear()\n            return\n        expClass = item.expClass\n        exp = expClass(item=self.ui.itemTree.currentItem().gitem)\n\n        params = exp.parameters()\n\n        if params is None:\n            self.ui.paramTree.clear()\n        else:\n            self.ui.paramTree.setParameters(params)\n        self.currentExporter = exp\n        self.ui.copyBtn.setEnabled(exp.allowCopy)\n        \n    def exportClicked(self):\n        self.selectBox.hide()\n        self.currentExporter.export()\n        \n    def copyClicked(self):\n        self.selectBox.hide()\n        self.currentExporter.export(copy=True)\n        \n    def close(self):\n        self.selectBox.setVisible(False)\n        self.setVisible(False)\n\n    def closeEvent(self, event):\n        self.close()\n        super().closeEvent(event)\n", "path": "pyqtgraph/GraphicsScene/exportDialog.py"}, {"content": "# Form implementation generated from reading ui file '../pyqtgraph/GraphicsScene/exportDialogTemplate.ui'\n#\n# Created by: PyQt6 UI code generator 6.1.0\n#\n# WARNING: Any manual changes made to this file will be lost when pyuic6 is\n# run again.  Do not edit this file unless you know what you are doing.\n\nfrom ..Qt import QtCore, QtGui, QtWidgets\n\n\nclass Ui_Form(object):\n    def setupUi(self, Form):\n        Form.setObjectName(\"Form\")\n        Form.resize(241, 367)\n        self.gridLayout = QtWidgets.QGridLayout(Form)\n        self.gridLayout.setSpacing(0)\n        self.gridLayout.setObjectName(\"gridLayout\")\n        self.label = QtWidgets.QLabel(Form)\n        self.label.setObjectName(\"label\")\n        self.gridLayout.addWidget(self.label, 0, 0, 1, 3)\n        self.itemTree = QtWidgets.QTreeWidget(Form)\n        self.itemTree.setObjectName(\"itemTree\")\n        self.itemTree.headerItem().setText(0, \"1\")\n        self.itemTree.header().setVisible(False)\n        self.gridLayout.addWidget(self.itemTree, 1, 0, 1, 3)\n        self.label_2 = QtWidgets.QLabel(Form)\n        self.label_2.setObjectName(\"label_2\")\n        self.gridLayout.addWidget(self.label_2, 2, 0, 1, 3)\n        self.formatList = QtWidgets.QListWidget(Form)\n        self.formatList.setObjectName(\"formatList\")\n        self.gridLayout.addWidget(self.formatList, 3, 0, 1, 3)\n        self.exportBtn = QtWidgets.QPushButton(Form)\n        self.exportBtn.setObjectName(\"exportBtn\")\n        self.gridLayout.addWidget(self.exportBtn, 6, 1, 1, 1)\n        self.closeBtn = QtWidgets.QPushButton(Form)\n        self.closeBtn.setObjectName(\"closeBtn\")\n        self.gridLayout.addWidget(self.closeBtn, 6, 2, 1, 1)\n        self.paramTree = ParameterTree(Form)\n        self.paramTree.setColumnCount(2)\n        self.paramTree.setObjectName(\"paramTree\")\n        self.paramTree.headerItem().setText(0, \"1\")\n        self.paramTree.header().setVisible(False)\n        self.gridLayout.addWidget(self.paramTree, 5, 0, 1, 3)\n        self.label_3 = QtWidgets.QLabel(Form)\n        self.label_3.setObjectName(\"label_3\")\n        self.gridLayout.addWidget(self.label_3, 4, 0, 1, 3)\n        self.copyBtn = QtWidgets.QPushButton(Form)\n        self.copyBtn.setObjectName(\"copyBtn\")\n        self.gridLayout.addWidget(self.copyBtn, 6, 0, 1, 1)\n\n        self.retranslateUi(Form)\n        QtCore.QMetaObject.connectSlotsByName(Form)\n\n    def retranslateUi(self, Form):\n        _translate = QtCore.QCoreApplication.translate\n        Form.setWindowTitle(_translate(\"Form\", \"Export\"))\n        self.label.setText(_translate(\"Form\", \"Item to export:\"))\n        self.label_2.setText(_translate(\"Form\", \"Export format\"))\n        self.exportBtn.setText(_translate(\"Form\", \"Export\"))\n        self.closeBtn.setText(_translate(\"Form\", \"Close\"))\n        self.label_3.setText(_translate(\"Form\", \"Export options\"))\n        self.copyBtn.setText(_translate(\"Form\", \"Copy\"))\nfrom ..parametertree import ParameterTree\n", "path": "pyqtgraph/GraphicsScene/exportDialogTemplate_generic.py"}]}