We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Python 3.10: ManagedWindow TypeError
Hi all,
I am trying to use pymeasure for the first time. But when running the example "ManagedWindow" I get the following error message as soon as I press the "queue" button in the GUI and nothing will be plotted. 

```
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
C:\Program Files\Python 3.10\lib\site-packages\pymeasure\display\manager.py in _update_progress(self, progress)
    158     def _update_progress(self, progress):
    159         if self.is_running():
--> 160             self._running_experiment.browser_item.setProgress(progress)
    161 
    162     def _update_status(self, status):

C:\Program Files\Python 3.10\lib\site-packages\pymeasure\display\browser.py in setProgress(self, progress)
     73 
     74     def setProgress(self, progress):
---> 75         self.progressbar.setValue(progress)
     76 
     77 class Browser(QtGui.QTreeWidget):

TypeError: setValue(self, int): argument 1 has unexpected type 'float'---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
C:\Program Files\Python 3.10\lib\site-packages\pymeasure\display\manager.py in _finish(self)
    253         experiment = self._running_experiment
    254         self._clean_up()
--> 255         experiment.browser_item.setProgress(100.)
    256         experiment.curve.update()
    257         self.finished.emit(experiment)

C:\Program Files\Python 3.10\lib\site-packages\pymeasure\display\browser.py in setProgress(self, progress)
     73 
     74     def setProgress(self, progress):
---> 75         self.progressbar.setValue(progress)
     76 
     77 class Browser(QtGui.QTreeWidget):

TypeError: setValue(self, int): argument 1 has unexpected type 'float'An exception has occurred, use %tb to see the full traceback.
```

I'm using Windows and Python 3.10.

