Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add examples #119

Merged
merged 77 commits into from
Aug 31, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
2b93dbe
Add examples
fredrikaverpil Aug 29, 2016
6765130
Increase sleep to 5 secs
fredrikaverpil Aug 29, 2016
12bd3d1
Fix parse error
fredrikaverpil Aug 29, 2016
3d6cdb0
Add headline
fredrikaverpil Aug 29, 2016
8fff5b9
Revert "Add headline"
fredrikaverpil Aug 29, 2016
b13dfcd
Implement #105
mottosso Aug 29, 2016
8f95c5d
Implement #105
mottosso Aug 29, 2016
1fe8bda
Fix Dockerfile for Python 3.5
mottosso Aug 29, 2016
b591fd5
Do not run under Python 3
mottosso Aug 29, 2016
0d69db9
Use standalone python scripts
fredrikaverpil Aug 29, 2016
2985cec
Remove debug command
fredrikaverpil Aug 29, 2016
fd5a9aa
Add examples testing to Python 3
fredrikaverpil Aug 29, 2016
dd221c8
Revert change
fredrikaverpil Aug 29, 2016
fb2fbfa
Revert change
fredrikaverpil Aug 29, 2016
4ccc85e
Add newline
fredrikaverpil Aug 29, 2016
7474ce1
Add missing members, exclude PySide2-only members
mottosso Aug 29, 2016
6264a44
Merge remote-tracking branch 'origin/master' into #105
mottosso Aug 29, 2016
0003969
Explicitly run test files
mottosso Aug 29, 2016
8885178
Attempt fix sefault
fredrikaverpil Aug 29, 2016
ce09ec5
Remove file
fredrikaverpil Aug 29, 2016
f643d01
Set preferred binding
fredrikaverpil Aug 29, 2016
0242e64
Remove preffered binding, use obj.__class__ instead of type()
fredrikaverpil Aug 29, 2016
7c19fa5
Add loadUiType example
fredrikaverpil Aug 29, 2016
4dadafa
Set preferred bindings
fredrikaverpil Aug 29, 2016
c537d99
Fix exec error in Python 3.5
fredrikaverpil Aug 29, 2016
6c9cce3
Add README
fredrikaverpil Aug 29, 2016
d10c7d6
Set preferred binding
fredrikaverpil Aug 29, 2016
ce3be1d
Remove pyside-tools and pyside2-tools
fredrikaverpil Aug 29, 2016
0c3093a
Update README
fredrikaverpil Aug 29, 2016
6643bdf
Fix isinstance(window, QtWidgets.QWidget)
fredrikaverpil Aug 29, 2016
cf7140a
Refine membership build
mottosso Aug 30, 2016
0ab9f8e
Rename to conform to https://github.com/mottosso/Qt.py/pull/120
fredrikaverpil Aug 30, 2016
bcb22a0
Add descriptions to membership test
mottosso Aug 30, 2016
1f7791e
Improve membership test, and augment documentation.
mottosso Aug 30, 2016
8f58e0d
Update documentation for load_ui
mottosso Aug 30, 2016
431d3ec
Clarify documentation and return values
mottosso Aug 30, 2016
c41007a
Test that documentation for load_ui is true
mottosso Aug 30, 2016
95fcc34
Test every binding; TODO: improve maintenance of these kinds of tests
mottosso Aug 30, 2016
4691451
Fix tests.py
mottosso Aug 30, 2016
6f39c2c
Merge pull request #121 from abstractfactory/documentation
mottosso Aug 30, 2016
6d86cc9
Merge pull request #120 from abstractfactory/#105
mottosso Aug 30, 2016
2ecb22e
Add examples
fredrikaverpil Aug 29, 2016
6590961
Increase sleep to 5 secs
fredrikaverpil Aug 29, 2016
8ffa6ac
Fix parse error
fredrikaverpil Aug 29, 2016
929225d
Add headline
fredrikaverpil Aug 29, 2016
c9ef52e
Revert "Add headline"
fredrikaverpil Aug 29, 2016
40e5cb3
Use standalone python scripts
fredrikaverpil Aug 29, 2016
8d82869
Revert change
fredrikaverpil Aug 29, 2016
6e3b17e
Revert change
fredrikaverpil Aug 29, 2016
50560a7
Add newline
fredrikaverpil Aug 29, 2016
9586119
Attempt fix sefault
fredrikaverpil Aug 29, 2016
1a50304
Remove file
fredrikaverpil Aug 29, 2016
214a3e9
Set preferred binding
fredrikaverpil Aug 29, 2016
e26a492
Remove preffered binding, use obj.__class__ instead of type()
fredrikaverpil Aug 29, 2016
989f4d0
Add loadUiType example
fredrikaverpil Aug 29, 2016
2d4dbc0
Set preferred bindings
fredrikaverpil Aug 29, 2016
4a7ca44
Fix exec error in Python 3.5
fredrikaverpil Aug 29, 2016
176b9e3
Add README
fredrikaverpil Aug 29, 2016
fe675c1
Set preferred binding
fredrikaverpil Aug 29, 2016
4d0c53b
Remove pyside-tools and pyside2-tools
fredrikaverpil Aug 29, 2016
35c600e
Update README
fredrikaverpil Aug 29, 2016
39290a5
Fix isinstance(window, QtWidgets.QWidget)
fredrikaverpil Aug 29, 2016
648d4a1
Rename to conform to https://github.com/mottosso/Qt.py/pull/120
fredrikaverpil Aug 30, 2016
63bc59e
Remove/rename file
fredrikaverpil Aug 30, 2016
8b96fb4
Add examples building
fredrikaverpil Aug 30, 2016
f15e879
Increase sleep delay to 10 (solve issues on OS X)
fredrikaverpil Aug 30, 2016
0e0f8eb
Merge remote-tracking branch 'refs/remotes/origin/feature/examples'
fredrikaverpil Aug 30, 2016
b73490f
Test test*.py
fredrikaverpil Aug 30, 2016
accc33c
Restructure
fredrikaverpil Aug 30, 2016
a3c7d38
Update path to .ui
fredrikaverpil Aug 30, 2016
659b32c
Fix comments by @mottosso
fredrikaverpil Aug 31, 2016
fb41189
Also copy non-python example files into work directory
fredrikaverpil Aug 31, 2016
2d06076
Do not buld examples, just run them as they are
fredrikaverpil Aug 31, 2016
f7d74c4
Rename examples
fredrikaverpil Aug 31, 2016
92bbf74
Wait for Xvfb
fredrikaverpil Aug 31, 2016
d4b6e62
Convert tabs to spaces (oops)
fredrikaverpil Aug 31, 2016
6649b6b
Add linebreaks for long bash command
fredrikaverpil Aug 31, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions Dockerfile-py2.7
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,16 @@ ENV DISPLAY :99

