Reply
Thread Tools
giannoug's Avatar
Posts: 334 | Thanked: 171 times | Joined on Dec 2009
#1
The easiest way to make applications for the N900 is Python and Qt. I'm pretty fluent in Python and programming in general but I think PyQt for Maemo lacks something really important, tutorials and guides.

I have some questions that couldn't be answered with Wiki and Forum searching. I'm planning to make a Wiki page with all the information for a starter, from Qt designer to deb packaging with the information this thread gathers.

Let's assume we are using Qt designer and a simple text editor.

What size should be set to the form? (I've seen 800x400 and 800x425)

How to make the compoments fill the form?

How can you use pyuic4 to output a file that you can include in your main python program?

How can you center (horizontal and vertical) elements?

Feel free to ask your own questions. More will be added, I can't remember all the problem I faced now
Thanks for all the answers!
 

The Following User Says Thank You to giannoug For This Useful Post:
Posts: 190 | Thanked: 129 times | Joined on Mar 2010 @ Bavaria, Germany
#2
Use the layouts and you don't have to care about placements, screen sizes etc.
Have seen a lot projects where people are setting control positions by hand! Please never do this!
Take a look at QVBoxLayout, QHBoxLayout etc. - they all can be used and tested in Qt Designer.

All your questions could be answered when someone makes a "How to use the Qt Designer with layout" wiki entry if it doesn't already exist.

Last edited by gri; 2010-05-20 at 12:00.
 
clasificado's Avatar
Posts: 466 | Thanked: 180 times | Joined on Feb 2010
#3
Take in account that PyQt is considered a thin layer on top of QT, so if you want pyqt tutorials youll get a mix of technical questions about how to improve that layer, and not the application developing thng.

for example, points 1, 2 and 4 matters to QT and no PyQt directly, because are concepts, and belong to QT

Dont consider this as a rule, its just a guide
 

The Following User Says Thank You to clasificado For This Useful Post:
giannoug's Avatar
Posts: 334 | Thanked: 171 times | Joined on Dec 2009
#4
Originally Posted by clasificado View Post
Take in account that PyQt is considered a thin layer on top of QT, so if you want pyqt tutorials youll get a mix of technical questions about how to improve that layer, and not the application developing thng.

for example, points 1, 2 and 4 matters to QT and no PyQt directly, because are concepts, and belong to QT

Dont consider this as a rule, its just a guide
True, but in order to design the UI you need Qt specific tools etc

Thanks for the comments guys, I found some information and answers to some of my questions. I'm going to make a Wiki page soon.
 
Nyrath's Avatar
Posts: 92 | Thanked: 50 times | Joined on Jan 2006 @ the praeternatural tower
#5
Originally Posted by giannoug View Post
How can you use pyuic4 to output a file that you can include in your main python program?
From the command line, you have to invoke pyuic4 using the form:
pyuic4 uiFile -o pythonFile

For example, say in directory c:\myProjects\textEditor you had a Qt Designer file called myEdit.ui and you were developing in a Windows environment. You'd invoke the Windows Command Prompt, and type in the following:

Code:
cd c:\myProjects\textEditor
pyuic4 myEdit.ui -o myEditUI.py
You could then use myEditUI.py in your PyQt project. I use the name *UI.py out of habit because that was in the documentation, but you can use any name you want.

I sometimes use a little python program to automate this, if I have lots of *.ui files. Create the following python script
Code:
import os, sys, glob
    
fileList = glob.glob('*.ui')
for fileName in fileList:
    theCommand = "pyuic4 %s -o %sUI.py" % (fileName, fileName[:-3])
    os.system(theCommand)
and save it as BatchPyuic4.py
Copy it into the folder with your *.ui files. From the command line, type
Code:
cd c:\myProjects\textEditor
python BatchPyuic4.py
It will find all your *.ui files, run pyuic4 on them, and save them as *.ui.py

Last edited by Nyrath; 2010-05-20 at 18:39.
 
Reply


 
Forum Jump


All times are GMT. The time now is 06:40.