Do you have an idea what is wrong? Probably something with the data type of progress. But what should I change? 
Thanks for your help.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `pymeasure/display/browser.py`
Content:
```
1 #
2 # This file is part of the PyMeasure package.
3 #
4 # Copyright (c) 2013-2021 PyMeasure Developers
5 #
6 # Permission is hereby granted, free of charge, to any person obtaining a copy
7 # of this software and associated documentation files (the "Software"), to deal
8 # in the Software without restriction, including without limitation the rights
9 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 # copies of the Software, and to permit persons to whom the Software is
11 # furnished to do so, subject to the following conditions:
12 #
13 # The above copyright notice and this permission notice shall be included in
14 # all copies or substantial portions of the Software.
15 #
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 # THE SOFTWARE.
23 #
24 
25 import logging
26 
27 from os.path import basename
28 
29 from .Qt import QtCore, QtGui
30 from ..experiment import Procedure
31 
32 log = logging.getLogger(__name__)
33 log.addHandler(logging.NullHandler())
34 
35 
36 class BrowserItem(QtGui.QTreeWidgetItem):
37     """ Represent a row in the :class:`~pymeasure.display.browser.Browser` tree widget """
38 
39     def __init__(self, results, color, parent=None):
40         super().__init__(parent)
41 
42         pixelmap = QtGui.QPixmap(24, 24)
43         pixelmap.fill(color)
44         self.setIcon(0, QtGui.QIcon(pixelmap))
45         self.setFlags(self.flags() | QtCore.Qt.ItemIsUserCheckable)
46         self.setCheckState(0, QtCore.Qt.Checked)
47         self.setText(1, basename(results.data_filename))
48 
49         self.setStatus(results.procedure.status)
50 
51         self.progressbar = QtGui.QProgressBar()
52         self.progressbar.setRange(0, 100)
53         self.progressbar.setValue(0)
54 
55     def setStatus(self, status):
56         status_label = {
57             Procedure.QUEUED: 'Queued', Procedure.RUNNING: 'Running',
58             Procedure.FAILED: 'Failed', Procedure.ABORTED: 'Aborted',
59             Procedure.FINISHED: 'Finished'}
60         self.setText(3, status_label[status])
61 
62         if status == Procedure.FAILED or status == Procedure.ABORTED:
63             # Set progress bar color to red
64             return  # Commented this out
65             self.progressbar.setStyleSheet("""
66             QProgressBar {
67                 border: 1px solid #AAAAAA;
68                 border-radius: 5px;
69                 text-align: center;
70             }
71             QProgressBar::chunk {
72                 background-color: red;
73             }
74             """)
75 
76     def setProgress(self, progress):
77         self.progressbar.setValue(progress)
78 
79 
80 class Browser(QtGui.QTreeWidget):
81     """Graphical list view of :class:`Experiment<pymeasure.display.manager.Experiment>`
82     objects allowing the user to view the status of queued Experiments as well as
83     loading and displaying data from previous runs.
84 
85     In order that different Experiments be displayed within the same Browser,
86     they must have entries in `DATA_COLUMNS` corresponding to the
87     `measured_quantities` of the Browser.
88     """
89 
90     def __init__(self, procedure_class, display_parameters,
91                  measured_quantities, sort_by_filename=False, parent=None):
92         super().__init__(parent)
93         self.display_parameters = display_parameters
94         self.procedure_class = procedure_class
95         self.measured_quantities = measured_quantities
96 
97         header_labels = ["Graph", "Filename", "Progress", "Status"]
98         for parameter in self.display_parameters:
99             header_labels.append(getattr(self.procedure_class, parameter).name)
100 
101         self.setColumnCount(len(header_labels))
102         self.setHeaderLabels(header_labels)
103         self.setSortingEnabled(True)
104         if sort_by_filename:
105             self.sortItems(1, QtCore.Qt.AscendingOrder)
106 
107         for i, width in enumerate([80, 140]):
108             self.header().resizeSection(i, width)
109 
110     def add(self, experiment):
111         """Add a :class:`Experiment<pymeasure.display.manager.Experiment>` object
112         to the Browser. This function checks to make sure that the Experiment
113         measures the appropriate quantities to warrant its inclusion, and then
114         adds a BrowserItem to the Browser, filling all relevant columns with
115         Parameter data.
116         """
117         experiment_parameters = experiment.procedure.parameter_objects()
118         experiment_parameter_names = list(experiment_parameters.keys())
119 
120         for measured_quantity in self.measured_quantities:
121             if measured_quantity not in experiment.procedure.DATA_COLUMNS:
122                 raise Exception("Procedure does not measure the"
123                                 " %s quantity." % measured_quantity)
124 
125         # Set the relevant fields within the BrowserItem if
126         # that Parameter is implemented
127         item = experiment.browser_item
128         for i, column in enumerate(self.display_parameters):
129             if column in experiment_parameter_names:
130                 item.setText(i + 4, str(experiment_parameters[column]))
131 
132         self.addTopLevelItem(item)
133         self.setItemWidget(item, 2, item.progressbar)
134         return item
135
```