WORKDIR /workspace/Qt.py
ENTRYPOINT cp -r /Qt.py /workspace && \
python build_caveats_tests.py && \
Xvfb :99 -screen 0 1024x768x16 2>/dev/null & \
sleep 3 && \
python build_caveats.py && \
python build_membership.py && \
Xvfb :99 -screen 0 1024x768x16 2>/dev/null & \
while ! ps aux | grep -q '[0]:00 Xvfb :99 -screen 0 1024x768x16'; \
do echo "Waiting for Xvfb..."; sleep 1; done && \
ps aux | grep Xvfb && \
nosetests \
--verbose \
--with-process-isolation \
--with-doctest \
--exe
--exe \
test*.py \
examples/*/*.py
11 changes: 7 additions & 4 deletions Dockerfile-py3.5
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,14 @@ ENV DISPLAY :99

WORKDIR /workspace/Qt.py
ENTRYPOINT cp -r /Qt.py /workspace && \
python3 build_caveats_tests.py && \
Xvfb :99 -screen 0 1024x768x16 2>/dev/null & \
sleep 3 && \
python3 build_caveats.py && \
Xvfb :99 -screen 0 1024x768x16 2>/dev/null & \
while ! ps aux | grep -q '[0]:00 Xvfb :99 -screen 0 1024x768x16'; \
do echo "Waiting for Xvfb..."; sleep 1; done && \
nosetests \
--verbose \
--with-process-isolation \
--with-doctest \
--exe
--exe \
test*.py \
examples/*/*.py
2 changes: 2 additions & 0 deletions Qt.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def _pyqt4():
PyQt4.QtCore.QStringListModel = PyQt4.QtGui.QStringListModel
PyQt4.QtCore.QItemSelectionModel = PyQt4.QtGui.QItemSelectionModel
PyQt4.QtCore.QSortFilterProxyModel = PyQt4.QtGui.QSortFilterProxyModel
PyQt4.QtCore.QAbstractProxyModel = PyQt4.QtGui.QAbstractProxyModel

try:
from PyQt4 import QtWebKit
Expand Down Expand Up @@ -117,6 +118,7 @@ def _pyside():
PySide.QtCore.QStringListModel = PySide.QtGui.QStringListModel
PySide.QtCore.QItemSelection = PySide.QtGui.QItemSelection
PySide.QtCore.QItemSelectionModel = PySide.QtGui.QItemSelectionModel
PySide.QtCore.QAbstractProxyModel = PySide.QtGui.QAbstractProxyModel

try:
from PySide import QtWebKit
Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ app.exec_()

All members of `Qt` stem directly from those available via PySide2, along with these additional members.

| Attribute | Type | Value
|:------------------------|:-------|:------------
| `__binding__` | `str` | A string reference to binding currently in use
| `__qt_version__` | `str` | Reference to version of Qt, such as Qt 5.6.1
| `__binding_version__` | `str` | Reference to version of binding, such as PySide 1.2.6
| `__wrapper_version__` | `str` | Version of this project
| `load_ui()` | `func` | Minimal wrapper of PyQt4.loadUi and PySide equivalent
| Attribute | Returns | Description
|:------------------------|:----------|:------------
| `__binding__` | `str` | A string reference to binding currently in use
| `__qt_version__` | `str` | Reference to version of Qt, such as Qt 5.6.1
| `__binding_version__` | `str` | Reference to version of binding, such as PySide 1.2.6
| `__wrapper_version__` | `str` | Version of this project
| `load_ui(fname=str)` | `QObject` | Minimal wrapper of PyQt4.loadUi and PySide equivalent

<br>

Expand Down Expand Up @@ -136,12 +136,12 @@ import sys
import Qt

app = QtWidgets.QApplication(sys.argv)
ui = Qt.load_ui("my.ui")
ui = Qt.load_ui(fname="my.ui")
ui.show()
app.exec_()
```

Please note, for maximum compatibility, only pass the argument of the filename to the `load_ui` function.
Please note, `load_ui` has only one argument, whereas the PyQt and PySide equivalent has more. See [here](https://github.com/mottosso/Qt.py/pull/81) for details - in a nutshell, those arguments differ between PyQt and PySide in incompatible ways.

<br>

Expand Down
File renamed without changes.
11 changes: 11 additions & 0 deletions build_examples.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import os
import glob
import shutil

# Copy example files into current working directory
for filepath in glob.glob('examples/*/*'):
filename = os.path.basename(filepath)
if filepath.endswith('.py'):
shutil.copyfile(filepath, 'test_'+filename) # Prepend 'test' to *.py
else:
shutil.copyfile(filepath, filename)
Loading