maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   Example Python/GTK Maemo apps + Sources? (https://talk.maemo.org/showthread.php?t=32257)

code177 2009-09-30 18:03

Example Python/GTK Maemo apps + Sources?
 
Hey all!

So I was wondering if we could get a list of some example application with their source for us new developers to look at. That would be really awesome, and I know a lot of you have some great code out there.

It would definitely speed up the learning process for us!

Thanks everyone :)

twaelti 2009-09-30 18:30

Re: Example Python/GTK Maemo apps + Sources?
 
You can find a lot of source code of current fremantle apps here:
http://repository.maemo.org/extras-d...e/free/source/

One example is the fremantle version of my mClock:
http://repository.maemo.org/extras-d...urce/m/mclock/ (It is however quite special as it includes a PyGTK/PyGame mix).

Mayn others include much better apps like gPodder or pyGTKEditor.

epage 2009-09-30 18:37

Re: Example Python/GTK Maemo apps + Sources?
 
Of course, in my infinite bias I'll add Dialcentral to that list.

Alex Atkin UK 2009-10-03 11:20

Re: Example Python/GTK Maemo apps + Sources?
 
I see gPodder is written in Python but overkill for a newbie to get to grips with. The problem I think is a lack of a good "getting started" guide.

I personally tried the Hello World sample. Problem is, I can't see what you need to do next to actually create something useful with different pages, buttons, text fields, pulling data from the web, etc.

Perhaps I have thrown myself into the deep end trying to do this when most of what I have done in the past has been cut/paste/edit jobs in PHP and JavaScript. But I really want to learn Python and Linux programming, when I found out about the N900 it seemed the perfect tool to do both those and get a mobile device configured how I want it.

I was frustrated and dismayed at how Windows Mobile halts the CPU when you stick it into standby and am curious how Maemo handles that too.

twaelti 2009-10-03 11:43

Re: Example Python/GTK Maemo apps + Sources?
 
Quote:

Originally Posted by Alex Atkin UK (Post 338690)
I see gPodder is written in Python but overkill for a newbie to get to grips with. The problem I think is a lack of a good "getting started" guide.

I personally tried the Hello World sample. Problem is, I can't see what you need to do next to actually create something useful with different pages, buttons, text fields, pulling data from the web, etc.

Try some tutorials not directly related to Maemo, but more general about Python (the programming language) and PyGTK+ (the python interface to the primary toolkit/library used in Maemo right now) or PyQT (the upcoming toolkit). Once you have that under control, it's a very small step to get up and running in Maemo.

akazero 2009-10-03 11:57

Re: Example Python/GTK Maemo apps + Sources?
 
Quote:

Originally Posted by twaelti (Post 338698)
Try some tutorials not directly related to Maemo, but more general about Python (the programming language) and PyGTK+ (the python interface to the primary toolkit/library used in Maemo right now) or PyQT (the upcoming toolkit). Once you have that under control, it's a very small step to get up and running in Maemo.

Thanks for the links they are very helpful! I was however wondering if there is a tutorial for this small step how to deploy an app in Maemo. I know my way round in Python but am looking for an up to date example that explains step by step how to create an application with Python (PyGTK or PyQT) for Maemo 5. Is there something like that? I searched and skimmed the documentation but couldn't really find what I was looking for.

Jaffa 2009-10-03 21:03

Re: Example Python/GTK Maemo apps + Sources?
 
Perhaps my own Hermes will be a useful starting point for you? I don't claim it's a bastion of good UI design, or that the UI is put together in the "best" way for Python.

However, I will claim the app is built on sound OO principles (GUI separate from worker classes etc.) and it features all the main UI bits: app menus, buttons, check boxes, inputs, scrolling lists, progress bars etc.

Source code at:

http://repository.maemo.org/extras-d...urce/h/hermes/

akazero 2009-10-03 22:27

Re: Example Python/GTK Maemo apps + Sources?
 
Thanks. The Hermes and mClock sources as examples should get me started as far as Python development is concerned. I will also have a look at the documentation specifically on Maemo packaging and hope to be able to take it from there...

Alex Atkin UK 2009-10-05 15:29

Re: Example Python/GTK Maemo apps + Sources?
 
