From 1ecceeaa9248c180133b8a52edf7ada29b43931c Mon Sep 17 00:00:00 2001
From: Luke Campagnola <luke.campagnola@gmail.com>
Date: Wed, 12 Feb 2014 03:02:09 -0500
Subject: [PATCH] Fixed unicode titles in Dock

---
 CHANGELOG                             |  1 +
 pyqtgraph/dockarea/Dock.py            |  3 ++-
 pyqtgraph/dockarea/tests/test_dock.py | 16 ++++++++++++++++
 pyqtgraph/python2_3.py                |  2 +-
 4 files changed, 20 insertions(+), 2 deletions(-)
 create mode 100644 pyqtgraph/dockarea/tests/test_dock.py

diff --git a/CHANGELOG b/CHANGELOG
index cf7a4efd..faabf931 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -61,6 +61,7 @@ pyqtgraph-0.9.9  [unreleased]
     - Fixed ImageItem exception building histogram when image has only one value
     - Fixed MeshData exception caused when vertexes have no matching faces
     - Fixed GLViewWidget exception handler
+    - Fixed unicode support in Dock
 
 
 pyqtgraph-0.9.8  2013-11-24
diff --git a/pyqtgraph/dockarea/Dock.py b/pyqtgraph/dockarea/Dock.py
index f83397c7..d3cfcbb6 100644
--- a/pyqtgraph/dockarea/Dock.py
+++ b/pyqtgraph/dockarea/Dock.py
@@ -2,6 +2,7 @@ from ..Qt import QtCore, QtGui
 
 from .DockDrop import *
 from ..widgets.VerticalLabel import VerticalLabel
+from ..python2_3 import asUnicode
 
 class Dock(QtGui.QWidget, DockDrop):
     
@@ -167,7 +168,7 @@ class Dock(QtGui.QWidget, DockDrop):
         self.resizeOverlay(self.size())
 
     def name(self):
-        return str(self.label.text())
+        return asUnicode(self.label.text())
 
     def container(self):
         return self._container
diff --git a/pyqtgraph/dockarea/tests/test_dock.py b/pyqtgraph/dockarea/tests/test_dock.py
new file mode 100644
index 00000000..949f3f0e
--- /dev/null
+++ b/pyqtgraph/dockarea/tests/test_dock.py
@@ -0,0 +1,16 @@
+# -*- coding: utf-8 -*-
+#import sip
+#sip.setapi('QString', 1)
+
+import pyqtgraph as pg
+pg.mkQApp()
+
+import pyqtgraph.dockarea as da
+
+def test_dock():
+    name = pg.asUnicode("évènts_zàhéér")
+    dock = da.Dock(name=name)
+    # make sure unicode names work correctly
+    assert dock.name() == name
+    # no surprises in return type.
+    assert type(dock.name()) == type(name)
diff --git a/pyqtgraph/python2_3.py b/pyqtgraph/python2_3.py
index 2182d3a1..b1c46f26 100644
--- a/pyqtgraph/python2_3.py
+++ b/pyqtgraph/python2_3.py
@@ -1,5 +1,5 @@
 """
-Helper functions which smooth out the differences between python 2 and 3.
+Helper functions that smooth out the differences between python 2 and 3.
 """
 import sys
 
-- 
GitLab