mirror of
https://github.com/pyqt/examples.git
synced 2025-08-28 20:37:39 +00:00
Update official PyQt examples to 5.12.3
This commit is contained in:
parent
c0adffcf62
commit
797022f3ad
@ -631,8 +631,8 @@ to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
{one line to give the program's name and a brief idea of what it does.}
|
||||
Copyright (C) {year} {name of author}
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@ -652,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail.
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
{project} Copyright (C) {year} {fullname}
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
@ -129,7 +129,7 @@ class Dialog(QDialog):
|
||||
self.sharedMemory.lock()
|
||||
|
||||
# Copy image data from buf into shared memory area.
|
||||
self.sharedMemory.data()[:] = buf.data().data()
|
||||
self.sharedMemory.data()[:size] = buf.data()[:size]
|
||||
self.sharedMemory.unlock()
|
||||
|
||||
def loadFromMemory(self):
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#############################################################################
|
||||
##
|
||||
## Copyright (C) 2013 Riverbank Computing Limited.
|
||||
## Copyright (C) 2017 Riverbank Computing Limited.
|
||||
## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
## All rights reserved.
|
||||
##
|
||||
@ -166,7 +166,8 @@ class PieView(QAbstractItemView):
|
||||
else:
|
||||
valueIndex = index
|
||||
|
||||
if self.model().data(valueIndex) > 0.0:
|
||||
value = self.model().data(valueIndex)
|
||||
if value is not None and value > 0.0:
|
||||
|
||||
listItem = 0
|
||||
for row in range(index.row()-1, -1, -1):
|
||||
@ -406,7 +407,7 @@ class PieView(QAbstractItemView):
|
||||
for column in range(columns):
|
||||
index = self.model().index(row, column, self.rootIndex())
|
||||
region = self.itemRegion(index)
|
||||
if not region.intersect(QRegion(contentsRect)).isEmpty():
|
||||
if region.intersects(QRegion(contentsRect)):
|
||||
indexes.append(index)
|
||||
|
||||
if len(indexes) > 0:
|
||||
@ -558,15 +559,21 @@ class MainWindow(QMainWindow):
|
||||
for row in range(self.model.rowCount(QModelIndex())):
|
||||
pieces = []
|
||||
|
||||
pieces.append(self.model.data(self.model.index(row, 0, QModelIndex()),
|
||||
Qt.DisplayRole))
|
||||
pieces.append(str(self.model.data(self.model.index(row, 1, QModelIndex()),
|
||||
Qt.DisplayRole)))
|
||||
pieces.append(self.model.data(self.model.index(row, 0, QModelIndex()),
|
||||
Qt.DecorationRole).name())
|
||||
pieces.append(
|
||||
self.model.data(
|
||||
self.model.index(row, 0, QModelIndex()),
|
||||
Qt.DisplayRole))
|
||||
pieces.append(
|
||||
'%g' % self.model.data(
|
||||
self.model.index(row, 1, QModelIndex()),
|
||||
Qt.DisplayRole))
|
||||
pieces.append(
|
||||
self.model.data(
|
||||
self.model.index(row, 0, QModelIndex()),
|
||||
Qt.DecorationRole).name())
|
||||
|
||||
f.write(QByteArray(','.join(pieces)))
|
||||
f.write('\n')
|
||||
f.write(b','.join([p.encode('utf-8') for p in pieces]))
|
||||
f.write(b'\n')
|
||||
|
||||
f.close()
|
||||
self.statusBar().showMessage("Saved %s" % fileName, 2000)
|
||||
|
@ -3,8 +3,8 @@
|
||||
|
||||
#############################################################################
|
||||
##
|
||||
## Copyright (C) 2013 Riverbank Computing Limited
|
||||
## Copyright (C) 2010 Hans-Peter Jansen <hpj@urpla.net>.
|
||||
## Copyright (C) 2017 Riverbank Computing Limited
|
||||
## Copyright (C) 2017 Hans-Peter Jansen <hpj@urpla.net>.
|
||||
## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
## All rights reserved.
|
||||
##
|
||||
@ -65,9 +65,11 @@ class Window(QWidget):
|
||||
typeComboBox = QComboBox()
|
||||
self.nextButton = QPushButton("&Next")
|
||||
self.previousButton = QPushButton("&Previous")
|
||||
|
||||
nameLabel.setBuddy(nameEdit)
|
||||
addressLabel.setBuddy(addressEdit)
|
||||
typeLabel.setBuddy(typeComboBox)
|
||||
|
||||
typeComboBox.setModel(self.typeModel)
|
||||
|
||||
# Set up the mapper.
|
||||
@ -75,7 +77,7 @@ class Window(QWidget):
|
||||
self.mapper.setModel(self.model)
|
||||
self.mapper.addMapping(nameEdit, 0)
|
||||
self.mapper.addMapping(addressEdit, 1)
|
||||
self.mapper.addMapping(typeComboBox, 2, 'currentIndex')
|
||||
self.mapper.addMapping(typeComboBox, 2, b'currentIndex')
|
||||
|
||||
# Set up connections and layouts.
|
||||
self.previousButton.clicked.connect(self.mapper.toPrevious)
|
||||
@ -112,12 +114,9 @@ class Window(QWidget):
|
||||
types = ("0", "1", "2", "0", "2")
|
||||
|
||||
for row, name in enumerate(names):
|
||||
item = QStandardItem(name)
|
||||
self.model.setItem(row, 0, item)
|
||||
item = QStandardItem(addresses[row])
|
||||
self.model.setItem(row, 1, item)
|
||||
item = QStandardItem(types[row])
|
||||
self.model.setItem(row, 2, item)
|
||||
self.model.setItem(row, 0, QStandardItem(name))
|
||||
self.model.setItem(row, 1, QStandardItem(addresses[row]))
|
||||
self.model.setItem(row, 2, QStandardItem(types[row]))
|
||||
|
||||
def updateButtons(self, row):
|
||||
self.previousButton.setEnabled(row > 0)
|
||||
|
@ -3,7 +3,8 @@
|
||||
|
||||
#############################################################################
|
||||
##
|
||||
## Copyright (C) 2013 Riverbank Computing Limited.
|
||||
## Copyright (C) 2017 Riverbank Computing Limited.
|
||||
## Copyright (C) 2017 Hans-Peter Jansen <hpj@urpla.net>
|
||||
## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
## All rights reserved.
|
||||
##
|
||||
@ -44,22 +45,52 @@
|
||||
|
||||
import sys
|
||||
|
||||
from PyQt5.QtWidgets import QApplication, QFileSystemModel, QTreeView
|
||||
from PyQt5.QtCore import (QCommandLineOption, QCommandLineParser,
|
||||
QCoreApplication, QDir, QT_VERSION_STR)
|
||||
from PyQt5.QtWidgets import (QApplication, QFileIconProvider, QFileSystemModel,
|
||||
QTreeView)
|
||||
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
|
||||
QCoreApplication.setApplicationVersion(QT_VERSION_STR)
|
||||
parser = QCommandLineParser()
|
||||
parser.setApplicationDescription("Qt Dir View Example")
|
||||
parser.addHelpOption()
|
||||
parser.addVersionOption()
|
||||
|
||||
dontUseCustomDirectoryIconsOption = QCommandLineOption('c',
|
||||
"Set QFileIconProvider.DontUseCustomDirectoryIcons")
|
||||
parser.addOption(dontUseCustomDirectoryIconsOption)
|
||||
parser.addPositionalArgument('directory', "The directory to start in.")
|
||||
parser.process(app)
|
||||
try:
|
||||
rootPath = parser.positionalArguments().pop(0)
|
||||
except IndexError:
|
||||
rootPath = None
|
||||
|
||||
model = QFileSystemModel()
|
||||
model.setRootPath('')
|
||||
if parser.isSet(dontUseCustomDirectoryIconsOption):
|
||||
model.iconProvider().setOptions(
|
||||
QFileIconProvider.DontUseCustomDirectoryIcons)
|
||||
tree = QTreeView()
|
||||
tree.setModel(model)
|
||||
if rootPath is not None:
|
||||
rootIndex = model.index(QDir.cleanPath(rootPath))
|
||||
if rootIndex.isValid():
|
||||
tree.setRootIndex(rootIndex)
|
||||
|
||||
# Demonstrating look and feel features.
|
||||
tree.setAnimated(False)
|
||||
tree.setIndentation(20)
|
||||
tree.setSortingEnabled(True)
|
||||
|
||||
availableSize = QApplication.desktop().availableGeometry(tree).size()
|
||||
tree.resize(availableSize / 2)
|
||||
tree.setColumnWidth(0, tree.width() / 3)
|
||||
|
||||
tree.setWindowTitle("Dir View")
|
||||
tree.resize(640, 480)
|
||||
tree.show()
|
||||
|
||||
sys.exit(app.exec_())
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#############################################################################
|
||||
##
|
||||
## Copyright (C) 2013 Riverbank Computing Limited.
|
||||
## Copyright (C) 2017 Riverbank Computing Limited.
|
||||
## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
## All rights reserved.
|
||||
##
|
||||
@ -154,7 +154,7 @@ class TreeModel(QAbstractItemModel):
|
||||
if not index.isValid():
|
||||
return 0
|
||||
|
||||
return Qt.ItemIsEditable | Qt.ItemIsEnabled | Qt.ItemIsSelectable
|
||||
return Qt.ItemIsEditable | super(TreeModel, self).flags(index)
|
||||
|
||||
def getItem(self, index):
|
||||
if index.isValid():
|
||||
|
163
src/pyqt-official/itemviews/frozencolumn/frozencolumn.py
Normal file
163
src/pyqt-official/itemviews/frozencolumn/frozencolumn.py
Normal file
@ -0,0 +1,163 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
#############################################################################
|
||||
##
|
||||
## Copyright (C) 2017 Hans-Peter Jansen <hpj@urpla.net>
|
||||
## Copyright (C) 2016 The Qt Company Ltd.
|
||||
##
|
||||
## This file is part of the examples of the Qt Toolkit.
|
||||
##
|
||||
## $QT_BEGIN_LICENSE:BSD$
|
||||
## Commercial License Usage
|
||||
## Licensees holding valid commercial Qt licenses may use this file in
|
||||
## accordance with the commercial license agreement provided with the
|
||||
## Software or, alternatively, in accordance with the terms contained in
|
||||
## a written agreement between you and The Qt Company. For licensing terms
|
||||
## and conditions see https:#www.qt.io/terms-conditions. For further
|
||||
## information use the contact form at https:#www.qt.io/contact-us.
|
||||
##
|
||||
## BSD License Usage
|
||||
## Alternatively, you may use self 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, self list of conditions and the following disclaimer.
|
||||
## * Redistributions in binary form must reproduce the above copyright
|
||||
## notice, self 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 self 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$
|
||||
##
|
||||
#############################################################################
|
||||
|
||||
|
||||
from PyQt5.QtCore import QFile, QFileInfo, Qt
|
||||
from PyQt5.QtGui import QStandardItem, QStandardItemModel
|
||||
from PyQt5.QtWidgets import QApplication, QHeaderView, QTableView
|
||||
|
||||
|
||||
class FreezeTableWidget(QTableView):
|
||||
def __init__(self, model):
|
||||
super(FreezeTableWidget, self).__init__()
|
||||
self.setModel(model)
|
||||
self.frozenTableView = QTableView(self)
|
||||
self.init()
|
||||
self.horizontalHeader().sectionResized.connect(self.updateSectionWidth)
|
||||
self.verticalHeader().sectionResized.connect(self.updateSectionHeight)
|
||||
self.frozenTableView.verticalScrollBar().valueChanged.connect(
|
||||
self.verticalScrollBar().setValue)
|
||||
self.verticalScrollBar().valueChanged.connect(
|
||||
self.frozenTableView.verticalScrollBar().setValue)
|
||||
|
||||
def init(self):
|
||||
self.frozenTableView.setModel(self.model())
|
||||
self.frozenTableView.setFocusPolicy(Qt.NoFocus)
|
||||
self.frozenTableView.verticalHeader().hide()
|
||||
self.frozenTableView.horizontalHeader().setSectionResizeMode(
|
||||
QHeaderView.Fixed)
|
||||
self.viewport().stackUnder(self.frozenTableView)
|
||||
|
||||
self.frozenTableView.setStyleSheet('''
|
||||
QTableView { border: none;
|
||||
background-color: #8EDE21;
|
||||
selection-background-color: #999;
|
||||
}''') # for demo purposes
|
||||
|
||||
self.frozenTableView.setSelectionModel(self.selectionModel())
|
||||
for col in range(1, self.model().columnCount()):
|
||||
self.frozenTableView.setColumnHidden(col, True)
|
||||
self.frozenTableView.setColumnWidth(0, self.columnWidth(0))
|
||||
self.frozenTableView.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
|
||||
self.frozenTableView.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
|
||||
self.frozenTableView.show()
|
||||
self.updateFrozenTableGeometry()
|
||||
self.setHorizontalScrollMode(self.ScrollPerPixel)
|
||||
self.setVerticalScrollMode(self.ScrollPerPixel)
|
||||
self.frozenTableView.setVerticalScrollMode(self.ScrollPerPixel)
|
||||
|
||||
def updateSectionWidth(self, logicalIndex, oldSize, newSize):
|
||||
if self.logicalIndex == 0:
|
||||
self.frozenTableView.setColumnWidth(0, newSize)
|
||||
self.updateFrozenTableGeometry()
|
||||
|
||||
def updateSectionHeight(self, logicalIndex, oldSize, newSize):
|
||||
self.frozenTableView.setRowHeight(logicalIndex, newSize)
|
||||
|
||||
def resizeEvent(self, event):
|
||||
super(FreezeTableWidget, self).resizeEvent(event)
|
||||
self.updateFrozenTableGeometry()
|
||||
|
||||
def moveCursor(self, cursorAction, modifiers):
|
||||
current = super(FreezeTableWidget, self).moveCursor(cursorAction, modifiers)
|
||||
if (cursorAction == self.MoveLeft and
|
||||
self.current.column() > 0 and
|
||||
self.visualRect(current).topLeft().x() <
|
||||
self.frozenTableView.columnWidth(0)):
|
||||
newValue = (self.horizontalScrollBar().value() +
|
||||
self.visualRect(current).topLeft().x() -
|
||||
self.frozenTableView.columnWidth(0))
|
||||
self.horizontalScrollBar().setValue(newValue)
|
||||
return current
|
||||
|
||||
def scrollTo(self, index, hint):
|
||||
if index.column() > 0:
|
||||
super(FreezeTableWidget, self).scrollTo(index, hint)
|
||||
|
||||
def updateFrozenTableGeometry(self):
|
||||
self.frozenTableView.setGeometry(
|
||||
self.verticalHeader().width() + self.frameWidth(),
|
||||
self.frameWidth(), self.columnWidth(0),
|
||||
self.viewport().height() + self.horizontalHeader().height())
|
||||
|
||||
|
||||
def main(args):
|
||||
def split_and_strip(s, splitter):
|
||||
return [s.strip() for s in line.split(splitter)]
|
||||
|
||||
app = QApplication(args)
|
||||
model = QStandardItemModel()
|
||||
file = QFile(QFileInfo(__file__).absolutePath() + '/grades.txt')
|
||||
if file.open(QFile.ReadOnly):
|
||||
line = file.readLine(200).decode('utf-8')
|
||||
header = split_and_strip(line, ',')
|
||||
model.setHorizontalHeaderLabels(header)
|
||||
row = 0
|
||||
while file.canReadLine():
|
||||
line = file.readLine(200).decode('utf-8')
|
||||
if not line.startswith('#') and ',' in line:
|
||||
fields = split_and_strip(line, ',')
|
||||
for col, field in enumerate(fields):
|
||||
newItem = QStandardItem(field)
|
||||
model.setItem(row, col, newItem)
|
||||
row += 1
|
||||
file.close()
|
||||
tableView = FreezeTableWidget(model)
|
||||
tableView.setWindowTitle("Frozen Column Example")
|
||||
tableView.resize(560, 680)
|
||||
tableView.show()
|
||||
return app.exec_()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
main(sys.argv)
|
36
src/pyqt-official/itemviews/frozencolumn/grades.txt
Normal file
36
src/pyqt-official/itemviews/frozencolumn/grades.txt
Normal file
@ -0,0 +1,36 @@
|
||||
France , Norway , YDS , UK(tech.), UK(adj.) , UIAA , Ger , Australia , Finland , Brazil
|
||||
|
||||
1, , 5.2, , , I , I , , , Isup
|
||||
2, , 5.3, , , II , II , 11, , II
|
||||
3, 3, 5.4, , , III , III , 12, , IIsup
|
||||
4, 4, 5.5, 4a , VD , IV , IV , 12, , III
|
||||
5a , 5-, 5.6, , S , V- , V , 13, 5-, IIIsup
|
||||
5b , 5, 5.7, 4b , HS , V , VI , 14, 5, IV
|
||||
, , , 4c , , V+ , , 15, ,
|
||||
5c , 5+, 5.8, , VS , VI- , VIIa , 16, 5, IVsup
|
||||
6a , 6-, 5.9, 5a , HVS , VI , VIIb , 17, , V
|
||||
6a+ , 6-/6 , 5.10a , , E1 , VI+ , VIIc , 18, 6-, VI
|
||||
6b , , 5.10b , 5b , , , , 19, , VI/VI+
|
||||
6b+ , 6, 5.10c , , E2 , VII- , VIIIa , 20, 6, VIsup/VI+
|
||||
6c , 6+, 5.10d , 5c , , VII , VIIIb , 21, , VIsup
|
||||
6c+ , 7-, 5.11a , , E3 , VII+ , VIIIc , 22, 6, 7a
|
||||
6c+ , 7, 5.11b , , , , , 23, , 7b
|
||||
7a , 7+, 5.11c , 6a , E4 , VIII- , IXa , 24, 7-, 7c
|
||||
7a , 7+/8- , 5.11d , , , VIII , IXb , , , 7c
|
||||
7a+ , 8-, 5.12a , , E5 , VIII+ , IXc , 25, 7, 8a
|
||||
7b , 8, 5.12b , 6b , , , , 26, 8-, 8b
|
||||
7b+ , 8/8+ , 5.12c , , E6 , IX- , Xa , 27, 8, 8c
|
||||
7c , 8+, 5.12d , 6c , , IX , Xb , 28, 8, 9a
|
||||
7c+ , 9-, 5.13a , , E7 , IX+ , Xc , 29, 9-, 9b
|
||||
8a , , 5.13b , , , , , , 9, 9c
|
||||
8a+ , 9-/9 , 5.13c , 7a , , X- , , 30, 9, 10a
|
||||
8b , 9, 5.13d , , E8 , X , , 31, 10-, 10b
|
||||
8b+ , 9/9+ , 5.14a , , , X+ , , 32, 10, 10c
|
||||
8c , 9+, 5.14b , 7b , , , , 33, 10, 11a
|
||||
8c+ , 10-, 5.14c , , E9 , XI- , , 34, 11-, 11b
|
||||
9a , 10, 5.14d , 7c , , XI , , 35, 11, 11c
|
||||
9a+ , , 5.15a , , , XI+ , , , , 12a
|
||||
9b , , 5.15b , , , , , , , 12b
|
||||
|
||||
# Wikipedia contributors. Grade (climbing). Wikipedia, The Free Encyclopedia. May 15, 2009, 20:42 UTC.
|
||||
# Available at: http://en.wikipedia.org/w/index.php?title=Grade_(climbing)&oldid=290165724. Accessed May 28, 2009.
|
BIN
src/pyqt-official/itemviews/interview/images/interview.png
Normal file
BIN
src/pyqt-official/itemviews/interview/images/interview.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 174 B |
BIN
src/pyqt-official/itemviews/interview/images/services.png
Normal file
BIN
src/pyqt-official/itemviews/interview/images/services.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.7 KiB |
191
src/pyqt-official/itemviews/interview/interview.py
Normal file
191
src/pyqt-official/itemviews/interview/interview.py
Normal file
@ -0,0 +1,191 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
#############################################################################
|
||||
##
|
||||
## Copyright (C) 2017 Hans-Peter Jansen <hpj@urpla.net>
|
||||
## Copyright (C) 2016 The Qt Company Ltd.
|
||||
##
|
||||
## This file is part of the examples of the Qt Toolkit.
|
||||
##
|
||||
## $QT_BEGIN_LICENSE:BSD$
|
||||
## Commercial License Usage
|
||||
## Licensees holding valid commercial Qt licenses may use this file in
|
||||
## accordance with the commercial license agreement provided with the
|
||||
## Software or, alternatively, in accordance with the terms contained in
|
||||
## a written agreement between you and The Qt Company. For licensing terms
|
||||
## and conditions see https:#www.qt.io/terms-conditions. For further
|
||||
## information use the contact form at https:#www.qt.io/contact-us.
|
||||
##
|
||||
## BSD License Usage
|
||||
## Alternatively, you may use self 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, self list of conditions and the following disclaimer.
|
||||
## * Redistributions in binary form must reproduce the above copyright
|
||||
## notice, self 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 self 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$
|
||||
##
|
||||
#############################################################################
|
||||
|
||||
|
||||
from PyQt5.QtCore import (QAbstractItemModel, QFileInfo, QItemSelectionModel,
|
||||
QModelIndex, Qt)
|
||||
from PyQt5.QtGui import QIcon
|
||||
from PyQt5.QtWidgets import (QAbstractItemView, QApplication,
|
||||
QFileIconProvider, QListView, QSplitter, QTableView, QTreeView)
|
||||
|
||||
|
||||
images_dir = QFileInfo(__file__).absolutePath() + '/images'
|
||||
|
||||
|
||||
class Node(object):
|
||||
def __init__(self, parent = None):
|
||||
self.parent = parent
|
||||
self.children = []
|
||||
|
||||
|
||||
class Model(QAbstractItemModel):
|
||||
def __init__(self, rows, columns, parent = None):
|
||||
super(Model, self).__init__(parent)
|
||||
self.services = QIcon(images_dir + '/services.png')
|
||||
self.rc = rows
|
||||
self.cc = columns
|
||||
self.tree = [Node() for node in range(rows)]
|
||||
self.iconProvider = QFileIconProvider()
|
||||
|
||||
def index(self, row, column, parent):
|
||||
if row < self.rc and row >= 0 and column < self.cc and column >= 0:
|
||||
parentNode = parent.internalPointer()
|
||||
childNode = self.node(row, parentNode)
|
||||
if childNode is not None:
|
||||
return self.createIndex(row, column, childNode)
|
||||
return QModelIndex()
|
||||
|
||||
def parent(self, child):
|
||||
if isinstance(child, QModelIndex):
|
||||
# parent of QModelIndex child
|
||||
if child.isValid():
|
||||
childNode = child.internalPointer()
|
||||
parentNode = self.parent(childNode)
|
||||
if parentNode:
|
||||
return self.createIndex(self.row(parentNode), 0, parentNode)
|
||||
return QModelIndex()
|
||||
else:
|
||||
# parent of Node
|
||||
if child:
|
||||
return child.parent
|
||||
|
||||
def rowCount(self, parent):
|
||||
if parent.isValid() and parent.column() != 0:
|
||||
return 0
|
||||
return self.rc
|
||||
|
||||
def columnCount(self, parent):
|
||||
return self.cc
|
||||
|
||||
def data(self, index, role):
|
||||
if not index.isValid():
|
||||
return None
|
||||
elif role == Qt.DisplayRole:
|
||||
return "Item %d:%s" % (index.row(), index.column())
|
||||
elif role == Qt.DecorationRole:
|
||||
if index.column() == 0:
|
||||
return self.iconProvider.icon(QFileIconProvider.Folder)
|
||||
return self.iconProvider.icon(QFileIconProvider.File)
|
||||
return None
|
||||
|
||||
def headerData(self, section, orientation, role):
|
||||
if role == Qt.DisplayRole:
|
||||
return str(section)
|
||||
if role == Qt.DecorationRole:
|
||||
return self.services
|
||||
return super(Model, self).headerData(section, orientation, role)
|
||||
|
||||
def hasChildren(self, parent):
|
||||
if parent.isValid() and parent.column() != 0:
|
||||
return False
|
||||
return self.rc > 0 and self.cc > 0
|
||||
|
||||
def flags(self, index):
|
||||
if not index.isValid():
|
||||
return 0
|
||||
return Qt.ItemIsDragEnabled | super(Model, self).flags(index)
|
||||
|
||||
def node(self, row, parent):
|
||||
if parent and not parent.children:
|
||||
parent.children = [Node(parent) for node in range(self.rc)]
|
||||
if parent:
|
||||
return parent.children[row]
|
||||
else:
|
||||
return self.tree[row]
|
||||
|
||||
def row(self, node):
|
||||
if node.parent:
|
||||
return node.parent.children.index(node)
|
||||
else:
|
||||
return self.tree.index(node)
|
||||
|
||||
|
||||
def main(args):
|
||||
app = QApplication(args)
|
||||
page = QSplitter()
|
||||
data = Model(1000, 10, page)
|
||||
selections = QItemSelectionModel(data)
|
||||
table = QTableView()
|
||||
table.setModel(data)
|
||||
table.setSelectionModel(selections)
|
||||
table.horizontalHeader().setSectionsMovable(True)
|
||||
table.verticalHeader().setSectionsMovable(True)
|
||||
# Set StaticContents to enable minimal repaints on resizes.
|
||||
table.viewport().setAttribute(Qt.WA_StaticContents)
|
||||
page.addWidget(table)
|
||||
tree = QTreeView()
|
||||
tree.setModel(data)
|
||||
tree.setSelectionModel(selections)
|
||||
tree.setUniformRowHeights(True)
|
||||
tree.header().setStretchLastSection(False)
|
||||
tree.viewport().setAttribute(Qt.WA_StaticContents)
|
||||
# Disable the focus rect to get minimal repaints when scrolling on Mac.
|
||||
tree.setAttribute(Qt.WA_MacShowFocusRect, False)
|
||||
page.addWidget(tree)
|
||||
list = QListView()
|
||||
list.setModel(data)
|
||||
list.setSelectionModel(selections)
|
||||
list.setViewMode(QListView.IconMode)
|
||||
list.setSelectionMode(QAbstractItemView.ExtendedSelection)
|
||||
list.setAlternatingRowColors(False)
|
||||
list.viewport().setAttribute(Qt.WA_StaticContents)
|
||||
list.setAttribute(Qt.WA_MacShowFocusRect, False)
|
||||
page.addWidget(list)
|
||||
page.setWindowIcon(QIcon(images_dir + '/interview.png'))
|
||||
page.setWindowTitle("Interview")
|
||||
page.show()
|
||||
return app.exec_()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
main(sys.argv)
|
@ -3,7 +3,7 @@
|
||||
|
||||
#############################################################################
|
||||
##
|
||||
## Copyright (C) 2013 Riverbank Computing Limited.
|
||||
## Copyright (C) 2017 Riverbank Computing Limited.
|
||||
## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
## All rights reserved.
|
||||
##
|
||||
@ -45,7 +45,7 @@
|
||||
from PyQt5.QtCore import (QAbstractTableModel, QDir, QModelIndex, QRect,
|
||||
QRectF, QSize, Qt)
|
||||
from PyQt5.QtGui import QBrush, qGray, QImage, QPainter
|
||||
from PyQt5.QtPrintSupport import QPrinter
|
||||
from PyQt5.QtPrintSupport import QPrintDialog, QPrinter
|
||||
from PyQt5.QtWidgets import (QAbstractItemDelegate, QApplication, QDialog,
|
||||
QFileDialog, QHBoxLayout, QLabel, QMainWindow, QMessageBox, QMenu,
|
||||
QProgressDialog, QSpinBox, QStyle, QStyleOptionViewItem, QTableView,
|
||||
@ -243,8 +243,8 @@ class MainWindow(QMainWindow):
|
||||
yscale = printer.pageRect().height() / float(sourceHeight)
|
||||
scale = min(xscale, yscale)
|
||||
|
||||
painter.translate(printer.pageRect().x()+printer.pageRect().width()/2,
|
||||
printer.pageRect().y()+printer.pageRect().height()/2)
|
||||
painter.translate(printer.paperRect().x()+printer.pageRect().width()/2,
|
||||
printer.paperRect().y()+printer.pageRect().height()/2)
|
||||
painter.scale(scale, scale)
|
||||
painter.translate(-sourceWidth/2, -sourceHeight/2)
|
||||
|
||||
@ -252,6 +252,7 @@ class MainWindow(QMainWindow):
|
||||
parent = QModelIndex()
|
||||
|
||||
progress = QProgressDialog("Printing...", "Cancel", 0, rows, self)
|
||||
progress.setWindowModality(Qt.ApplicationModal)
|
||||
y = ItemSize / 2.0
|
||||
|
||||
for row in range(rows):
|
||||
@ -264,11 +265,11 @@ class MainWindow(QMainWindow):
|
||||
|
||||
for column in range(columns):
|
||||
option.rect = QRect(x, y, ItemSize, ItemSize)
|
||||
self.view.itemDelegate.paint(painter, option,
|
||||
self.view.itemDelegate().paint(painter, option,
|
||||
self.model.index(row, column, parent))
|
||||
x = x + ItemSize
|
||||
x += ItemSize
|
||||
|
||||
y = y + ItemSize
|
||||
y += ItemSize
|
||||
|
||||
progress.setValue(rows)
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#############################################################################
|
||||
##
|
||||
## Copyright (C) 2013 Riverbank Computing Limited.
|
||||
## Copyright (C) 2017 Riverbank Computing Limited.
|
||||
## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
## All rights reserved.
|
||||
##
|
||||
@ -44,12 +44,14 @@
|
||||
|
||||
from PyQt5.QtCore import QModelIndex, Qt
|
||||
from PyQt5.QtGui import QStandardItemModel
|
||||
from PyQt5.QtWidgets import QApplication, QItemDelegate, QSpinBox, QTableView
|
||||
from PyQt5.QtWidgets import (QApplication, QSpinBox, QStyledItemDelegate,
|
||||
QTableView)
|
||||
|
||||
|
||||
class SpinBoxDelegate(QItemDelegate):
|
||||
class SpinBoxDelegate(QStyledItemDelegate):
|
||||
def createEditor(self, parent, option, index):
|
||||
editor = QSpinBox(parent)
|
||||
editor.setFrame(False)
|
||||
editor.setMinimum(0)
|
||||
editor.setMaximum(100)
|
||||
|
||||
|
164
src/pyqt-official/itemviews/storageview.py
Normal file
164
src/pyqt-official/itemviews/storageview.py
Normal file
@ -0,0 +1,164 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
#############################################################################
|
||||
##
|
||||
## Copyright (C) 2017 Hans-Peter Jansen <hpj@urpla.net>
|
||||
## Copyright (C) 2016 The Qt Company Ltd.
|
||||
## Copyright (C) 2016 Ivan Komissarov
|
||||
##
|
||||
## This file is part of the examples of the Qt Toolkit.
|
||||
##
|
||||
## $QT_BEGIN_LICENSE:BSD$
|
||||
## Commercial License Usage
|
||||
## Licensees holding valid commercial Qt licenses may use this file in
|
||||
## accordance with the commercial license agreement provided with the
|
||||
## Software or, alternatively, in accordance with the terms contained in
|
||||
## a written agreement between you and The Qt Company. For licensing terms
|
||||
## and conditions see https:#www.qt.io/terms-conditions. For further
|
||||
## information use the contact form at https:#www.qt.io/contact-us.
|
||||
##
|
||||
## BSD License Usage
|
||||
## Alternatively, you may use self 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, self list of conditions and the following disclaimer.
|
||||
## * Redistributions in binary form must reproduce the above copyright
|
||||
## notice, self 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 self 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 math
|
||||
|
||||
from PyQt5.QtCore import QAbstractTableModel, QByteArray, QDir, QStorageInfo, Qt
|
||||
from PyQt5.QtWidgets import QAbstractItemView, QApplication, QTreeView
|
||||
|
||||
|
||||
def sizeToString(size):
|
||||
if size <= 0:
|
||||
return "0 b"
|
||||
decimals = 2
|
||||
units = ["b", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"]
|
||||
power = int(math.log(size, 1024))
|
||||
try:
|
||||
unit = units[power]
|
||||
except IndexError:
|
||||
unit = units[-1]
|
||||
power = len(units) - 1
|
||||
if power == 0:
|
||||
decimals = 0
|
||||
normsize = size / math.pow(1024, power)
|
||||
#: this should expand to "1.23 GB"
|
||||
return "%0.*f %s" % (decimals, normsize, unit)
|
||||
|
||||
|
||||
class StorageModel(QAbstractTableModel):
|
||||
ColumnRootPath, ColumnName, ColumnDevice, ColumnFileSystemName, \
|
||||
ColumnTotal, ColumnFree, ColumnAvailable, ColumnIsReady, \
|
||||
ColumnIsReadOnly, ColumnIsValid, ColumnCount = range(11)
|
||||
|
||||
columnFuncMap = {
|
||||
ColumnRootPath: lambda volume: QDir.toNativeSeparators(volume.rootPath()),
|
||||
ColumnName: lambda volume: volume.name(),
|
||||
ColumnDevice: lambda volume: volume.device(),
|
||||
ColumnFileSystemName: lambda volume: volume.fileSystemType(),
|
||||
ColumnTotal: lambda volume: sizeToString(volume.bytesTotal()),
|
||||
ColumnFree: lambda volume: sizeToString(volume.bytesFree()),
|
||||
ColumnAvailable: lambda volume: sizeToString(volume.bytesAvailable()),
|
||||
ColumnIsReady: lambda volume: volume.isReady(),
|
||||
ColumnIsReadOnly: lambda volume: volume.isReadOnly(),
|
||||
ColumnIsValid: lambda volume: volume.isValid(),
|
||||
}
|
||||
|
||||
columnNameMap = {
|
||||
ColumnRootPath: "Root path",
|
||||
ColumnName: "Volume Name",
|
||||
ColumnDevice: "Device",
|
||||
ColumnFileSystemName: "File system",
|
||||
ColumnTotal: "Total",
|
||||
ColumnFree: "Free",
|
||||
ColumnAvailable: "Available",
|
||||
ColumnIsReady: "Ready",
|
||||
ColumnIsReadOnly: "Read-only",
|
||||
ColumnIsValid: "Valid",
|
||||
}
|
||||
|
||||
def __init__(self, parent = None):
|
||||
super(StorageModel, self).__init__(parent)
|
||||
self.volumes = QStorageInfo.mountedVolumes()
|
||||
|
||||
def columnCount(self, parent = None):
|
||||
return self.ColumnCount
|
||||
|
||||
def rowCount(self, parent):
|
||||
if parent.isValid():
|
||||
return 0
|
||||
return len(self.volumes)
|
||||
|
||||
def data(self, index, role):
|
||||
if not index.isValid():
|
||||
return None
|
||||
if role == Qt.DisplayRole:
|
||||
volume = self.volumes[index.row()]
|
||||
func = self.columnFuncMap.get(index.column())
|
||||
if func is not None:
|
||||
return func(volume)
|
||||
|
||||
elif role == Qt.ToolTipRole:
|
||||
volume = self.volumes[index.row()]
|
||||
tooltip = []
|
||||
for column in range(self.ColumnCount):
|
||||
label = self.columnNameMap.get(column)
|
||||
value = self.columnFuncMap[column](volume)
|
||||
if isinstance(value, QByteArray):
|
||||
value = str(bytes(value).decode('utf-8'))
|
||||
tooltip.append("{0}: {1}".format(label, value))
|
||||
return "\n".join(tooltip)
|
||||
|
||||
def headerData(self, section, orientation, role):
|
||||
if orientation != Qt.Horizontal:
|
||||
return None
|
||||
if role != Qt.DisplayRole:
|
||||
return None
|
||||
return self.columnNameMap.get(section)
|
||||
|
||||
|
||||
def main(args):
|
||||
app = QApplication (args)
|
||||
view = QTreeView()
|
||||
view.setModel(StorageModel(view))
|
||||
view.resize(640, 480)
|
||||
view.setSelectionBehavior(QAbstractItemView.SelectRows)
|
||||
for column in range(view.model().columnCount()):
|
||||
view.resizeColumnToContents(column)
|
||||
view.show()
|
||||
return app.exec_()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
main(sys.argv)
|
@ -337,7 +337,7 @@ class Camera(QMainWindow):
|
||||
super(Camera, self).keyReleaseEvent(event)
|
||||
|
||||
def updateRecordTime(self):
|
||||
msg = "Recorded %d sec" % self.mediaRecorder.duration() // 1000
|
||||
msg = "Recorded %d sec" % (self.mediaRecorder.duration() // 1000)
|
||||
self.ui.statusbar.showMessage(msg)
|
||||
|
||||
def processCapturedImage(self, requestId, img):
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#############################################################################
|
||||
##
|
||||
## Copyright (C) 2015 Riverbank Computing Limited.
|
||||
## Copyright (C) 2018 Riverbank Computing Limited.
|
||||
## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
## All rights reserved.
|
||||
##
|
||||
@ -46,7 +46,7 @@ import sys
|
||||
import math
|
||||
|
||||
from PyQt5.QtCore import pyqtSignal, QSize, Qt, QTimer
|
||||
from PyQt5.QtGui import QPixmap
|
||||
from PyQt5.QtGui import QOpenGLVersionProfile, QPixmap
|
||||
from PyQt5.QtWidgets import (QAction, QApplication, QGridLayout, QLabel,
|
||||
QLineEdit, QMainWindow, QMessageBox, QOpenGLWidget, QScrollArea,
|
||||
QSizePolicy, QSlider, QWidget)
|
||||
@ -97,7 +97,9 @@ class GLWidget(QOpenGLWidget):
|
||||
self.update()
|
||||
|
||||
def initializeGL(self):
|
||||
self.gl = self.context().versionFunctions()
|
||||
version_profile = QOpenGLVersionProfile()
|
||||
version_profile.setVersion(2, 0)
|
||||
self.gl = self.context().versionFunctions(version_profile)
|
||||
self.gl.initializeOpenGLFunctions()
|
||||
|
||||
lightPos = (5.0, 5.0, 10.0, 1.0)
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#############################################################################
|
||||
##
|
||||
## Copyright (C) 2015 Riverbank Computing Limited.
|
||||
## Copyright (C) 2018 Riverbank Computing Limited.
|
||||
## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
## All rights reserved.
|
||||
##
|
||||
@ -46,7 +46,7 @@ import sys
|
||||
import math
|
||||
|
||||
from PyQt5.QtCore import pyqtSignal, QPoint, QSize, Qt
|
||||
from PyQt5.QtGui import QColor
|
||||
from PyQt5.QtGui import QColor, QOpenGLVersionProfile
|
||||
from PyQt5.QtWidgets import (QApplication, QHBoxLayout, QOpenGLWidget, QSlider,
|
||||
QWidget)
|
||||
|
||||
@ -139,7 +139,9 @@ class GLWidget(QOpenGLWidget):
|
||||
self.update()
|
||||
|
||||
def initializeGL(self):
|
||||
self.gl = self.context().versionFunctions()
|
||||
version_profile = QOpenGLVersionProfile()
|
||||
version_profile.setVersion(2, 0)
|
||||
self.gl = self.context().versionFunctions(version_profile)
|
||||
self.gl.initializeOpenGLFunctions()
|
||||
|
||||
self.setClearColor(self.trolltechPurple.darker())
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#############################################################################
|
||||
##
|
||||
## Copyright (C) 2013 Riverbank Computing Limited.
|
||||
## Copyright (C) 2018 Riverbank Computing Limited.
|
||||
## Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
## Contact: http://www.qt-project.org/legal
|
||||
##
|
||||
@ -46,7 +46,8 @@ import array
|
||||
|
||||
from PyQt5.QtCore import QEvent
|
||||
from PyQt5.QtGui import (QGuiApplication, QMatrix4x4, QOpenGLContext,
|
||||
QOpenGLShader, QOpenGLShaderProgram, QSurfaceFormat, QWindow)
|
||||
QOpenGLShader, QOpenGLShaderProgram, QOpenGLVersionProfile,
|
||||
QSurfaceFormat, QWindow)
|
||||
|
||||
|
||||
class OpenGLWindow(QWindow):
|
||||
@ -92,7 +93,9 @@ class OpenGLWindow(QWindow):
|
||||
self.m_context.makeCurrent(self)
|
||||
|
||||
if needsInitialize:
|
||||
self.m_gl = self.m_context.versionFunctions()
|
||||
version_profile = QOpenGLVersionProfile()
|
||||
version_profile.setVersion(2, 0)
|
||||
self.m_gl = self.m_context.versionFunctions(version_profile)
|
||||
self.m_gl.initializeOpenGLFunctions()
|
||||
|
||||
self.initialize()
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#############################################################################
|
||||
##
|
||||
## Copyright (C) 2015 Riverbank Computing Limited.
|
||||
## Copyright (C) 2018 Riverbank Computing Limited.
|
||||
## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
## All rights reserved.
|
||||
##
|
||||
@ -47,8 +47,8 @@ import math, random
|
||||
|
||||
from PyQt5.QtCore import (QPoint, QPointF, QRect, QRectF, QSize, Qt, QTime,
|
||||
QTimer)
|
||||
from PyQt5.QtGui import (QBrush, QColor, QFontMetrics, QImage, QPainter,
|
||||
QRadialGradient, QSurfaceFormat)
|
||||
from PyQt5.QtGui import (QBrush, QColor, QFontMetrics, QImage,
|
||||
QOpenGLVersionProfile, QPainter, QRadialGradient, QSurfaceFormat)
|
||||
from PyQt5.QtWidgets import QApplication, QOpenGLWidget
|
||||
|
||||
|
||||
@ -157,7 +157,9 @@ class GLWidget(QOpenGLWidget):
|
||||
self.zRot = angle
|
||||
|
||||
def initializeGL(self):
|
||||
self.gl = self.context().versionFunctions()
|
||||
version_profile = QOpenGLVersionProfile()
|
||||
version_profile.setVersion(2, 0)
|
||||
self.gl = self.context().versionFunctions(version_profile)
|
||||
self.gl.initializeOpenGLFunctions()
|
||||
|
||||
self.object = self.makeObject()
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#############################################################################
|
||||
##
|
||||
## Copyright (C) 2015 Riverbank Computing Limited.
|
||||
## Copyright (C) 2018 Riverbank Computing Limited.
|
||||
## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
## All rights reserved.
|
||||
##
|
||||
@ -46,7 +46,8 @@ import sys
|
||||
|
||||
from PyQt5.QtCore import pyqtSignal, QFileInfo, QPoint, QSize, Qt, QTimer
|
||||
from PyQt5.QtGui import (QColor, QImage, QMatrix4x4, QOpenGLShader,
|
||||
QOpenGLShaderProgram, QOpenGLTexture, QSurfaceFormat)
|
||||
QOpenGLShaderProgram, QOpenGLTexture, QOpenGLVersionProfile,
|
||||
QSurfaceFormat)
|
||||
from PyQt5.QtWidgets import QApplication, QGridLayout, QOpenGLWidget, QWidget
|
||||
|
||||
|
||||
@ -114,7 +115,9 @@ void main(void)
|
||||
self.update()
|
||||
|
||||
def initializeGL(self):
|
||||
self.gl = self.context().versionFunctions()
|
||||
version_profile = QOpenGLVersionProfile()
|
||||
version_profile.setVersion(2, 0)
|
||||
self.gl = self.context().versionFunctions(version_profile)
|
||||
self.gl.initializeOpenGLFunctions()
|
||||
|
||||
self.makeObject()
|
||||
|
@ -82,8 +82,10 @@
|
||||
<example filename="coloreditorfactory" name="Color Editor Factory" image="coloreditorfactoryimage.png"/>
|
||||
<example filename="combowidgetmapper" name="Combo Widget Mapper" />
|
||||
<example filename="dirview" name="Directory View" />
|
||||
<example filename="fetchmore" name="Fetch More" />
|
||||
<example filename="editabletreemodel" name="Editable Tree Model" />
|
||||
<example filename="fetchmore" name="Fetch More" />
|
||||
<example filename="frozencolumn" name="Frozen Column" />
|
||||
<example filename="interview" name="Interview" />
|
||||
<example filename="pixelator" name="Pixelator" />
|
||||
<example filename="puzzle" name="Puzzle " image="itemviewspuzzle-example.png"/>
|
||||
<example filename="simpledommodel" name="Simple DOM Model" />
|
||||
@ -92,6 +94,7 @@
|
||||
<example filename="spinboxdelegate" name="Spin Box Delegate" />
|
||||
<example filename="spreadsheet" name="Spreadsheet"/>
|
||||
<example filename="stardelegate" name="Star Delegate" />
|
||||
<example filename="storageview" name="Storage View" />
|
||||
</category>
|
||||
<category dirname="layouts" name="Layouts">
|
||||
<example filename="basiclayouts" name="Basic Layouts" />
|
||||
|
0
src/pyqt-official/qtdemo/qtdemo.pyw → src/pyqt-official/qtdemo/qtdemo.py
Normal file → Executable file
0
src/pyqt-official/qtdemo/qtdemo.pyw → src/pyqt-official/qtdemo/qtdemo.py
Normal file → Executable file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -3,7 +3,7 @@
|
||||
|
||||
#############################################################################
|
||||
##
|
||||
## Copyright (C) 2016 Riverbank Computing Limited.
|
||||
## Copyright (C) 2018 Riverbank Computing Limited.
|
||||
## Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
##
|
||||
## This file is part of the examples of PyQt.
|
||||
@ -100,8 +100,14 @@ class AnimalModel(QAbstractListModel):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import os
|
||||
import sys
|
||||
|
||||
# This is necessary to avoid a possible crash when running from another
|
||||
# directory by ensuring the compiled version of the embedded QML file
|
||||
# doesn't get mixed up with another of the same name.
|
||||
os.chdir(os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
app = QGuiApplication(sys.argv)
|
||||
|
||||
model = AnimalModel()
|
||||
|
@ -2,8 +2,7 @@
|
||||
|
||||
# Resource object code
|
||||
#
|
||||
# Created: Tue Jul 23 11:31:33 2013
|
||||
# by: The Resource Compiler for PyQt (Qt v5.1.0)
|
||||
# Created by: The Resource Compiler for PyQt5 (Qt v5.10.1)
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
||||
@ -156,15 +155,30 @@ qt_resource_name = b"\
|
||||
\x00\x69\x00\x65\x00\x77\x00\x2e\x00\x71\x00\x6d\x00\x6c\
|
||||
"
|
||||
|
||||
qt_resource_struct = b"\
|
||||
qt_resource_struct_v1 = b"\
|
||||
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x01\
|
||||
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\
|
||||
"
|
||||
|
||||
qt_resource_struct_v2 = b"\
|
||||
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x01\
|
||||
\x00\x00\x00\x00\x00\x00\x00\x00\
|
||||
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\
|
||||
\x00\x00\x01\x61\x10\x60\xec\xb8\
|
||||
"
|
||||
|
||||
qt_version = [int(v) for v in QtCore.qVersion().split('.')]
|
||||
if qt_version < [5, 8, 0]:
|
||||
rcc_version = 1
|
||||
qt_resource_struct = qt_resource_struct_v1
|
||||
else:
|
||||
rcc_version = 2
|
||||
qt_resource_struct = qt_resource_struct_v2
|
||||
|
||||
def qInitResources():
|
||||
QtCore.qRegisterResourceData(0x01, qt_resource_struct, qt_resource_name, qt_resource_data)
|
||||
QtCore.qRegisterResourceData(rcc_version, qt_resource_struct, qt_resource_name, qt_resource_data)
|
||||
|
||||
def qCleanupResources():
|
||||
QtCore.qUnregisterResourceData(0x01, qt_resource_struct, qt_resource_name, qt_resource_data)
|
||||
QtCore.qUnregisterResourceData(rcc_version, qt_resource_struct, qt_resource_name, qt_resource_data)
|
||||
|
||||
qInitResources()
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#############################################################################
|
||||
##
|
||||
## Copyright (C) 2013 Riverbank Computing Limited.
|
||||
## Copyright (C) 2018 Riverbank Computing Limited.
|
||||
## Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
##
|
||||
## This file is part of the examples of PyQt.
|
||||
@ -82,8 +82,14 @@ class DataObject(QObject):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import os
|
||||
import sys
|
||||
|
||||
# This is necessary to avoid a possible crash when running from another
|
||||
# directory by ensuring the compiled version of the embedded QML file
|
||||
# doesn't get mixed up with another of the same name.
|
||||
os.chdir(os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
app = QGuiApplication(sys.argv)
|
||||
|
||||
dataList = [DataObject("Item 1", 'red'),
|
||||
|
@ -2,8 +2,7 @@
|
||||
|
||||
# Resource object code
|
||||
#
|
||||
# Created: Mon Jul 22 22:27:26 2013
|
||||
# by: The Resource Compiler for PyQt (Qt v5.1.0)
|
||||
# Created by: The Resource Compiler for PyQt5 (Qt v5.10.1)
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
||||
@ -161,15 +160,30 @@ qt_resource_name = b"\
|
||||
\x00\x69\x00\x65\x00\x77\x00\x2e\x00\x71\x00\x6d\x00\x6c\
|
||||
"
|
||||
|
||||
qt_resource_struct = b"\
|
||||
qt_resource_struct_v1 = b"\
|
||||
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x01\
|
||||
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\
|
||||
"
|
||||
|
||||
qt_resource_struct_v2 = b"\
|
||||
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x01\
|
||||
\x00\x00\x00\x00\x00\x00\x00\x00\
|
||||
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\
|
||||
\x00\x00\x01\x61\x10\x60\xec\xb8\
|
||||
"
|
||||
|
||||
qt_version = [int(v) for v in QtCore.qVersion().split('.')]
|
||||
if qt_version < [5, 8, 0]:
|
||||
rcc_version = 1
|
||||
qt_resource_struct = qt_resource_struct_v1
|
||||
else:
|
||||
rcc_version = 2
|
||||
qt_resource_struct = qt_resource_struct_v2
|
||||
|
||||
def qInitResources():
|
||||
QtCore.qRegisterResourceData(0x01, qt_resource_struct, qt_resource_name, qt_resource_data)
|
||||
QtCore.qRegisterResourceData(rcc_version, qt_resource_struct, qt_resource_name, qt_resource_data)
|
||||
|
||||
def qCleanupResources():
|
||||
QtCore.qUnregisterResourceData(0x01, qt_resource_struct, qt_resource_name, qt_resource_data)
|
||||
QtCore.qUnregisterResourceData(rcc_version, qt_resource_struct, qt_resource_name, qt_resource_data)
|
||||
|
||||
qInitResources()
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#############################################################################
|
||||
##
|
||||
## Copyright (C) 2013 Riverbank Computing Limited.
|
||||
## Copyright (C) 2018 Riverbank Computing Limited.
|
||||
## Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
##
|
||||
## This file is part of the examples of PyQt.
|
||||
@ -41,6 +41,7 @@
|
||||
#############################################################################
|
||||
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
from PyQt5.QtCore import QUrl
|
||||
@ -50,6 +51,11 @@ from PyQt5.QtQuick import QQuickView
|
||||
import stringlistmodel_rc
|
||||
|
||||
|
||||
# This is necessary to avoid a possible crash when running from another
|
||||
# directory by ensuring the compiled version of the embedded QML file doesn't
|
||||
# get mixed up with another of the same name.
|
||||
os.chdir(os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
app = QGuiApplication(sys.argv)
|
||||
|
||||
dataList = ["Item 1", "Item 2", "Item 3", "Item 4"]
|
||||
|
@ -2,8 +2,7 @@
|
||||
|
||||
# Resource object code
|
||||
#
|
||||
# Created: Mon Jul 22 22:20:10 2013
|
||||
# by: The Resource Compiler for PyQt (Qt v5.1.0)
|
||||
# Created by: The Resource Compiler for PyQt5 (Qt v5.10.1)
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
||||
@ -159,15 +158,30 @@ qt_resource_name = b"\
|
||||
\x00\x69\x00\x65\x00\x77\x00\x2e\x00\x71\x00\x6d\x00\x6c\
|
||||
"
|
||||
|
||||
qt_resource_struct = b"\
|
||||
qt_resource_struct_v1 = b"\
|
||||
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x01\
|
||||
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\
|
||||
"
|
||||
|
||||
qt_resource_struct_v2 = b"\
|
||||
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x01\
|
||||
\x00\x00\x00\x00\x00\x00\x00\x00\
|
||||
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\
|
||||
\x00\x00\x01\x62\x96\x22\x83\x38\
|
||||
"
|
||||
|
||||
qt_version = [int(v) for v in QtCore.qVersion().split('.')]
|
||||
if qt_version < [5, 8, 0]:
|
||||
rcc_version = 1
|
||||
qt_resource_struct = qt_resource_struct_v1
|
||||
else:
|
||||
rcc_version = 2
|
||||
qt_resource_struct = qt_resource_struct_v2
|
||||
|
||||
def qInitResources():
|
||||
QtCore.qRegisterResourceData(0x01, qt_resource_struct, qt_resource_name, qt_resource_data)
|
||||
QtCore.qRegisterResourceData(rcc_version, qt_resource_struct, qt_resource_name, qt_resource_data)
|
||||
|
||||
def qCleanupResources():
|
||||
QtCore.qUnregisterResourceData(0x01, qt_resource_struct, qt_resource_name, qt_resource_data)
|
||||
QtCore.qUnregisterResourceData(rcc_version, qt_resource_struct, qt_resource_name, qt_resource_data)
|
||||
|
||||
qInitResources()
|
||||
|
@ -2,8 +2,7 @@
|
||||
|
||||
# Resource object code
|
||||
#
|
||||
# Created: Tue Jul 23 17:08:56 2013
|
||||
# by: The Resource Compiler for PyQt (Qt v5.1.0)
|
||||
# Created by: The Resource Compiler for PyQt5 (Qt v5.8.0)
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
||||
@ -200,17 +199,36 @@ qt_resource_name = b"\
|
||||
\x00\x61\x00\x69\x00\x6e\x00\x2e\x00\x71\x00\x6d\x00\x6c\
|
||||
"
|
||||
|
||||
qt_resource_struct = b"\
|
||||
qt_resource_struct_v1 = b"\
|
||||
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x01\
|
||||
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x02\
|
||||
\x00\x00\x00\x1a\x00\x02\x00\x00\x00\x01\x00\x00\x00\x03\
|
||||
\x00\x00\x00\x3c\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\
|
||||
"
|
||||
|
||||
qt_resource_struct_v2 = b"\
|
||||
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x01\
|
||||
\x00\x00\x00\x00\x00\x00\x00\x00\
|
||||
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x02\
|
||||
\x00\x00\x00\x00\x00\x00\x00\x00\
|
||||
\x00\x00\x00\x1a\x00\x02\x00\x00\x00\x01\x00\x00\x00\x03\
|
||||
\x00\x00\x00\x00\x00\x00\x00\x00\
|
||||
\x00\x00\x00\x3c\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\
|
||||
\x00\x00\x01\x5a\x38\x00\xd4\xd8\
|
||||
"
|
||||
|
||||
qt_version = QtCore.qVersion().split('.')
|
||||
if qt_version < ['5', '8', '0']:
|
||||
rcc_version = 1
|
||||
qt_resource_struct = qt_resource_struct_v1
|
||||
else:
|
||||
rcc_version = 2
|
||||
qt_resource_struct = qt_resource_struct_v2
|
||||
|
||||
def qInitResources():
|
||||
QtCore.qRegisterResourceData(0x01, qt_resource_struct, qt_resource_name, qt_resource_data)
|
||||
QtCore.qRegisterResourceData(rcc_version, qt_resource_struct, qt_resource_name, qt_resource_data)
|
||||
|
||||
def qCleanupResources():
|
||||
QtCore.qUnregisterResourceData(0x01, qt_resource_struct, qt_resource_name, qt_resource_data)
|
||||
QtCore.qUnregisterResourceData(rcc_version, qt_resource_struct, qt_resource_name, qt_resource_data)
|
||||
|
||||
qInitResources()
|
||||
|
@ -2,8 +2,7 @@
|
||||
|
||||
# Resource object code
|
||||
#
|
||||
# Created: Mon Jul 22 19:07:45 2013
|
||||
# by: The Resource Compiler for PyQt (Qt v5.1.0)
|
||||
# Created by: The Resource Compiler for PyQt5 (Qt v5.8.0)
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
||||
@ -218,6 +217,214 @@ qt_resource_data = b"\
|
||||
\x20\x20\x20\x20\x20\x66\x6f\x6e\x74\x2e\x70\x69\x78\x65\x6c\x53\
|
||||
\x69\x7a\x65\x3a\x20\x31\x32\x0a\x20\x20\x20\x20\x20\x20\x20\x20\
|
||||
\x7d\x0a\x20\x20\x20\x20\x7d\x0a\x7d\x0a\
|
||||
\x00\x00\x0c\xd7\
|
||||
\x2f\
|
||||
\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\
|
||||
\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\
|
||||
\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\
|
||||
\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\
|
||||
\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x0a\x2a\x2a\x0a\
|
||||
\x2a\x2a\x20\x43\x6f\x70\x79\x72\x69\x67\x68\x74\x20\x28\x43\x29\
|
||||
\x20\x32\x30\x31\x33\x20\x44\x69\x67\x69\x61\x20\x50\x6c\x63\x20\
|
||||
\x61\x6e\x64\x2f\x6f\x72\x20\x69\x74\x73\x20\x73\x75\x62\x73\x69\
|
||||
\x64\x69\x61\x72\x79\x28\x2d\x69\x65\x73\x29\x2e\x0a\x2a\x2a\x20\
|
||||
\x43\x6f\x6e\x74\x61\x63\x74\x3a\x20\x68\x74\x74\x70\x3a\x2f\x2f\
|
||||
\x77\x77\x77\x2e\x71\x74\x2d\x70\x72\x6f\x6a\x65\x63\x74\x2e\x6f\
|
||||
\x72\x67\x2f\x6c\x65\x67\x61\x6c\x0a\x2a\x2a\x0a\x2a\x2a\x20\x54\
|
||||
\x68\x69\x73\x20\x66\x69\x6c\x65\x20\x69\x73\x20\x70\x61\x72\x74\
|
||||
\x20\x6f\x66\x20\x74\x68\x65\x20\x65\x78\x61\x6d\x70\x6c\x65\x73\
|
||||
\x20\x6f\x66\x20\x74\x68\x65\x20\x51\x74\x20\x54\x6f\x6f\x6c\x6b\
|
||||
\x69\x74\x2e\x0a\x2a\x2a\x0a\x2a\x2a\x20\x24\x51\x54\x5f\x42\x45\
|
||||
\x47\x49\x4e\x5f\x4c\x49\x43\x45\x4e\x53\x45\x3a\x42\x53\x44\x24\
|
||||
\x0a\x2a\x2a\x20\x59\x6f\x75\x20\x6d\x61\x79\x20\x75\x73\x65\x20\
|
||||
\x74\x68\x69\x73\x20\x66\x69\x6c\x65\x20\x75\x6e\x64\x65\x72\x20\
|
||||
\x74\x68\x65\x20\x74\x65\x72\x6d\x73\x20\x6f\x66\x20\x74\x68\x65\
|
||||
\x20\x42\x53\x44\x20\x6c\x69\x63\x65\x6e\x73\x65\x20\x61\x73\x20\
|
||||
\x66\x6f\x6c\x6c\x6f\x77\x73\x3a\x0a\x2a\x2a\x0a\x2a\x2a\x20\x22\
|
||||
\x52\x65\x64\x69\x73\x74\x72\x69\x62\x75\x74\x69\x6f\x6e\x20\x61\
|
||||
\x6e\x64\x20\x75\x73\x65\x20\x69\x6e\x20\x73\x6f\x75\x72\x63\x65\
|
||||
\x20\x61\x6e\x64\x20\x62\x69\x6e\x61\x72\x79\x20\x66\x6f\x72\x6d\
|
||||
\x73\x2c\x20\x77\x69\x74\x68\x20\x6f\x72\x20\x77\x69\x74\x68\x6f\
|
||||
\x75\x74\x0a\x2a\x2a\x20\x6d\x6f\x64\x69\x66\x69\x63\x61\x74\x69\
|
||||
\x6f\x6e\x2c\x20\x61\x72\x65\x20\x70\x65\x72\x6d\x69\x74\x74\x65\
|
||||
\x64\x20\x70\x72\x6f\x76\x69\x64\x65\x64\x20\x74\x68\x61\x74\x20\
|
||||
\x74\x68\x65\x20\x66\x6f\x6c\x6c\x6f\x77\x69\x6e\x67\x20\x63\x6f\
|
||||
\x6e\x64\x69\x74\x69\x6f\x6e\x73\x20\x61\x72\x65\x0a\x2a\x2a\x20\
|
||||
\x6d\x65\x74\x3a\x0a\x2a\x2a\x20\x20\x20\x2a\x20\x52\x65\x64\x69\
|
||||
\x73\x74\x72\x69\x62\x75\x74\x69\x6f\x6e\x73\x20\x6f\x66\x20\x73\
|
||||
\x6f\x75\x72\x63\x65\x20\x63\x6f\x64\x65\x20\x6d\x75\x73\x74\x20\
|
||||
\x72\x65\x74\x61\x69\x6e\x20\x74\x68\x65\x20\x61\x62\x6f\x76\x65\
|
||||
\x20\x63\x6f\x70\x79\x72\x69\x67\x68\x74\x0a\x2a\x2a\x20\x20\x20\
|
||||
\x20\x20\x6e\x6f\x74\x69\x63\x65\x2c\x20\x74\x68\x69\x73\x20\x6c\
|
||||
\x69\x73\x74\x20\x6f\x66\x20\x63\x6f\x6e\x64\x69\x74\x69\x6f\x6e\
|
||||
\x73\x20\x61\x6e\x64\x20\x74\x68\x65\x20\x66\x6f\x6c\x6c\x6f\x77\
|
||||
\x69\x6e\x67\x20\x64\x69\x73\x63\x6c\x61\x69\x6d\x65\x72\x2e\x0a\
|
||||
\x2a\x2a\x20\x20\x20\x2a\x20\x52\x65\x64\x69\x73\x74\x72\x69\x62\
|
||||
\x75\x74\x69\x6f\x6e\x73\x20\x69\x6e\x20\x62\x69\x6e\x61\x72\x79\
|
||||
\x20\x66\x6f\x72\x6d\x20\x6d\x75\x73\x74\x20\x72\x65\x70\x72\x6f\
|
||||
\x64\x75\x63\x65\x20\x74\x68\x65\x20\x61\x62\x6f\x76\x65\x20\x63\
|
||||
\x6f\x70\x79\x72\x69\x67\x68\x74\x0a\x2a\x2a\x20\x20\x20\x20\x20\
|
||||
\x6e\x6f\x74\x69\x63\x65\x2c\x20\x74\x68\x69\x73\x20\x6c\x69\x73\
|
||||
\x74\x20\x6f\x66\x20\x63\x6f\x6e\x64\x69\x74\x69\x6f\x6e\x73\x20\
|
||||
\x61\x6e\x64\x20\x74\x68\x65\x20\x66\x6f\x6c\x6c\x6f\x77\x69\x6e\
|
||||
\x67\x20\x64\x69\x73\x63\x6c\x61\x69\x6d\x65\x72\x20\x69\x6e\x0a\
|
||||
\x2a\x2a\x20\x20\x20\x20\x20\x74\x68\x65\x20\x64\x6f\x63\x75\x6d\
|
||||
\x65\x6e\x74\x61\x74\x69\x6f\x6e\x20\x61\x6e\x64\x2f\x6f\x72\x20\
|
||||
\x6f\x74\x68\x65\x72\x20\x6d\x61\x74\x65\x72\x69\x61\x6c\x73\x20\
|
||||
\x70\x72\x6f\x76\x69\x64\x65\x64\x20\x77\x69\x74\x68\x20\x74\x68\
|
||||
\x65\x0a\x2a\x2a\x20\x20\x20\x20\x20\x64\x69\x73\x74\x72\x69\x62\
|
||||
\x75\x74\x69\x6f\x6e\x2e\x0a\x2a\x2a\x20\x20\x20\x2a\x20\x4e\x65\
|
||||
\x69\x74\x68\x65\x72\x20\x74\x68\x65\x20\x6e\x61\x6d\x65\x20\x6f\
|
||||
\x66\x20\x44\x69\x67\x69\x61\x20\x50\x6c\x63\x20\x61\x6e\x64\x20\
|
||||
\x69\x74\x73\x20\x53\x75\x62\x73\x69\x64\x69\x61\x72\x79\x28\x2d\
|
||||
\x69\x65\x73\x29\x20\x6e\x6f\x72\x20\x74\x68\x65\x20\x6e\x61\x6d\
|
||||
\x65\x73\x0a\x2a\x2a\x20\x20\x20\x20\x20\x6f\x66\x20\x69\x74\x73\
|
||||
\x20\x63\x6f\x6e\x74\x72\x69\x62\x75\x74\x6f\x72\x73\x20\x6d\x61\
|
||||
\x79\x20\x62\x65\x20\x75\x73\x65\x64\x20\x74\x6f\x20\x65\x6e\x64\
|
||||
\x6f\x72\x73\x65\x20\x6f\x72\x20\x70\x72\x6f\x6d\x6f\x74\x65\x20\
|
||||
\x70\x72\x6f\x64\x75\x63\x74\x73\x20\x64\x65\x72\x69\x76\x65\x64\
|
||||
\x0a\x2a\x2a\x20\x20\x20\x20\x20\x66\x72\x6f\x6d\x20\x74\x68\x69\
|
||||
\x73\x20\x73\x6f\x66\x74\x77\x61\x72\x65\x20\x77\x69\x74\x68\x6f\
|
||||
\x75\x74\x20\x73\x70\x65\x63\x69\x66\x69\x63\x20\x70\x72\x69\x6f\
|
||||
\x72\x20\x77\x72\x69\x74\x74\x65\x6e\x20\x70\x65\x72\x6d\x69\x73\
|
||||
\x73\x69\x6f\x6e\x2e\x0a\x2a\x2a\x0a\x2a\x2a\x0a\x2a\x2a\x20\x54\
|
||||
\x48\x49\x53\x20\x53\x4f\x46\x54\x57\x41\x52\x45\x20\x49\x53\x20\
|
||||
\x50\x52\x4f\x56\x49\x44\x45\x44\x20\x42\x59\x20\x54\x48\x45\x20\
|
||||
\x43\x4f\x50\x59\x52\x49\x47\x48\x54\x20\x48\x4f\x4c\x44\x45\x52\
|
||||
\x53\x20\x41\x4e\x44\x20\x43\x4f\x4e\x54\x52\x49\x42\x55\x54\x4f\
|
||||
\x52\x53\x0a\x2a\x2a\x20\x22\x41\x53\x20\x49\x53\x22\x20\x41\x4e\
|
||||
\x44\x20\x41\x4e\x59\x20\x45\x58\x50\x52\x45\x53\x53\x20\x4f\x52\
|
||||
\x20\x49\x4d\x50\x4c\x49\x45\x44\x20\x57\x41\x52\x52\x41\x4e\x54\
|
||||
\x49\x45\x53\x2c\x20\x49\x4e\x43\x4c\x55\x44\x49\x4e\x47\x2c\x20\
|
||||
\x42\x55\x54\x20\x4e\x4f\x54\x0a\x2a\x2a\x20\x4c\x49\x4d\x49\x54\
|
||||
\x45\x44\x20\x54\x4f\x2c\x20\x54\x48\x45\x20\x49\x4d\x50\x4c\x49\
|
||||
\x45\x44\x20\x57\x41\x52\x52\x41\x4e\x54\x49\x45\x53\x20\x4f\x46\
|
||||
\x20\x4d\x45\x52\x43\x48\x41\x4e\x54\x41\x42\x49\x4c\x49\x54\x59\
|
||||
\x20\x41\x4e\x44\x20\x46\x49\x54\x4e\x45\x53\x53\x20\x46\x4f\x52\
|
||||
\x0a\x2a\x2a\x20\x41\x20\x50\x41\x52\x54\x49\x43\x55\x4c\x41\x52\
|
||||
\x20\x50\x55\x52\x50\x4f\x53\x45\x20\x41\x52\x45\x20\x44\x49\x53\
|
||||
\x43\x4c\x41\x49\x4d\x45\x44\x2e\x20\x49\x4e\x20\x4e\x4f\x20\x45\
|
||||
\x56\x45\x4e\x54\x20\x53\x48\x41\x4c\x4c\x20\x54\x48\x45\x20\x43\
|
||||
\x4f\x50\x59\x52\x49\x47\x48\x54\x0a\x2a\x2a\x20\x4f\x57\x4e\x45\
|
||||
\x52\x20\x4f\x52\x20\x43\x4f\x4e\x54\x52\x49\x42\x55\x54\x4f\x52\
|
||||
\x53\x20\x42\x45\x20\x4c\x49\x41\x42\x4c\x45\x20\x46\x4f\x52\x20\
|
||||
\x41\x4e\x59\x20\x44\x49\x52\x45\x43\x54\x2c\x20\x49\x4e\x44\x49\
|
||||
\x52\x45\x43\x54\x2c\x20\x49\x4e\x43\x49\x44\x45\x4e\x54\x41\x4c\
|
||||
\x2c\x0a\x2a\x2a\x20\x53\x50\x45\x43\x49\x41\x4c\x2c\x20\x45\x58\
|
||||
\x45\x4d\x50\x4c\x41\x52\x59\x2c\x20\x4f\x52\x20\x43\x4f\x4e\x53\
|
||||
\x45\x51\x55\x45\x4e\x54\x49\x41\x4c\x20\x44\x41\x4d\x41\x47\x45\
|
||||
\x53\x20\x28\x49\x4e\x43\x4c\x55\x44\x49\x4e\x47\x2c\x20\x42\x55\
|
||||
\x54\x20\x4e\x4f\x54\x0a\x2a\x2a\x20\x4c\x49\x4d\x49\x54\x45\x44\
|
||||
\x20\x54\x4f\x2c\x20\x50\x52\x4f\x43\x55\x52\x45\x4d\x45\x4e\x54\
|
||||
\x20\x4f\x46\x20\x53\x55\x42\x53\x54\x49\x54\x55\x54\x45\x20\x47\
|
||||
\x4f\x4f\x44\x53\x20\x4f\x52\x20\x53\x45\x52\x56\x49\x43\x45\x53\
|
||||
\x3b\x20\x4c\x4f\x53\x53\x20\x4f\x46\x20\x55\x53\x45\x2c\x0a\x2a\
|
||||
\x2a\x20\x44\x41\x54\x41\x2c\x20\x4f\x52\x20\x50\x52\x4f\x46\x49\
|
||||
\x54\x53\x3b\x20\x4f\x52\x20\x42\x55\x53\x49\x4e\x45\x53\x53\x20\
|
||||
\x49\x4e\x54\x45\x52\x52\x55\x50\x54\x49\x4f\x4e\x29\x20\x48\x4f\
|
||||
\x57\x45\x56\x45\x52\x20\x43\x41\x55\x53\x45\x44\x20\x41\x4e\x44\
|
||||
\x20\x4f\x4e\x20\x41\x4e\x59\x0a\x2a\x2a\x20\x54\x48\x45\x4f\x52\
|
||||
\x59\x20\x4f\x46\x20\x4c\x49\x41\x42\x49\x4c\x49\x54\x59\x2c\x20\
|
||||
\x57\x48\x45\x54\x48\x45\x52\x20\x49\x4e\x20\x43\x4f\x4e\x54\x52\
|
||||
\x41\x43\x54\x2c\x20\x53\x54\x52\x49\x43\x54\x20\x4c\x49\x41\x42\
|
||||
\x49\x4c\x49\x54\x59\x2c\x20\x4f\x52\x20\x54\x4f\x52\x54\x0a\x2a\
|
||||
\x2a\x20\x28\x49\x4e\x43\x4c\x55\x44\x49\x4e\x47\x20\x4e\x45\x47\
|
||||
\x4c\x49\x47\x45\x4e\x43\x45\x20\x4f\x52\x20\x4f\x54\x48\x45\x52\
|
||||
\x57\x49\x53\x45\x29\x20\x41\x52\x49\x53\x49\x4e\x47\x20\x49\x4e\
|
||||
\x20\x41\x4e\x59\x20\x57\x41\x59\x20\x4f\x55\x54\x20\x4f\x46\x20\
|
||||
\x54\x48\x45\x20\x55\x53\x45\x0a\x2a\x2a\x20\x4f\x46\x20\x54\x48\
|
||||
\x49\x53\x20\x53\x4f\x46\x54\x57\x41\x52\x45\x2c\x20\x45\x56\x45\
|
||||
\x4e\x20\x49\x46\x20\x41\x44\x56\x49\x53\x45\x44\x20\x4f\x46\x20\
|
||||
\x54\x48\x45\x20\x50\x4f\x53\x53\x49\x42\x49\x4c\x49\x54\x59\x20\
|
||||
\x4f\x46\x20\x53\x55\x43\x48\x20\x44\x41\x4d\x41\x47\x45\x2e\x22\
|
||||
\x0a\x2a\x2a\x0a\x2a\x2a\x20\x24\x51\x54\x5f\x45\x4e\x44\x5f\x4c\
|
||||
\x49\x43\x45\x4e\x53\x45\x24\x0a\x2a\x2a\x0a\x2a\x2a\x2a\x2a\x2a\
|
||||
\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\
|
||||
\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\
|
||||
\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\
|
||||
\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\
|
||||
\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2f\x0a\x69\x6d\x70\x6f\x72\x74\x20\
|
||||
\x51\x74\x51\x75\x69\x63\x6b\x20\x32\x2e\x30\x0a\x0a\x52\x65\x63\
|
||||
\x74\x61\x6e\x67\x6c\x65\x20\x7b\x0a\x20\x20\x20\x20\x69\x64\x3a\
|
||||
\x20\x63\x6f\x6e\x74\x61\x69\x6e\x65\x72\x0a\x20\x20\x20\x20\x70\
|
||||
\x72\x6f\x70\x65\x72\x74\x79\x20\x49\x74\x65\x6d\x20\x65\x78\x61\
|
||||
\x6d\x70\x6c\x65\x49\x74\x65\x6d\x0a\x20\x20\x20\x20\x77\x69\x64\
|
||||
\x74\x68\x3a\x20\x4c\x69\x73\x74\x56\x69\x65\x77\x2e\x76\x69\x65\
|
||||
\x77\x2e\x77\x69\x64\x74\x68\x0a\x20\x20\x20\x20\x68\x65\x69\x67\
|
||||
\x68\x74\x3a\x20\x62\x75\x74\x74\x6f\x6e\x2e\x69\x6d\x70\x6c\x69\
|
||||
\x63\x69\x74\x48\x65\x69\x67\x68\x74\x20\x2b\x20\x32\x32\x0a\x0a\
|
||||
\x20\x20\x20\x20\x67\x72\x61\x64\x69\x65\x6e\x74\x3a\x20\x47\x72\
|
||||
\x61\x64\x69\x65\x6e\x74\x20\x7b\x0a\x20\x20\x20\x20\x20\x20\x20\
|
||||
\x20\x47\x72\x61\x64\x69\x65\x6e\x74\x53\x74\x6f\x70\x20\x7b\x0a\
|
||||
\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x70\x6f\x73\x69\
|
||||
\x74\x69\x6f\x6e\x3a\x20\x30\x0a\x20\x20\x20\x20\x20\x20\x20\x20\
|
||||
\x20\x20\x20\x20\x42\x65\x68\x61\x76\x69\x6f\x72\x20\x6f\x6e\x20\
|
||||
\x63\x6f\x6c\x6f\x72\x20\x7b\x43\x6f\x6c\x6f\x72\x41\x6e\x69\x6d\
|
||||
\x61\x74\x69\x6f\x6e\x20\x7b\x20\x64\x75\x72\x61\x74\x69\x6f\x6e\
|
||||
\x3a\x20\x31\x30\x30\x20\x7d\x7d\x0a\x20\x20\x20\x20\x20\x20\x20\
|
||||
\x20\x20\x20\x20\x20\x63\x6f\x6c\x6f\x72\x3a\x20\x62\x75\x74\x74\
|
||||
\x6f\x6e\x2e\x70\x72\x65\x73\x73\x65\x64\x20\x3f\x20\x22\x23\x65\
|
||||
\x30\x65\x30\x65\x30\x22\x20\x3a\x20\x22\x23\x66\x66\x66\x22\x0a\
|
||||
\x20\x20\x20\x20\x20\x20\x20\x20\x7d\x0a\x20\x20\x20\x20\x20\x20\
|
||||
\x20\x20\x47\x72\x61\x64\x69\x65\x6e\x74\x53\x74\x6f\x70\x20\x7b\
|
||||
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x70\x6f\x73\
|
||||
\x69\x74\x69\x6f\x6e\x3a\x20\x31\x0a\x20\x20\x20\x20\x20\x20\x20\
|
||||
\x20\x20\x20\x20\x20\x42\x65\x68\x61\x76\x69\x6f\x72\x20\x6f\x6e\
|
||||
\x20\x63\x6f\x6c\x6f\x72\x20\x7b\x43\x6f\x6c\x6f\x72\x41\x6e\x69\
|
||||
\x6d\x61\x74\x69\x6f\x6e\x20\x7b\x20\x64\x75\x72\x61\x74\x69\x6f\
|
||||
\x6e\x3a\x20\x31\x30\x30\x20\x7d\x7d\x0a\x20\x20\x20\x20\x20\x20\
|
||||
\x20\x20\x20\x20\x20\x20\x63\x6f\x6c\x6f\x72\x3a\x20\x62\x75\x74\
|
||||
\x74\x6f\x6e\x2e\x70\x72\x65\x73\x73\x65\x64\x20\x3f\x20\x22\x23\
|
||||
\x65\x30\x65\x30\x65\x30\x22\x20\x3a\x20\x62\x75\x74\x74\x6f\x6e\
|
||||
\x2e\x63\x6f\x6e\x74\x61\x69\x6e\x73\x4d\x6f\x75\x73\x65\x20\x3f\
|
||||
\x20\x22\x23\x66\x35\x66\x35\x66\x35\x22\x20\x3a\x20\x22\x23\x65\
|
||||
\x65\x65\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x7d\x0a\x20\x20\
|
||||
\x20\x20\x7d\x0a\x0a\x20\x20\x20\x20\x49\x6d\x61\x67\x65\x20\x7b\
|
||||
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x69\x64\x3a\x20\x69\x6d\x61\
|
||||
\x67\x65\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x6f\x70\x61\x63\x69\
|
||||
\x74\x79\x3a\x20\x30\x2e\x37\x0a\x20\x20\x20\x20\x20\x20\x20\x20\
|
||||
\x42\x65\x68\x61\x76\x69\x6f\x72\x20\x6f\x6e\x20\x6f\x70\x61\x63\
|
||||
\x69\x74\x79\x20\x7b\x4e\x75\x6d\x62\x65\x72\x41\x6e\x69\x6d\x61\
|
||||
\x74\x69\x6f\x6e\x20\x7b\x64\x75\x72\x61\x74\x69\x6f\x6e\x3a\x20\
|
||||
\x31\x30\x30\x7d\x7d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x73\x6f\
|
||||
\x75\x72\x63\x65\x3a\x20\x22\x69\x6d\x61\x67\x65\x73\x2f\x6e\x65\
|
||||
\x78\x74\x2e\x70\x6e\x67\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\
|
||||
\x61\x6e\x63\x68\x6f\x72\x73\x2e\x76\x65\x72\x74\x69\x63\x61\x6c\
|
||||
\x43\x65\x6e\x74\x65\x72\x3a\x20\x70\x61\x72\x65\x6e\x74\x2e\x76\
|
||||
\x65\x72\x74\x69\x63\x61\x6c\x43\x65\x6e\x74\x65\x72\x0a\x20\x20\
|
||||
\x20\x20\x20\x20\x20\x20\x61\x6e\x63\x68\x6f\x72\x73\x2e\x72\x69\
|
||||
\x67\x68\x74\x3a\x20\x70\x61\x72\x65\x6e\x74\x2e\x72\x69\x67\x68\
|
||||
\x74\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x61\x6e\x63\x68\x6f\x72\
|
||||
\x73\x2e\x72\x69\x67\x68\x74\x4d\x61\x72\x67\x69\x6e\x3a\x20\x31\
|
||||
\x36\x0a\x20\x20\x20\x20\x7d\x0a\x0a\x20\x20\x20\x20\x42\x75\x74\
|
||||
\x74\x6f\x6e\x20\x7b\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x69\x64\
|
||||
\x3a\x20\x62\x75\x74\x74\x6f\x6e\x0a\x20\x20\x20\x20\x20\x20\x20\
|
||||
\x20\x61\x6e\x63\x68\x6f\x72\x73\x2e\x74\x6f\x70\x3a\x20\x70\x61\
|
||||
\x72\x65\x6e\x74\x2e\x74\x6f\x70\x0a\x20\x20\x20\x20\x20\x20\x20\
|
||||
\x20\x61\x6e\x63\x68\x6f\x72\x73\x2e\x6c\x65\x66\x74\x3a\x20\x70\
|
||||
\x61\x72\x65\x6e\x74\x2e\x6c\x65\x66\x74\x0a\x20\x20\x20\x20\x20\
|
||||
\x20\x20\x20\x61\x6e\x63\x68\x6f\x72\x73\x2e\x62\x6f\x74\x74\x6f\
|
||||
\x6d\x3a\x20\x70\x61\x72\x65\x6e\x74\x2e\x62\x6f\x74\x74\x6f\x6d\
|
||||
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x61\x6e\x63\x68\x6f\x72\x73\
|
||||
\x2e\x72\x69\x67\x68\x74\x3a\x69\x6d\x61\x67\x65\x2e\x6c\x65\x66\
|
||||
\x74\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x74\x65\x78\x74\x3a\x20\
|
||||
\x6e\x61\x6d\x65\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x73\x75\x62\
|
||||
\x54\x65\x78\x74\x3a\x20\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6f\
|
||||
\x6e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x6f\x6e\x43\x6c\x69\x63\
|
||||
\x6b\x65\x64\x3a\x20\x65\x78\x61\x6d\x70\x6c\x65\x49\x74\x65\x6d\
|
||||
\x2e\x65\x78\x61\x6d\x70\x6c\x65\x55\x72\x6c\x20\x3d\x20\x75\x72\
|
||||
\x6c\x3b\x0a\x20\x20\x20\x20\x7d\x0a\x0a\x20\x20\x20\x20\x52\x65\
|
||||
\x63\x74\x61\x6e\x67\x6c\x65\x20\x7b\x0a\x20\x20\x20\x20\x20\x20\
|
||||
\x20\x20\x68\x65\x69\x67\x68\x74\x3a\x20\x31\x0a\x20\x20\x20\x20\
|
||||
\x20\x20\x20\x20\x63\x6f\x6c\x6f\x72\x3a\x20\x22\x23\x63\x63\x63\
|
||||
\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x61\x6e\x63\x68\x6f\x72\
|
||||
\x73\x2e\x62\x6f\x74\x74\x6f\x6d\x3a\x20\x70\x61\x72\x65\x6e\x74\
|
||||
\x2e\x62\x6f\x74\x74\x6f\x6d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\
|
||||
\x61\x6e\x63\x68\x6f\x72\x73\x2e\x6c\x65\x66\x74\x3a\x20\x70\x61\
|
||||
\x72\x65\x6e\x74\x2e\x6c\x65\x66\x74\x0a\x20\x20\x20\x20\x20\x20\
|
||||
\x20\x20\x61\x6e\x63\x68\x6f\x72\x73\x2e\x72\x69\x67\x68\x74\x3a\
|
||||
\x20\x70\x61\x72\x65\x6e\x74\x2e\x72\x69\x67\x68\x74\x0a\x20\x20\
|
||||
\x20\x20\x7d\x0a\x7d\x0a\
|
||||
\x00\x00\x14\x36\
|
||||
\x2f\
|
||||
\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\
|
||||
@ -544,214 +751,6 @@ qt_resource_data = b"\
|
||||
\x20\x20\x20\x7d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\
|
||||
\x20\x7d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x7d\x0a\x20\x20\x20\
|
||||
\x20\x7d\x0a\x7d\x0a\
|
||||
\x00\x00\x0c\xd7\
|
||||
\x2f\
|
||||
\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\
|
||||
\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\
|
||||
\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\
|
||||
\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\
|
||||
\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x0a\x2a\x2a\x0a\
|
||||
\x2a\x2a\x20\x43\x6f\x70\x79\x72\x69\x67\x68\x74\x20\x28\x43\x29\
|
||||
\x20\x32\x30\x31\x33\x20\x44\x69\x67\x69\x61\x20\x50\x6c\x63\x20\
|
||||
\x61\x6e\x64\x2f\x6f\x72\x20\x69\x74\x73\x20\x73\x75\x62\x73\x69\
|
||||
\x64\x69\x61\x72\x79\x28\x2d\x69\x65\x73\x29\x2e\x0a\x2a\x2a\x20\
|
||||
\x43\x6f\x6e\x74\x61\x63\x74\x3a\x20\x68\x74\x74\x70\x3a\x2f\x2f\
|
||||
\x77\x77\x77\x2e\x71\x74\x2d\x70\x72\x6f\x6a\x65\x63\x74\x2e\x6f\
|
||||
\x72\x67\x2f\x6c\x65\x67\x61\x6c\x0a\x2a\x2a\x0a\x2a\x2a\x20\x54\
|
||||
\x68\x69\x73\x20\x66\x69\x6c\x65\x20\x69\x73\x20\x70\x61\x72\x74\
|
||||
\x20\x6f\x66\x20\x74\x68\x65\x20\x65\x78\x61\x6d\x70\x6c\x65\x73\
|
||||
\x20\x6f\x66\x20\x74\x68\x65\x20\x51\x74\x20\x54\x6f\x6f\x6c\x6b\
|
||||
\x69\x74\x2e\x0a\x2a\x2a\x0a\x2a\x2a\x20\x24\x51\x54\x5f\x42\x45\
|
||||
\x47\x49\x4e\x5f\x4c\x49\x43\x45\x4e\x53\x45\x3a\x42\x53\x44\x24\
|
||||
\x0a\x2a\x2a\x20\x59\x6f\x75\x20\x6d\x61\x79\x20\x75\x73\x65\x20\
|
||||
\x74\x68\x69\x73\x20\x66\x69\x6c\x65\x20\x75\x6e\x64\x65\x72\x20\
|
||||
\x74\x68\x65\x20\x74\x65\x72\x6d\x73\x20\x6f\x66\x20\x74\x68\x65\
|
||||
\x20\x42\x53\x44\x20\x6c\x69\x63\x65\x6e\x73\x65\x20\x61\x73\x20\
|
||||
\x66\x6f\x6c\x6c\x6f\x77\x73\x3a\x0a\x2a\x2a\x0a\x2a\x2a\x20\x22\
|
||||
\x52\x65\x64\x69\x73\x74\x72\x69\x62\x75\x74\x69\x6f\x6e\x20\x61\
|
||||
\x6e\x64\x20\x75\x73\x65\x20\x69\x6e\x20\x73\x6f\x75\x72\x63\x65\
|
||||
\x20\x61\x6e\x64\x20\x62\x69\x6e\x61\x72\x79\x20\x66\x6f\x72\x6d\
|
||||
\x73\x2c\x20\x77\x69\x74\x68\x20\x6f\x72\x20\x77\x69\x74\x68\x6f\
|
||||
\x75\x74\x0a\x2a\x2a\x20\x6d\x6f\x64\x69\x66\x69\x63\x61\x74\x69\
|
||||
\x6f\x6e\x2c\x20\x61\x72\x65\x20\x70\x65\x72\x6d\x69\x74\x74\x65\
|
||||
\x64\x20\x70\x72\x6f\x76\x69\x64\x65\x64\x20\x74\x68\x61\x74\x20\
|
||||
\x74\x68\x65\x20\x66\x6f\x6c\x6c\x6f\x77\x69\x6e\x67\x20\x63\x6f\
|
||||
\x6e\x64\x69\x74\x69\x6f\x6e\x73\x20\x61\x72\x65\x0a\x2a\x2a\x20\
|
||||
\x6d\x65\x74\x3a\x0a\x2a\x2a\x20\x20\x20\x2a\x20\x52\x65\x64\x69\
|
||||
\x73\x74\x72\x69\x62\x75\x74\x69\x6f\x6e\x73\x20\x6f\x66\x20\x73\
|
||||
\x6f\x75\x72\x63\x65\x20\x63\x6f\x64\x65\x20\x6d\x75\x73\x74\x20\
|
||||
\x72\x65\x74\x61\x69\x6e\x20\x74\x68\x65\x20\x61\x62\x6f\x76\x65\
|
||||
\x20\x63\x6f\x70\x79\x72\x69\x67\x68\x74\x0a\x2a\x2a\x20\x20\x20\
|
||||
\x20\x20\x6e\x6f\x74\x69\x63\x65\x2c\x20\x74\x68\x69\x73\x20\x6c\
|
||||
\x69\x73\x74\x20\x6f\x66\x20\x63\x6f\x6e\x64\x69\x74\x69\x6f\x6e\
|
||||
\x73\x20\x61\x6e\x64\x20\x74\x68\x65\x20\x66\x6f\x6c\x6c\x6f\x77\
|
||||
\x69\x6e\x67\x20\x64\x69\x73\x63\x6c\x61\x69\x6d\x65\x72\x2e\x0a\
|
||||
\x2a\x2a\x20\x20\x20\x2a\x20\x52\x65\x64\x69\x73\x74\x72\x69\x62\
|
||||
\x75\x74\x69\x6f\x6e\x73\x20\x69\x6e\x20\x62\x69\x6e\x61\x72\x79\
|
||||
\x20\x66\x6f\x72\x6d\x20\x6d\x75\x73\x74\x20\x72\x65\x70\x72\x6f\
|
||||
\x64\x75\x63\x65\x20\x74\x68\x65\x20\x61\x62\x6f\x76\x65\x20\x63\
|
||||
\x6f\x70\x79\x72\x69\x67\x68\x74\x0a\x2a\x2a\x20\x20\x20\x20\x20\
|
||||
\x6e\x6f\x74\x69\x63\x65\x2c\x20\x74\x68\x69\x73\x20\x6c\x69\x73\
|
||||
\x74\x20\x6f\x66\x20\x63\x6f\x6e\x64\x69\x74\x69\x6f\x6e\x73\x20\
|
||||
\x61\x6e\x64\x20\x74\x68\x65\x20\x66\x6f\x6c\x6c\x6f\x77\x69\x6e\
|
||||
\x67\x20\x64\x69\x73\x63\x6c\x61\x69\x6d\x65\x72\x20\x69\x6e\x0a\
|
||||
\x2a\x2a\x20\x20\x20\x20\x20\x74\x68\x65\x20\x64\x6f\x63\x75\x6d\
|
||||
\x65\x6e\x74\x61\x74\x69\x6f\x6e\x20\x61\x6e\x64\x2f\x6f\x72\x20\
|
||||
\x6f\x74\x68\x65\x72\x20\x6d\x61\x74\x65\x72\x69\x61\x6c\x73\x20\
|
||||
\x70\x72\x6f\x76\x69\x64\x65\x64\x20\x77\x69\x74\x68\x20\x74\x68\
|
||||
\x65\x0a\x2a\x2a\x20\x20\x20\x20\x20\x64\x69\x73\x74\x72\x69\x62\
|
||||
\x75\x74\x69\x6f\x6e\x2e\x0a\x2a\x2a\x20\x20\x20\x2a\x20\x4e\x65\
|
||||
\x69\x74\x68\x65\x72\x20\x74\x68\x65\x20\x6e\x61\x6d\x65\x20\x6f\
|
||||
\x66\x20\x44\x69\x67\x69\x61\x20\x50\x6c\x63\x20\x61\x6e\x64\x20\
|
||||
\x69\x74\x73\x20\x53\x75\x62\x73\x69\x64\x69\x61\x72\x79\x28\x2d\
|
||||
\x69\x65\x73\x29\x20\x6e\x6f\x72\x20\x74\x68\x65\x20\x6e\x61\x6d\
|
||||
\x65\x73\x0a\x2a\x2a\x20\x20\x20\x20\x20\x6f\x66\x20\x69\x74\x73\
|
||||
\x20\x63\x6f\x6e\x74\x72\x69\x62\x75\x74\x6f\x72\x73\x20\x6d\x61\
|
||||
\x79\x20\x62\x65\x20\x75\x73\x65\x64\x20\x74\x6f\x20\x65\x6e\x64\
|
||||
\x6f\x72\x73\x65\x20\x6f\x72\x20\x70\x72\x6f\x6d\x6f\x74\x65\x20\
|
||||
\x70\x72\x6f\x64\x75\x63\x74\x73\x20\x64\x65\x72\x69\x76\x65\x64\
|
||||
\x0a\x2a\x2a\x20\x20\x20\x20\x20\x66\x72\x6f\x6d\x20\x74\x68\x69\
|
||||
\x73\x20\x73\x6f\x66\x74\x77\x61\x72\x65\x20\x77\x69\x74\x68\x6f\
|
||||
\x75\x74\x20\x73\x70\x65\x63\x69\x66\x69\x63\x20\x70\x72\x69\x6f\
|
||||
\x72\x20\x77\x72\x69\x74\x74\x65\x6e\x20\x70\x65\x72\x6d\x69\x73\
|
||||
\x73\x69\x6f\x6e\x2e\x0a\x2a\x2a\x0a\x2a\x2a\x0a\x2a\x2a\x20\x54\
|
||||
\x48\x49\x53\x20\x53\x4f\x46\x54\x57\x41\x52\x45\x20\x49\x53\x20\
|
||||
\x50\x52\x4f\x56\x49\x44\x45\x44\x20\x42\x59\x20\x54\x48\x45\x20\
|
||||
\x43\x4f\x50\x59\x52\x49\x47\x48\x54\x20\x48\x4f\x4c\x44\x45\x52\
|
||||
\x53\x20\x41\x4e\x44\x20\x43\x4f\x4e\x54\x52\x49\x42\x55\x54\x4f\
|
||||
\x52\x53\x0a\x2a\x2a\x20\x22\x41\x53\x20\x49\x53\x22\x20\x41\x4e\
|
||||
\x44\x20\x41\x4e\x59\x20\x45\x58\x50\x52\x45\x53\x53\x20\x4f\x52\
|
||||
\x20\x49\x4d\x50\x4c\x49\x45\x44\x20\x57\x41\x52\x52\x41\x4e\x54\
|
||||
\x49\x45\x53\x2c\x20\x49\x4e\x43\x4c\x55\x44\x49\x4e\x47\x2c\x20\
|
||||
\x42\x55\x54\x20\x4e\x4f\x54\x0a\x2a\x2a\x20\x4c\x49\x4d\x49\x54\
|
||||
\x45\x44\x20\x54\x4f\x2c\x20\x54\x48\x45\x20\x49\x4d\x50\x4c\x49\
|
||||
\x45\x44\x20\x57\x41\x52\x52\x41\x4e\x54\x49\x45\x53\x20\x4f\x46\
|
||||
\x20\x4d\x45\x52\x43\x48\x41\x4e\x54\x41\x42\x49\x4c\x49\x54\x59\
|
||||
\x20\x41\x4e\x44\x20\x46\x49\x54\x4e\x45\x53\x53\x20\x46\x4f\x52\
|
||||
\x0a\x2a\x2a\x20\x41\x20\x50\x41\x52\x54\x49\x43\x55\x4c\x41\x52\
|
||||
\x20\x50\x55\x52\x50\x4f\x53\x45\x20\x41\x52\x45\x20\x44\x49\x53\
|
||||
\x43\x4c\x41\x49\x4d\x45\x44\x2e\x20\x49\x4e\x20\x4e\x4f\x20\x45\
|
||||
\x56\x45\x4e\x54\x20\x53\x48\x41\x4c\x4c\x20\x54\x48\x45\x20\x43\
|
||||
\x4f\x50\x59\x52\x49\x47\x48\x54\x0a\x2a\x2a\x20\x4f\x57\x4e\x45\
|
||||
\x52\x20\x4f\x52\x20\x43\x4f\x4e\x54\x52\x49\x42\x55\x54\x4f\x52\
|
||||
\x53\x20\x42\x45\x20\x4c\x49\x41\x42\x4c\x45\x20\x46\x4f\x52\x20\
|
||||
\x41\x4e\x59\x20\x44\x49\x52\x45\x43\x54\x2c\x20\x49\x4e\x44\x49\
|
||||
\x52\x45\x43\x54\x2c\x20\x49\x4e\x43\x49\x44\x45\x4e\x54\x41\x4c\
|
||||
\x2c\x0a\x2a\x2a\x20\x53\x50\x45\x43\x49\x41\x4c\x2c\x20\x45\x58\
|
||||
\x45\x4d\x50\x4c\x41\x52\x59\x2c\x20\x4f\x52\x20\x43\x4f\x4e\x53\
|
||||
\x45\x51\x55\x45\x4e\x54\x49\x41\x4c\x20\x44\x41\x4d\x41\x47\x45\
|
||||
\x53\x20\x28\x49\x4e\x43\x4c\x55\x44\x49\x4e\x47\x2c\x20\x42\x55\
|
||||
\x54\x20\x4e\x4f\x54\x0a\x2a\x2a\x20\x4c\x49\x4d\x49\x54\x45\x44\
|
||||
\x20\x54\x4f\x2c\x20\x50\x52\x4f\x43\x55\x52\x45\x4d\x45\x4e\x54\
|
||||
\x20\x4f\x46\x20\x53\x55\x42\x53\x54\x49\x54\x55\x54\x45\x20\x47\
|
||||
\x4f\x4f\x44\x53\x20\x4f\x52\x20\x53\x45\x52\x56\x49\x43\x45\x53\
|
||||
\x3b\x20\x4c\x4f\x53\x53\x20\x4f\x46\x20\x55\x53\x45\x2c\x0a\x2a\
|
||||
\x2a\x20\x44\x41\x54\x41\x2c\x20\x4f\x52\x20\x50\x52\x4f\x46\x49\
|
||||
\x54\x53\x3b\x20\x4f\x52\x20\x42\x55\x53\x49\x4e\x45\x53\x53\x20\
|
||||
\x49\x4e\x54\x45\x52\x52\x55\x50\x54\x49\x4f\x4e\x29\x20\x48\x4f\
|
||||
\x57\x45\x56\x45\x52\x20\x43\x41\x55\x53\x45\x44\x20\x41\x4e\x44\
|
||||
\x20\x4f\x4e\x20\x41\x4e\x59\x0a\x2a\x2a\x20\x54\x48\x45\x4f\x52\
|
||||
\x59\x20\x4f\x46\x20\x4c\x49\x41\x42\x49\x4c\x49\x54\x59\x2c\x20\
|
||||
\x57\x48\x45\x54\x48\x45\x52\x20\x49\x4e\x20\x43\x4f\x4e\x54\x52\
|
||||
\x41\x43\x54\x2c\x20\x53\x54\x52\x49\x43\x54\x20\x4c\x49\x41\x42\
|
||||
\x49\x4c\x49\x54\x59\x2c\x20\x4f\x52\x20\x54\x4f\x52\x54\x0a\x2a\
|
||||
\x2a\x20\x28\x49\x4e\x43\x4c\x55\x44\x49\x4e\x47\x20\x4e\x45\x47\
|
||||
\x4c\x49\x47\x45\x4e\x43\x45\x20\x4f\x52\x20\x4f\x54\x48\x45\x52\
|
||||
\x57\x49\x53\x45\x29\x20\x41\x52\x49\x53\x49\x4e\x47\x20\x49\x4e\
|
||||
\x20\x41\x4e\x59\x20\x57\x41\x59\x20\x4f\x55\x54\x20\x4f\x46\x20\
|
||||
\x54\x48\x45\x20\x55\x53\x45\x0a\x2a\x2a\x20\x4f\x46\x20\x54\x48\
|
||||
\x49\x53\x20\x53\x4f\x46\x54\x57\x41\x52\x45\x2c\x20\x45\x56\x45\
|
||||
\x4e\x20\x49\x46\x20\x41\x44\x56\x49\x53\x45\x44\x20\x4f\x46\x20\
|
||||
\x54\x48\x45\x20\x50\x4f\x53\x53\x49\x42\x49\x4c\x49\x54\x59\x20\
|
||||
\x4f\x46\x20\x53\x55\x43\x48\x20\x44\x41\x4d\x41\x47\x45\x2e\x22\
|
||||
\x0a\x2a\x2a\x0a\x2a\x2a\x20\x24\x51\x54\x5f\x45\x4e\x44\x5f\x4c\
|
||||
\x49\x43\x45\x4e\x53\x45\x24\x0a\x2a\x2a\x0a\x2a\x2a\x2a\x2a\x2a\
|
||||
\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\
|
||||
\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\
|
||||
\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\
|
||||
\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\
|
||||
\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2f\x0a\x69\x6d\x70\x6f\x72\x74\x20\
|
||||
\x51\x74\x51\x75\x69\x63\x6b\x20\x32\x2e\x30\x0a\x0a\x52\x65\x63\
|
||||
\x74\x61\x6e\x67\x6c\x65\x20\x7b\x0a\x20\x20\x20\x20\x69\x64\x3a\
|
||||
\x20\x63\x6f\x6e\x74\x61\x69\x6e\x65\x72\x0a\x20\x20\x20\x20\x70\
|
||||
\x72\x6f\x70\x65\x72\x74\x79\x20\x49\x74\x65\x6d\x20\x65\x78\x61\
|
||||
\x6d\x70\x6c\x65\x49\x74\x65\x6d\x0a\x20\x20\x20\x20\x77\x69\x64\
|
||||
\x74\x68\x3a\x20\x4c\x69\x73\x74\x56\x69\x65\x77\x2e\x76\x69\x65\
|
||||
\x77\x2e\x77\x69\x64\x74\x68\x0a\x20\x20\x20\x20\x68\x65\x69\x67\
|
||||
\x68\x74\x3a\x20\x62\x75\x74\x74\x6f\x6e\x2e\x69\x6d\x70\x6c\x69\
|
||||
\x63\x69\x74\x48\x65\x69\x67\x68\x74\x20\x2b\x20\x32\x32\x0a\x0a\
|
||||
\x20\x20\x20\x20\x67\x72\x61\x64\x69\x65\x6e\x74\x3a\x20\x47\x72\
|
||||
\x61\x64\x69\x65\x6e\x74\x20\x7b\x0a\x20\x20\x20\x20\x20\x20\x20\
|
||||
\x20\x47\x72\x61\x64\x69\x65\x6e\x74\x53\x74\x6f\x70\x20\x7b\x0a\
|
||||
\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x70\x6f\x73\x69\
|
||||
\x74\x69\x6f\x6e\x3a\x20\x30\x0a\x20\x20\x20\x20\x20\x20\x20\x20\
|
||||
\x20\x20\x20\x20\x42\x65\x68\x61\x76\x69\x6f\x72\x20\x6f\x6e\x20\
|
||||
\x63\x6f\x6c\x6f\x72\x20\x7b\x43\x6f\x6c\x6f\x72\x41\x6e\x69\x6d\
|
||||
\x61\x74\x69\x6f\x6e\x20\x7b\x20\x64\x75\x72\x61\x74\x69\x6f\x6e\
|
||||
\x3a\x20\x31\x30\x30\x20\x7d\x7d\x0a\x20\x20\x20\x20\x20\x20\x20\
|
||||
\x20\x20\x20\x20\x20\x63\x6f\x6c\x6f\x72\x3a\x20\x62\x75\x74\x74\
|
||||
\x6f\x6e\x2e\x70\x72\x65\x73\x73\x65\x64\x20\x3f\x20\x22\x23\x65\
|
||||
\x30\x65\x30\x65\x30\x22\x20\x3a\x20\x22\x23\x66\x66\x66\x22\x0a\
|
||||
\x20\x20\x20\x20\x20\x20\x20\x20\x7d\x0a\x20\x20\x20\x20\x20\x20\
|
||||
\x20\x20\x47\x72\x61\x64\x69\x65\x6e\x74\x53\x74\x6f\x70\x20\x7b\
|
||||
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x70\x6f\x73\
|
||||
\x69\x74\x69\x6f\x6e\x3a\x20\x31\x0a\x20\x20\x20\x20\x20\x20\x20\
|
||||
\x20\x20\x20\x20\x20\x42\x65\x68\x61\x76\x69\x6f\x72\x20\x6f\x6e\
|
||||
\x20\x63\x6f\x6c\x6f\x72\x20\x7b\x43\x6f\x6c\x6f\x72\x41\x6e\x69\
|
||||
\x6d\x61\x74\x69\x6f\x6e\x20\x7b\x20\x64\x75\x72\x61\x74\x69\x6f\
|
||||
\x6e\x3a\x20\x31\x30\x30\x20\x7d\x7d\x0a\x20\x20\x20\x20\x20\x20\
|
||||
\x20\x20\x20\x20\x20\x20\x63\x6f\x6c\x6f\x72\x3a\x20\x62\x75\x74\
|
||||
\x74\x6f\x6e\x2e\x70\x72\x65\x73\x73\x65\x64\x20\x3f\x20\x22\x23\
|
||||
\x65\x30\x65\x30\x65\x30\x22\x20\x3a\x20\x62\x75\x74\x74\x6f\x6e\
|
||||
\x2e\x63\x6f\x6e\x74\x61\x69\x6e\x73\x4d\x6f\x75\x73\x65\x20\x3f\
|
||||
\x20\x22\x23\x66\x35\x66\x35\x66\x35\x22\x20\x3a\x20\x22\x23\x65\
|
||||
\x65\x65\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x7d\x0a\x20\x20\
|
||||
\x20\x20\x7d\x0a\x0a\x20\x20\x20\x20\x49\x6d\x61\x67\x65\x20\x7b\
|
||||
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x69\x64\x3a\x20\x69\x6d\x61\
|
||||
\x67\x65\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x6f\x70\x61\x63\x69\
|
||||
\x74\x79\x3a\x20\x30\x2e\x37\x0a\x20\x20\x20\x20\x20\x20\x20\x20\
|
||||
\x42\x65\x68\x61\x76\x69\x6f\x72\x20\x6f\x6e\x20\x6f\x70\x61\x63\
|
||||
\x69\x74\x79\x20\x7b\x4e\x75\x6d\x62\x65\x72\x41\x6e\x69\x6d\x61\
|
||||
\x74\x69\x6f\x6e\x20\x7b\x64\x75\x72\x61\x74\x69\x6f\x6e\x3a\x20\
|
||||
\x31\x30\x30\x7d\x7d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x73\x6f\
|
||||
\x75\x72\x63\x65\x3a\x20\x22\x69\x6d\x61\x67\x65\x73\x2f\x6e\x65\
|
||||
\x78\x74\x2e\x70\x6e\x67\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\
|
||||
\x61\x6e\x63\x68\x6f\x72\x73\x2e\x76\x65\x72\x74\x69\x63\x61\x6c\
|
||||
\x43\x65\x6e\x74\x65\x72\x3a\x20\x70\x61\x72\x65\x6e\x74\x2e\x76\
|
||||
\x65\x72\x74\x69\x63\x61\x6c\x43\x65\x6e\x74\x65\x72\x0a\x20\x20\
|
||||
\x20\x20\x20\x20\x20\x20\x61\x6e\x63\x68\x6f\x72\x73\x2e\x72\x69\
|
||||
\x67\x68\x74\x3a\x20\x70\x61\x72\x65\x6e\x74\x2e\x72\x69\x67\x68\
|
||||
\x74\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x61\x6e\x63\x68\x6f\x72\
|
||||
\x73\x2e\x72\x69\x67\x68\x74\x4d\x61\x72\x67\x69\x6e\x3a\x20\x31\
|
||||
\x36\x0a\x20\x20\x20\x20\x7d\x0a\x0a\x20\x20\x20\x20\x42\x75\x74\
|
||||
\x74\x6f\x6e\x20\x7b\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x69\x64\
|
||||
\x3a\x20\x62\x75\x74\x74\x6f\x6e\x0a\x20\x20\x20\x20\x20\x20\x20\
|
||||
\x20\x61\x6e\x63\x68\x6f\x72\x73\x2e\x74\x6f\x70\x3a\x20\x70\x61\
|
||||
\x72\x65\x6e\x74\x2e\x74\x6f\x70\x0a\x20\x20\x20\x20\x20\x20\x20\
|
||||
\x20\x61\x6e\x63\x68\x6f\x72\x73\x2e\x6c\x65\x66\x74\x3a\x20\x70\
|
||||
\x61\x72\x65\x6e\x74\x2e\x6c\x65\x66\x74\x0a\x20\x20\x20\x20\x20\
|
||||
\x20\x20\x20\x61\x6e\x63\x68\x6f\x72\x73\x2e\x62\x6f\x74\x74\x6f\
|
||||
\x6d\x3a\x20\x70\x61\x72\x65\x6e\x74\x2e\x62\x6f\x74\x74\x6f\x6d\
|
||||
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x61\x6e\x63\x68\x6f\x72\x73\
|
||||
\x2e\x72\x69\x67\x68\x74\x3a\x69\x6d\x61\x67\x65\x2e\x6c\x65\x66\
|
||||
\x74\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x74\x65\x78\x74\x3a\x20\
|
||||
\x6e\x61\x6d\x65\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x73\x75\x62\
|
||||
\x54\x65\x78\x74\x3a\x20\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6f\
|
||||
\x6e\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x6f\x6e\x43\x6c\x69\x63\
|
||||
\x6b\x65\x64\x3a\x20\x65\x78\x61\x6d\x70\x6c\x65\x49\x74\x65\x6d\
|
||||
\x2e\x65\x78\x61\x6d\x70\x6c\x65\x55\x72\x6c\x20\x3d\x20\x75\x72\
|
||||
\x6c\x3b\x0a\x20\x20\x20\x20\x7d\x0a\x0a\x20\x20\x20\x20\x52\x65\
|
||||
\x63\x74\x61\x6e\x67\x6c\x65\x20\x7b\x0a\x20\x20\x20\x20\x20\x20\
|
||||
\x20\x20\x68\x65\x69\x67\x68\x74\x3a\x20\x31\x0a\x20\x20\x20\x20\
|
||||
\x20\x20\x20\x20\x63\x6f\x6c\x6f\x72\x3a\x20\x22\x23\x63\x63\x63\
|
||||
\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x61\x6e\x63\x68\x6f\x72\
|
||||
\x73\x2e\x62\x6f\x74\x74\x6f\x6d\x3a\x20\x70\x61\x72\x65\x6e\x74\
|
||||
\x2e\x62\x6f\x74\x74\x6f\x6d\x0a\x20\x20\x20\x20\x20\x20\x20\x20\
|
||||
\x61\x6e\x63\x68\x6f\x72\x73\x2e\x6c\x65\x66\x74\x3a\x20\x70\x61\
|
||||
\x72\x65\x6e\x74\x2e\x6c\x65\x66\x74\x0a\x20\x20\x20\x20\x20\x20\
|
||||
\x20\x20\x61\x6e\x63\x68\x6f\x72\x73\x2e\x72\x69\x67\x68\x74\x3a\
|
||||
\x20\x70\x61\x72\x65\x6e\x74\x2e\x72\x69\x67\x68\x74\x0a\x20\x20\
|
||||
\x20\x20\x7d\x0a\x7d\x0a\
|
||||
\x00\x00\x05\x5b\
|
||||
\x89\
|
||||
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
|
||||
@ -949,23 +948,23 @@ qt_resource_name = b"\
|
||||
\x07\x9e\x88\xb4\
|
||||
\x00\x73\
|
||||
\x00\x68\x00\x61\x00\x72\x00\x65\x00\x64\
|
||||
\x00\x06\
|
||||
\x07\x03\x7d\xc3\
|
||||
\x00\x69\
|
||||
\x00\x6d\x00\x61\x00\x67\x00\x65\x00\x73\
|
||||
\x00\x0a\
|
||||
\x0b\x68\x71\x5c\
|
||||
\x00\x42\
|
||||
\x00\x75\x00\x74\x00\x74\x00\x6f\x00\x6e\x00\x2e\x00\x71\x00\x6d\x00\x6c\
|
||||
\x00\x10\
|
||||
\x09\x8e\x7d\x5c\
|
||||
\x00\x4c\
|
||||
\x00\x61\x00\x75\x00\x6e\x00\x63\x00\x68\x00\x65\x00\x72\x00\x4c\x00\x69\x00\x73\x00\x74\x00\x2e\x00\x71\x00\x6d\x00\x6c\
|
||||
\x00\x1a\
|
||||
\x04\x27\x53\xdc\
|
||||
\x00\x53\
|
||||
\x00\x69\x00\x6d\x00\x70\x00\x6c\x00\x65\x00\x4c\x00\x61\x00\x75\x00\x6e\x00\x63\x00\x68\x00\x65\x00\x72\x00\x44\x00\x65\x00\x6c\
|
||||
\x00\x65\x00\x67\x00\x61\x00\x74\x00\x65\x00\x2e\x00\x71\x00\x6d\x00\x6c\
|
||||
\x00\x06\
|
||||
\x07\x03\x7d\xc3\
|
||||
\x00\x69\
|
||||
\x00\x6d\x00\x61\x00\x67\x00\x65\x00\x73\
|
||||
\x00\x10\
|
||||
\x09\x8e\x7d\x5c\
|
||||
\x00\x4c\
|
||||
\x00\x61\x00\x75\x00\x6e\x00\x63\x00\x68\x00\x65\x00\x72\x00\x4c\x00\x69\x00\x73\x00\x74\x00\x2e\x00\x71\x00\x6d\x00\x6c\
|
||||
\x00\x08\
|
||||
\x0c\xf7\x59\xc7\
|
||||
\x00\x6e\
|
||||
@ -976,21 +975,48 @@ qt_resource_name = b"\
|
||||
\x00\x61\x00\x63\x00\x6b\x00\x2e\x00\x70\x00\x6e\x00\x67\
|
||||
"
|
||||
|
||||
qt_resource_struct = b"\
|
||||
qt_resource_struct_v1 = b"\
|
||||
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x01\
|
||||
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x04\x00\x00\x00\x02\
|
||||
\x00\x00\x00\x64\x00\x00\x00\x00\x00\x01\x00\x00\x21\x19\
|
||||
\x00\x00\x00\x12\x00\x02\x00\x00\x00\x02\x00\x00\x00\x06\
|
||||
\x00\x00\x00\x3e\x00\x00\x00\x00\x00\x01\x00\x00\x0c\xdf\
|
||||
\x00\x00\x00\x24\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\
|
||||
\x00\x00\x00\x2c\x00\x00\x00\x00\x00\x01\x00\x00\x0c\xdf\
|
||||
\x00\x00\x00\x66\x00\x02\x00\x00\x00\x02\x00\x00\x00\x06\
|
||||
\x00\x00\x00\x78\x00\x00\x00\x00\x00\x01\x00\x00\x19\xba\
|
||||
\x00\x00\x00\x12\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\
|
||||
\x00\x00\x00\xb4\x00\x00\x00\x00\x00\x01\x00\x00\x33\x53\
|
||||
\x00\x00\x00\x9e\x00\x00\x00\x00\x00\x01\x00\x00\x2d\xf4\
|
||||
"
|
||||
|
||||
qt_resource_struct_v2 = b"\
|
||||
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x01\
|
||||
\x00\x00\x00\x00\x00\x00\x00\x00\
|
||||
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x04\x00\x00\x00\x02\
|
||||
\x00\x00\x00\x00\x00\x00\x00\x00\
|
||||
\x00\x00\x00\x2c\x00\x00\x00\x00\x00\x01\x00\x00\x0c\xdf\
|
||||
\x00\x00\x01\x5a\x38\x00\xd4\xd8\
|
||||
\x00\x00\x00\x66\x00\x02\x00\x00\x00\x02\x00\x00\x00\x06\
|
||||
\x00\x00\x00\x00\x00\x00\x00\x00\
|
||||
\x00\x00\x00\x78\x00\x00\x00\x00\x00\x01\x00\x00\x19\xba\
|
||||
\x00\x00\x01\x5a\x38\x00\xd4\xd8\
|
||||
\x00\x00\x00\x12\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\
|
||||
\x00\x00\x01\x5a\x38\x00\xd4\xd8\
|
||||
\x00\x00\x00\xb4\x00\x00\x00\x00\x00\x01\x00\x00\x33\x53\
|
||||
\x00\x00\x01\x5a\x38\x00\xd4\xd8\
|
||||
\x00\x00\x00\x9e\x00\x00\x00\x00\x00\x01\x00\x00\x2d\xf4\
|
||||
\x00\x00\x01\x5a\x38\x00\xd4\xd8\
|
||||
"
|
||||
|
||||
qt_version = QtCore.qVersion().split('.')
|
||||
if qt_version < ['5', '8', '0']:
|
||||
rcc_version = 1
|
||||
qt_resource_struct = qt_resource_struct_v1
|
||||
else:
|
||||
rcc_version = 2
|
||||
qt_resource_struct = qt_resource_struct_v2
|
||||
|
||||
def qInitResources():
|
||||
QtCore.qRegisterResourceData(0x01, qt_resource_struct, qt_resource_name, qt_resource_data)
|
||||
QtCore.qRegisterResourceData(rcc_version, qt_resource_struct, qt_resource_name, qt_resource_data)
|
||||
|
||||
def qCleanupResources():
|
||||
QtCore.qUnregisterResourceData(0x01, qt_resource_struct, qt_resource_name, qt_resource_data)
|
||||
QtCore.qUnregisterResourceData(rcc_version, qt_resource_struct, qt_resource_name, qt_resource_data)
|
||||
|
||||
qInitResources()
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#############################################################################
|
||||
##
|
||||
## Copyright (C) 2013 Riverbank Computing Limited.
|
||||
## Copyright (C) 2018 Riverbank Computing Limited.
|
||||
## Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
##
|
||||
## This file is part of the examples of PyQt.
|
||||
@ -41,7 +41,7 @@
|
||||
#############################################################################
|
||||
|
||||
|
||||
from PyQt5.QtCore import pyqtProperty, QRectF, QUrl
|
||||
from PyQt5.QtCore import pyqtProperty, pyqtSignal, QRectF, QUrl
|
||||
from PyQt5.QtGui import QColor, QGuiApplication, QPainter, QPen
|
||||
from PyQt5.QtQml import qmlRegisterType
|
||||
from PyQt5.QtQuick import QQuickPaintedItem, QQuickView
|
||||
@ -49,13 +49,18 @@ from PyQt5.QtQuick import QQuickPaintedItem, QQuickView
|
||||
|
||||
class PieChart(QQuickPaintedItem):
|
||||
|
||||
@pyqtProperty(str)
|
||||
nameChanged = pyqtSignal(str)
|
||||
|
||||
@pyqtProperty(str, notify=nameChanged)
|
||||
def name(self):
|
||||
return self._name
|
||||
|
||||
@name.setter
|
||||
def name(self, name):
|
||||
self._name = name
|
||||
if self._name != name:
|
||||
self._name = name
|
||||
self.nameChanged.emit(name)
|
||||
self.update()
|
||||
|
||||
@pyqtProperty(QColor)
|
||||
def color(self):
|
||||
@ -91,7 +96,8 @@ if __name__ == '__main__':
|
||||
view.setResizeMode(QQuickView.SizeRootObjectToView)
|
||||
view.setSource(
|
||||
QUrl.fromLocalFile(
|
||||
os.path.join(os.path.dirname(__file__),'app.qml')))
|
||||
os.path.join(os.path.dirname(os.path.abspath(__file__)),
|
||||
'app.qml')))
|
||||
view.show()
|
||||
|
||||
sys.exit(app.exec_())
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#############################################################################
|
||||
##
|
||||
## Copyright (C) 2013 Riverbank Computing Limited.
|
||||
## Copyright (C) 2018 Riverbank Computing Limited.
|
||||
## Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
##
|
||||
## This file is part of the examples of PyQt.
|
||||
@ -100,7 +100,8 @@ if __name__ == '__main__':
|
||||
view.setResizeMode(QQuickView.SizeRootObjectToView)
|
||||
view.setSource(
|
||||
QUrl.fromLocalFile(
|
||||
os.path.join(os.path.dirname(__file__),'app.qml')))
|
||||
os.path.join(os.path.dirname(os.path.abspath(__file__)),
|
||||
'app.qml')))
|
||||
view.show()
|
||||
|
||||
sys.exit(app.exec_())
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#############################################################################
|
||||
##
|
||||
## Copyright (C) 2013 Riverbank Computing Limited.
|
||||
## Copyright (C) 2018 Riverbank Computing Limited.
|
||||
## Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
##
|
||||
## This file is part of the examples of PyQt.
|
||||
@ -101,7 +101,8 @@ if __name__ == '__main__':
|
||||
view.setResizeMode(QQuickView.SizeRootObjectToView)
|
||||
view.setSource(
|
||||
QUrl.fromLocalFile(
|
||||
os.path.join(os.path.dirname(__file__),'app.qml')))
|
||||
os.path.join(os.path.dirname(os.path.abspath(__file__)),
|
||||
'app.qml')))
|
||||
view.show()
|
||||
|
||||
sys.exit(app.exec_())
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#############################################################################
|
||||
##
|
||||
## Copyright (C) 2013 Riverbank Computing Limited.
|
||||
## Copyright (C) 2018 Riverbank Computing Limited.
|
||||
## Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
##
|
||||
## This file is part of the examples of PyQt.
|
||||
@ -109,7 +109,8 @@ if __name__ == '__main__':
|
||||
view.setResizeMode(QQuickView.SizeRootObjectToView)
|
||||
view.setSource(
|
||||
QUrl.fromLocalFile(
|
||||
os.path.join(os.path.dirname(__file__),'app.qml')))
|
||||
os.path.join(os.path.dirname(os.path.abspath(__file__)),
|
||||
'app.qml')))
|
||||
view.show()
|
||||
|
||||
sys.exit(app.exec_())
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#############################################################################
|
||||
##
|
||||
## Copyright (C) 2013 Riverbank Computing Limited.
|
||||
## Copyright (C) 2018 Riverbank Computing Limited.
|
||||
## Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
##
|
||||
## This file is part of the examples of PyQt.
|
||||
@ -122,7 +122,8 @@ if __name__ == '__main__':
|
||||
view.setResizeMode(QQuickView.SizeRootObjectToView)
|
||||
view.setSource(
|
||||
QUrl.fromLocalFile(
|
||||
os.path.join(os.path.dirname(__file__),'app.qml')))
|
||||
os.path.join(os.path.dirname(os.path.abspath(__file__)),
|
||||
'app.qml')))
|
||||
view.show()
|
||||
|
||||
sys.exit(app.exec_())
|
||||
|
@ -1,2 +1,2 @@
|
||||
module Charts
|
||||
plugin pyqt5qmlplugin C:/Users/marcus/AppData/Local/Programs/Python/Python35/Lib/site-packages/PyQt5/plugins/PyQt5
|
||||
plugin pyqt5qmlplugin
|
||||
|
78
src/pyqt-official/remoteobjects/modelview/modelviewclient.py
Normal file
78
src/pyqt-official/remoteobjects/modelview/modelviewclient.py
Normal file
@ -0,0 +1,78 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
|
||||
#############################################################################
|
||||
##
|
||||
## Copyright (C) 2018 Riverbank Computing Limited
|
||||
## Copyright (C) 2017 Ford Motor Company
|
||||
##
|
||||
## This file is part of the examples of PyQt.
|
||||
##
|
||||
## $QT_BEGIN_LICENSE:BSD$
|
||||
## Commercial License Usage
|
||||
## Licensees holding valid commercial Qt licenses may use this file in
|
||||
## accordance with the commercial license agreement provided with the
|
||||
## Software or, alternatively, in accordance with the terms contained in
|
||||
## a written agreement between you and The Qt Company. For licensing terms
|
||||
## and conditions see https://www.qt.io/terms-conditions. For further
|
||||
## information use the contact form at https://www.qt.io/contact-us.
|
||||
##
|
||||
## BSD License Usage
|
||||
## Alternatively, 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
|
||||
|
||||
from PyQt5.QtCore import QLoggingCategory, QUrl
|
||||
from PyQt5.QtRemoteObjects import QRemoteObjectNode
|
||||
from PyQt5.QtWidgets import QApplication, QTreeView
|
||||
|
||||
|
||||
QLoggingCategory.setFilterRules('qt.remoteobjects.debug=false\n'
|
||||
'qt.remoteobjects.warning=false\n'
|
||||
'qt.remoteobjects.models.debug=false\n'
|
||||
'qt.remoteobjects.models.debug=false')
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
|
||||
node = QRemoteObjectNode(QUrl('local:registry'))
|
||||
node.setHeartbeatInterval(1000)
|
||||
|
||||
view = QTreeView()
|
||||
view.setWindowTitle("RemoteView")
|
||||
view.resize(640, 480)
|
||||
|
||||
model = node.acquireModel('RemoteModel')
|
||||
view.setModel(model)
|
||||
view.show();
|
||||
|
||||
sys.exit(app.exec_())
|
169
src/pyqt-official/remoteobjects/modelview/modelviewserver.py
Normal file
169
src/pyqt-official/remoteobjects/modelview/modelviewserver.py
Normal file
@ -0,0 +1,169 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
|
||||
#############################################################################
|
||||
##
|
||||
## Copyright (C) 2018 Riverbank Computing Limited
|
||||
## Copyright (C) 2017 Ford Motor Company
|
||||
##
|
||||
## This file is part of the PyQt examples.
|
||||
##
|
||||
## $QT_BEGIN_LICENSE:BSD$
|
||||
## Commercial License Usage
|
||||
## Licensees holding valid commercial Qt licenses may use this file in
|
||||
## accordance with the commercial license agreement provided with the
|
||||
## Software or, alternatively, in accordance with the terms contained in
|
||||
## a written agreement between you and The Qt Company. For licensing terms
|
||||
## and conditions see https://www.qt.io/terms-conditions. For further
|
||||
## information use the contact form at https://www.qt.io/contact-us.
|
||||
##
|
||||
## BSD License Usage
|
||||
## Alternatively, 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
|
||||
|
||||
from PyQt5.QtCore import (pyqtSlot, QLoggingCategory, QModelIndex, QObject, Qt,
|
||||
QTimer, QUrl)
|
||||
from PyQt5.QtGui import QColor, QStandardItem, QStandardItemModel
|
||||
from PyQt5.QtRemoteObjects import QRemoteObjectHost, QRemoteObjectRegistryHost
|
||||
from PyQt5.QtWidgets import QApplication, QTreeView
|
||||
|
||||
|
||||
class TimerHandler(QObject):
|
||||
|
||||
def __init__(self, model, parent=None):
|
||||
super().__init__(parent)
|
||||
|
||||
self._model = model
|
||||
|
||||
@pyqtSlot()
|
||||
def changeData(self):
|
||||
for i in range(10, 50):
|
||||
self._model.setData(self._model.index(i, 1), QColor(Qt.blue),
|
||||
Qt.BackgroundRole)
|
||||
|
||||
@pyqtSlot()
|
||||
def insertData(self):
|
||||
self._model.insertRows(2, 9)
|
||||
|
||||
for i in range(2, 11):
|
||||
self._model.setData(self._model.index(i, 1), QColor(Qt.green),
|
||||
Qt.BackgroundRole)
|
||||
self._model.setData(self._model.index(i, 1), "InsertedRow",
|
||||
Qt.DisplayRole)
|
||||
|
||||
@pyqtSlot()
|
||||
def removeData(self):
|
||||
self._model.removeRows(2, 4)
|
||||
|
||||
@pyqtSlot()
|
||||
def changeFlags(self):
|
||||
item = self._model.item(0, 0)
|
||||
item.setEnabled(False)
|
||||
|
||||
item = item.child(0, 0)
|
||||
item.setFlags(item.flags() & Qt.ItemIsSelectable)
|
||||
|
||||
@pyqtSlot()
|
||||
def moveData(self):
|
||||
self._model.moveRows(QModelIndex(), 2, 4, QModelIndex(), 10)
|
||||
|
||||
|
||||
def addChild(numChildren, nestingLevel):
|
||||
result = []
|
||||
|
||||
if nestingLevel == 0:
|
||||
return result
|
||||
|
||||
for i in range(numChildren):
|
||||
child = QStandardItem(
|
||||
"Child num {}, nesting level {}".format(i + 1, nestingLevel))
|
||||
|
||||
if i == 0:
|
||||
child.appendRow(addChild(numChildren, nestingLevel - 1))
|
||||
|
||||
result.append(child)
|
||||
|
||||
return result
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
QLoggingCategory.setFilterRules('qt.remoteobjects.debug=false\n'
|
||||
'qt.remoteobjects.warning=false')
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
|
||||
sourceModel = QStandardItemModel()
|
||||
sourceModel.setHorizontalHeaderLabels(
|
||||
["First Column with spacing", "Second Column with spacing"])
|
||||
|
||||
for i in range(10000):
|
||||
firstItem = QStandardItem("FancyTextNumber {}".format(i))
|
||||
if i == 0:
|
||||
firstItem.appendRow(addChild(2, 2))
|
||||
|
||||
secondItem = QStandardItem("FancyRow2TextNumber {}".format(i))
|
||||
if i % 2 == 0:
|
||||
firstItem.setBackground(Qt.red)
|
||||
|
||||
sourceModel.invisibleRootItem().appendRow([firstItem, secondItem])
|
||||
|
||||
# Needed by QMLModelViewClient.
|
||||
roleNames = {
|
||||
Qt.DisplayRole: b'_text',
|
||||
Qt.BackgroundRole: b'_color'
|
||||
}
|
||||
sourceModel.setItemRoleNames(roleNames)
|
||||
|
||||
roles = [Qt.DisplayRole, Qt.BackgroundRole]
|
||||
|
||||
node = QRemoteObjectRegistryHost(QUrl('local:registry'))
|
||||
|
||||
node2 = QRemoteObjectHost(QUrl('local:replica'), QUrl('local:registry'))
|
||||
node2.enableRemoting(sourceModel, 'RemoteModel', roles)
|
||||
|
||||
view = QTreeView()
|
||||
view.setWindowTitle("SourceView")
|
||||
view.setModel(sourceModel)
|
||||
view.show()
|
||||
|
||||
handler = TimerHandler(sourceModel)
|
||||
QTimer.singleShot(5000, handler.changeData)
|
||||
QTimer.singleShot(10000, handler.insertData)
|
||||
QTimer.singleShot(11000, handler.changeFlags)
|
||||
QTimer.singleShot(12000, handler.removeData)
|
||||
QTimer.singleShot(13000, handler.moveData)
|
||||
|
||||
sys.exit(app.exec_())
|
@ -0,0 +1,110 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
|
||||
#############################################################################
|
||||
##
|
||||
## Copyright (C) 2018 Riverbank Computing Limited
|
||||
## Copyright (C) 2017 Ford Motor Company
|
||||
##
|
||||
## This file is part of the PyQt examples.
|
||||
##
|
||||
## $QT_BEGIN_LICENSE:BSD$
|
||||
## Commercial License Usage
|
||||
## Licensees holding valid commercial Qt licenses may use this file in
|
||||
## accordance with the commercial license agreement provided with the
|
||||
## Software or, alternatively, in accordance with the terms contained in
|
||||
## a written agreement between you and The Qt Company. For licensing terms
|
||||
## and conditions see https://www.qt.io/terms-conditions. For further
|
||||
## information use the contact form at https://www.qt.io/contact-us.
|
||||
##
|
||||
## BSD License Usage
|
||||
## Alternatively, 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
|
||||
|
||||
from PyQt5.QtCore import pyqtSignal, pyqtSlot, QCoreApplication, QObject, QUrl
|
||||
from PyQt5.QtRemoteObjects import QRemoteObjectNode
|
||||
|
||||
|
||||
class DynamicClient(QObject):
|
||||
|
||||
# This signal is connected with server_slot() slot of the source object and
|
||||
# echoes back the switch state received from the source.
|
||||
echoSwitchState = pyqtSignal(bool)
|
||||
|
||||
def __init__(self, replica, parent=None):
|
||||
super().__init__(parent)
|
||||
|
||||
self._replica = replica
|
||||
self._clientSwitchState = False
|
||||
|
||||
replica.initialized.connect(self.initConnection)
|
||||
|
||||
@pyqtSlot(bool)
|
||||
def recSwitchState(self, value):
|
||||
self._clientSwitchState = self._replica.property('currState')
|
||||
|
||||
print("Received source state", value, self._clientSwitchState)
|
||||
|
||||
# Emit the signal to echo the received state back to the server.
|
||||
self.echoSwitchState.emit(self._clientSwitchState)
|
||||
|
||||
@pyqtSlot()
|
||||
def initConnection(self):
|
||||
# Connect the replica source signal currStateChanged() with the
|
||||
# client's recSwitchState() slot to receive the source's current state.
|
||||
self._replica.currStateChanged.connect(self.recSwitchState)
|
||||
|
||||
# Connect the client's echoSwitchState() signal with replica's
|
||||
# server_slot() to echo back the received state.
|
||||
self.echoSwitchState.connect(self._replica.server_slot)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
app = QCoreApplication(sys.argv)
|
||||
|
||||
# Create the remote object node.
|
||||
repNode = QRemoteObjectNode()
|
||||
|
||||
# Connect with the remote host node.
|
||||
repNode.connectToNode(QUrl('local:replica'))
|
||||
|
||||
# Acquire a replica of the source from the host node.
|
||||
replica = repNode.acquireDynamic('SimpleSwitch')
|
||||
|
||||
# Create the client switch object and pass the replica to it.
|
||||
rswitch = DynamicClient(replica)
|
||||
|
||||
sys.exit(app.exec_())
|
@ -0,0 +1,130 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
|
||||
#############################################################################
|
||||
##
|
||||
## Copyright (C) 2018 Riverbank Computing Limited
|
||||
## Copyright (C) 2017 Ford Motor Company
|
||||
##
|
||||
## This file is part of the PyQt examples.
|
||||
##
|
||||
## $QT_BEGIN_LICENSE:BSD$
|
||||
## Commercial License Usage
|
||||
## Licensees holding valid commercial Qt licenses may use this file in
|
||||
## accordance with the commercial license agreement provided with the
|
||||
## Software or, alternatively, in accordance with the terms contained in
|
||||
## a written agreement between you and The Qt Company. For licensing terms
|
||||
## and conditions see https://www.qt.io/terms-conditions. For further
|
||||
## information use the contact form at https://www.qt.io/contact-us.
|
||||
##
|
||||
## BSD License Usage
|
||||
## Alternatively, 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
|
||||
|
||||
from PyQt5.QtCore import (pyqtProperty, pyqtSignal, pyqtSlot, QCoreApplication,
|
||||
QObject, QTimer, QUrl)
|
||||
from PyQt5.QtRemoteObjects import QRemoteObjectHost
|
||||
|
||||
|
||||
class SimpleSwitch(QObject):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
|
||||
self._currState = False
|
||||
|
||||
self._stateChangeTimer = QTimer(self)
|
||||
self._stateChangeTimer.timeout.connect(self._timeout)
|
||||
self._stateChangeTimer.start(2000)
|
||||
|
||||
print("Source node started")
|
||||
|
||||
# PyQt does not support the use of static source types defined in .rep
|
||||
# files. However we can manually specify a dynamic type that matches a
|
||||
# .rep defined type by defining properties, signals and slots in the same
|
||||
# order. We also have to account for any internals also generated by the
|
||||
# .rep generator. At the moment this only includes an extra 'push' slot
|
||||
# for each property (that never seems to get called). This allows this
|
||||
# example to act as a server for Qt's C++ 'directconnectclient' example.
|
||||
# It is not necessary when using with clients that use dynamic source types
|
||||
# (written using either C++ or Python).
|
||||
@pyqtSlot()
|
||||
def pushCurrState(self, currState):
|
||||
pass
|
||||
|
||||
def _get_currState(self):
|
||||
return self._currState
|
||||
|
||||
def _set_currState(self, value):
|
||||
# If the value has changed then update it and emit the notify signal.
|
||||
if self._currState != value:
|
||||
self._currState = value
|
||||
self.currStateChanged.emit(value)
|
||||
|
||||
# The property's notify signal.
|
||||
currStateChanged = pyqtSignal(bool)
|
||||
|
||||
# The property exposed to a remote client.
|
||||
currState = pyqtProperty(bool, fget=_get_currState, fset=_set_currState,
|
||||
notify=currStateChanged)
|
||||
|
||||
# The slot exposed to a remote client.
|
||||
@pyqtSlot(bool)
|
||||
def server_slot(self, clientState):
|
||||
# The switch state echoed back by the client.
|
||||
print("Replica state is", clientState)
|
||||
|
||||
def _timeout(self):
|
||||
# Note that we don't decorate this callable so that it doesn't get
|
||||
# exposed in a replica.
|
||||
self.currState = not self.currState
|
||||
|
||||
print("Source state is", self.currState)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
app = QCoreApplication(sys.argv)
|
||||
|
||||
# Create the simple switch.
|
||||
srcSwitch = SimpleSwitch()
|
||||
|
||||
# Create the host object node.
|
||||
srcNode = QRemoteObjectHost(QUrl('local:replica'))
|
||||
|
||||
# Enable remoting.
|
||||
srcNode.enableRemoting(srcSwitch, 'SimpleSwitch')
|
||||
|
||||
sys.exit(app.exec_())
|
@ -0,0 +1,107 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
|
||||
#############################################################################
|
||||
##
|
||||
## Copyright (C) 2018 Riverbank Computing Limited
|
||||
## Copyright (C) 2017 Ford Motor Company
|
||||
##
|
||||
## This file is part of the PyQt examples.
|
||||
##
|
||||
## $QT_BEGIN_LICENSE:BSD$
|
||||
## Commercial License Usage
|
||||
## Licensees holding valid commercial Qt licenses may use this file in
|
||||
## accordance with the commercial license agreement provided with the
|
||||
## Software or, alternatively, in accordance with the terms contained in
|
||||
## a written agreement between you and The Qt Company. For licensing terms
|
||||
## and conditions see https://www.qt.io/terms-conditions. For further
|
||||
## information use the contact form at https://www.qt.io/contact-us.
|
||||
##
|
||||
## BSD License Usage
|
||||
## Alternatively, 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
|
||||
|
||||
from PyQt5.QtCore import pyqtSignal, pyqtSlot, QCoreApplication, QObject, QUrl
|
||||
from PyQt5.QtRemoteObjects import QRemoteObjectNode
|
||||
|
||||
|
||||
class DynamicClient(QObject):
|
||||
|
||||
# This signal is connected with server_slot() slot of the source object and
|
||||
# echoes back the switch state received from the source.
|
||||
echoSwitchState = pyqtSignal(bool)
|
||||
|
||||
def __init__(self, replica, parent=None):
|
||||
super().__init__(parent)
|
||||
|
||||
self._replica = replica
|
||||
self._clientSwitchState = False
|
||||
|
||||
replica.initialized.connect(self.initConnection)
|
||||
|
||||
@pyqtSlot(bool)
|
||||
def recSwitchState(self, value):
|
||||
self._clientSwitchState = self._replica.property('currState')
|
||||
|
||||
print("Received source state", value, self._clientSwitchState)
|
||||
|
||||
# Emit the signal to echo the received state back to the server.
|
||||
self.echoSwitchState.emit(self._clientSwitchState)
|
||||
|
||||
@pyqtSlot()
|
||||
def initConnection(self):
|
||||
# Connect the replica source signal currStateChanged() with the
|
||||
# client's recSwitchState() slot to receive the source's current state.
|
||||
self._replica.currStateChanged.connect(self.recSwitchState)
|
||||
|
||||
# Connect the client's echoSwitchState() signal with replica's
|
||||
# server_slot() to echo back the received state.
|
||||
self.echoSwitchState.connect(self._replica.server_slot)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
app = QCoreApplication(sys.argv)
|
||||
|
||||
# Create the remote object node.
|
||||
repNode = QRemoteObjectNode(QUrl('local:registry'))
|
||||
|
||||
# Acquire a replica of the source from the host node.
|
||||
replica = repNode.acquireDynamic('SimpleSwitch')
|
||||
|
||||
# Create the client switch object and pass the replica to it.
|
||||
rswitch = DynamicClient(replica)
|
||||
|
||||
sys.exit(app.exec_())
|
@ -0,0 +1,135 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
|
||||
#############################################################################
|
||||
##
|
||||
## Copyright (C) 2018 Riverbank Computing Limited
|
||||
## Copyright (C) 2017 Ford Motor Company
|
||||
##
|
||||
## This file is part of the PyQt examples.
|
||||
##
|
||||
## $QT_BEGIN_LICENSE:BSD$
|
||||
## Commercial License Usage
|
||||
## Licensees holding valid commercial Qt licenses may use this file in
|
||||
## accordance with the commercial license agreement provided with the
|
||||
## Software or, alternatively, in accordance with the terms contained in
|
||||
## a written agreement between you and The Qt Company. For licensing terms
|
||||
## and conditions see https://www.qt.io/terms-conditions. For further
|
||||
## information use the contact form at https://www.qt.io/contact-us.
|
||||
##
|
||||
## BSD License Usage
|
||||
## Alternatively, 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
|
||||
|
||||
from PyQt5.QtCore import (pyqtProperty, pyqtSignal, pyqtSlot, QCoreApplication,
|
||||
QObject, QTimer, QUrl)
|
||||
from PyQt5.QtRemoteObjects import QRemoteObjectHost, QRemoteObjectRegistryHost
|
||||
|
||||
|
||||
class SimpleSwitch(QObject):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
|
||||
self._currState = False
|
||||
|
||||
self._stateChangeTimer = QTimer(self)
|
||||
self._stateChangeTimer.timeout.connect(self._timeout)
|
||||
self._stateChangeTimer.start(2000)
|
||||
|
||||
print("Source node started")
|
||||
|
||||
# PyQt does not support the use of static source types defined in .rep
|
||||
# files. However we can manually specify a dynamic type that matches a
|
||||
# .rep defined type by defining properties, signals and slots in the same
|
||||
# order. We also have to account for any internals also generated by the
|
||||
# .rep generator. At the moment this only includes an extra 'push' slot
|
||||
# for each property (that never seems to get called). This allows this
|
||||
# example to act as a server for Qt's C++ 'directconnectclient' example.
|
||||
# It is not necessary when using with clients that use dynamic source types
|
||||
# (written using either C++ or Python).
|
||||
@pyqtSlot()
|
||||
def pushCurrState(self, currState):
|
||||
pass
|
||||
|
||||
def _get_currState(self):
|
||||
return self._currState
|
||||
|
||||
def _set_currState(self, value):
|
||||
# If the value has changed then update it and emit the notify signal.
|
||||
if self._currState != value:
|
||||
self._currState = value
|
||||
self.currStateChanged.emit(value)
|
||||
|
||||
# The property's notify signal.
|
||||
currStateChanged = pyqtSignal(bool)
|
||||
|
||||
# The property exposed to a remote client.
|
||||
currState = pyqtProperty(bool, fget=_get_currState, fset=_set_currState,
|
||||
notify=currStateChanged)
|
||||
|
||||
# The slot exposed to a remote client.
|
||||
@pyqtSlot(bool)
|
||||
def server_slot(self, clientState):
|
||||
# The switch state echoed back by the client.
|
||||
print("Replica state is", clientState)
|
||||
|
||||
def _timeout(self):
|
||||
# Note that we don't decorate this callable so that it doesn't get
|
||||
# exposed in a replica.
|
||||
self.currState = not self.currState
|
||||
|
||||
print("Source state is", self.currState)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
app = QCoreApplication(sys.argv)
|
||||
|
||||
# Create the simple switch.
|
||||
srcSwitch = SimpleSwitch()
|
||||
|
||||
# Create the node that hosts the registry. This could be in a separate
|
||||
# process.
|
||||
regNode = QRemoteObjectRegistryHost(QUrl('local:registry'))
|
||||
|
||||
# Create the host object node. This will connect to the registry node
|
||||
# rather than to a client.
|
||||
srcNode = QRemoteObjectHost(QUrl('local:replica'), QUrl('local:registry'))
|
||||
|
||||
# Enable remoting.
|
||||
srcNode.enableRemoting(srcSwitch, 'SimpleSwitch')
|
||||
|
||||
sys.exit(app.exec_())
|
@ -1,6 +1,6 @@
|
||||
Paulo Coelho: O Gênio e as Rosas
|
||||
Anna Hallström, Urban Östberg: Svår svenska
|
||||
Darrell Huff: How to Lie with Statistics
|
||||
Franz Kafka: Das Schloß
|
||||
Walter Moers: Die 13½ Leben des Käpt'n Blaubär
|
||||
Dag Solstad: Forsøk på å beskrive det ugjennomtrengelige
|
||||
Paulo Coelho: O Gênio e as Rosas
|
||||
Anna Hallström, Urban Östberg: Svår svenska
|
||||
Darrell Huff: How to Lie with Statistics
|
||||
Franz Kafka: Das Schloß
|
||||
Walter Moers: Die 13½ Leben des Käpt'n Blaubär
|
||||
Dag Solstad: Forsøk på å beskrive det ugjennomtrengelige
|
||||
|
@ -1,8 +1,8 @@
|
||||
Paulo Coelho: O Gênio e as Rosas
|
||||
Jean-Pierre Coffe: À table en famille avec 15 ¤ par jour
|
||||
Anna Hallström, Urban Östberg: Svår svenska
|
||||
Darrell Huff: How to Lie with Statistics
|
||||
Franz Kafka: Das Schloß
|
||||
Helena Lehecková: T¨ekkiä suomalaisille
|
||||
Arthur Rimbaud: ¼uvres complètes
|
||||
Dag Solstad: Forsøk på å beskrive det ugjennomtrengelige
|
||||
Paulo Coelho: O Gênio e as Rosas
|
||||
Jean-Pierre Coffe: À table en famille avec 15 ¤ par jour
|
||||
Anna Hallström, Urban Östberg: Svår svenska
|
||||
Darrell Huff: How to Lie with Statistics
|
||||
Franz Kafka: Das Schloß
|
||||
Helena Lehecková: T¨ekkiä suomalaisille
|
||||
Arthur Rimbaud: ¼uvres complètes
|
||||
Dag Solstad: Forsøk på å beskrive det ugjennomtrengelige
|
||||
|
Loading…
x
Reference in New Issue
Block a user