From c34d1cbff89a67527eaeadc9927f66608b7f454a Mon Sep 17 00:00:00 2001 From: Luke Campagnola <> Date: Fri, 11 May 2012 23:52:11 -0400 Subject: [PATCH] Bugfixes against python3 updates. Everything appears wo be working as normal in Python2 Python3 is still only partially functional. --- configfile.py | 2 +- dockarea/Dock.py | 6 ++++++ dockarea/DockDrop.py | 5 ++--- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/configfile.py b/configfile.py index f91774aa..c4448ff0 100644 --- a/configfile.py +++ b/configfile.py @@ -51,7 +51,7 @@ def readConfigFile(fname): try: #os.chdir(newDir) ## bad. fd = open(fname) - s = asUnicode(fd.read(), 'UTF-8') + s = asUnicode(fd.read()) fd.close() s = s.replace("\r\n", "\n") s = s.replace("\r", "\n") diff --git a/dockarea/Dock.py b/dockarea/Dock.py index acfa94f6..9c3c1605 100644 --- a/dockarea/Dock.py +++ b/dockarea/Dock.py @@ -64,6 +64,12 @@ class Dock(QtGui.QWidget, DockDrop): self.setStretch(*size) + def implements(self, name=None): + if name is None: + return ['dock'] + else: + return name == 'dock' + def setStretch(self, x=None, y=None): #print "setStretch", self, x, y #self._stretch = (x, y) diff --git a/dockarea/DockDrop.py b/dockarea/DockDrop.py index 6e526b17..acab28cd 100644 --- a/dockarea/DockDrop.py +++ b/dockarea/DockDrop.py @@ -20,7 +20,8 @@ class DockDrop(object): self.overlay.raise_() def dragEnterEvent(self, ev): - if isinstance(ev.source(), Dock.Dock): + src = ev.source() + if hasattr(src, 'implements') and src.implements('dock'): #print "drag enter accept" ev.accept() else: @@ -125,5 +126,3 @@ class DropAreaOverlay(QtGui.QWidget): p.setBrush(QtGui.QBrush(QtGui.QColor(100, 100, 255, 50))) p.setPen(QtGui.QPen(QtGui.QColor(50, 50, 150), 3)) p.drawRect(rgn) - -from . import Dock \ No newline at end of file