Merge lp:~photostory/photostory/cleanup into lp:photostory

Proposed by Josh Brown
Status: Rejected
Rejected by: Josh Brown
Proposed branch: lp:~photostory/photostory/cleanup
Merge into: lp:photostory
Diff against target: 541 lines (+254/-276)
1 file modified
photostory (+254/-276)
To merge this branch: bzr merge lp:~photostory/photostory/cleanup
Reviewer Review Type Date Requested Status
Josh Brown Disapprove
Joel Auterson Needs Resubmitting
Review via email: mp+40287@code.launchpad.net
To post a comment you must log in.
lp:~photostory/photostory/cleanup updated
26. By Josh Brown

Correct video creating path

27. By David Turner

-Fixed the FPS Video Creation Process
-Fixed a GTK Warning message

28. By David Turner

-Fixed bug #672272: The program now starts if the logo is missing

29. By David Turner

-Fixed the program crashing on startup

Revision history for this message
Joel Auterson (joel-auterson) wrote :

Check this out for the latest version, will you Josh? I never got around to approving it so it's probably out of date. Apologies.

review: Needs Resubmitting
lp:~photostory/photostory/cleanup updated
30. By Josh Brown

General cleanup; remove Main() function and other changes

Revision history for this message
Josh Brown (joshbrown) wrote :

I've manually cleaned the newest version of <code> and overwrote this branch with the amended <code> branch. This is ready for merging into <code> again, although testing beforehand may be prudent.

Revision history for this message
Joel Auterson (joel-auterson) wrote :

Could you do it AGAIN after I've got rid of the pickling? I have an
idea as to how we're going to do this.

Revision history for this message
Josh Brown (joshbrown) wrote :

If you've already started work on the pickling then I'll redo the cleanup afterwards.

Revision history for this message
Josh Brown (joshbrown) wrote :

I'm going to reject this as much of it has been incorporated into <lp:~photostory/photostory/code>, revision 34. Another proposal can be made at a later date if further changes are necessary, please feel free to reopen if you disagree.

review: Disapprove
Revision history for this message
Joel Auterson (joel-auterson) wrote :

It's your code, Josh, do whatever you feel necessary. :)

Unmerged revisions

30. By Josh Brown