Path: `setup.py`
Content:
```
1 #
2 # This file is part of the PyMeasure package.
3 #
4 # Copyright (c) 2013-2021 PyMeasure Developers
5 #
6 # Permission is hereby granted, free of charge, to any person obtaining a copy
7 # of this software and associated documentation files (the "Software"), to deal
8 # in the Software without restriction, including without limitation the rights
9 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 # copies of the Software, and to permit persons to whom the Software is
11 # furnished to do so, subject to the following conditions:
12 #
13 # The above copyright notice and this permission notice shall be included in
14 # all copies or substantial portions of the Software.
15 #
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 # THE SOFTWARE.
23 #
24 
25 
26 from setuptools import setup, find_packages
27 
28 setup(
29     name='PyMeasure',
30     version='0.9.0',
31     author='PyMeasure Developers',
32     packages=find_packages(),
33     scripts=[],
34     url='https://github.com/pymeasure/pymeasure',
35     download_url='https://github.com/pymeasure/pymeasure/tarball/v0.9.0',
36     license='MIT License',
37     description='Scientific measurement library for instruments, experiments, and live-plotting',
38     long_description=open('README.rst').read() + "\n\n" + open('CHANGES.txt').read(),
39     install_requires=[
40         "numpy >= 1.6.1",
41         "pandas >= 0.14",
42         "pyvisa >= 1.8",
43         "pyserial >= 2.7",
44         "pyqtgraph >= 0.9.10"
45     ],
46     extras_require={
47         'matplotlib': ['matplotlib >= 2.0.2'],
48         'tcp': [
49             'pyzmq >= 16.0.2',
50             'cloudpickle >= 0.3.1'
51         ],
52         'python-vxi11': ['python-vxi11 >= 0.9']
53     },
54     setup_requires=[
55         'pytest-runner'
56     ],
57     tests_require=[
58         'pytest >= 2.9.1',
59         'pytest-qt >= 2.4.0',
60         'pyvisa-sim >= 0.4.0',
61     ],
62     classifiers=[
63         "Development Status :: 4 - Beta",
64         "Intended Audience :: Science/Research",
65         "License :: OSI Approved :: MIT License",
66         "Operating System :: MacOS",
67         "Operating System :: Microsoft :: Windows",
68         "Operating System :: POSIX",
69         "Operating System :: Unix",
70         "Programming Language :: Python :: 3 :: Only",
71         "Programming Language :: Python :: 3.7",
72         "Programming Language :: Python :: 3.8",
73         "Programming Language :: Python :: 3.9",
74         "Topic :: Scientific/Engineering",
75     ],
76     keywords="measure instrument experiment control automate graph plot"
77 )
78
```
--- 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/pymeasure/display/browser.py b/pymeasure/display/browser.py
--- a/pymeasure/display/browser.py
+++ b/pymeasure/display/browser.py
@@ -74,7 +74,7 @@
             """)
 
     def setProgress(self, progress):
-        self.progressbar.setValue(progress)
+        self.progressbar.setValue(int(progress))
 
 
 class Browser(QtGui.QTreeWidget):
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -71,6 +71,7 @@
         "Programming Language :: Python :: 3.7",
         "Programming Language :: Python :: 3.8",
         "Programming Language :: Python :: 3.9",
+        "Programming Language :: Python :: 3.10",
         "Topic :: Scientific/Engineering",
     ],
     keywords="measure instrument experiment control automate graph plot"

{"golden_diff": "diff --git a/pymeasure/display/browser.py b/pymeasure/display/browser.py\n--- a/pymeasure/display/browser.py\n+++ b/pymeasure/display/browser.py\n@@ -74,7 +74,7 @@\n             \"\"\")\n \n     def setProgress(self, progress):\n-        self.progressbar.setValue(progress)\n+        self.progressbar.setValue(int(progress))\n \n \n class Browser(QtGui.QTreeWidget):\ndiff --git a/setup.py b/setup.py\n--- a/setup.py\n+++ b/setup.py\n@@ -71,6 +71,7 @@\n         \"Programming Language :: Python :: 3.7\",\n         \"Programming Language :: Python :: 3.8\",\n         \"Programming Language :: Python :: 3.9\",\n+        \"Programming Language :: Python :: 3.10\",\n         \"Topic :: Scientific/Engineering\",\n     ],\n     keywords=\"measure instrument experiment control automate graph plot\"\n", "issue": "Python 3.10: ManagedWindow TypeError\nHi all,\r\nI am trying to use pymeasure for the first time. But when running the example \"ManagedWindow\" I get the following error message as soon as I press the \"queue\" button in the GUI and nothing will be plotted. \r\n\r\n```\r\n---------------------------------------------------------------------------\r\nTypeError                                 Traceback (most recent call last)\r\nC:\\Program Files\\Python 3.10\\lib\\site-packages\\pymeasure\\display\\manager.py in _update_progress(self, progress)\r\n    158     def _update_progress(self, progress):\r\n    159         if self.is_running():\r\n--> 160             self._running_experiment.browser_item.setProgress(progress)\r\n    161 \r\n    162     def _update_status(self, status):\r\n\r\nC:\\Program Files\\Python 3.10\\lib\\site-packages\\pymeasure\\display\\browser.py in setProgress(self, progress)\r\n     73 \r\n     74     def setProgress(self, progress):\r\n---> 75         self.progressbar.setValue(progress)\r\n     76 \r\n     77 class Browser(QtGui.QTreeWidget):\r\n\r\nTypeError: setValue(self, int): argument 1 has unexpected type 'float'---------------------------------------------------------------------------\r\nTypeError                                 Traceback (most recent call last)\r\nC:\\Program Files\\Python 3.10\\lib\\site-packages\\pymeasure\\display\\manager.py in _finish(self)\r\n    253         experiment = self._running_experiment\r\n    254         self._clean_up()\r\n--> 255         experiment.browser_item.setProgress(100.)\r\n    256         experiment.curve.update()\r\n    257         self.finished.emit(experiment)\r\n\r\nC:\\Program Files\\Python 3.10\\lib\\site-packages\\pymeasure\\display\\browser.py in setProgress(self, progress)\r\n     73 \r\n     74     def setProgress(self, progress):\r\n---> 75         self.progressbar.setValue(progress)\r\n     76 \r\n     77 class Browser(QtGui.QTreeWidget):\r\n\r\nTypeError: setValue(self, int): argument 1 has unexpected type 'float'An exception has occurred, use %tb to see the full traceback.\r\n```\r\n\r\nI'm using Windows and Python 3.10.\r\n\r\nDo you have an idea what is wrong? Probably something with the data type of progress. But what should I change? \r\nThanks for your help.\n", "before_files": [{"content": "#\n# This file is part of the PyMeasure package.\n#\n# Copyright (c) 2013-2021 PyMeasure Developers\n#\n# Permission is hereby granted, free of charge, to any person obtaining a copy\n# of this software and associated documentation files (the \"Software\"), to deal\n# in the Software without restriction, including without limitation the rights\n# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n# copies of the Software, and to permit persons to whom the Software is\n# furnished to do so, subject to the following conditions:\n#\n# The above copyright notice and this permission notice shall be included in\n# all copies or substantial portions of the Software.\n#\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n# THE SOFTWARE.\n#\n\nimport logging\n\nfrom os.path import basename\n\nfrom .Qt import QtCore, QtGui\nfrom ..experiment import Procedure\n\nlog = logging.getLogger(__name__)\nlog.addHandler(logging.NullHandler())\n\n\nclass BrowserItem(QtGui.QTreeWidgetItem):\n    \"\"\" Represent a row in the :class:`~pymeasure.display.browser.Browser` tree widget \"\"\"\n\n    def __init__(self, results, color, parent=None):\n        super().__init__(parent)\n\n        pixelmap = QtGui.QPixmap(24, 24)\n        pixelmap.fill(color)\n        self.setIcon(0, QtGui.QIcon(pixelmap))\n        self.setFlags(self.flags() | QtCore.Qt.ItemIsUserCheckable)\n        self.setCheckState(0, QtCore.Qt.Checked)\n        self.setText(1, basename(results.data_filename))\n\n        self.setStatus(results.procedure.status)\n\n        self.progressbar = QtGui.QProgressBar()\n        self.progressbar.setRange(0, 100)\n        self.progressbar.setValue(0)\n\n    def setStatus(self, status):\n        status_label = {\n            Procedure.QUEUED: 'Queued', Procedure.RUNNING: 'Running',\n            Procedure.FAILED: 'Failed', Procedure.ABORTED: 'Aborted',\n            Procedure.FINISHED: 'Finished'}\n        self.setText(3, status_label[status])\n\n        if status == Procedure.FAILED or status == Procedure.ABORTED:\n            # Set progress bar color to red\n            return  # Commented this out\n            self.progressbar.setStyleSheet(\"\"\"\n            QProgressBar {\n                border: 1px solid #AAAAAA;\n                border-radius: 5px;\n                text-align: center;\n            }\n            QProgressBar::chunk {\n                background-color: red;\n            }\n            \"\"\")\n\n    def setProgress(self, progress):\n        self.progressbar.setValue(progress)\n\n\nclass Browser(QtGui.QTreeWidget):\n    \"\"\"Graphical list view of :class:`Experiment<pymeasure.display.manager.Experiment>`\n    objects allowing the user to view the status of queued Experiments as well as\n    loading and displaying data from previous runs.\n\n    In order that different Experiments be displayed within the same Browser,\n    they must have entries in `DATA_COLUMNS` corresponding to the\n    `measured_quantities` of the Browser.\n    \"\"\"\n\n    def __init__(self, procedure_class, display_parameters,\n                 measured_quantities, sort_by_filename=False, parent=None):\n        super().__init__(parent)\n        self.display_parameters = display_parameters\n        self.procedure_class = procedure_class\n        self.measured_quantities = measured_quantities\n\n        header_labels = [\"Graph\", \"Filename\", \"Progress\", \"Status\"]\n        for parameter in self.display_parameters:\n            header_labels.append(getattr(self.procedure_class, parameter).name)\n\n        self.setColumnCount(len(header_labels))\n        self.setHeaderLabels(header_labels)\n        self.setSortingEnabled(True)\n        if sort_by_filename:\n            self.sortItems(1, QtCore.Qt.AscendingOrder)\n\n        for i, width in enumerate([80, 140]):\n            self.header().resizeSection(i, width)\n\n    def add(self, experiment):\n        \"\"\"Add a :class:`Experiment<pymeasure.display.manager.Experiment>` object\n        to the Browser. This function checks to make sure that the Experiment\n        measures the appropriate quantities to warrant its inclusion, and then\n        adds a BrowserItem to the Browser, filling all relevant columns with\n        Parameter data.\n        \"\"\"\n        experiment_parameters = experiment.procedure.parameter_objects()\n        experiment_parameter_names = list(experiment_parameters.keys())\n\n        for measured_quantity in self.measured_quantities:\n            if measured_quantity not in experiment.procedure.DATA_COLUMNS:\n                raise Exception(\"Procedure does not measure the\"\n                                \" %s quantity.\" % measured_quantity)\n\n        # Set the relevant fields within the BrowserItem if\n        # that Parameter is implemented\n        item = experiment.browser_item\n        for i, column in enumerate(self.display_parameters):\n            if column in experiment_parameter_names:\n                item.setText(i + 4, str(experiment_parameters[column]))\n\n        self.addTopLevelItem(item)\n        self.setItemWidget(item, 2, item.progressbar)\n        return item\n", "path": "pymeasure/display/browser.py"}, {"content": "#\n# This file is part of the PyMeasure package.\n#\n# Copyright (c) 2013-2021 PyMeasure Developers\n#\n# Permission is hereby granted, free of charge, to any person obtaining a copy\n# of this software and associated documentation files (the \"Software\"), to deal\n# in the Software without restriction, including without limitation the rights\n# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n# copies of the Software, and to permit persons to whom the Software is\n# furnished to do so, subject to the following conditions:\n#\n# The above copyright notice and this permission notice shall be included in\n# all copies or substantial portions of the Software.\n#\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n# THE SOFTWARE.\n#\n\n\nfrom setuptools import setup, find_packages\n\nsetup(\n    name='PyMeasure',\n    version='0.9.0',\n    author='PyMeasure Developers',\n    packages=find_packages(),\n    scripts=[],\n    url='https://github.com/pymeasure/pymeasure',\n    download_url='https://github.com/pymeasure/pymeasure/tarball/v0.9.0',\n    license='MIT License',\n    description='Scientific measurement library for instruments, experiments, and live-plotting',\n    long_description=open('README.rst').read() + \"\\n\\n\" + open('CHANGES.txt').read(),\n    install_requires=[\n        \"numpy >= 1.6.1\",\n        \"pandas >= 0.14\",\n        \"pyvisa >= 1.8\",\n        \"pyserial >= 2.7\",\n        \"pyqtgraph >= 0.9.10\"\n    ],\n    extras_require={\n        'matplotlib': ['matplotlib >= 2.0.2'],\n        'tcp': [\n            'pyzmq >= 16.0.2',\n            'cloudpickle >= 0.3.1'\n        ],\n        'python-vxi11': ['python-vxi11 >= 0.9']\n    },\n    setup_requires=[\n        'pytest-runner'\n    ],\n    tests_require=[\n        'pytest >= 2.9.1',\n        'pytest-qt >= 2.4.0',\n        'pyvisa-sim >= 0.4.0',\n    ],\n    classifiers=[\n        \"Development Status :: 4 - Beta\",\n        \"Intended Audience :: Science/Research\",\n        \"License :: OSI Approved :: MIT License\",\n        \"Operating System :: MacOS\",\n        \"Operating System :: Microsoft :: Windows\",\n        \"Operating System :: POSIX\",\n        \"Operating System :: Unix\",\n        \"Programming Language :: Python :: 3 :: Only\",\n        \"Programming Language :: Python :: 3.7\",\n        \"Programming Language :: Python :: 3.8\",\n        \"Programming Language :: Python :: 3.9\",\n        \"Topic :: Scientific/Engineering\",\n    ],\n    keywords=\"measure instrument experiment control automate graph plot\"\n)\n", "path": "setup.py"}], "after_files": [{"content": "#\n# This file is part of the PyMeasure package.\n#\n# Copyright (c) 2013-2021 PyMeasure Developers\n#\n# Permission is hereby granted, free of charge, to any person obtaining a copy\n# of this software and associated documentation files (the \"Software\"), to deal\n# in the Software without restriction, including without limitation the rights\n# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n# copies of the Software, and to permit persons to whom the Software is\n# furnished to do so, subject to the following conditions:\n#\n# The above copyright notice and this permission notice shall be included in\n# all copies or substantial portions of the Software.\n#\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n# THE SOFTWARE.\n#\n\nimport logging\n\nfrom os.path import basename\n\nfrom .Qt import QtCore, QtGui\nfrom ..experiment import Procedure\n\nlog = logging.getLogger(__name__)\nlog.addHandler(logging.NullHandler())\n\n\nclass BrowserItem(QtGui.QTreeWidgetItem):\n    \"\"\" Represent a row in the :class:`~pymeasure.display.browser.Browser` tree widget \"\"\"\n\n    def __init__(self, results, color, parent=None):\n        super().__init__(parent)\n\n        pixelmap = QtGui.QPixmap(24, 24)\n        pixelmap.fill(color)\n        self.setIcon(0, QtGui.QIcon(pixelmap))\n        self.setFlags(self.flags() | QtCore.Qt.ItemIsUserCheckable)\n        self.setCheckState(0, QtCore.Qt.Checked)\n        self.setText(1, basename(results.data_filename))\n\n        self.setStatus(results.procedure.status)\n\n        self.progressbar = QtGui.QProgressBar()\n        self.progressbar.setRange(0, 100)\n        self.progressbar.setValue(0)\n\n    def setStatus(self, status):\n        status_label = {\n            Procedure.QUEUED: 'Queued', Procedure.RUNNING: 'Running',\n            Procedure.FAILED: 'Failed', Procedure.ABORTED: 'Aborted',\n            Procedure.FINISHED: 'Finished'}\n        self.setText(3, status_label[status])\n\n        if status == Procedure.FAILED or status == Procedure.ABORTED:\n            # Set progress bar color to red\n            return  # Commented this out\n            self.progressbar.setStyleSheet(\"\"\"\n            QProgressBar {\n                border: 1px solid #AAAAAA;\n                border-radius: 5px;\n                text-align: center;\n            }\n            QProgressBar::chunk {\n                background-color: red;\n            }\n            \"\"\")\n\n    def setProgress(self, progress):\n        self.progressbar.setValue(int(progress))\n\n\nclass Browser(QtGui.QTreeWidget):\n    \"\"\"Graphical list view of :class:`Experiment<pymeasure.display.manager.Experiment>`\n    objects allowing the user to view the status of queued Experiments as well as\n    loading and displaying data from previous runs.\n\n    In order that different Experiments be displayed within the same Browser,\n    they must have entries in `DATA_COLUMNS` corresponding to the\n    `measured_quantities` of the Browser.\n    \"\"\"\n\n    def __init__(self, procedure_class, display_parameters,\n                 measured_quantities, sort_by_filename=False, parent=None):\n        super().__init__(parent)\n        self.display_parameters = display_parameters\n        self.procedure_class = procedure_class\n        self.measured_quantities = measured_quantities\n\n        header_labels = [\"Graph\", \"Filename\", \"Progress\", \"Status\"]\n        for parameter in self.display_parameters:\n            header_labels.append(getattr(self.procedure_class, parameter).name)\n\n        self.setColumnCount(len(header_labels))\n        self.setHeaderLabels(header_labels)\n        self.setSortingEnabled(True)\n        if sort_by_filename:\n            self.sortItems(1, QtCore.Qt.AscendingOrder)\n\n        for i, width in enumerate([80, 140]):\n            self.header().resizeSection(i, width)\n\n    def add(self, experiment):\n        \"\"\"Add a :class:`Experiment<pymeasure.display.manager.Experiment>` object\n        to the Browser. This function checks to make sure that the Experiment\n        measures the appropriate quantities to warrant its inclusion, and then\n        adds a BrowserItem to the Browser, filling all relevant columns with\n        Parameter data.\n        \"\"\"\n        experiment_parameters = experiment.procedure.parameter_objects()\n        experiment_parameter_names = list(experiment_parameters.keys())\n\n        for measured_quantity in self.measured_quantities:\n            if measured_quantity not in experiment.procedure.DATA_COLUMNS:\n                raise Exception(\"Procedure does not measure the\"\n                                \" %s quantity.\" % measured_quantity)\n\n        # Set the relevant fields within the BrowserItem if\n        # that Parameter is implemented\n        item = experiment.browser_item\n        for i, column in enumerate(self.display_parameters):\n            if column in experiment_parameter_names:\n                item.setText(i + 4, str(experiment_parameters[column]))\n\n        self.addTopLevelItem(item)\n        self.setItemWidget(item, 2, item.progressbar)\n        return item\n", "path": "pymeasure/display/browser.py"}, {"content": "#\n# This file is part of the PyMeasure package.\n#\n# Copyright (c) 2013-2021 PyMeasure Developers\n#\n# Permission is hereby granted, free of charge, to any person obtaining a copy\n# of this software and associated documentation files (the \"Software\"), to deal\n# in the Software without restriction, including without limitation the rights\n# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n# copies of the Software, and to permit persons to whom the Software is\n# furnished to do so, subject to the following conditions:\n#\n# The above copyright notice and this permission notice shall be included in\n# all copies or substantial portions of the Software.\n#\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n# THE SOFTWARE.\n#\n\n\nfrom setuptools import setup, find_packages\n\nsetup(\n    name='PyMeasure',\n    version='0.9.0',\n    author='PyMeasure Developers',\n    packages=find_packages(),\n    scripts=[],\n    url='https://github.com/pymeasure/pymeasure',\n    download_url='https://github.com/pymeasure/pymeasure/tarball/v0.9.0',\n    license='MIT License',\n    description='Scientific measurement library for instruments, experiments, and live-plotting',\n    long_description=open('README.rst').read() + \"\\n\\n\" + open('CHANGES.txt').read(),\n    install_requires=[\n        \"numpy >= 1.6.1\",\n        \"pandas >= 0.14\",\n        \"pyvisa >= 1.8\",\n        \"pyserial >= 2.7\",\n        \"pyqtgraph >= 0.9.10\"\n    ],\n    extras_require={\n        'matplotlib': ['matplotlib >= 2.0.2'],\n        'tcp': [\n            'pyzmq >= 16.0.2',\n            'cloudpickle >= 0.3.1'\n        ],\n        'python-vxi11': ['python-vxi11 >= 0.9']\n    },\n    setup_requires=[\n        'pytest-runner'\n    ],\n    tests_require=[\n        'pytest >= 2.9.1',\n        'pytest-qt >= 2.4.0',\n        'pyvisa-sim >= 0.4.0',\n    ],\n    classifiers=[\n        \"Development Status :: 4 - Beta\",\n        \"Intended Audience :: Science/Research\",\n        \"License :: OSI Approved :: MIT License\",\n        \"Operating System :: MacOS\",\n        \"Operating System :: Microsoft :: Windows\",\n        \"Operating System :: POSIX\",\n        \"Operating System :: Unix\",\n        \"Programming Language :: Python :: 3 :: Only\",\n        \"Programming Language :: Python :: 3.7\",\n        \"Programming Language :: Python :: 3.8\",\n        \"Programming Language :: Python :: 3.9\",\n        \"Programming Language :: Python :: 3.10\",\n        \"Topic :: Scientific/Engineering\",\n    ],\n    keywords=\"measure instrument experiment control automate graph plot\"\n)\n", "path": "setup.py"}]}