We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Add fontSize kwarg to DockLabel constructor
Allows the font size of Dock title bars to be adjusted.

I need this for a project I'm writing -- the default font is quite small for what are significant graphical elements in a GUI.


--- 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/dockarea/Dock.py`
Content:
```
1 # -*- coding: utf-8 -*-
2 from ..Qt import QtCore, QtGui
3 
4 from .DockDrop import *
5 from ..widgets.VerticalLabel import VerticalLabel
6 from ..python2_3 import asUnicode
7 
8 class Dock(QtGui.QWidget, DockDrop):
9 
10     sigStretchChanged = QtCore.Signal()
11     sigClosed = QtCore.Signal(object)
12 
13     def __init__(self, name, area=None, size=(10, 10), widget=None, hideTitle=False, autoOrientation=True, closable=False):
14         QtGui.QWidget.__init__(self)
15         DockDrop.__init__(self)
16         self._container = None
17         self._name = name
18         self.area = area
19         self.label = DockLabel(name, self, closable)
20         if closable:
21             self.label.sigCloseClicked.connect(self.close)
22         self.labelHidden = False
23         self.moveLabel = True  ## If false, the dock is no longer allowed to move the label.
24         self.autoOrient = autoOrientation
25         self.orientation = 'horizontal'
26         #self.label.setAlignment(QtCore.Qt.AlignHCenter)
27         self.topLayout = QtGui.QGridLayout()
28         self.topLayout.setContentsMargins(0, 0, 0, 0)
29         self.topLayout.setSpacing(0)
30         self.setLayout(self.topLayout)
31         self.topLayout.addWidget(self.label, 0, 1)
32         self.widgetArea = QtGui.QWidget()
33         self.topLayout.addWidget(self.widgetArea, 1, 1)
34         self.layout = QtGui.QGridLayout()
35         self.layout.setContentsMargins(0, 0, 0, 0)
36         self.layout.setSpacing(0)
37         self.widgetArea.setLayout(self.layout)
38         self.widgetArea.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
39         self.widgets = []
40         self._container = None
41         self.currentRow = 0
42         #self.titlePos = 'top'
43         self.raiseOverlay()
44         self.hStyle = """
45         Dock > QWidget {
46             border: 1px solid #000;
47             border-radius: 5px;
48             border-top-left-radius: 0px;
49             border-top-right-radius: 0px;
50             border-top-width: 0px;
51         }"""
52         self.vStyle = """
53         Dock > QWidget {
54             border: 1px solid #000;
55             border-radius: 5px;
56             border-top-left-radius: 0px;
57             border-bottom-left-radius: 0px;
58             border-left-width: 0px;
59         }"""
60         self.nStyle = """
61         Dock > QWidget {
62             border: 1px solid #000;
63             border-radius: 5px;
64         }"""
65         self.dragStyle = """
66         Dock > QWidget {
67             border: 4px solid #00F;
68             border-radius: 5px;
69         }"""
70         self.setAutoFillBackground(False)
71         self.widgetArea.setStyleSheet(self.hStyle)
72 
73         self.setStretch(*size)
74 
75         if widget is not None:
76             self.addWidget(widget)
77 
78         if hideTitle:
79             self.hideTitleBar()
80 
81     def implements(self, name=None):
82         if name is None:
83             return ['dock']
84         else:
85             return name == 'dock'
86 
87     def setStretch(self, x=None, y=None):
88         """
89         Set the 'target' size for this Dock.
90         The actual size will be determined by comparing this Dock's
91         stretch value to the rest of the docks it shares space with.
92         """
93         if x is None:
94             x = 0
95         if y is None:
96             y = 0
97         self._stretch = (x, y)
98         self.sigStretchChanged.emit()
99         
100     def stretch(self):
101         return self._stretch
102 
103     def hideTitleBar(self):
104         """
105         Hide the title bar for this Dock.
106         This will prevent the Dock being moved by the user.
107         """
108         self.label.hide()
109         self.labelHidden = True
110         if 'center' in self.allowedAreas:
111             self.allowedAreas.remove('center')
112         self.updateStyle()
113 
114     def showTitleBar(self):
115         """
116         Show the title bar for this Dock.
117         """
118         self.label.show()
119         self.labelHidden = False
120         self.allowedAreas.add('center')
121         self.updateStyle()
122 
123     def title(self):
124         """
125         Gets the text displayed in the title bar for this dock.
126         """
127         return asUnicode(self.label.text())
128 
129     def setTitle(self, text):
130         """
131         Sets the text displayed in title bar for this Dock.
132         """
133         self.label.setText(text)
134 
135     def setOrientation(self, o='auto', force=False):
136         """
137         Sets the orientation of the title bar for this Dock.
138         Must be one of 'auto', 'horizontal', or 'vertical'.
139         By default ('auto'), the orientation is determined
140         based on the aspect ratio of the Dock.
141         """
142         # setOrientation may be called before the container is set in some cases
143         # (via resizeEvent), so there's no need to do anything here until called
144         # again by containerChanged
145         if self.container() is None:
146             return
147 
148         if o == 'auto' and self.autoOrient:
149             if self.container().type() == 'tab':
150                 o = 'horizontal'
151             elif self.width() > self.height()*1.5:
152                 o = 'vertical'
153             else:
154                 o = 'horizontal'
155         if force or self.orientation != o:
156             self.orientation = o
157             self.label.setOrientation(o)
158             self.updateStyle()
159 
160     def updateStyle(self):
161         ## updates orientation and appearance of title bar
162         if self.labelHidden:
163             self.widgetArea.setStyleSheet(self.nStyle)
164         elif self.orientation == 'vertical':
165             self.label.setOrientation('vertical')
166             if self.moveLabel:
167                 self.topLayout.addWidget(self.label, 1, 0)
168             self.widgetArea.setStyleSheet(self.vStyle)
169         else:
170             self.label.setOrientation('horizontal')
171             if self.moveLabel:
172                 self.topLayout.addWidget(self.label, 0, 1)
173             self.widgetArea.setStyleSheet(self.hStyle)
174 
175     def resizeEvent(self, ev):
176         self.setOrientation()
177         self.resizeOverlay(self.size())
178 
179     def name(self):
180         return self._name
181 
182     def addWidget(self, widget, row=None, col=0, rowspan=1, colspan=1):
183         """
184         Add a new widget to the interior of this Dock.
185         Each Dock uses a QGridLayout to arrange widgets within.
186         """
187         if row is None:
188             row = self.currentRow
189         self.currentRow = max(row+1, self.currentRow)
190         self.widgets.append(widget)
191         self.layout.addWidget(widget, row, col, rowspan, colspan)
192         self.raiseOverlay()
193         
194     def startDrag(self):
195         self.drag = QtGui.QDrag(self)
196         mime = QtCore.QMimeData()
197         self.drag.setMimeData(mime)
198         self.widgetArea.setStyleSheet(self.dragStyle)
199         self.update()
200         action = self.drag.exec_()
201         self.updateStyle()
202 
203     def float(self):
204         self.area.floatDock(self)
205             
206     def container(self):
207         return self._container
208 
209     def containerChanged(self, c):
210         if self._container is not None:
211             # ask old container to close itself if it is no longer needed
212             self._container.apoptose()
213         self._container = c
214         if c is None:
215             self.area = None
216         else:
217             self.area = c.area
218             if c.type() != 'tab':
219                 self.moveLabel = True
220                 self.label.setDim(False)
221             else:
222                 self.moveLabel = False
223                 
224             self.setOrientation(force=True)
225 
226     def raiseDock(self):
227         """If this Dock is stacked underneath others, raise it to the top."""
228         self.container().raiseDock(self)
229 
230     def close(self):
231         """Remove this dock from the DockArea it lives inside."""
232         self.setParent(None)
233         QtGui.QLabel.close(self.label)
234         self.label.setParent(None)
235         self._container.apoptose()
236         self._container = None
237         self.sigClosed.emit(self)
238 
239     def __repr__(self):
240         return "<Dock %s %s>" % (self.name(), self.stretch())
241 
242     ## PySide bug: We need to explicitly redefine these methods
243     ## or else drag/drop events will not be delivered.
244     def dragEnterEvent(self, *args):
245         DockDrop.dragEnterEvent(self, *args)
246 
247     def dragMoveEvent(self, *args):
248         DockDrop.dragMoveEvent(self, *args)
249 
250     def dragLeaveEvent(self, *args):
251         DockDrop.dragLeaveEvent(self, *args)
252 
253     def dropEvent(self, *args):
254         DockDrop.dropEvent(self, *args)
255 
256 
257 class DockLabel(VerticalLabel):
258 
259     sigClicked = QtCore.Signal(object, object)
260     sigCloseClicked = QtCore.Signal()
261 
262     def __init__(self, text, dock, showCloseButton):
263         self.dim = False
264         self.fixedWidth = False
265         VerticalLabel.__init__(self, text, orientation='horizontal', forceWidth=False)
266         self.setAlignment(QtCore.Qt.AlignTop|QtCore.Qt.AlignHCenter)
267         self.dock = dock
268         self.updateStyle()
269         self.setAutoFillBackground(False)
270         self.mouseMoved = False
271 
272         self.closeButton = None
273         if showCloseButton:
274             self.closeButton = QtGui.QToolButton(self)
275             self.closeButton.clicked.connect(self.sigCloseClicked)
276             self.closeButton.setIcon(QtGui.QApplication.style().standardIcon(QtGui.QStyle.SP_TitleBarCloseButton))
277 
278     def updateStyle(self):
279         r = '3px'
280         if self.dim:
281             fg = '#aaa'
282             bg = '#44a'
283             border = '#339'
284         else:
285             fg = '#fff'
286             bg = '#66c'
287             border = '#55B'
288 
289         if self.orientation == 'vertical':
290             self.vStyle = """DockLabel {
291                 background-color : %s;
292                 color : %s;
293                 border-top-right-radius: 0px;
294                 border-top-left-radius: %s;
295                 border-bottom-right-radius: 0px;
296                 border-bottom-left-radius: %s;
297                 border-width: 0px;
298                 border-right: 2px solid %s;
299                 padding-top: 3px;
300                 padding-bottom: 3px;
301             }""" % (bg, fg, r, r, border)
302             self.setStyleSheet(self.vStyle)
303         else:
304             self.hStyle = """DockLabel {
305                 background-color : %s;
306                 color : %s;
307                 border-top-right-radius: %s;
308                 border-top-left-radius: %s;
309                 border-bottom-right-radius: 0px;
310                 border-bottom-left-radius: 0px;
311                 border-width: 0px;
312                 border-bottom: 2px solid %s;
313                 padding-left: 3px;
314                 padding-right: 3px;
315             }""" % (bg, fg, r, r, border)
316             self.setStyleSheet(self.hStyle)
317 
318     def setDim(self, d):
319         if self.dim != d:
320             self.dim = d
321             self.updateStyle()
322 
323     def setOrientation(self, o):
324         VerticalLabel.setOrientation(self, o)
325         self.updateStyle()
326 
327     def mousePressEvent(self, ev):
328         self.pressPos = ev.pos()
329         self.mouseMoved = False
330         ev.accept()
331 
332     def mouseMoveEvent(self, ev):
333         if not self.mouseMoved:
334             self.mouseMoved = (ev.pos() - self.pressPos).manhattanLength() > QtGui.QApplication.startDragDistance()
335 
336         if self.mouseMoved and ev.buttons() == QtCore.Qt.LeftButton:
337             self.dock.startDrag()
338         ev.accept()
339 
340     def mouseReleaseEvent(self, ev):
341         ev.accept()
342         if not self.mouseMoved:
343             self.sigClicked.emit(self, ev)
344 
345     def mouseDoubleClickEvent(self, ev):
346         if ev.button() == QtCore.Qt.LeftButton:
347             self.dock.float()
348 
349     def resizeEvent (self, ev):
350         if self.closeButton:
351             if self.orientation == 'vertical':
352                 size = ev.size().width()
353                 pos = QtCore.QPoint(0, 0)
354             else:
355                 size = ev.size().height()
356                 pos = QtCore.QPoint(ev.size().width() - size, 0)
357             self.closeButton.setFixedSize(QtCore.QSize(size, size))
358             self.closeButton.move(pos)
359         super(DockLabel,self).resizeEvent(ev)
360
```
--- 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/dockarea/Dock.py b/pyqtgraph/dockarea/Dock.py
--- a/pyqtgraph/dockarea/Dock.py
+++ b/pyqtgraph/dockarea/Dock.py
@@ -10,13 +10,13 @@
     sigStretchChanged = QtCore.Signal()
     sigClosed = QtCore.Signal(object)
 
-    def __init__(self, name, area=None, size=(10, 10), widget=None, hideTitle=False, autoOrientation=True, closable=False):
+    def __init__(self, name, area=None, size=(10, 10), widget=None, hideTitle=False, autoOrientation=True, closable=False, fontSize="12px"):
         QtGui.QWidget.__init__(self)
         DockDrop.__init__(self)
         self._container = None
         self._name = name
         self.area = area
-        self.label = DockLabel(name, self, closable)
+        self.label = DockLabel(name, self, closable, fontSize)
         if closable:
             self.label.sigCloseClicked.connect(self.close)
         self.labelHidden = False
@@ -259,9 +259,10 @@
     sigClicked = QtCore.Signal(object, object)
     sigCloseClicked = QtCore.Signal()
 
-    def __init__(self, text, dock, showCloseButton):
+    def __init__(self, text, dock, showCloseButton, fontSize):
         self.dim = False
         self.fixedWidth = False
+        self.fontSize = fontSize
         VerticalLabel.__init__(self, text, orientation='horizontal', forceWidth=False)
         self.setAlignment(QtCore.Qt.AlignTop|QtCore.Qt.AlignHCenter)
         self.dock = dock
@@ -298,7 +299,8 @@
                 border-right: 2px solid %s;
                 padding-top: 3px;
                 padding-bottom: 3px;
-            }""" % (bg, fg, r, r, border)
+                font-size: %s;
+            }""" % (bg, fg, r, r, border, self.fontSize)
             self.setStyleSheet(self.vStyle)
         else:
             self.hStyle = """DockLabel {
@@ -312,7 +314,8 @@
                 border-bottom: 2px solid %s;
                 padding-left: 3px;
                 padding-right: 3px;
-            }""" % (bg, fg, r, r, border)
+                font-size: %s;
+            }""" % (bg, fg, r, r, border, self.fontSize)
             self.setStyleSheet(self.hStyle)
 
     def setDim(self, d):

{"golden_diff": "diff --git a/pyqtgraph/dockarea/Dock.py b/pyqtgraph/dockarea/Dock.py\n--- a/pyqtgraph/dockarea/Dock.py\n+++ b/pyqtgraph/dockarea/Dock.py\n@@ -10,13 +10,13 @@\n     sigStretchChanged = QtCore.Signal()\n     sigClosed = QtCore.Signal(object)\n \n-    def __init__(self, name, area=None, size=(10, 10), widget=None, hideTitle=False, autoOrientation=True, closable=False):\n+    def __init__(self, name, area=None, size=(10, 10), widget=None, hideTitle=False, autoOrientation=True, closable=False, fontSize=\"12px\"):\n         QtGui.QWidget.__init__(self)\n         DockDrop.__init__(self)\n         self._container = None\n         self._name = name\n         self.area = area\n-        self.label = DockLabel(name, self, closable)\n+        self.label = DockLabel(name, self, closable, fontSize)\n         if closable:\n             self.label.sigCloseClicked.connect(self.close)\n         self.labelHidden = False\n@@ -259,9 +259,10 @@\n     sigClicked = QtCore.Signal(object, object)\n     sigCloseClicked = QtCore.Signal()\n \n-    def __init__(self, text, dock, showCloseButton):\n+    def __init__(self, text, dock, showCloseButton, fontSize):\n         self.dim = False\n         self.fixedWidth = False\n+        self.fontSize = fontSize\n         VerticalLabel.__init__(self, text, orientation='horizontal', forceWidth=False)\n         self.setAlignment(QtCore.Qt.AlignTop|QtCore.Qt.AlignHCenter)\n         self.dock = dock\n@@ -298,7 +299,8 @@\n                 border-right: 2px solid %s;\n                 padding-top: 3px;\n                 padding-bottom: 3px;\n-            }\"\"\" % (bg, fg, r, r, border)\n+                font-size: %s;\n+            }\"\"\" % (bg, fg, r, r, border, self.fontSize)\n             self.setStyleSheet(self.vStyle)\n         else:\n             self.hStyle = \"\"\"DockLabel {\n@@ -312,7 +314,8 @@\n                 border-bottom: 2px solid %s;\n                 padding-left: 3px;\n                 padding-right: 3px;\n-            }\"\"\" % (bg, fg, r, r, border)\n+                font-size: %s;\n+            }\"\"\" % (bg, fg, r, r, border, self.fontSize)\n             self.setStyleSheet(self.hStyle)\n \n     def setDim(self, d):\n", "issue": "Add fontSize kwarg to DockLabel constructor\nAllows the font size of Dock title bars to be adjusted.\n\nI need this for a project I'm writing -- the default font is quite small for what are significant graphical elements in a GUI.\n\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\nfrom ..Qt import QtCore, QtGui\n\nfrom .DockDrop import *\nfrom ..widgets.VerticalLabel import VerticalLabel\nfrom ..python2_3 import asUnicode\n\nclass Dock(QtGui.QWidget, DockDrop):\n\n    sigStretchChanged = QtCore.Signal()\n    sigClosed = QtCore.Signal(object)\n\n    def __init__(self, name, area=None, size=(10, 10), widget=None, hideTitle=False, autoOrientation=True, closable=False):\n        QtGui.QWidget.__init__(self)\n        DockDrop.__init__(self)\n        self._container = None\n        self._name = name\n        self.area = area\n        self.label = DockLabel(name, self, closable)\n        if closable:\n            self.label.sigCloseClicked.connect(self.close)\n        self.labelHidden = False\n        self.moveLabel = True  ## If false, the dock is no longer allowed to move the label.\n        self.autoOrient = autoOrientation\n        self.orientation = 'horizontal'\n        #self.label.setAlignment(QtCore.Qt.AlignHCenter)\n        self.topLayout = QtGui.QGridLayout()\n        self.topLayout.setContentsMargins(0, 0, 0, 0)\n        self.topLayout.setSpacing(0)\n        self.setLayout(self.topLayout)\n        self.topLayout.addWidget(self.label, 0, 1)\n        self.widgetArea = QtGui.QWidget()\n        self.topLayout.addWidget(self.widgetArea, 1, 1)\n        self.layout = QtGui.QGridLayout()\n        self.layout.setContentsMargins(0, 0, 0, 0)\n        self.layout.setSpacing(0)\n        self.widgetArea.setLayout(self.layout)\n        self.widgetArea.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)\n        self.widgets = []\n        self._container = None\n        self.currentRow = 0\n        #self.titlePos = 'top'\n        self.raiseOverlay()\n        self.hStyle = \"\"\"\n        Dock > QWidget {\n            border: 1px solid #000;\n            border-radius: 5px;\n            border-top-left-radius: 0px;\n            border-top-right-radius: 0px;\n            border-top-width: 0px;\n        }\"\"\"\n        self.vStyle = \"\"\"\n        Dock > QWidget {\n            border: 1px solid #000;\n            border-radius: 5px;\n            border-top-left-radius: 0px;\n            border-bottom-left-radius: 0px;\n            border-left-width: 0px;\n        }\"\"\"\n        self.nStyle = \"\"\"\n        Dock > QWidget {\n            border: 1px solid #000;\n            border-radius: 5px;\n        }\"\"\"\n        self.dragStyle = \"\"\"\n        Dock > QWidget {\n            border: 4px solid #00F;\n            border-radius: 5px;\n        }\"\"\"\n        self.setAutoFillBackground(False)\n        self.widgetArea.setStyleSheet(self.hStyle)\n\n        self.setStretch(*size)\n\n        if widget is not None:\n            self.addWidget(widget)\n\n        if hideTitle:\n            self.hideTitleBar()\n\n    def implements(self, name=None):\n        if name is None:\n            return ['dock']\n        else:\n            return name == 'dock'\n\n    def setStretch(self, x=None, y=None):\n        \"\"\"\n        Set the 'target' size for this Dock.\n        The actual size will be determined by comparing this Dock's\n        stretch value to the rest of the docks it shares space with.\n        \"\"\"\n        if x is None:\n            x = 0\n        if y is None:\n            y = 0\n        self._stretch = (x, y)\n        self.sigStretchChanged.emit()\n        \n    def stretch(self):\n        return self._stretch\n\n    def hideTitleBar(self):\n        \"\"\"\n        Hide the title bar for this Dock.\n        This will prevent the Dock being moved by the user.\n        \"\"\"\n        self.label.hide()\n        self.labelHidden = True\n        if 'center' in self.allowedAreas:\n            self.allowedAreas.remove('center')\n        self.updateStyle()\n\n    def showTitleBar(self):\n        \"\"\"\n        Show the title bar for this Dock.\n        \"\"\"\n        self.label.show()\n        self.labelHidden = False\n        self.allowedAreas.add('center')\n        self.updateStyle()\n\n    def title(self):\n        \"\"\"\n        Gets the text displayed in the title bar for this dock.\n        \"\"\"\n        return asUnicode(self.label.text())\n\n    def setTitle(self, text):\n        \"\"\"\n        Sets the text displayed in title bar for this Dock.\n        \"\"\"\n        self.label.setText(text)\n\n    def setOrientation(self, o='auto', force=False):\n        \"\"\"\n        Sets the orientation of the title bar for this Dock.\n        Must be one of 'auto', 'horizontal', or 'vertical'.\n        By default ('auto'), the orientation is determined\n        based on the aspect ratio of the Dock.\n        \"\"\"\n        # setOrientation may be called before the container is set in some cases\n        # (via resizeEvent), so there's no need to do anything here until called\n        # again by containerChanged\n        if self.container() is None:\n            return\n\n        if o == 'auto' and self.autoOrient:\n            if self.container().type() == 'tab':\n                o = 'horizontal'\n            elif self.width() > self.height()*1.5:\n                o = 'vertical'\n            else:\n                o = 'horizontal'\n        if force or self.orientation != o:\n            self.orientation = o\n            self.label.setOrientation(o)\n            self.updateStyle()\n\n    def updateStyle(self):\n        ## updates orientation and appearance of title bar\n        if self.labelHidden:\n            self.widgetArea.setStyleSheet(self.nStyle)\n        elif self.orientation == 'vertical':\n            self.label.setOrientation('vertical')\n            if self.moveLabel:\n                self.topLayout.addWidget(self.label, 1, 0)\n            self.widgetArea.setStyleSheet(self.vStyle)\n        else:\n            self.label.setOrientation('horizontal')\n            if self.moveLabel:\n                self.topLayout.addWidget(self.label, 0, 1)\n            self.widgetArea.setStyleSheet(self.hStyle)\n\n    def resizeEvent(self, ev):\n        self.setOrientation()\n        self.resizeOverlay(self.size())\n\n    def name(self):\n        return self._name\n\n    def addWidget(self, widget, row=None, col=0, rowspan=1, colspan=1):\n        \"\"\"\n        Add a new widget to the interior of this Dock.\n        Each Dock uses a QGridLayout to arrange widgets within.\n        \"\"\"\n        if row is None:\n            row = self.currentRow\n        self.currentRow = max(row+1, self.currentRow)\n        self.widgets.append(widget)\n        self.layout.addWidget(widget, row, col, rowspan, colspan)\n        self.raiseOverlay()\n        \n    def startDrag(self):\n        self.drag = QtGui.QDrag(self)\n        mime = QtCore.QMimeData()\n        self.drag.setMimeData(mime)\n        self.widgetArea.setStyleSheet(self.dragStyle)\n        self.update()\n        action = self.drag.exec_()\n        self.updateStyle()\n\n    def float(self):\n        self.area.floatDock(self)\n            \n    def container(self):\n        return self._container\n\n    def containerChanged(self, c):\n        if self._container is not None:\n            # ask old container to close itself if it is no longer needed\n            self._container.apoptose()\n        self._container = c\n        if c is None:\n            self.area = None\n        else:\n            self.area = c.area\n            if c.type() != 'tab':\n                self.moveLabel = True\n                self.label.setDim(False)\n            else:\n                self.moveLabel = False\n                \n            self.setOrientation(force=True)\n\n    def raiseDock(self):\n        \"\"\"If this Dock is stacked underneath others, raise it to the top.\"\"\"\n        self.container().raiseDock(self)\n\n    def close(self):\n        \"\"\"Remove this dock from the DockArea it lives inside.\"\"\"\n        self.setParent(None)\n        QtGui.QLabel.close(self.label)\n        self.label.setParent(None)\n        self._container.apoptose()\n        self._container = None\n        self.sigClosed.emit(self)\n\n    def __repr__(self):\n        return \"<Dock %s %s>\" % (self.name(), self.stretch())\n\n    ## PySide bug: We need to explicitly redefine these methods\n    ## or else drag/drop events will not be delivered.\n    def dragEnterEvent(self, *args):\n        DockDrop.dragEnterEvent(self, *args)\n\n    def dragMoveEvent(self, *args):\n        DockDrop.dragMoveEvent(self, *args)\n\n    def dragLeaveEvent(self, *args):\n        DockDrop.dragLeaveEvent(self, *args)\n\n    def dropEvent(self, *args):\n        DockDrop.dropEvent(self, *args)\n\n\nclass DockLabel(VerticalLabel):\n\n    sigClicked = QtCore.Signal(object, object)\n    sigCloseClicked = QtCore.Signal()\n\n    def __init__(self, text, dock, showCloseButton):\n        self.dim = False\n        self.fixedWidth = False\n        VerticalLabel.__init__(self, text, orientation='horizontal', forceWidth=False)\n        self.setAlignment(QtCore.Qt.AlignTop|QtCore.Qt.AlignHCenter)\n        self.dock = dock\n        self.updateStyle()\n        self.setAutoFillBackground(False)\n        self.mouseMoved = False\n\n        self.closeButton = None\n        if showCloseButton:\n            self.closeButton = QtGui.QToolButton(self)\n            self.closeButton.clicked.connect(self.sigCloseClicked)\n            self.closeButton.setIcon(QtGui.QApplication.style().standardIcon(QtGui.QStyle.SP_TitleBarCloseButton))\n\n    def updateStyle(self):\n        r = '3px'\n        if self.dim:\n            fg = '#aaa'\n            bg = '#44a'\n            border = '#339'\n        else:\n            fg = '#fff'\n            bg = '#66c'\n            border = '#55B'\n\n        if self.orientation == 'vertical':\n            self.vStyle = \"\"\"DockLabel {\n                background-color : %s;\n                color : %s;\n                border-top-right-radius: 0px;\n                border-top-left-radius: %s;\n                border-bottom-right-radius: 0px;\n                border-bottom-left-radius: %s;\n                border-width: 0px;\n                border-right: 2px solid %s;\n                padding-top: 3px;\n                padding-bottom: 3px;\n            }\"\"\" % (bg, fg, r, r, border)\n            self.setStyleSheet(self.vStyle)\n        else:\n            self.hStyle = \"\"\"DockLabel {\n                background-color : %s;\n                color : %s;\n                border-top-right-radius: %s;\n                border-top-left-radius: %s;\n                border-bottom-right-radius: 0px;\n                border-bottom-left-radius: 0px;\n                border-width: 0px;\n                border-bottom: 2px solid %s;\n                padding-left: 3px;\n                padding-right: 3px;\n            }\"\"\" % (bg, fg, r, r, border)\n            self.setStyleSheet(self.hStyle)\n\n    def setDim(self, d):\n        if self.dim != d:\n            self.dim = d\n            self.updateStyle()\n\n    def setOrientation(self, o):\n        VerticalLabel.setOrientation(self, o)\n        self.updateStyle()\n\n    def mousePressEvent(self, ev):\n        self.pressPos = ev.pos()\n        self.mouseMoved = False\n        ev.accept()\n\n    def mouseMoveEvent(self, ev):\n        if not self.mouseMoved:\n            self.mouseMoved = (ev.pos() - self.pressPos).manhattanLength() > QtGui.QApplication.startDragDistance()\n\n        if self.mouseMoved and ev.buttons() == QtCore.Qt.LeftButton:\n            self.dock.startDrag()\n        ev.accept()\n\n    def mouseReleaseEvent(self, ev):\n        ev.accept()\n        if not self.mouseMoved:\n            self.sigClicked.emit(self, ev)\n\n    def mouseDoubleClickEvent(self, ev):\n        if ev.button() == QtCore.Qt.LeftButton:\n            self.dock.float()\n\n    def resizeEvent (self, ev):\n        if self.closeButton:\n            if self.orientation == 'vertical':\n                size = ev.size().width()\n                pos = QtCore.QPoint(0, 0)\n            else:\n                size = ev.size().height()\n                pos = QtCore.QPoint(ev.size().width() - size, 0)\n            self.closeButton.setFixedSize(QtCore.QSize(size, size))\n            self.closeButton.move(pos)\n        super(DockLabel,self).resizeEvent(ev)\n", "path": "pyqtgraph/dockarea/Dock.py"}], "after_files": [{"content": "# -*- coding: utf-8 -*-\nfrom ..Qt import QtCore, QtGui\n\nfrom .DockDrop import *\nfrom ..widgets.VerticalLabel import VerticalLabel\nfrom ..python2_3 import asUnicode\n\nclass Dock(QtGui.QWidget, DockDrop):\n\n    sigStretchChanged = QtCore.Signal()\n    sigClosed = QtCore.Signal(object)\n\n    def __init__(self, name, area=None, size=(10, 10), widget=None, hideTitle=False, autoOrientation=True, closable=False, fontSize=\"12px\"):\n        QtGui.QWidget.__init__(self)\n        DockDrop.__init__(self)\n        self._container = None\n        self._name = name\n        self.area = area\n        self.label = DockLabel(name, self, closable, fontSize)\n        if closable:\n            self.label.sigCloseClicked.connect(self.close)\n        self.labelHidden = False\n        self.moveLabel = True  ## If false, the dock is no longer allowed to move the label.\n        self.autoOrient = autoOrientation\n        self.orientation = 'horizontal'\n        #self.label.setAlignment(QtCore.Qt.AlignHCenter)\n        self.topLayout = QtGui.QGridLayout()\n        self.topLayout.setContentsMargins(0, 0, 0, 0)\n        self.topLayout.setSpacing(0)\n        self.setLayout(self.topLayout)\n        self.topLayout.addWidget(self.label, 0, 1)\n        self.widgetArea = QtGui.QWidget()\n        self.topLayout.addWidget(self.widgetArea, 1, 1)\n        self.layout = QtGui.QGridLayout()\n        self.layout.setContentsMargins(0, 0, 0, 0)\n        self.layout.setSpacing(0)\n        self.widgetArea.setLayout(self.layout)\n        self.widgetArea.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)\n        self.widgets = []\n        self._container = None\n        self.currentRow = 0\n        #self.titlePos = 'top'\n        self.raiseOverlay()\n        self.hStyle = \"\"\"\n        Dock > QWidget {\n            border: 1px solid #000;\n            border-radius: 5px;\n            border-top-left-radius: 0px;\n            border-top-right-radius: 0px;\n            border-top-width: 0px;\n        }\"\"\"\n        self.vStyle = \"\"\"\n        Dock > QWidget {\n            border: 1px solid #000;\n            border-radius: 5px;\n            border-top-left-radius: 0px;\n            border-bottom-left-radius: 0px;\n            border-left-width: 0px;\n        }\"\"\"\n        self.nStyle = \"\"\"\n        Dock > QWidget {\n            border: 1px solid #000;\n            border-radius: 5px;\n        }\"\"\"\n        self.dragStyle = \"\"\"\n        Dock > QWidget {\n            border: 4px solid #00F;\n            border-radius: 5px;\n        }\"\"\"\n        self.setAutoFillBackground(False)\n        self.widgetArea.setStyleSheet(self.hStyle)\n\n        self.setStretch(*size)\n\n        if widget is not None:\n            self.addWidget(widget)\n\n        if hideTitle:\n            self.hideTitleBar()\n\n    def implements(self, name=None):\n        if name is None:\n            return ['dock']\n        else:\n            return name == 'dock'\n\n    def setStretch(self, x=None, y=None):\n        \"\"\"\n        Set the 'target' size for this Dock.\n        The actual size will be determined by comparing this Dock's\n        stretch value to the rest of the docks it shares space with.\n        \"\"\"\n        if x is None:\n            x = 0\n        if y is None:\n            y = 0\n        self._stretch = (x, y)\n        self.sigStretchChanged.emit()\n        \n    def stretch(self):\n        return self._stretch\n\n    def hideTitleBar(self):\n        \"\"\"\n        Hide the title bar for this Dock.\n        This will prevent the Dock being moved by the user.\n        \"\"\"\n        self.label.hide()\n        self.labelHidden = True\n        if 'center' in self.allowedAreas:\n            self.allowedAreas.remove('center')\n        self.updateStyle()\n\n    def showTitleBar(self):\n        \"\"\"\n        Show the title bar for this Dock.\n        \"\"\"\n        self.label.show()\n        self.labelHidden = False\n        self.allowedAreas.add('center')\n        self.updateStyle()\n\n    def title(self):\n        \"\"\"\n        Gets the text displayed in the title bar for this dock.\n        \"\"\"\n        return asUnicode(self.label.text())\n\n    def setTitle(self, text):\n        \"\"\"\n        Sets the text displayed in title bar for this Dock.\n        \"\"\"\n        self.label.setText(text)\n\n    def setOrientation(self, o='auto', force=False):\n        \"\"\"\n        Sets the orientation of the title bar for this Dock.\n        Must be one of 'auto', 'horizontal', or 'vertical'.\n        By default ('auto'), the orientation is determined\n        based on the aspect ratio of the Dock.\n        \"\"\"\n        # setOrientation may be called before the container is set in some cases\n        # (via resizeEvent), so there's no need to do anything here until called\n        # again by containerChanged\n        if self.container() is None:\n            return\n\n        if o == 'auto' and self.autoOrient:\n            if self.container().type() == 'tab':\n                o = 'horizontal'\n            elif self.width() > self.height()*1.5:\n                o = 'vertical'\n            else:\n                o = 'horizontal'\n        if force or self.orientation != o:\n            self.orientation = o\n            self.label.setOrientation(o)\n            self.updateStyle()\n\n    def updateStyle(self):\n        ## updates orientation and appearance of title bar\n        if self.labelHidden:\n            self.widgetArea.setStyleSheet(self.nStyle)\n        elif self.orientation == 'vertical':\n            self.label.setOrientation('vertical')\n            if self.moveLabel:\n                self.topLayout.addWidget(self.label, 1, 0)\n            self.widgetArea.setStyleSheet(self.vStyle)\n        else:\n            self.label.setOrientation('horizontal')\n            if self.moveLabel:\n                self.topLayout.addWidget(self.label, 0, 1)\n            self.widgetArea.setStyleSheet(self.hStyle)\n\n    def resizeEvent(self, ev):\n        self.setOrientation()\n        self.resizeOverlay(self.size())\n\n    def name(self):\n        return self._name\n\n    def addWidget(self, widget, row=None, col=0, rowspan=1, colspan=1):\n        \"\"\"\n        Add a new widget to the interior of this Dock.\n        Each Dock uses a QGridLayout to arrange widgets within.\n        \"\"\"\n        if row is None:\n            row = self.currentRow\n        self.currentRow = max(row+1, self.currentRow)\n        self.widgets.append(widget)\n        self.layout.addWidget(widget, row, col, rowspan, colspan)\n        self.raiseOverlay()\n        \n    def startDrag(self):\n        self.drag = QtGui.QDrag(self)\n        mime = QtCore.QMimeData()\n        self.drag.setMimeData(mime)\n        self.widgetArea.setStyleSheet(self.dragStyle)\n        self.update()\n        action = self.drag.exec_()\n        self.updateStyle()\n\n    def float(self):\n        self.area.floatDock(self)\n            \n    def container(self):\n        return self._container\n\n    def containerChanged(self, c):\n        if self._container is not None:\n            # ask old container to close itself if it is no longer needed\n            self._container.apoptose()\n        self._container = c\n        if c is None:\n            self.area = None\n        else:\n            self.area = c.area\n            if c.type() != 'tab':\n                self.moveLabel = True\n                self.label.setDim(False)\n            else:\n                self.moveLabel = False\n                \n            self.setOrientation(force=True)\n\n    def raiseDock(self):\n        \"\"\"If this Dock is stacked underneath others, raise it to the top.\"\"\"\n        self.container().raiseDock(self)\n\n    def close(self):\n        \"\"\"Remove this dock from the DockArea it lives inside.\"\"\"\n        self.setParent(None)\n        QtGui.QLabel.close(self.label)\n        self.label.setParent(None)\n        self._container.apoptose()\n        self._container = None\n        self.sigClosed.emit(self)\n\n    def __repr__(self):\n        return \"<Dock %s %s>\" % (self.name(), self.stretch())\n\n    ## PySide bug: We need to explicitly redefine these methods\n    ## or else drag/drop events will not be delivered.\n    def dragEnterEvent(self, *args):\n        DockDrop.dragEnterEvent(self, *args)\n\n    def dragMoveEvent(self, *args):\n        DockDrop.dragMoveEvent(self, *args)\n\n    def dragLeaveEvent(self, *args):\n        DockDrop.dragLeaveEvent(self, *args)\n\n    def dropEvent(self, *args):\n        DockDrop.dropEvent(self, *args)\n\n\nclass DockLabel(VerticalLabel):\n\n    sigClicked = QtCore.Signal(object, object)\n    sigCloseClicked = QtCore.Signal()\n\n    def __init__(self, text, dock, showCloseButton, fontSize):\n        self.dim = False\n        self.fixedWidth = False\n        self.fontSize = fontSize\n        VerticalLabel.__init__(self, text, orientation='horizontal', forceWidth=False)\n        self.setAlignment(QtCore.Qt.AlignTop|QtCore.Qt.AlignHCenter)\n        self.dock = dock\n        self.updateStyle()\n        self.setAutoFillBackground(False)\n        self.mouseMoved = False\n\n        self.closeButton = None\n        if showCloseButton:\n            self.closeButton = QtGui.QToolButton(self)\n            self.closeButton.clicked.connect(self.sigCloseClicked)\n            self.closeButton.setIcon(QtGui.QApplication.style().standardIcon(QtGui.QStyle.SP_TitleBarCloseButton))\n\n    def updateStyle(self):\n        r = '3px'\n        if self.dim:\n            fg = '#aaa'\n            bg = '#44a'\n            border = '#339'\n        else:\n            fg = '#fff'\n            bg = '#66c'\n            border = '#55B'\n\n        if self.orientation == 'vertical':\n            self.vStyle = \"\"\"DockLabel {\n                background-color : %s;\n                color : %s;\n                border-top-right-radius: 0px;\n                border-top-left-radius: %s;\n                border-bottom-right-radius: 0px;\n                border-bottom-left-radius: %s;\n                border-width: 0px;\n                border-right: 2px solid %s;\n                padding-top: 3px;\n                padding-bottom: 3px;\n                font-size: %s;\n            }\"\"\" % (bg, fg, r, r, border, self.fontSize)\n            self.setStyleSheet(self.vStyle)\n        else:\n            self.hStyle = \"\"\"DockLabel {\n                background-color : %s;\n                color : %s;\n                border-top-right-radius: %s;\n                border-top-left-radius: %s;\n                border-bottom-right-radius: 0px;\n                border-bottom-left-radius: 0px;\n                border-width: 0px;\n                border-bottom: 2px solid %s;\n                padding-left: 3px;\n                padding-right: 3px;\n                font-size: %s;\n            }\"\"\" % (bg, fg, r, r, border, self.fontSize)\n            self.setStyleSheet(self.hStyle)\n\n    def setDim(self, d):\n        if self.dim != d:\n            self.dim = d\n            self.updateStyle()\n\n    def setOrientation(self, o):\n        VerticalLabel.setOrientation(self, o)\n        self.updateStyle()\n\n    def mousePressEvent(self, ev):\n        self.pressPos = ev.pos()\n        self.mouseMoved = False\n        ev.accept()\n\n    def mouseMoveEvent(self, ev):\n        if not self.mouseMoved:\n            self.mouseMoved = (ev.pos() - self.pressPos).manhattanLength() > QtGui.QApplication.startDragDistance()\n\n        if self.mouseMoved and ev.buttons() == QtCore.Qt.LeftButton:\n            self.dock.startDrag()\n        ev.accept()\n\n    def mouseReleaseEvent(self, ev):\n        ev.accept()\n        if not self.mouseMoved:\n            self.sigClicked.emit(self, ev)\n\n    def mouseDoubleClickEvent(self, ev):\n        if ev.button() == QtCore.Qt.LeftButton:\n            self.dock.float()\n\n    def resizeEvent (self, ev):\n        if self.closeButton:\n            if self.orientation == 'vertical':\n                size = ev.size().width()\n                pos = QtCore.QPoint(0, 0)\n            else:\n                size = ev.size().height()\n                pos = QtCore.QPoint(ev.size().width() - size, 0)\n            self.closeButton.setFixedSize(QtCore.QSize(size, size))\n            self.closeButton.move(pos)\n        super(DockLabel,self).resizeEvent(ev)\n", "path": "pyqtgraph/dockarea/Dock.py"}]}