General cleanup; remove Main() function and other changes

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'photostory'
2--- photostory 2011-01-24 04:12:08 +0000
3+++ photostory 2011-02-08 23:10:47 +0000
4@@ -1,283 +1,261 @@
5 #!/usr/bin/python
6
7-#Photostory 0.9
8-#by Joel Auterson (joel.auterson@googlemail.com)
9-#http://www.launchpad.net/photostory
10+# Photostory 0.95
11+# Joel Auterson (joel.auterson@googlemail.com)
12+# http://launchpad.net/photostory
13
14-import pygst
15-pygst.require("0.10")
16-import gst
17-import pygtk
18-import gtk
19-from time import strftime
20-import time
21-import os.path
22-import os
23-import cPickle
24+import time, os, cPickle, gtk, gst, glib
25 from threading import Timer
26-import glib
27-
28-class Main:
29-
30- def __init__(self):
31-
32- pipeline = None
33- xvimagesink = None
34- movie = None
35- self.movPath = None
36- self.adj = gtk.Adjustment(5, 1, 10, 1)
37- self.pic=None
38-
39- # If the `~/.photostory/photos` directory doesn't exist, create it:
40- if not os.path.exists(os.path.expanduser('~/.photostory/photos')):
41- os.makedirs(os.path.expanduser('~/.photostory/photos'))
42-
43- # If the `~/.photostory/db` pickle doesn't exist, create it:
44- if not os.path.isfile(os.path.expanduser('~/.photostory/db')):
45- cPickle.dump({}, open(os.path.expanduser('~/.photostory/db'), 'w'))
46-
47- # If the `~/.photostory/num` pickle doesn't exist, create it:
48- if not os.path.isfile(os.path.expanduser('~/.photostory/num')):
49- cPickle.dump(0, open(os.path.expanduser('~/.photostory/num'), 'w'))
50-
51- # Load the `db` and `num` pickles:
52- self.db = cPickle.load(open(os.path.expanduser('~/.photostory/db'), 'rb'))
53- self.ind = int(cPickle.load(open(os.path.expanduser('~/.photostory/num'), 'rb')))
54-
55- todayPicName = os.path.expanduser('~/.photostory/photos/') + str(self.ind) + ".png"
56- todayDate = None
57-
58- def chooseDay(cal):
59- dateTuple = cal.get_date()
60- setPic(dateTuple)
61-
62- def closedown(win):
63- print 'ind ' + str(self.ind)
64- print 'db' + str(self.db)
65- cPickle.dump(self.db, open(os.path.expanduser('~/.photostory/db'), 'wb'))
66- cPickle.dump(self.ind, open(os.path.expanduser('~/.photostory/num'), 'wb'))
67- gtk.main_quit()
68-
69- def about(aboutBut):
70- dAbout = gtk.AboutDialog()
71- dAbout.set_name("Photostory")
72- dAbout.set_comments("Photostory is an application that lets you tell the story of your life in photos, by taking a snapshot of you each day. You can then make these into a video to share with friends or on the internet.")
73- dAbout.set_artists(("Josh Brown", ""))
74- dAbout.set_authors(("Joel Auterson", "David Turner", "Josh Brown"))
75- dAbout.set_website("http://launchpad.net/photostory")
76- response = dAbout.run()
77- if response == -6:
78- dAbout.destroy()
79-
80- def movify(filmBut):
81-
82- def movPick(movFileButton):
83- movPicker = gtk.FileChooserDialog(title="Choose a save location", parent=movDia, action=gtk.FILE_CHOOSER_ACTION_SAVE, buttons=(("Save Here", -6)), backend=None)
84- movRes = movPicker.run()
85- if movRes == -6:
86- self.movPath = movPicker.get_filename()
87- movPicker.destroy()
88-
89- def movGen(movButton):
90-
91- movDia.destroy()
92-
93- filmPipe = gst.Pipeline("filmPipe")
94- filmSrc = gst.element_factory_make("multifilesrc", "filmSrc")
95- filmSrc.set_property("location", os.path.expanduser("~/.photostory/photos/") + "%d.png")
96- filmFilt1 = gst.element_factory_make("capsfilter", "filmFilt1")
97- filmCap1 = gst.Caps("image/png,framerate=" + str(int(self.adj.get_value())) + "/1,pixel-aspect-ratio=1/1")
98- filmFilt1.set_property("caps", filmCap1)
99- filmPngDec = gst.element_factory_make("pngdec", "filmPngDec")
100- filmff = gst.element_factory_make("ffmpegcolorspace", "filmff")
101- filmFilt2 = gst.element_factory_make("capsfilter", "filmFilt2")
102- filmCap2 = gst.Caps("video/x-raw-yuv")
103- filmFilt2.set_property("caps", filmCap2)
104- filmTheora = gst.element_factory_make("xvidenc", "filmTheora")
105- filmOggmux = gst.element_factory_make("ffmux_mp4", "filmOggmux")
106- filmFilesink = gst.element_factory_make("filesink", "filmFilesink")
107- filmFilesink.set_property("location", self.movPath)
108-
109- filmPipe.add(filmSrc, filmFilt1, filmPngDec, filmff, filmFilt2, filmTheora, filmOggmux, filmFilesink)
110- gst.element_link_many(filmSrc, filmFilt1, filmPngDec, filmff, filmFilt2, filmTheora, filmOggmux, filmFilesink)
111- filmPipe.set_state(gst.STATE_PLAYING)
112- time.sleep(5)
113- filmBut.set_sensitive(True)
114-
115- movDia = gtk.Window(gtk.WINDOW_TOPLEVEL)
116- movDia.set_title("Create Film")
117- movDia.set_resizable(False)
118- filmBut.set_sensitive(False)
119- movVbox = gtk.VBox(homogeneous=False, spacing=2)
120- movLabel = gtk.Label("Here you can create a video made up of all your photos. \n\nJust choose a save location and hit 'create'.\n\nRemember, the path must end in '.mp4'.\n")
121- movFileButton = gtk.Button(label="Choose a location")
122- movButton = gtk.Button(label="Create")
123-
124- #FPS Slider
125- movSliderBox = gtk.HBox(homogeneous=False, spacing=3)
126- movSliderLabel = gtk.Label("FPS:")
127- movSlider = gtk.HScale(self.adj)
128- movSlider.set_digits(0)
129- movSliderBox.pack_start(movSliderLabel, expand=False)
130- movSliderBox.pack_start(movSlider, expand=True)
131-
132- movDia.add(movVbox)
133- movVbox.pack_start(movLabel, expand=False)
134- movVbox.pack_start(movSliderBox, expand=False)
135- movVbox.pack_start(movFileButton, expand=False)
136- movVbox.pack_start(movButton, expand=False)
137- movButton.connect("clicked", movGen)
138- movFileButton.connect("clicked", movPick)
139- movDia.show_all()
140-
141- def capture(takeBut):
142-
143- def takePic():
144- pipeline.set_state(gst.STATE_NULL)
145- stillPipe = gst.Pipeline("stillPipe")
146- stillCam = gst.element_factory_make("v4l2src", "stillPipe")
147- stillFilt = gst.element_factory_make("capsfilter", "stillFilt")
148- stillCap = gst.Caps("video/x-raw-yuv,width=640,height=480")
149- stillFilt.set_property("caps", stillCap)
150- ffmpegcolorspace = gst.element_factory_make("ffmpegcolorspace", "ffmpegcolorspace")
151- pngEnc = gst.element_factory_make("pngenc", "pngenc")
152- filesink = gst.element_factory_make("filesink", "filesink")
153- filesink.set_property("location", todayPicName)
154- self.db[todayDate] = todayPicName
155- cal.freeze()
156- cal.select_month(todayDate[1], todayDate[0])
157- cal.select_day(todayDate[2])
158- cal.thaw()
159- stillPipe.add(stillCam, stillFilt, ffmpegcolorspace, pngEnc, filesink)
160- gst.element_link_many(stillCam, stillFilt, ffmpegcolorspace, pngEnc, filesink)
161- stillPipe.set_state(gst.STATE_PLAYING)
162- time.sleep(1)
163- stillPipe.set_state(gst.STATE_NULL)
164- xvimagesink.set_xwindow_id(movie.window.xid)
165- pipeline.set_state(gst.STATE_PLAYING)
166- setPic(todayDate)
167- self.ind += 1
168-
169- def countdown(n = 3):
170- self.pic.set_markup("<span size='54000'>" + str(n) + "</span>")
171- if n == 0: takePic()
172- else: glib.timeout_add(1000, countdown, n-1)
173-
174- countdown()
175-
176- def deletePic(deleteBut):
177- def getKey(dic, val):
178- return [k for k, v in dic.iteritems() if v == val][0]
179- date = cal.get_date()
180- if date in self.db:
181- os.remove(self.db[date])
182- setPic("")
183- if date == todayDate:
184- takeBut.set_label("Take today's photo")
185- takeBut.set_sensitive(True)
186- gaps = 0
187- i = 0
188- for element in self.db:
189- oldPath = os.path.expanduser('~/.photostory/photos/') + str(i) + ".png"
190- if not os.path.exists(oldPath):
191- gaps += 1
192- i += 1
193- oldPath = os.path.expanduser('~/.photostory/photos/') + str(i) + ".png"
194- if os.path.exists(oldPath):
195- key = getKey(self.db, oldPath)
196- newPath = os.path.expanduser('~/.photostory/photos/') + str(i-gaps) + ".png"
197- os.rename(oldPath, newPath)
198- self.db[key] = newPath
199- i += 1
200- del self.db[date]
201- self.ind -= 1
202-
203- def setPic(date):
204- if self.pic != None:
205- vbox1.remove(self.pic)
206- vbox1.remove(hbox2)
207- if date in self.db:
208- self.pic = gtk.Image()
209- self.pic.set_from_file(self.db[date])
210- takeBut.set_label("Photo taken for this day.")
211- takeBut.set_sensitive(False)
212- else:
213- if date == todayDate:
214- takeBut.set_label("Take today's photo")
215- takeBut.set_sensitive(True)
216- else:
217- takeBut.set_label("Take today's photo")
218- takeBut.set_sensitive(False)
219- self.pic = gtk.Label()
220- self.pic.set_justify(gtk.JUSTIFY_CENTER)
221- self.pic.set_markup("<span size='54000'>No Photo\nToday</span>");
222- self.pic.set_size_request(640, 480)
223- vbox1.pack_start(self.pic)
224- vbox1.pack_start(hbox2)
225- vbox1.show_all()
226-
227- #Interface
228- self.win = gtk.Window(gtk.WINDOW_TOPLEVEL)
229- self.win.connect("destroy", closedown)
230- self.win.set_default_size(900, 600)
231- self.win.set_resizable(False)
232- self.win.set_title("Photostory")
233- if os.path.exists("photostory.svg"):
234- self.win.set_icon_from_file("photostory.svg")
235- movie = gtk.DrawingArea()
236- movie.set_size_request(320, 240)
237- hbox = gtk.HBox(homogeneous=False, spacing=3)
238- vbox1 = gtk.VBox(homogeneous=False)
239- vbox2 = gtk.VBox(homogeneous = False)
240- filmBut = gtk.Button(label="Create Film")
241- filmBut.connect("clicked", movify)
242- deleteBut = gtk.Button(label="Delete Photo")
243- deleteBut.connect("clicked", deletePic)
244- shareBut = gtk.Button(label="Share Video")
245- hbox2 = gtk.HBox(homogeneous=True)
246- aboutBut = gtk.Button(label="About")
247- aboutBut.connect("clicked", about)
248-
249- cal = gtk.Calendar()
250- todayDate = cal.get_date()
251- cal.connect("day-selected", chooseDay)
252-
253- takeBut = gtk.Button(label="Take today's photo")
254- takeBut.connect("clicked", capture)
255-
256- setPic(todayDate)
257-
258- self.win.add(hbox)
259- hbox.pack_start(vbox1, expand=False)
260- hbox2.pack_start(filmBut, expand=False)
261- hbox2.pack_start(deleteBut, expand=False)
262- #hbox2.pack_start(shareBut)
263- hbox2.pack_start(aboutBut)
264- vbox2.pack_start(movie)
265- vbox2.pack_start(cal, expand=False, padding=25)
266- vbox2.pack_start(takeBut, expand=False)
267- hbox.pack_start(vbox2)
268-
269- self.win.show_all()
270-
271- #Pipeline stuff - feed
272- pipeline = gst.Pipeline("mypipeline")
273-
274- camera = gst.element_factory_make("v4l2src", "camera")
275- camera.set_property("device", "/dev/video0")
276-
277- caps = gst.Caps("video/x-raw-yuv,width=640,height=480,framerate=30/1")
278- filt = gst.element_factory_make("capsfilter", "filter")
279- filt.set_property("caps", caps)
280-
281- xvimagesink = gst.element_factory_make("xvimagesink", "sink")
282-
283- pipeline.add(camera, filt, xvimagesink)
284- gst.element_link_many(camera, filt, xvimagesink)
285-
286+
287+pipeline = None
288+xvimagesink = None
289+movie = None
290+movPath = None
291+adj = gtk.Adjustment(5, 1, 10, 1)
292+pic = None
293+
294+# If the `~/.photostory/photos` directory doesn't exist, create it:
295+if not os.path.exists(os.path.expanduser('~/.photostory/photos')):
296+ os.makedirs(os.path.expanduser('~/.photostory/photos'))
297+
298+# If the `~/.photostory/db` pickle doesn't exist, create it:
299+if not os.path.isfile(os.path.expanduser('~/.photostory/db')):
300+ cPickle.dump({}, open(os.path.expanduser('~/.photostory/db'), 'w'))
301+
302+# If the `~/.photostory/num` pickle doesn't exist, create it:
303+if not os.path.isfile(os.path.expanduser('~/.photostory/num')):
304+ cPickle.dump(0, open(os.path.expanduser('~/.photostory/num'), 'w'))
305+
306+# Load the `db` and `num` pickles:
307+db = cPickle.load(open(os.path.expanduser('~/.photostory/db'), 'rb'))
308+ind = int(cPickle.load(open(os.path.expanduser('~/.photostory/num'), 'rb')))
309+
310+todayPicName = os.path.expanduser('~/.photostory/photos/') + str(self.ind) + ".png"
311+todayDate = None
312+
313+def chooseDay(cal):
314+ dateTuple = cal.get_date()
315+ setPic(dateTuple)
316+
317+def closedown(win):
318+ print 'ind ' + str(ind)
319+ print 'db' + str(db)
320+ cPickle.dump(db, open(os.path.expanduser('~/.photostory/db'), 'wb'))
321+ cPickle.dump(ind, open(os.path.expanduser('~/.photostory/num'), 'wb'))
322+ gtk.main_quit()
323+
324+def about(aboutBut):
325+ dAbout = gtk.AboutDialog()
326+ dAbout.set_name("Photostory")
327+ dAbout.set_comments("Photostory is an application that lets you tell the story of your life in photos, by taking a snapshot of you each day. You can then make these into a video to share with friends or on the internet.")
328+ dAbout.set_artists(("Josh Brown"))
329+ dAbout.set_authors(("Joel Auterson", "David Turner", "Josh Brown"))
330+ dAbout.set_website("http://launchpad.net/photostory")
331+ response = dAbout.run()
332+ if response == -6:
333+ dAbout.destroy()
334+
335+def movify(filmBut):
336+ def movPick(movFileButton):
337+ movPicker = gtk.FileChooserDialog(title="Choose a save location", parent=movDia, action=gtk.FILE_CHOOSER_ACTION_SAVE, buttons=(("Save Here", -6)), backend=None)
338+ movRes = movPicker.run()
339+ if movRes == -6:
340+ movPath = movPicker.get_filename()
341+ movPicker.destroy()
342+
343+ def movGen(movButton):
344+ movDia.destroy()
345+
346+ filmPipe = gst.Pipeline("filmPipe")
347+ filmSrc = gst.element_factory_make("multifilesrc", "filmSrc")
348+ filmSrc.set_property("location", os.path.expanduser("~/.photostory/photos/") + "%d.png")
349+ filmFilt1 = gst.element_factory_make("capsfilter", "filmFilt1")
350+ filmCap1 = gst.Caps("image/png,framerate=" + str(int(self.adj.get_value())) + "/1,pixel-aspect-ratio=1/1")
351+ filmFilt1.set_property("caps", filmCap1)
352+ filmPngDec = gst.element_factory_make("pngdec", "filmPngDec")
353+ filmff = gst.element_factory_make("ffmpegcolorspace", "filmff")
354+ filmFilt2 = gst.element_factory_make("capsfilter", "filmFilt2")
355+ filmCap2 = gst.Caps("video/x-raw-yuv")
356+ filmFilt2.set_property("caps", filmCap2)
357+ filmTheora = gst.element_factory_make("xvidenc", "filmTheora")
358+ filmOggmux = gst.element_factory_make("ffmux_mp4", "filmOggmux")
359+ filmFilesink = gst.element_factory_make("filesink", "filmFilesink")
360+ filmFilesink.set_property("location", movPath)
361+
362+ filmPipe.add(filmSrc, filmFilt1, filmPngDec, filmff, filmFilt2, filmTheora, filmOggmux, filmFilesink)
363+ gst.element_link_many(filmSrc, filmFilt1, filmPngDec, filmff, filmFilt2, filmTheora, filmOggmux, filmFilesink)
364+ filmPipe.set_state(gst.STATE_PLAYING)
365+ time.sleep(5)
366+ filmBut.set_sensitive(True)
367+
368+ movDia = gtk.Window(gtk.WINDOW_TOPLEVEL)
369+ movDia.set_title("Create Film")
370+ movDia.set_resizable(False)
371+ filmBut.set_sensitive(False)
372+ movVbox = gtk.VBox(homogeneous=False, spacing=2)
373+ movLabel = gtk.Label("Here you can create a video made up of all your photos. \n\nJust choose a save location and hit 'create'.\n\nRemember, the path must end in '.mp4'.\n")
374+ movFileButton = gtk.Button(label="Choose a location")
375+ movButton = gtk.Button(label="Create")
376+
377+ #FPS Slider
378+ movSliderBox = gtk.HBox(homogeneous=False, spacing=3)
379+ movSliderLabel = gtk.Label("FPS:")
380+ movSlider = gtk.HScale(adj)
381+ movSlider.set_digits(0)
382+ movSliderBox.pack_start(movSliderLabel, expand=False)
383+ movSliderBox.pack_start(movSlider, expand=True)
384+
385+ movDia.add(movVbox)
386+ movVbox.pack_start(movLabel, expand=False)
387+ movVbox.pack_start(movSliderBox, expand=False)
388+ movVbox.pack_start(movFileButton, expand=False)
389+ movVbox.pack_start(movButton, expand=False)
390+ movButton.connect("clicked", movGen)
391+ movFileButton.connect("clicked", movPick)
392+ movDia.show_all()
393+
394+def capture(takeBut):
395+ def takePic():
396+ pipeline.set_state(gst.STATE_NULL)
397+ stillPipe = gst.Pipeline("stillPipe")
398+ stillCam = gst.element_factory_make("v4l2src", "stillPipe")
399+ stillFilt = gst.element_factory_make("capsfilter", "stillFilt")
400+ stillCap = gst.Caps("video/x-raw-yuv,width=640,height=480")
401+ stillFilt.set_property("caps", stillCap)
402+ ffmpegcolorspace = gst.element_factory_make("ffmpegcolorspace", "ffmpegcolorspace")
403+ pngEnc = gst.element_factory_make("pngenc", "pngenc")
404+ filesink = gst.element_factory_make("filesink", "filesink")
405+ filesink.set_property("location", todayPicName)
406+ db[todayDate] = todayPicName
407+ cal.freeze()
408+ cal.select_month(todayDate[1], todayDate[0])
409+ cal.select_day(todayDate[2])
410+ cal.thaw()
411+ stillPipe.add(stillCam, stillFilt, ffmpegcolorspace, pngEnc, filesink)
412+ gst.element_link_many(stillCam, stillFilt, ffmpegcolorspace, pngEnc, filesink)
413+ stillPipe.set_state(gst.STATE_PLAYING)
414+ time.sleep(1)
415+ stillPipe.set_state(gst.STATE_NULL)
416 xvimagesink.set_xwindow_id(movie.window.xid)
417-
418 pipeline.set_state(gst.STATE_PLAYING)
419-
420-start=Main()
421+ setPic(todayDate)
422+ ind += 1
423+
424+ def countdown(n = 3):
425+ self.pic.set_markup("<span size='54000'>" + str(n) + "</span>")
426+ if n == 0: takePic()
427+ else: glib.timeout_add(1000, countdown, n-1)
428+
429+ countdown()
430+
431+def deletePic(deleteBut):
432+ def getKey(dic, val):
433+ return [k for k, v in dic.iteritems() if v == val][0]
434+ date = cal.get_date()
435+ if date in db:
436+ os.remove(db[date])
437+ setPic("")
438+ if date == todayDate:
439+ takeBut.set_label("Take today's photo")
440+ takeBut.set_sensitive(True)
441+ gaps = 0
442+ i = 0
443+ for element in db:
444+ oldPath = os.path.expanduser('~/.photostory/photos/') + str(i) + ".png"
445+ if not os.path.exists(oldPath):
446+ gaps += 1
447+ i += 1
448+ oldPath = os.path.expanduser('~/.photostory/photos/') + str(i) + ".png"
449+ if os.path.exists(oldPath):
450+ key = getKey(db, oldPath)
451+ newPath = os.path.expanduser('~/.photostory/photos/') + str(i-gaps) + ".png"
452+ os.rename(oldPath, newPath)
453+ db[key] = newPath
454+ i += 1
455+ del db[date]
456+ ind -= 1
457+
458+def setPic(date):
459+ global pic
460+ if pic != None:
461+ vbox1.remove(pic)
462+ vbox1.remove(hbox2)
463+ if date in db:
464+ pic = gtk.Image()
465+ pic.set_from_file(db[date])
466+ takeBut.set_label("Photo taken for this day.")
467+ takeBut.set_sensitive(False)
468+ else:
469+ if date == todayDate:
470+ takeBut.set_label("Take today's photo")
471+ takeBut.set_sensitive(True)
472+ else:
473+ takeBut.set_label("Take today's photo")
474+ takeBut.set_sensitive(False)
475+ pic = gtk.Label()
476+ pic.set_justify(gtk.JUSTIFY_CENTER)
477+ pic.set_markup("<span size='54000'>No Photo\nToday</span>");
478+ pic.set_size_request(640, 480)
479+ vbox1.pack_start(pic)
480+ vbox1.pack_start(hbox2)
481+ vbox1.show_all()
482+
483+#Interface
484+self.win = gtk.Window(gtk.WINDOW_TOPLEVEL)
485+self.win.connect("destroy", closedown)
486+self.win.set_default_size(900, 600)
487+self.win.set_resizable(False)
488+self.win.set_title("Photostory")
489+if os.path.exists("photostory.svg"):
490+ self.win.set_icon_from_file("photostory.svg")
491+movie = gtk.DrawingArea()
492+movie.set_size_request(320, 240)
493+hbox = gtk.HBox(homogeneous=False, spacing=3)
494+vbox1 = gtk.VBox(homogeneous=False)
495+vbox2 = gtk.VBox(homogeneous = False)
496+filmBut = gtk.Button(label="Create Film")
497+filmBut.connect("clicked", movify)
498+deleteBut = gtk.Button(label="Delete Photo")
499+deleteBut.connect("clicked", deletePic)
500+shareBut = gtk.Button(label="Share Video")
501+hbox2 = gtk.HBox(homogeneous=True)
502+aboutBut = gtk.Button(label="About")
503+aboutBut.connect("clicked", about)
504+
505+cal = gtk.Calendar()
506+todayDate = cal.get_date()
507+cal.connect("day-selected", chooseDay)
508+
509+takeBut = gtk.Button(label="Take today's photo")
510+takeBut.connect("clicked", capture)
511+
512+setPic(todayDate)
513+
514+self.win.add(hbox)
515+hbox.pack_start(vbox1, expand=False)
516+hbox2.pack_start(filmBut, expand=False)
517+hbox2.pack_start(deleteBut, expand=False)
518+#hbox2.pack_start(shareBut)
519+hbox2.pack_start(aboutBut)
520+vbox2.pack_start(movie)
521+vbox2.pack_start(cal, expand=False, padding=25)
522+vbox2.pack_start(takeBut, expand=False)
523+hbox.pack_start(vbox2)
524+
525+self.win.show_all()
526+
527+#Pipeline stuff - feed
528+pipeline = gst.Pipeline("mypipeline")
529+camera = gst.element_factory_make("v4l2src", "camera")
530+camera.set_property("device", "/dev/video0")
531+caps = gst.Caps("video/x-raw-yuv,width=640,height=480,framerate=30/1")
532+filt = gst.element_factory_make("capsfilter", "filter")
533+filt.set_property("caps", caps)
534+xvimagesink = gst.element_factory_make("xvimagesink", "sink")
535+pipeline.add(camera, filt, xvimagesink)
536+gst.element_link_many(camera, filt, xvimagesink)
537+xvimagesink.set_xwindow_id(movie.window.xid)
538+pipeline.set_state(gst.STATE_PLAYING)
539+
540+# Start GTK
541 gtk.main()

Subscribers

People subscribed via source and target branches

to all changes: