maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   Are there any N900 PyQt examples? (https://talk.maemo.org/showthread.php?t=41916)

LadyBug 2010-01-23 08:47

Are there any N900 PyQt examples?
 
I've been hunting for any N900 PyQt widget and application examples, but so far I haven't found a lot. Most of the examples in the docs assume the use of C/C++.

I've got a smal application working in Eric4 / Qt Designer, but I'd like to make it a N900 widget.

Any help appreciated.

omeriko9 2010-01-28 21:54

Re: Are there any N900 PyQt examples?
 
I second that request... couldnīt find any PyQt4 code examples on google for n900 desktop widget...

attila77 2010-02-01 01:44

Re: Are there any N900 PyQt examples?
 
If you show me a little example helloworld widget in Qt/C++, I can try and make a PyQt widget out of it.

danielwilms 2010-02-01 08:40

Re: Are there any N900 PyQt examples?
 
Quote:

Originally Posted by attila77 (Post 504499)
If you show me a little example helloworld widget in Qt/C++, I can try and make a PyQt widget out of it.

Have a look here.

Daniel

attila77 2010-02-01 15:00

Re: Are there any N900 PyQt examples?
 
Whoa, that's no moon... It looks more like an X function handling example than Qt :) Not sure how to handle all that except through ctypes, and if I go there, it will be ugly as hell (what's the point in writing Python code if it looks uglier than the C original ? :) )

irooniam 2010-02-03 02:06

Re: Are there any N900 PyQt examples?
 
Hello,

this might help you a bit.

I use qt designer and then I use pyside's tool to convert the xx.ui to xx.py to include

pyside-uic -d xx.ui -o xx.py

my main body of code (main.py) looks like this:
from PySide import QtCore, QtGui
import sys
import ui


class starter(QtGui.QMainWindow):
def __init__(self, parent=None):
super(starter, self).__init__(parent)
self.ui = ui.Ui_Frame()
self.ui.setupUi(self)

if __name__ == "__main__":
app = QtGui.QApplication(sys.argv)
starter = starter()
starter.show()
sys.exit(app.exec_())


Please note that this example, used a frame, so if you start with a widget your line will look something like:
ui.Ui_Widget()

Hope that helps.

lostinmirkwood 2010-02-03 20:57

Re: Are there any N900 PyQt examples?
 
FYI, "PyQt Documentation and Examples" just got released to Extras. That might be helpful

http://maemo.org/packages/package_in...oc/4.7-maemo2/

attila77 2010-02-03 21:55

Re: Are there any N900 PyQt examples?
 
Hey, that's a familiar package :) But jokes aside, the discussion was about desktop widgets, and that examples packages falls short in that regard (as they are sadly not really supported in Qt4.5 without some workarounds/quite a bit of boilerplate code). Apparently Qt4.6 will be better in that regard (this is not really about PyQt, PyQt will use whatever the underlying Qt supports).

irooniam 2010-02-03 23:14

Re: Are there any N900 PyQt examples?
 
Yeah after I re-read it I realized you're asking the same thing I was in another thread:

http://talk.maemo.org/showthread.php?t=43177

Daniel said he's hoping to have an example up soon.

lostinmirkwood 2010-02-05 18:27

Re: Are there any N900 PyQt examples?
 
Quote:

Hey, that's a familiar package
oops. Had I know you were the maintainer I'd wouldn't have mentioned it. I have found it quite interesting though, as on device code examples.

lostinmirkwood 2010-02-05 18:46

Re: Are there any N900 PyQt examples?
 
attila77 and danielwilms,

What IDE are you using for PyQt coding, Eric4 with QTDesigner? I saw the Pluthon IDE but had issues with bringing in the .ui

Eric4's Build Form (Discussed here ) I found quite useful to auto-generate code for events and signals. But I love the way you can use Pluthon to SSH and Export the display for testing.

Secondly, is there a Wiki or a Site we should all know about directly relating to Python+Qt on maemo5?

It seems to me that as a newbie to maemo programming there are so many options for both programming languages/environments and IDEs, that it's had to know where to start.

Qt4.5 or Qt4.6
Python 2.5 or 2.6
PyQt4.6 PyQt4.7 or just PySide
Pluthon, Eric4, QTCreator/Designer or PyGTKEditor

And then should we debug on scratchbox, on Ubuntu as a python script or even on device (physically or ssh'ed)

I'm a little lost, but in love with all these wonderful options, just for Python alone; and glad we're not stuck in a world of: well there's officially our-way-of-doing-it or our-way-of-doing-it.

attila77 2010-02-06 11:45

Re: Are there any N900 PyQt examples?
 
A lot of the questions you describe are a matter of personal preference, so a bit difficult to give universal recommendations. As for the technical part:
  • Qt4.5 or Qt4.6

Qt4.5 in is Extras, and also available for the N800/N810. Qt4.6 is still in flux with (near-)nightly builds available, the stable is expected with PR1.2

  • Python 2.5 or 2.6

2.5, there is no other choice on Maemo 4/5

  • PyQt4.6 PyQt4.7 or just PySide

PyQt4.6 is irrelevant :) PyQt4.7 is available to both Qt4.5 and Qt4.6 so covers a bit more ground (N800+N810+N900) and is currently smaller/more memory efficient, although I fully expect the PySide team to show some massive improvements around PR1.2 :) PyQt will be in Extras in three days. PySide is Qt4.6 only (=N900 only), and will be Extras ready after PR1.2, with the same caveat as Qt4.6 - it has not yet reached a stable status, so it's still a moving target. PySide's real relevance will probably show in Maemo 6, in Maemo 5 it's mostly irrelevant, I'd go for PyQt as you don't loose anything, but then again, I'm biased and am certain PySide guys will recommend PySide ;)

An unbiased (well, at least we tried ;) ) overview can be seen at:
http://wiki.maemo.org/PyMaemo/GUI_to...election_guide

  • Pluthon, Eric4, QTCreator/Designer or PyGTKEditor

Tough one. Personally, I use QtDesigner for .ui elements and WingIDE as my main IDE as it's pretty configurable (allows on-device debugging) and works nicely with PyQt (knows about PyQt autocompletion, help, etc). Wing is sadly not generally free, though it IS available for free to bona fide OSS developers (but not commercial devs). Pluthon is also very good in Maemo device integration, but lacks the Qt touch - it does work but the templates/help/etc are GTK oriented. And, of course, Eclipse itself is a love/hate thing :) Eric4 is okay, but AFAIK no on-device action support which makes it a bit limited. Never tried PyGTKEditor.

I generally try to develop as much as possible on the desktop, and just switch to on-device when I start using something Maemo-specific. I usually code in a way that my Maemo apps are (ugly, but working) desktop apps, too.

PS. Oh, and a lot of (hopefully :) ) useful Python-Qt info can be read about in the slideshare presentation in my sig, given at the 2009 Maemo Summit

eitama 2010-02-16 22:53

Re: Are there any N900 PyQt examples?
 
Hi Attila,

You post has been the most informative one I have read so far, but still, just like the original poster, I am lost.

My Experience :
- Java programming on PC (in eclipse).
- Some C / C++ in visual studio .
- Lots of C# in visual studio.
- Python on windows, Python on S60 (n95).
- TCL.

I'd like to write a small widget for my n900, it will query something every 5 seconds, and display the information in the widget on the n900 home desktop, it does not require performance or fast loading etc etc.
I am sure Python is the way to go - But I have no idea how to start.
What do I need to install? How do I make a PyQt APP to run? How do I port it to the N900, and how do I access on N900 API to get the information I want.

Hmph.
Eitam.

attila77 2010-02-16 23:32

Re: Are there any N900 PyQt examples?
 
Quote:

Originally Posted by eitama (Post 530910)
I'd like to write a small widget for my n900, it will query something every 5 seconds, and display the information in the widget on the n900 home desktop, it does not require performance or fast loading etc etc.
I am sure Python is the way to go - But I have no idea how to start.
What do I need to install? How do I make a PyQt APP to run? How do I port it to the N900, and how do I access on N900 API to get the information I want.

Unfortunately, Qt desktop widgets are an area where we are thin *at the moment*. Qt4.6, which promises serious improvements in this area will be released to the general public soon via an OTA upgrade. When that happens, we'll of course release the adequate python bindings ASAP and it will be happy hacking land. Until then, I suggest playing with standalone PyQt applications which work fairly well (try the PyQt4 Demo package for examples).

eitama 2010-02-17 12:17

Re: Are there any N900 PyQt examples?
 
Thanks for taking the time to answer me.
I don't really want to wait for PR1.2, So I will just go ahead and do it with GTK or Hildon, though I have no idea how to approach that.

Too many steps just to start doing anything.

Thanks though :)

mece 2010-02-17 12:32

Re: Are there any N900 PyQt examples?
 
Quote:

Originally Posted by eitama (Post 531982)
Thanks for taking the time to answer me.
I don't really want to wait for PR1.2, So I will just go ahead and do it with GTK or Hildon, though I have no idea how to approach that.

Too many steps just to start doing anything.

Thanks though :)

start here: http://wiki.maemo.org/PyMaemo

eitama 2010-02-17 13:37

Re: Are there any N900 PyQt examples?
 
@mece

WOW! This is exactly what I was looking for! thank you!
You are my savior!

Now I can go ahead and write my app, which is : a desktop widget or app that will remind you that you forgot to close the camera lens by means of visual alert or sound not sure yet, So you won't scratch your lense by mistake.


All times are GMT. The time now is 13:13.

vBulletin® Version 3.8.8