Active Topics

 



Notices


Reply
Thread Tools
Posts: 391 | Thanked: 908 times | Joined on Aug 2011 @ suncity
#1
Hi Community!

I had some time to learn programming on my own; I like it, and I made a little script that I wanted to share. Please keep in mind, that I’m not a programmer at all, this is just my hobby.

I thought maybe we could share some of our little apps, codes, experiences to ease our and each others life a bit.

So here is mine.

I know that there are time lapse apps for n900, but I wanted to make my own, so I wrote a little script in python. Keep in mind, that this app represents my personal needs; but hey, you can modify the source code in any level, in any detail! I know that the code is probably not that beautiful, but this is my first bigger app with UI.

The program itself:
1. It has a capturing window where you can take pictures with the desired settings; and
2. a converter window, where you can make the time lapse movie. It is working with any jpg pictures in any directory, so if you copy that part of the code to another file, you can make a standalone converter app.

1. The capturing window:

On the left side you can specify the capturing, on the right side there is the viewfinder.
The buttons from left to right, top to bottom:
- “Select device”: you can specify whether you would like to use the front camera or the back camera.
- “Counter”: you can specify the number of picture you would like to be taken. If this is not set, the capturing goes “forever”. When capturing, it is also counting the number of pictures that were taken, eg. if 3 is set as max, then 3 / 1, 3 / 2, etc. If max reached, it stops.
- “Viewfinder”: you can turn the viewfinder on or off.
- “Automatic”: this captures the images within the predefined time intervals you specified with “Select framerate” button. If a maximum number was set with counter, then it stops when that number is reached; if not, then it goes “forever”. Of course you can stop it with hitting the button again; then it stops capturing.
The pictures are taken with the resolution of 640x480 (front camera) and 800x480 (back camera). You can edit this in the source code or make another button for it to be able to specify any other resolution. But keep in mind that taking pictures in higher resolutions is taking more time.
To make the viewing and capturing possible, the viewfinder is turning off when picture is taken, and then it turns on again.
First I added a countdown button to know when it is taking the pictures, but it is efficient only when the pictures are taken with another method, but for that method the viewfinder had to be off all the time, so I removed it.
Now the countdown button is not set, because I found that there is sometimes a +- 1 second difference to the time interval, maybe because of the tracker.
- “Select framerate”: you can specify the time interval (seconds) of picture-taking. Minimum is 4, maximum is 30 seconds, but you can extend it in the source code, or simply replace the picker button with entry widget.
Due to the capturing method you won’t be able to set the minimum lower, because the commands have to be executed (turn the viewfinder off, take the picture, and turn the viewfinder on) and this needs time…
There is the other capturing method I wrote first though; in that way you would be able to capture pictures in every 1, 2, or 3 seconds too, but in that way the viewfinder have to be off completely.
- “Manual”: you can capture pictures by hand, just click the button. The counting of taken pictures is working too.
- “Save as…”: you can specify the folder and the filename of the pictures. The pictures are saved in time format, so the specified filename will be showed before the time tag. Eg. If the filename is “test”, then the name of the saved file will be “test20141217_101543.jpg”
- “PyTimelapseMaker”: opens another window with the video maker.

2. Converter window:

The buttons from left to right, top to bottom:
- “Select folder”: you can specify the folder where the jpg files are. Keep in mind that all of the jpg files will be in the movie. If the folder doesn’t contain any jpg files, a message will be shown.
- “Save as”: you can specify folder and filename. The saved movie will be in avi format, no matter of the name you specify (eg. test.mp4). If you would like to use another format, you have to edit the source code (the converter command).
- “Select framerate”: you can specify the frame rate of the movie; 1 picture is the minimum, 30 pictures are the maximum (per second of course).
- “Select scale”: you can specify whether you would like to use 400x240 or 800x480. You can edit this too in the source code if you would like to extend it. But keep in mind that if the pictures are in low resolution, they won’t be better if you choose higher resolution…
- “Convert”: when everything is set, it creates the movie. There is no progress bar, the button will be “on” during the conversion. When its “light” turns off, the conversion is done.
- “Playback”: you can watch the last movie made. There is no option to select any movie, you have to use a player for that, but the last movie can be watched. If you would like to be able to choose any movie, you have to edit the source code and connect that option to the button.

As you can see, this is quite simple; I just wanted to have a user interface for the commands, so I wouldn’t have to write everything in the terminal every time.

To use the app, you have to install a mplayer that contains mencoder; so you have to compile one yourself, or use the one I’m using. Also you have to install gstreamer-tools to have gst-launch.

Please test it and feel free to tell me your impressions about it.

Cheers,

jm

EDIT: There was a little bug I found - capturing didn't work if you set the counter or the framerate (or both) above 9. Now it works.

EDIT: You can now turn the viewfinder on and off simply hitting the button (no need to the previous "press q in the terminal" option. Note that hitting the button will kill every mplayer that is opened.); and both of the cameras use the v4l2 driver so the picture of the front camera is not greenish and creepy anymore.
Attached Images
  
Attached Files
File Type: zip pytimelapse.zip (2.9 KB, 173 views)

Last edited by justmemory; 2015-02-24 at 11:03.
 

The Following 22 Users Say Thank You to justmemory For This Useful Post:
Posts: 1,994 | Thanked: 3,342 times | Joined on Jun 2010 @ N900: Battery low. N950: torx 4 re-used once and fine; SIM port torn apart
#2
Quick reply...

I can only point to QDialGPS as an example of QML and VirTranSim as an example of GTK-C.

Oh, and I have been doing smaiks as example of HTML+Javascript, but it's far from finished.

And I'm looking at kimi-hildon. Fascinating calendar app... Packed both back-end and front-end into one-package, if I understand it correctly?

Best wishes.
 

The Following 5 Users Say Thank You to Wikiwide For This Useful Post:
Posts: 391 | Thanked: 908 times | Joined on Aug 2011 @ suncity
#3
Hi,

I would like to ask for some help:

I'm trying to write a program in which multiple files can be selected, but it is not working in Hildon.

I attached two files (written in python); 'test' is working fine, it uses gtk.FileChooserDialog and set_select_multiple is working (you have to press Ctrl key). But in 'testhildon' multiple selection isn't working, though it 'believes' that it should get filenames, because it creates a list (but it contains only one element of course).

I tried everything that I could possibly think of, I'm trying to look for anserws on the internet for 2 days now, but nothing works. Is it even possible...?

If you have any idea, please share; it would be much appreciated.

Thanks,

jm
Attached Files
File Type: zip hildonvsgtk_problem.zip (1.3 KB, 163 views)

Last edited by justmemory; 2015-01-26 at 07:35.
 

The Following 3 Users Say Thank You to justmemory For This Useful Post:
Posts: 1,994 | Thanked: 3,342 times | Joined on Jun 2010 @ N900: Battery low. N950: torx 4 re-used once and fine; SIM port torn apart
#4
I do not get Python...
http://maemo.org/api_refs/2.1/hildon...Selection.html

Are you sure that Hildon-Python interface uses high enough version of PyGTK? set_select_multiple is available in PyGTK 2.4 and above. Your python file requires pygtk ('2.0').

Thank you. Best wishes.
 

The Following User Says Thank You to Wikiwide For This Useful Post:
Posts: 1,994 | Thanked: 3,342 times | Joined on Jun 2010 @ N900: Battery low. N950: torx 4 re-used once and fine; SIM port torn apart
#5
I do not get Python...

In python-hildon package, object definitions say that HildonFileChooserDialog has parent GtkDialog. Shouldn't it be GtkFileChooserDialog? Because pygtk on Maemo 5 is version 2.5, and thus already should include GtkFileChooserDialog (introduced in 2.4)

