aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/declarative/extending/chapter1-basics/basics.py7
-rw-r--r--examples/declarative/extending/chapter2-methods/methods.py7
-rw-r--r--examples/declarative/extending/chapter3-bindings/bindings.py7
-rw-r--r--examples/declarative/extending/chapter4-customPropertyTypes/customPropertyTypes.py7
-rw-r--r--examples/declarative/extending/chapter5-listproperties/listproperties.py7
-rw-r--r--examples/utils/utils.py48
6 files changed, 15 insertions, 68 deletions
diff --git a/examples/declarative/extending/chapter1-basics/basics.py b/examples/declarative/extending/chapter1-basics/basics.py
index e75e1b330..a604a05bc 100644
--- a/examples/declarative/extending/chapter1-basics/basics.py
+++ b/examples/declarative/extending/chapter1-basics/basics.py
@@ -41,9 +41,8 @@
"""PySide2 port of the qml/tutorials/extending-qml/chapter1-basics example from Qt v5.x"""
-import sys, os
-sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', '..', 'utils'))
-from utils import text_type
+import os
+import sys
from PySide2.QtCore import Property, Signal, QUrl
from PySide2.QtGui import QGuiApplication, QPen, QPainter, QColor
@@ -76,7 +75,7 @@ class PieChart (QQuickPaintedItem):
nameChanged = Signal()
color = Property(QColor, getColor, setColor)
- name = Property(text_type, getName, setName, notify=nameChanged)
+ name = Property(str, getName, setName, notify=nameChanged)
if __name__ == '__main__':
app = QGuiApplication(sys.argv)
diff --git a/examples/declarative/extending/chapter2-methods/methods.py b/examples/declarative/extending/chapter2-methods/methods.py
index e2a4eb804..819d4514a 100644
--- a/examples/declarative/extending/chapter2-methods/methods.py
+++ b/examples/declarative/extending/chapter2-methods/methods.py
@@ -41,9 +41,8 @@
"""PySide2 port of the qml/tutorials/extending-qml/chapter2-methods example from Qt v5.x"""
-import sys, os
-sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', '..', 'utils'))
-from utils import text_type
+import os
+import sys
from PySide2.QtCore import Property, Signal, Slot, QUrl, Qt
from PySide2.QtGui import QGuiApplication, QPen, QPainter, QColor
@@ -74,7 +73,7 @@ class PieChart (QQuickPaintedItem):
self._name = value
color = Property(QColor, getColor, setColor)
- name = Property(text_type, getName, setName)
+ name = Property(str, getName, setName)
chartCleared = Signal()
@Slot() # This should be something like @Invokable
diff --git a/examples/declarative/extending/chapter3-bindings/bindings.py b/examples/declarative/extending/chapter3-bindings/bindings.py
index b603cb65e..62e19c955 100644
--- a/examples/declarative/extending/chapter3-bindings/bindings.py
+++ b/examples/declarative/extending/chapter3-bindings/bindings.py
@@ -41,9 +41,8 @@
"""PySide2 port of the qml/tutorials/extending-qml/chapter3-bindings example from Qt v5.x"""
-import sys, os
-sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', '..', 'utils'))
-from utils import text_type
+import os
+import sys
from PySide2.QtCore import Property, Signal, Slot, QUrl, Qt
from PySide2.QtGui import QGuiApplication, QPen, QPainter, QColor
@@ -79,7 +78,7 @@ class PieChart (QQuickPaintedItem):
colorChanged = Signal()
color = Property(QColor, getColor, setColor, notify=colorChanged)
- name = Property(text_type, getName, setName)
+ name = Property(str, getName, setName)
chartCleared = Signal()
@Slot() # This should be something like @Invokable
diff --git a/examples/declarative/extending/chapter4-customPropertyTypes/customPropertyTypes.py b/examples/declarative/extending/chapter4-customPropertyTypes/customPropertyTypes.py
index 888cb4861..b07aad59b 100644
--- a/examples/declarative/extending/chapter4-customPropertyTypes/customPropertyTypes.py
+++ b/examples/declarative/extending/chapter4-customPropertyTypes/customPropertyTypes.py
@@ -41,9 +41,8 @@
"""PySide2 port of the qml/tutorials/extending-qml/chapter4-customPropertyTypes example from Qt v5.x"""
-import sys, os
-sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', '..', 'utils'))
-from utils import text_type
+import os
+import sys
from PySide2.QtCore import Property, QUrl
from PySide2.QtGui import QGuiApplication, QPen, QPainter, QColor
@@ -82,7 +81,7 @@ class PieChart (QQuickItem):
def setName(self, value):
self._name = value
- name = Property(text_type, getName, setName)
+ name = Property(str, getName, setName)
def getPieSlice(self):
return self._pieSlice
diff --git a/examples/declarative/extending/chapter5-listproperties/listproperties.py b/examples/declarative/extending/chapter5-listproperties/listproperties.py
index 5c3c428c2..dd3e5c65c 100644
--- a/examples/declarative/extending/chapter5-listproperties/listproperties.py
+++ b/examples/declarative/extending/chapter5-listproperties/listproperties.py
@@ -41,9 +41,8 @@
"""PySide2 port of the qml/tutorials/extending-qml/chapter5-listproperties example from Qt v5.x"""
-import sys, os
-sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', '..', 'utils'))
-from utils import text_type
+import os
+import sys
from PySide2.QtCore import Property, QUrl
from PySide2.QtGui import QGuiApplication, QPen, QPainter, QColor
@@ -97,7 +96,7 @@ class PieChart (QQuickItem):
def setName(self, value):
self._name = value
- name = Property(text_type, getName, setName)
+ name = Property(str, getName, setName)
def appendSlice(self, _slice):
_slice.setParentItem(self)
diff --git a/examples/utils/utils.py b/examples/utils/utils.py
deleted file mode 100644
index 96421e47b..000000000
--- a/examples/utils/utils.py
+++ /dev/null
@@ -1,48 +0,0 @@
-
-#############################################################################
-##
-## Copyright (C) 2016 The Qt Company Ltd.
-## Contact: http://www.qt.io/licensing/
-##
-## This file is part of the Qt for Python examples of the Qt Toolkit.
-##
-## $QT_BEGIN_LICENSE:BSD$
-## You may use this file under the terms of the BSD license as follows:
-##
-## "Redistribution and use in source and binary forms, with or without
-## modification, are permitted provided that the following conditions are
-## met:
-## * Redistributions of source code must retain the above copyright
-## notice, this list of conditions and the following disclaimer.
-## * Redistributions in binary form must reproduce the above copyright
-## notice, this list of conditions and the following disclaimer in
-## the documentation and/or other materials provided with the
-## distribution.
-## * Neither the name of The Qt Company Ltd nor the names of its
-## contributors may be used to endorse or promote products derived
-## from this software without specific prior written permission.
-##
-##
-## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-import sys
-isPY3 = sys.version_info[0] == 3
-
-if isPY3:
- text_type = str
-else:
- text_type = unicode