Active Topics

 


Reply
Thread Tools
Munk's Avatar
Posts: 229 | Thanked: 108 times | Joined on Oct 2007 @ Sacramento, California
#1
Hi, I'm working on my first Python application ever and I have some questions that I couldn't find doing searches or possibly just not understand when I found it.

First, I've been developing it on my Windows XP machine with Python runtime and PyGame installed. What I make on it transfers over to my N810 and runs perfectly fine just a million times slower. I use nano on the N810 to do additional editing when I am away from the laptop. My question on this one is if I should be doing my development and transferring another way?

Second, how the heck do I get the icon that I've created to show up in the task bar? If I switch away from the screen, I can't toggle back but still hear the audio it was playing continue on. Do I need to use GTK window items which I'm not sure I even understand what that is. Or, do I just simply need to make an icon and stick it in the right directory? I do have it showing up in the maemo menu to launch the app with no issues so at least I'm doing part of it right.

Third, I eventually want to make a .deb file but my program uses two different sub-directories. I use a "data" sub-directory to store my icons, audio files, xml data, etc. I also use a directory where I store larger ".wav" files that I currently have under "\media\mmc1\wav_files" so I'm not eating away from the built-in storage area. Is it possible to make a .deb installation that would create and install my different files into different locations?

Fourth, is there a maximum amount of files that I can have in my .deb install? I currently am using about 120 files and that could grow by the time I am done. Will this be a nightmare to maintain too?

Last, I need the screen to undim at times, is there a way to do this from Python? I read somewhere that someone tried it but they couldn't get it to work. Am I now crossing over into this "dbus" world and is it as scary as I feel it is?

Please be kind as I really am trying to get this working without being a pest.
 
yerga's Avatar
Posts: 696 | Thanked: 1,012 times | Joined on Mar 2006 @ Asturies, Spain
#2
Originally Posted by Munk View Post
Hi, I'm working on my first Python application ever and I have some questions that I couldn't find doing searches or possibly just not understand when I found it.
Welcome to the awesome python world

First, I've been developing it on my Windows XP machine with Python runtime and PyGame installed. What I make on it transfers over to my N810 and runs perfectly fine just a million times slower. I use nano on the N810 to do additional editing when I am away from the laptop. My question on this one is if I should be doing my development and transferring another way?
It depends on the tastes of everyone.
I, generally, develop in the scratchbox environment because I can have a more realistic view as it works. But my applications are all hildon/gtk based, and the UI can look different that in the desktop (smaller widgets, etc.). If you develop with pygame it looks similar in the desktop as in the tablet, but as you say slower
Sometimes I write code in the train when I return to home in weekdays, python allow us to do it without compile nothing. I use leafpad or pygtkeditor in the tablet.

When I am in the desktop I transfer the files for ssh using gftp. There people who have a more automatic process with rsync or other tools.

Second, how the heck do I get the icon that I've created to show up in the task bar? If I switch away from the screen, I can't toggle back but still hear the audio it was playing continue on. Do I need to use GTK window items which I'm not sure I even understand what that is. Or, do I just simply need to make an icon and stick it in the right directory? I do have it showing up in the maemo menu to launch the app with no issues so at least I'm doing part of it right.
Yeah, as it's a pygame application, it needs some special code to be shown in the taskbar.
Where you have you main code put:
Code:
import os
os.environ["SDL_VIDEO_X11_WMCLASS"]="here_your_binary_name"
I think it's the only thing necessary, but I haven't coded any pygame application. If it doesn't works, you could look at the code of some existing pygame projects as mclok, pyano or others.


Third, I eventually want to make a .deb file but my program uses two different sub-directories. I use a "data" sub-directory to store my icons, audio files, xml data, etc. I also use a directory where I store larger ".wav" files that I currently have under "\media\mmc1\wav_files" so I'm not eating away from the built-in storage area. Is it possible to make a .deb installation that would create and install my different files into different locations?
Yeah, it's possible if you use "The Right Way (TM)" with debian tools. I don't know if you can to do it if you use other tools, specially if you haven't a debian system.
A recommendation is you don't hard-coded the large files to a specific directory. I mean if you put the files automatically to /media/mmc1, people could not have that directory in the memory card (i.e n810 if you haven't an external card).
A good script in the debian/postinst file could help here, allow to the user choose the card where put the files.

Fourth, is there a maximum amount of files that I can have in my .deb install? I currently am using about 120 files and that could grow by the time I am done. Will this be a nightmare to maintain too?
No, you can put the files you estimate necessary. When you have done the framework for the debian packages (I mean you have all directories and everything put in the right order), the creation of debian packages is practically automatic and you can easily add new files to this process. Again I am talking about the debian way to do packages, with other tools I don't know.