Thank you. Best wishes.
~~~~~~~~~~~~~~~~~
Per aspera ad astra...
 

The Following User Says Thank You to Wikiwide For This Useful Post:
Posts: 391 | Thanked: 908 times | Joined on Aug 2011 @ suncity
#6
Thank you, Wikiwide for your answer.

My python version on the phone is 2.5.4, so it should not be a problem, as the GTK version of the script runs just fine.

I use FileChooserDialog in both scripts; set_select_multiple is the option connected only to FileChooserDialog.
I could use gtk.FileChooserDialog - as you see in the attached script -, but in that way I will miss the "hildonish" look, as it opens a gtk window with small fonts, etc (as you can see if you run the script). That is why I wrote that the GTK version is working, but the Hildon version doesn't.

Hildon File Selection was my thought too, but it doesn't work either (or I don't use it in the right way...?), because as I saw these are two different things and I cannot bind them together.

Cheers,

jm
 

The Following 3 Users Say Thank You to justmemory For This Useful Post:
Halftux's Avatar
Posts: 862 | Thanked: 2,511 times | Joined on Feb 2012 @ Germany
#7
Originally Posted by justmemory View Post
I use FileChooserDialog in both scripts; set_select_multiple is the option connected only to FileChooserDialog.
I could use gtk.FileChooserDialog - as you see in the attached script -, but in that way I will miss the "hildonish" look, as it opens a gtk window with small fonts, etc (as you can see if you run the script). That is why I wrote that the GTK version is working, but the Hildon version doesn't.
For GTK-apps you must use HildonWindow instead of GtkWindow and HildonFileChooserDialog instead of GtkFileChooserDialog.

Look here.
 

The Following 4 Users Say Thank You to Halftux For This Useful Post:
Posts: 1,994 | Thanked: 3,342 times | Joined on Jun 2010 @ N900: Battery low. N950: torx 4 re-used once and fine; SIM port torn apart
#8
Originally Posted by Halftux View Post
For GTK-apps you must use HildonWindow instead of GtkWindow and HildonFileChooserDialog instead of GtkFileChooserDialog.

Look here.
He does all this, in Hildon example. hildon.Window, gtk.Table, hildon.Button, hildon.FileChooserDialog...

The question is, did anybody ever get in Python-Hildon multiple file selection to work? I am hoping that maintainer of Python-Hildon could clarify the matter...
hildon.FileChooserDialog.set_select_multiple(True)

Thank you. Best wishes.
 

The Following 3 Users Say Thank You to Wikiwide For This Useful Post:
Posts: 391 | Thanked: 908 times | Joined on Aug 2011 @ suncity
#9
Hi All!

Here is another code I wrote recently.

Please read the description first!

Cheers,

jm
Attached Images
 
Attached Files
File Type: zip wallet.zip (249.8 KB, 158 views)
File Type: zip mywallet.zip (8.6 KB, 155 views)
 

The Following 4 Users Say Thank You to justmemory For This Useful Post:
Posts: 391 | Thanked: 908 times | Joined on Aug 2011 @ suncity
#10
Hi All!

As I described before, the expense tracker application is updated with some statistical function.

Please read the description first!!!

Unzip the python code and the icons to the same folder (I recommend creating a .mywallet folder in /home/user/ or else you have to edit the source code to use the icons of the buttons).

Don't forget that this application is based on my needs; if you do not like something just change or disable that in the source code.

Hope you will find it useful.

Cheers,

jm
Attached Files
File Type: zip wallet.zip (53.1 KB, 154 views)
File Type: zip wallet_description.zip (463.9 KB, 142 views)

Last edited by justmemory; 2015-05-25 at 19:32.
 

The Following 4 Users Say Thank You to justmemory For This Useful Post:
Reply

Tags
maemo 5, python-hildon

Thread Tools

 
Forum Jump


All times are GMT. The time now is 02:45.