Can widgets be written in Python?
Or is there a widget that can embed a small HTML page with JavaScript etc? (like how Windows Sidebar Gadgets work)

HangLoose 2009-12-10 13:38

Re: Example Python/GTK Maemo apps + Sources?
 
Quote:

Originally Posted by Alex Atkin UK (Post 339810)
Can widgets be written in Python?
Or is there a widget that can embed a small HTML page with JavaScript etc? (like how Windows Sidebar Gadgets work)

Also interested in knowing if widgets can be written in Python...

updated: yes they can... http://wiki.maemo.org/PyMaemo/HildonDesktop

my question now is actually a more advanced tutorial? can anyone provide me with directions?

thanks

justmemory 2018-07-02 08:36

Re: Example Python/GTK Maemo apps + Sources?
 
Hi All!

Sorry for bumping an old thread but searching through the forums and the internet weren't succesful for my specific problem.

I'm trying to write a maemo5 hildon home widget in python according to the wiki. My problem is that when I run it from terminal it behaves as expected but when I add it from the desktop menu (with desktop file in /usr/share/applications/hildon-home/ and .py file in /usr/lib/hildon-desktop/) it doesn't behaves right (does not do the refreshing and showing the infos right)...

(It is a simple weather widget, refreshing connected to wifi connection dbus signal)

What am I doing wrong...? Maybe someone could point me to the right direction...?

Thanks,

jm

freemangordon 2018-07-02 09:30

Re: Example Python/GTK Maemo apps + Sources?
 
wrong dbus session?

justmemory 2018-07-02 09:40

Re: Example Python/GTK Maemo apps + Sources?
 
Quote:

Originally Posted by freemangordon (Post 1545932)
wrong dbus session?

Thanks for the answer.
I do not think that dbus session is wrong because the script is working fine when I run it from terminal... (I use com.nokia.wlancond)

(Sidenote: I'm aware of the fact that a python hildon home widget needs "speciel treatment" when using dbus signal - I made those modifications too... )

Halftux 2018-07-02 09:45

Re: Example Python/GTK Maemo apps + Sources?
 
Maybe try to put run-standalone.sh infront of the command.

justmemory 2018-07-02 09:55

Re: Example Python/GTK Maemo apps + Sources?
 
Quote:

Originally Posted by Halftux (Post 1545935)
Maybe try to put run-standalone.sh infront of the command.

... to where... :)
The .desktop file contains only an "X-Path" row where I have to write - let's say - "weather.py" (maybe that is the place you think I should write "run-standalone"?). So my main problem is that it does not want to do the refreshing properly when added from hildon desktop menu.

From terminal it is working fine...

Edit:// Maybe I should upload the given stuff; as soon as I get home I will do that...

Android_808 2018-07-02 12:02

Re: Example Python/GTK Maemo apps + Sources?
 
Could it be path related?

justmemory 2018-07-02 12:15

Re: Example Python/GTK Maemo apps + Sources?
 
Quote:

Originally Posted by Android_808 (Post 1545940)
Could it be path related?

You mean python path...? I do not know... For hildon home widgets the desktop file should point to the corresponding "module" which has to be in /usr/lib/hildon-desktop/...
In the script I use "#!/usr/bin/env python" so I can execute it easier (shorter command) but it is not in the wiki... maybe I should delete that line and see if it is the path that causing issues... I cannot imagine how that could be an issue though...

sicelo 2018-07-02 16:41

Re: Example Python/GTK Maemo apps + Sources?
 
is it foss? posting your code might lead to easier help

justmemory 2018-07-02 17:44

Re: Example Python/GTK Maemo apps + Sources?
 
2 Attachment(s)
As I wrote earlier - and sicelo was right on that - I attached the whole stuff maybe some could give a hint... :)

peterleinchen 2018-07-02 18:52

Re: Example Python/GTK Maemo apps + Sources?
 
Quote:

Originally Posted by freemangordon (Post 1545932)
wrong dbus session?

I have no idea but freemangordon definitely has :p
There are two different dbus sessions. One for user and one for root.
Executing from terminal: as user or as root?
Try the other one and see if it still works...

justmemory 2018-07-02 20:07

Re: Example Python/GTK Maemo apps + Sources?
 
Quote:

Originally Posted by peterleinchen (Post 1545949)
Try the other one and see if it still works...

In both cases it is working fine...

d1hacker 2018-07-03 00:01

Re: Example Python/GTK Maemo apps + Sources?
 
I was wondering if you have any booklet, or some offline QT installer, how can I do my apps compiled in python?

Halftux 2018-07-03 17:23

Re: Example Python/GTK Maemo apps + Sources?
 
@ justmemory I will give up python is to complicated for me

So here are my hints:
  • check file size from downloaded data sometimes 0kb weatherdata (also some timing problem?)
  • maybe after moving files do a chmod (file permissions changes)
  • check timing download, refresh and parsing
  • check your py script with internet, without internet and switching on internet (I had something like line 167 unknown sleep...but could be my mistake)
  • when modifing the py file restart hildon-home and maybe desktop dont know

Code:

dsmetool -k /usr/bin/hildon-home
dsmetool -t /usr/bin/hildon-home
killall hildon-desktop

And now the most important and valueable advice try to avoid python:D
Good luck in finishing this, I really would like to see it properly running.

Halftux 2018-07-03 17:29

Re: Example Python/GTK Maemo apps + Sources?
 
Quote:

Originally Posted by d1hacker (Post 1545953)
I was wondering if you have any booklet, or some offline QT installer, how can I do my apps compiled in python?

It is not necessary compile python files.
For a booklet, about what:confused:, hmm don't know look in our wiki.
Offline QT installer you will find it somewhere in the development section search for QtSDK.

justmemory 2018-07-03 18:44

Re: Example Python/GTK Maemo apps + Sources?
 
Quote:

Originally Posted by Halftux (Post 1545987)
@ justmemory I will give up python is to complicated for me

Me too... :)

Quote:

Originally Posted by Halftux (Post 1545987)
So here are my hints:
  • check file size from downloaded data sometimes 0kb weatherdata (also some timing problem?)
  • maybe after moving files do a chmod (file permissions changes)
  • check timing download, refresh and parsing
  • check your py script with internet, without internet and switching on internet (I had something like line 167 unknown sleep...but could be my mistake)
  • when modifing the py file restart hildon-home and maybe desktop dont know

Code:

dsmetool -k /usr/bin/hildon-home
dsmetool -t /usr/bin/hildon-home
killall hildon-desktop

And now the most important and valueable advice try to avoid python:D
Good luck in finishing this, I really would like to see it properly running.

So many thanks for trying this! I think you were on the right path as I noticed that there is something going wrong around disconnect and connect again to wireless network; even if the script refreshes the weather data is fails to be shown (only a black box) and I have to kill hildon-home and save /usr/share/applications/hildon-home/my_widget.desktop file to get it to work again...
I checked the permissions as well; timing should be OK and everything else should be fine too as the widget works just fine when it is running from terminal as a simple python app. I just cannot figure out why.

Soooo... my solution (???) was that I wrote an init.d script and started the python script as a service/daemon. This way it is working as espected and no need for terminal... I do not know whether it is a good solution but it is working for now...

So many thanks to everyone...

Maemish 2019-09-02 05:52

Re: Example Python/GTK Maemo apps + Sources?
 
I have a friend who knows coding and whom I got interested on N900 (I pointed him one good online with all the bells and whistles for 30Eur). He has now suggested for us to do a coding project. I am interested on an automated installer to do all that stuff I need to do after reflashing (removing stuff, installing stuff, editing stuff) and it to work the same way cssu installer is working. Is there a source code for the cssu intaller somewhere?

justmemory 2019-09-02 11:52

Re: Example Python/GTK Maemo apps + Sources?
 
Maemish,

CSSU installer on the wiki page only adds the community repo and runs the community-ssu-enabler (if I understand the method well, but please correct me). The source code of the latter is here.

Maemish 2019-09-02 11:56

Re: Example Python/GTK Maemo apps + Sources?
 
Is it so that microb can't open github pages or am I missing something?

justmemory 2019-09-02 12:07

Re: Example Python/GTK Maemo apps + Sources?
 
No, it can't... I'm able to open github on n900 only with opera... Or try it from ED... (time consuming...)


All times are GMT. The time now is 23:32.

vBulletin® Version 3.8.8