2012-03-31

installing an ide #dev.pyqt

3.6: web.cyb/dev.pyqt/finding and installing an ide:

summary:
. see comparing ide's.
Spyder is running advanced examples .

pos: not eric? check qt for suggestions:
. eric doesn't even have any doc's?
[3.31: I had pretty unlikely problem;
I just needed time think or see a newsgroup ...]
why aren't I using qt's tools?
well, for that you should check their pyside site,
and see if they have any tools ...
[all they have is a reference to a tutor book
that is going to tell you to use Idle .]

proj: PySide is installed:
. why doesn't installation work? pyside is not installed?
I just misspelled it: forgot to camelcase PySide .
I tried from both the ubuntu software center
and from instructions from the PySide page
for getting it from the terminal . one of them does work .

qt's advice:
. Qt API is implemented in C++,
and provides additional features for easier cross-platform development.
QML – introduced with Qt Quick
is a CSS and JavaScript-like declarative, language
designed to describe the user interface of a program:
both what it looks like, and how it behaves .
Qt has signals and slots [doc.qt.nokia.com]
and Guarded pointers to avoid dangling pointers .

Bindings to Qt exist for several other languages,
including Ada,
and Python (pyside and pyqt).

PyQt [riverbankcomputing.com] (GPL/commercial)
    Tutorials [diotavelli.net]
API Documentation [riverbankcomputing.com]
    Reference Guide [riverbankcomputing.com]
    Book [qtrac.eu]
    Whitepaper [riverbankcomputing.com]
. use PyQt to create widgets that can be used in Qt Designer .
    KDE Platform and py bindings (source)
. mix PyKDE widgets and other classes
with PyQt widgets and classes, just as you would in C++.

PySide: Python for Qt [pyside.org] (LGPL)
    Wiki
    Documentation (tutorials, examples, API reference)
    Downloads, pyside-docs-latest.zip
    Mailing list [lists.pyside.org]
    Bugzilla [bugs.pyside.org]

qt-project.org
the PySide project now utilizes Qt’s Jira bug tracker.
Being a Qt Add-on provides PySide a permanent home
and perfect alignment with Qt Frameworks.
Furthermore, the project gets improved visibility, as well as a simple,
carefully thought out meritocratic project structure.
source code;
dev access .
docs

. diff's between PyQt and PySide .

eric seems flakey and not well doc'd:
[3.31: but only because it expected me to have svn installed,
and I missed the main technical report (out since 2011.8.16)
that serves as the primary documentation .]
. the 2nd tutorial (intro page)(.zip)
. eric's Web Browser's Technical Report
. eric forum .

check for how to install and config eric:
trust your package manager:
* Get rid of anything you've installed
outside of the package manager
* Open Synaptic (System --> Administration
--> Synaptic Package Manager)
* Type 'Eric' into the Quick Search text box

for eric4 you should have the following installed:
    Python 2.6.0 or better
    Qt 4.6.0 or better (from Nokia)
    PyQt 4.6.0 or better (from Riverbank)
    QScintilla 2.2.0 or better (from Riverbank)

3.7: web.cyb/dev.pyqt/finding and
installing an ide/spyder:

I'm looking at spyder's doc's from its menu
(file:///usr/share/pyshared/spyderlib/doc/installation.html)
and I'm thinking it's an IDE like ipython is,
but one of its recommended modules
is ipython:
. I don't think it pre-installed
what it recommends
because I just now was able
to install ipython and matplotlib;
ie, they were not already on-board,
according to unbuntu software center .

3.9: proj.cyb/dev.pyqt/
testing an ide with tutorial's code:

. this is my own xu path:
uservv@ubuntu:~$ $PATH
bash: /usr/local/sbin:/usr/local/bin:/usr/sbin:-
/usr/bin:/sbin:/bin:/usr/games:

. spyder is an ide started from the command line:
uservv@ubuntu:~$ spyder

. the integrated console looks like this:
Python 2.7.1+ (r271:86832, Apr 11 2011, 18:05:24)
[GCC 4.5.2] on linux2

. it has the normal control-o to open a file browser,
and then with hello world loaded that way,
hitting menu/run creates this in its console:
>>> runfile(r'/home/uservv/pyqt/chap01/hello.py',-
wdir=r'/home/uservv/pyqt/chap01')
Hello World
>>>
. the file it ran was this:
#!/usr/bin/env python
from __future__ import print_function
print("Hello World")

then I had it run a .pyw file, bringing up a window
that contained an array of numbers
pyQt gui in action!

3.23: todo:[done]
page192, 0382, has gui-driven file io example;
chapt 13 code is interesting for text editor code example .

proj.cyb/dev.pyqt/
qrc_resources module not generated:

I tried to run pythoneditor2.pyw,
but it returned ImportError:
No module named qrc_resources
-- Traceback (most recent call last):
  File "/home/uservv/0pyqt/chap13/
pythoneditor.pyw", line 24, in
    import qrc_resources
I think the book said there was
a program I need to run
in order to generate that missing resource,
but I thought for the examples
that would have already been done .

3.24: proj.cyb/dev.pyqt/
get the advanced examples running:
. find someone making the same mistake
(translated from german by google)
I bought myself the book
Rapid GUI Programming with Python on QT.
Now it is show some demos
so that it equals the error.
eg Chapter 15 assetmanager.pyw line 17
Code:
import qrc_resources
results in an error:
The program examined produced
the unhandled exception ImportError
"No module named qrc_resources"
solution:
In the archives of the sample files
are located next to the folders on the individual chapters
2 scripts called makepyqt.pyw and mkpyqt.py.
The former allows you to create GUI
even with the resource files in the folders.
This procedure is not necessary, 
you can integrate the resources via files.
But it is not a bad approach,
and it does not hurt to try it
as part of the book .
So just "python makepyqt.pyw" recursive call
and let all qrc_resources generate.
[it pops up the window "[make pyqt]
with the options to
recurse? translate? dry-run?
so I set it to recurse for do-all .
. then it has 3 buttons: build, clean, quit,
and I just hit build .]
The log then showed this message:
... converted to chap[...]/resources.qrc
chap[...]/qrc_resources.py

the conversion programs were in the root
of the sample's folder system;
there was also a readme that says this:
Two helper programs are provided:
mkpyqt.py (a console application),
and makepyqt.pyw (a GUI application).
These programs both do the same thing:
They run pyuic4, pyrcc4, pylupdate4, and lrelease
with the correct command line arguments.
In some cases you may need to
set the path to pyuic4 (pyuic4.bat on Windows),
and possibly to the other programs as well.
For mkpyqt.py this means editing the file itself
(the paths are in variables near the top);
for makepyqt.pyw, click "More->Options"
and set the paths there.
The use of these programs
is described in Chapter 7.
. the way I ran it with no troubles was by
cd'ing to the folder where makepyqt.pyw was,
and then using the current-folder qualifier
on makepyqt.pyw:
here's the result of the whole session:
uservv@ubuntu:~$ cd 0pyqt
uservv@ubuntu:~/0pyqt$ ls
chap01  ...       makepyqt.pyw
... gpl-2.0.txt  mkpyqt.py
... gpl-3.0.txt  README.txt
uservv@ubuntu:~/0pyqt$ python ./makepyqt.pyw
uservv@ubuntu:~/0pyqt$

. the editor sample project is working,
and the editor's open command
lets the user browse for a file !

No comments:

Post a Comment