![]() |
Python help and suggestions please
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. |
Re: Python help and suggestions please
Quote:
Quote:
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. Quote:
Where you have you main code put: Code:
import osQuote:
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. Quote:
Quote:
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. Quote:
|
Re: Python help and suggestions please
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. |
Re: Python help and suggestions please
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): http://www.xbox1.com/temp/traveller-Atmosphere.png http://www.xbox1.com/temp/traveller-Weather.png http://www.xbox1.com/temp/traveller-Horoscope.png http://www.xbox1.com/temp/traveller-Alarms.png http://www.xbox1.com/temp/traveller-Alarm.png 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. :( |
Re: Python help and suggestions please
Quote:
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! |
Re: Python help and suggestions please
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.
|
Re: Python help and suggestions please
Quote:
|
Re: Python help and suggestions please
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. |
Re: Python help and suggestions please
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? |
Re: Python help and suggestions please
Sorry, I don't really know much so better off waiting for a better answer...
You can do Code:
os.system(browser --url=<url>) |
Re: Python help and suggestions please
Quote:
http://docs.python.org/library/webbrowser.html |
Re: Python help and suggestions please
Quote:
http://www.internettablettalk.com/fo...ad.php?t=25582 I decided to show my miseries pretty fast (just after I was able to make some number movings :) ) and the support from people in the forum is great. Kudos to your project (that seem pretty advanced). Once youll release your version we should merge the thread since the topic is pretty the same :) Developing for the nokia tablet is a joy and, since the hardware is exactly the same for everyone, pretty easy to spot particular technics, optimizations and tricks that every developer use. P.S. Xbox1? |
Re: Python help and suggestions please
Quote:
http://xbox1.com/puaelauncher/ The xbox1.com was a fan site I made a long time ago and then let die because a new way of thinking was taking place for me. I find that I, and many others, take sides. Sometimes to a fault. So take it with a grain of salt. I got permission from accuweaher.com to use their data and they gave me a custom xml link for this program. But there were a few rules to follow in exchange including: displaying their logo, having at least two days of forecasts showing and making each day a link to theri website with expanded details. So this is why I am after this knowledge. Oh and BTW, the people at Accuweather.com couldn't have been any cooler, kinder and more down to earth. They were simply great. The people of this forum are also some of the best people I know without knowing them. So helpful and similar in thoughts and at times so different. Sometimes a little strong on the Linux platform side. Just a good group. I love my NIT and hope this program could help others. Sorry for rambling. :o |
Re: Python help and suggestions please
Quote:
So if you spot something could be usefull for your projects just use it; i have no problem in case you need, togenerate particular sizes since I translated the approach of the kontori theme maker (1 file source) and i can easily create a different version with few steps. Size changes= ok hue changes(tones) =ok completely new graphics= heavy challenged by time and mood |
Re: Python help and suggestions please
Quote:
|
Re: Python help and suggestions please
Anyone know why "webbrowser.open" seems to work perfectly on Windows but doesn't error or actually pop-up a browser on the NIT? Maybe I should just use the suggested command line from Qwerty12 of "os.system(browser --url=<url>)"
Sometimes, programming success is fast and exciting. Other times, I can waste an entire day just trying to pull a simple little item up. :mad: |
Re: Python help and suggestions please
Well at least for me it works fine
this is what I do at python console Code:
>>> import webbrowser |
| All times are GMT. The time now is 22:01. |
vBulletin® Version 3.8.8