Last, I need the screen to undim at times, is there a way to do this from Python? I read somewhere that someone tried it but they couldn't get it to work. Am I now crossing over into this "dbus" world and is it as scary as I feel it is?
Yeah, I agree completely dbus is really scary
It's posiible dim/undim it with dbus commands, so you don't need send dbus signals with dbus code, else you can run a dbus command with os.popen or os.command.
I think the necessary command is somewhere here in the forum.

Please be kind as I really am trying to get this working without being a pest.
I think I was kind enough
__________________
Daniel Martín Yerga
maemo.org profile
Twitter
 

The Following 7 Users Say Thank You to yerga For This Useful Post:
Munk's Avatar
Posts: 229 | Thanked: 108 times | Joined on Oct 2007 @ Sacramento, California
#3
Wow, Daniel (Yerga), thank you for responding to all of my questions. Next, I will try your suggestions with what I have working and see where I go from there.

Thanks again.
 
Munk's Avatar
Posts: 229 | Thanked: 108 times | Joined on Oct 2007 @ Sacramento, California
#4
Hi yerga, (and everyone else that has helped me learn Python)

I finally put that little piece of code into my Python program and have it showing the icon in the task manager. Thanks, thanks, thanks. I'm getting close to releasing my program, but there's still more coding, centering, bug trapping, etc. to do. Also, I need to master the .deb creation process. I'm not quite ready to release it, so this is not really an "Announce" post, but rather a thanks and here's what I've been up to.

My program, called "traveller" (European spelling) is yet another clock, but it was aimed at the traveler who goes to hotel rooms and needs an atmospheric sound to drown out the noisy cars, guest, etc. The user can load up their own .wav files and pick which sounds to play letting it loop for an atmospheric background. I paid $80 for a hardware device to do this and it was pretty limited too. While I was at it, I figured that I might as well add a weather update, horoscope, alarms, world time, etc. World time will come later or maybe not at all. Not sure yet.

For now, here's what I've been up to for the last three months (geesh time flys):







I'm so busy all of the time that it's taking forever and I'm afraid the N900 will be out by the time this is ready.

Last edited by Munk; 2008-12-18 at 06:24. Reason: Wow, I didn't realize my horoscope was perfect for this post. Getting feedback from friends.
 

The Following 9 Users Say Thank You to Munk For This Useful Post:
thp's Avatar
Posts: 1,391 | Thanked: 4,272 times | Joined on Sep 2007 @ Vienna, Austria
#5
Originally Posted by Munk View Post
I'm so busy all of the time that it's taking forever and I'm afraid the N900 will be out by the time this is ready.
That's not a problem at all. To my knowledge the current tablets won't stop working when the N900 is out. Something many people forget.

Also, if you would do a release on maemo.org (with all the unfinished bits disabled/hidden) maybe other people like your ideas and start contributing. Give it a try! Good luck!
 

The Following 2 Users Say Thank You to thp For This Useful Post:
pycage's Avatar
Posts: 3,404 | Thanked: 4,474 times | Joined on Oct 2005 @ Germany
#6
If you don't rely too heavily on D-Bus API and maemo-specific stuff, chances are good that the software will work unchanged on the next OS release thanks to Python.
 

The Following User Says Thank You to pycage For This Useful Post:
Munk's Avatar
Posts: 229 | Thanked: 108 times | Joined on Oct 2007 @ Sacramento, California
#7
Originally Posted by pycage View Post
If you don't rely too heavily on D-Bus API and maemo-specific stuff, chances are good that the software will work unchanged on the next OS release thanks to Python.
Well, no problems here as I really am not using any d-bus calls yet. But, during my internet update and downloading XML data it can sometime pause for a long time. I saw somewhere where someone was using the d-bus and I believe it was called streams so they could get the data without halting the show. Is this advisable?
 
pycage's Avatar
Posts: 3,404 | Thanked: 4,474 times | Joined on Oct 2005 @ Germany
#8
This has nothing to do with D-Bus. What you want is to use a separate thread for downloading the stuff, so that it doesn't block your application.
Another alternative (esp. when using PyGTK) is gobject.io_add_watch for asynchronous but non-threaded IO. Threads and PyGTK generally don't behave very well together.
 

The Following User Says Thank You to pycage For This Useful Post:
Munk's Avatar
Posts: 229 | Thanked: 108 times | Joined on Oct 2007 @ Sacramento, California
#9
Another question on Python. In my searches I could not find the answer.

Is there a way that I can have Python launch the web browser and a specific URL? Just to reword it, there's a giant button that says open this web page on the screen of the Python Pygame app. The user clicks it and then the browser opens up and is browsing to a specific URL?
 
qwerty12's Avatar
Posts: 4,274 | Thanked: 5,358 times | Joined on Sep 2007 @ Looking at y'all and sighing
#10
Sorry, I don't really know much so better off waiting for a better answer...
You can do
Code:
 os.system(browser --url=<url>)
to launch it using the equivalent of launching it from the command line in a new window but it can also be launched via dbus. I kinda know how to do it in c, not really sure how python works :/
 
Reply


 
Forum Jump


All times are GMT. The time now is 07:25.