prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Changed exportDialog
  This pull request fixes #2367. The code has been changed as it was suggested in the issue.
  
  ![image](https://user-images.githubusercontent.com/79045568/198548982-d69eeda1-6868-4c29-9ce5-337f6b33352c.png)
  
  
  
  
  --- 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         if not self.shown:
  53             self.shown = True
  54             vcenter = self.scene.getViewWidget().geometry().center()
  55             x = max(0, int(vcenter.x() - self.width() / 2))
  56             y = max(0, int(vcenter.y() - self.height() / 2))
  57             self.move(x, y)
  58         
  59     def updateItemList(self, select=None):
  60         self.ui.itemTree.clear()
  61         si = QtWidgets.QTreeWidgetItem(["Entire Scene"])
  62         si.gitem = self.scene
  63         self.ui.itemTree.addTopLevelItem(si)
  64         self.ui.itemTree.setCurrentItem(si)
  65         si.setExpanded(True)
  66         for child in self.scene.items():
  67             if child.parentItem() is None:
  68                 self.updateItemTree(child, si, select=select)
  69                 
  70     def updateItemTree(self, item, treeItem, select=None):
  71         si = None
  72         if isinstance(item, ViewBox):
  73             si = QtWidgets.QTreeWidgetItem(['ViewBox'])
  74         elif isinstance(item, PlotItem):
  75             si = QtWidgets.QTreeWidgetItem(['Plot'])
  76             
  77         if si is not None:
  78             si.gitem = item
  79             treeItem.addChild(si)
  80             treeItem = si
  81             if si.gitem is select:
  82                 self.ui.itemTree.setCurrentItem(si)
  83             
  84         for ch in item.childItems():
  85             self.updateItemTree(ch, treeItem, select=select)
  86         
  87             
  88     def exportItemChanged(self, item, prev):
  89         if item is None:
  90             return
  91         if item.gitem is self.scene:
  92             newBounds = self.scene.views()[0].viewRect()
  93         else:
  94             newBounds = item.gitem.sceneBoundingRect()
  95         self.selectBox.setRect(newBounds)
  96         self.selectBox.show()
  97         self.updateFormatList()
  98         
  99     def updateFormatList(self):
  100         current = self.ui.formatList.currentItem()
  101 
  102         self.ui.formatList.clear()
  103         gotCurrent = False
  104         for exp in exporters.listExporters():
  105             item = FormatExportListWidgetItem(exp, QtCore.QCoreApplication.translate('Exporter', exp.Name))
  106             self.ui.formatList.addItem(item)
  107             if item is current:
  108                 self.ui.formatList.setCurrentRow(self.ui.formatList.count() - 1)
  109                 gotCurrent = True
  110                 
  111         if not gotCurrent:
  112             self.ui.formatList.setCurrentRow(0)
  113         
  114     def exportFormatChanged(self, item, prev):
  115         if item is None:
  116             self.currentExporter = None
  117             self.ui.paramTree.clear()
  118             return
  119         expClass = item.expClass
  120         exp = expClass(item=self.ui.itemTree.currentItem().gitem)
  121 
  122         params = exp.parameters()
  123 
  124         if params is None:
  125             self.ui.paramTree.clear()
  126         else:
  127             self.ui.paramTree.setParameters(params)
  128         self.currentExporter = exp
  129         self.ui.copyBtn.setEnabled(exp.allowCopy)
  130         
  131     def exportClicked(self):
  132         self.selectBox.hide()
  133         self.currentExporter.export()
  134         
  135     def copyClicked(self):
  136         self.selectBox.hide()
  137         self.currentExporter.export(copy=True)
  138         
  139     def close(self):
  140         self.selectBox.setVisible(False)
  141         self.setVisible(False)
  142 
  143     def closeEvent(self, event):
  144         self.close()
  145         super().closeEvent(event)
  146
  ```
  --- 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()
  
  ```
  
golden_diff: diff --git a/pyqtgraph/GraphicsScene/exportDialog.py b/pyqtgraph/GraphicsScene/exportDialog.py
  --- a/pyqtgraph/GraphicsScene/exportDialog.py
  +++ b/pyqtgraph/GraphicsScene/exportDialog.py
  @@ -51,10 +51,11 @@
           self.selectBox.setVisible(True)
           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)
  +            screen = QtWidgets.QApplication.desktop().screenNumber(QtWidgets.QApplication.desktop().cursor().pos())
  +            centre = QtWidgets.QDesktopWidget().availableGeometry(screen).center()
  +            frame = self.frameGeometry()
  +            frame.moveCenter(centre)
  +            self.move(frame.topLeft())
           
       def updateItemList(self, select=None):
           self.ui.itemTree.clear()
  
verification_info: {"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@@ -51,10 +51,11 @@\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+            screen = QtWidgets.QApplication.desktop().screenNumber(QtWidgets.QApplication.desktop().cursor().pos())\n+            centre = QtWidgets.QDesktopWidget().availableGeometry(screen).center()\n+            frame = self.frameGeometry()\n+            frame.moveCenter(centre)\n+            self.move(frame.topLeft())\n         \n     def updateItemList(self, select=None):\n         self.ui.itemTree.clear()\n", "issue": "Changed exportDialog\nThis pull request fixes #2367. The code has been changed as it was suggested in the issue.\r\n\r\n![image](https://user-images.githubusercontent.com/79045568/198548982-d69eeda1-6868-4c29-9ce5-337f6b33352c.png)\r\n\r\n\r\n\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        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 is 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"}], "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            screen = QtWidgets.QApplication.desktop().screenNumber(QtWidgets.QApplication.desktop().cursor().pos())\n            centre = QtWidgets.QDesktopWidget().availableGeometry(screen).center()\n            frame = self.frameGeometry()\n            frame.moveCenter(centre)\n            self.move(frame.topLeft())\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 is 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"}]}