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
=== modified file 'photostory'
--- photostory 2011-01-24 04:12:08 +0000
+++ photostory 2011-02-08 23:10:47 +0000
@@ -1,283 +1,261 @@
1#!/usr/bin/python1#!/usr/bin/python
22
3#Photostory 0.93# Photostory 0.95
4#by Joel Auterson (joel.auterson@googlemail.com)4# Joel Auterson (joel.auterson@googlemail.com)
5#http://www.launchpad.net/photostory5# http://launchpad.net/photostory
66
7import pygst7import time, os, cPickle, gtk, gst, glib
8pygst.require("0.10")
9import gst
10import pygtk
11import gtk
12from time import strftime
13import time
14import os.path
15import os
16import cPickle
17from threading import Timer8from threading import Timer
18import glib9
1910pipeline = None
20class Main:11xvimagesink = None
2112movie = None
22 def __init__(self):13movPath = None
2314adj = gtk.Adjustment(5, 1, 10, 1)
24 pipeline = None15pic = None
25 xvimagesink = None16
26 movie = None17# If the `~/.photostory/photos` directory doesn't exist, create it:
27 self.movPath = None18if not os.path.exists(os.path.expanduser('~/.photostory/photos')):
28 self.adj = gtk.Adjustment(5, 1, 10, 1)19 os.makedirs(os.path.expanduser('~/.photostory/photos'))
29 self.pic=None20
3021# If the `~/.photostory/db` pickle doesn't exist, create it:
31 # If the `~/.photostory/photos` directory doesn't exist, create it:22if not os.path.isfile(os.path.expanduser('~/.photostory/db')):
32 if not os.path.exists(os.path.expanduser('~/.photostory/photos')):23 cPickle.dump({}, open(os.path.expanduser('~/.photostory/db'), 'w'))
33 os.makedirs(os.path.expanduser('~/.photostory/photos'))24
3425# If the `~/.photostory/num` pickle doesn't exist, create it:
35 # If the `~/.photostory/db` pickle doesn't exist, create it:26if not os.path.isfile(os.path.expanduser('~/.photostory/num')):
36 if not os.path.isfile(os.path.expanduser('~/.photostory/db')):27 cPickle.dump(0, open(os.path.expanduser('~/.photostory/num'), 'w'))
37 cPickle.dump({}, open(os.path.expanduser('~/.photostory/db'), 'w'))28
3829# Load the `db` and `num` pickles:
39 # If the `~/.photostory/num` pickle doesn't exist, create it:30db = cPickle.load(open(os.path.expanduser('~/.photostory/db'), 'rb'))
40 if not os.path.isfile(os.path.expanduser('~/.photostory/num')):31ind = int(cPickle.load(open(os.path.expanduser('~/.photostory/num'), 'rb')))
41 cPickle.dump(0, open(os.path.expanduser('~/.photostory/num'), 'w'))32
4233todayPicName = os.path.expanduser('~/.photostory/photos/') + str(self.ind) + ".png"
43 # Load the `db` and `num` pickles:34todayDate = None
44 self.db = cPickle.load(open(os.path.expanduser('~/.photostory/db'), 'rb'))35
45 self.ind = int(cPickle.load(open(os.path.expanduser('~/.photostory/num'), 'rb')))36def chooseDay(cal):
4637 dateTuple = cal.get_date()
47 todayPicName = os.path.expanduser('~/.photostory/photos/') + str(self.ind) + ".png"38 setPic(dateTuple)
48 todayDate = None39
4940def closedown(win):
50 def chooseDay(cal):41 print 'ind ' + str(ind)
51 dateTuple = cal.get_date()42 print 'db' + str(db)
52 setPic(dateTuple)43 cPickle.dump(db, open(os.path.expanduser('~/.photostory/db'), 'wb'))
5344 cPickle.dump(ind, open(os.path.expanduser('~/.photostory/num'), 'wb'))
54 def closedown(win):45 gtk.main_quit()
55 print 'ind ' + str(self.ind)46
56 print 'db' + str(self.db)47def about(aboutBut):
57 cPickle.dump(self.db, open(os.path.expanduser('~/.photostory/db'), 'wb'))48 dAbout = gtk.AboutDialog()
58 cPickle.dump(self.ind, open(os.path.expanduser('~/.photostory/num'), 'wb'))49 dAbout.set_name("Photostory")
59 gtk.main_quit()50 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.")
6051 dAbout.set_artists(("Josh Brown"))
61 def about(aboutBut):52 dAbout.set_authors(("Joel Auterson", "David Turner", "Josh Brown"))
62 dAbout = gtk.AboutDialog()53 dAbout.set_website("http://launchpad.net/photostory")
63 dAbout.set_name("Photostory")54 response = dAbout.run()
64 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.")55 if response == -6:
65 dAbout.set_artists(("Josh Brown", ""))56 dAbout.destroy()
66 dAbout.set_authors(("Joel Auterson", "David Turner", "Josh Brown"))57
67 dAbout.set_website("http://launchpad.net/photostory")58def movify(filmBut):
68 response = dAbout.run()59 def movPick(movFileButton):
69 if response == -6:60 movPicker = gtk.FileChooserDialog(title="Choose a save location", parent=movDia, action=gtk.FILE_CHOOSER_ACTION_SAVE, buttons=(("Save Here", -6)), backend=None)
70 dAbout.destroy()61 movRes = movPicker.run()
7162 if movRes == -6:
72 def movify(filmBut):63 movPath = movPicker.get_filename()
7364 movPicker.destroy()
74 def movPick(movFileButton):65
75 movPicker = gtk.FileChooserDialog(title="Choose a save location", parent=movDia, action=gtk.FILE_CHOOSER_ACTION_SAVE, buttons=(("Save Here", -6)), backend=None)66 def movGen(movButton):
76 movRes = movPicker.run()67 movDia.destroy()
77 if movRes == -6:68
78 self.movPath = movPicker.get_filename()69 filmPipe = gst.Pipeline("filmPipe")
79 movPicker.destroy()70 filmSrc = gst.element_factory_make("multifilesrc", "filmSrc")
8071 filmSrc.set_property("location", os.path.expanduser("~/.photostory/photos/") + "%d.png")
81 def movGen(movButton):72 filmFilt1 = gst.element_factory_make("capsfilter", "filmFilt1")
8273 filmCap1 = gst.Caps("image/png,framerate=" + str(int(self.adj.get_value())) + "/1,pixel-aspect-ratio=1/1")
83 movDia.destroy()74 filmFilt1.set_property("caps", filmCap1)
8475 filmPngDec = gst.element_factory_make("pngdec", "filmPngDec")
85 filmPipe = gst.Pipeline("filmPipe")76 filmff = gst.element_factory_make("ffmpegcolorspace", "filmff")
86 filmSrc = gst.element_factory_make("multifilesrc", "filmSrc")77 filmFilt2 = gst.element_factory_make("capsfilter", "filmFilt2")
87 filmSrc.set_property("location", os.path.expanduser("~/.photostory/photos/") + "%d.png")78 filmCap2 = gst.Caps("video/x-raw-yuv")
88 filmFilt1 = gst.element_factory_make("capsfilter", "filmFilt1")79 filmFilt2.set_property("caps", filmCap2)
89 filmCap1 = gst.Caps("image/png,framerate=" + str(int(self.adj.get_value())) + "/1,pixel-aspect-ratio=1/1")80 filmTheora = gst.element_factory_make("xvidenc", "filmTheora")
90 filmFilt1.set_property("caps", filmCap1)81 filmOggmux = gst.element_factory_make("ffmux_mp4", "filmOggmux")
91 filmPngDec = gst.element_factory_make("pngdec", "filmPngDec")82 filmFilesink = gst.element_factory_make("filesink", "filmFilesink")
92 filmff = gst.element_factory_make("ffmpegcolorspace", "filmff")83 filmFilesink.set_property("location", movPath)
93 filmFilt2 = gst.element_factory_make("capsfilter", "filmFilt2")84
94 filmCap2 = gst.Caps("video/x-raw-yuv")85 filmPipe.add(filmSrc, filmFilt1, filmPngDec, filmff, filmFilt2, filmTheora, filmOggmux, filmFilesink)
95 filmFilt2.set_property("caps", filmCap2)86 gst.element_link_many(filmSrc, filmFilt1, filmPngDec, filmff, filmFilt2, filmTheora, filmOggmux, filmFilesink)
96 filmTheora = gst.element_factory_make("xvidenc", "filmTheora")87 filmPipe.set_state(gst.STATE_PLAYING)
97 filmOggmux = gst.element_factory_make("ffmux_mp4", "filmOggmux")88 time.sleep(5)
98 filmFilesink = gst.element_factory_make("filesink", "filmFilesink")89 filmBut.set_sensitive(True)
99 filmFilesink.set_property("location", self.movPath)90
10091 movDia = gtk.Window(gtk.WINDOW_TOPLEVEL)
101 filmPipe.add(filmSrc, filmFilt1, filmPngDec, filmff, filmFilt2, filmTheora, filmOggmux, filmFilesink)92 movDia.set_title("Create Film")
102 gst.element_link_many(filmSrc, filmFilt1, filmPngDec, filmff, filmFilt2, filmTheora, filmOggmux, filmFilesink)93 movDia.set_resizable(False)
103 filmPipe.set_state(gst.STATE_PLAYING)94 filmBut.set_sensitive(False)
104 time.sleep(5)95 movVbox = gtk.VBox(homogeneous=False, spacing=2)
105 filmBut.set_sensitive(True)96 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")
10697 movFileButton = gtk.Button(label="Choose a location")
107 movDia = gtk.Window(gtk.WINDOW_TOPLEVEL)98 movButton = gtk.Button(label="Create")
108 movDia.set_title("Create Film")99
109 movDia.set_resizable(False)100 #FPS Slider
110 filmBut.set_sensitive(False)101 movSliderBox = gtk.HBox(homogeneous=False, spacing=3)
111 movVbox = gtk.VBox(homogeneous=False, spacing=2)102 movSliderLabel = gtk.Label("FPS:")
112 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")103 movSlider = gtk.HScale(adj)
113 movFileButton = gtk.Button(label="Choose a location")104 movSlider.set_digits(0)
114 movButton = gtk.Button(label="Create")105 movSliderBox.pack_start(movSliderLabel, expand=False)
115106 movSliderBox.pack_start(movSlider, expand=True)
116 #FPS Slider107
117 movSliderBox = gtk.HBox(homogeneous=False, spacing=3)108 movDia.add(movVbox)
118 movSliderLabel = gtk.Label("FPS:")109 movVbox.pack_start(movLabel, expand=False)
119 movSlider = gtk.HScale(self.adj)110 movVbox.pack_start(movSliderBox, expand=False)
120 movSlider.set_digits(0)111 movVbox.pack_start(movFileButton, expand=False)
121 movSliderBox.pack_start(movSliderLabel, expand=False)112 movVbox.pack_start(movButton, expand=False)
122 movSliderBox.pack_start(movSlider, expand=True)113 movButton.connect("clicked", movGen)
123114 movFileButton.connect("clicked", movPick)
124 movDia.add(movVbox)115 movDia.show_all()
125 movVbox.pack_start(movLabel, expand=False)116
126 movVbox.pack_start(movSliderBox, expand=False)117def capture(takeBut):
127 movVbox.pack_start(movFileButton, expand=False)118 def takePic():
128 movVbox.pack_start(movButton, expand=False)119 pipeline.set_state(gst.STATE_NULL)
129 movButton.connect("clicked", movGen)120 stillPipe = gst.Pipeline("stillPipe")
130 movFileButton.connect("clicked", movPick)121 stillCam = gst.element_factory_make("v4l2src", "stillPipe")
131 movDia.show_all()122 stillFilt = gst.element_factory_make("capsfilter", "stillFilt")
132123 stillCap = gst.Caps("video/x-raw-yuv,width=640,height=480")
133 def capture(takeBut):124 stillFilt.set_property("caps", stillCap)
134125 ffmpegcolorspace = gst.element_factory_make("ffmpegcolorspace", "ffmpegcolorspace")
135 def takePic():126 pngEnc = gst.element_factory_make("pngenc", "pngenc")
136 pipeline.set_state(gst.STATE_NULL)127 filesink = gst.element_factory_make("filesink", "filesink")
137 stillPipe = gst.Pipeline("stillPipe")128 filesink.set_property("location", todayPicName)
138 stillCam = gst.element_factory_make("v4l2src", "stillPipe")129 db[todayDate] = todayPicName
139 stillFilt = gst.element_factory_make("capsfilter", "stillFilt")130 cal.freeze()
140 stillCap = gst.Caps("video/x-raw-yuv,width=640,height=480")131 cal.select_month(todayDate[1], todayDate[0])
141 stillFilt.set_property("caps", stillCap)132 cal.select_day(todayDate[2])
142 ffmpegcolorspace = gst.element_factory_make("ffmpegcolorspace", "ffmpegcolorspace")133 cal.thaw()
143 pngEnc = gst.element_factory_make("pngenc", "pngenc")134 stillPipe.add(stillCam, stillFilt, ffmpegcolorspace, pngEnc, filesink)
144 filesink = gst.element_factory_make("filesink", "filesink")135 gst.element_link_many(stillCam, stillFilt, ffmpegcolorspace, pngEnc, filesink)
145 filesink.set_property("location", todayPicName)136 stillPipe.set_state(gst.STATE_PLAYING)
146 self.db[todayDate] = todayPicName137 time.sleep(1)
147 cal.freeze()138 stillPipe.set_state(gst.STATE_NULL)
148 cal.select_month(todayDate[1], todayDate[0])
149 cal.select_day(todayDate[2])
150 cal.thaw()
151 stillPipe.add(stillCam, stillFilt, ffmpegcolorspace, pngEnc, filesink)
152 gst.element_link_many(stillCam, stillFilt, ffmpegcolorspace, pngEnc, filesink)
153 stillPipe.set_state(gst.STATE_PLAYING)
154 time.sleep(1)
155 stillPipe.set_state(gst.STATE_NULL)
156 xvimagesink.set_xwindow_id(movie.window.xid)
157 pipeline.set_state(gst.STATE_PLAYING)
158 setPic(todayDate)
159 self.ind += 1
160
161 def countdown(n = 3):
162 self.pic.set_markup("<span size='54000'>" + str(n) + "</span>")
163 if n == 0: takePic()
164 else: glib.timeout_add(1000, countdown, n-1)
165
166 countdown()
167
168 def deletePic(deleteBut):
169 def getKey(dic, val):
170 return [k for k, v in dic.iteritems() if v == val][0]
171 date = cal.get_date()
172 if date in self.db:
173 os.remove(self.db[date])
174 setPic("")
175 if date == todayDate:
176 takeBut.set_label("Take today's photo")
177 takeBut.set_sensitive(True)
178 gaps = 0
179 i = 0
180 for element in self.db:
181 oldPath = os.path.expanduser('~/.photostory/photos/') + str(i) + ".png"
182 if not os.path.exists(oldPath):
183 gaps += 1
184 i += 1
185 oldPath = os.path.expanduser('~/.photostory/photos/') + str(i) + ".png"
186 if os.path.exists(oldPath):
187 key = getKey(self.db, oldPath)
188 newPath = os.path.expanduser('~/.photostory/photos/') + str(i-gaps) + ".png"
189 os.rename(oldPath, newPath)
190 self.db[key] = newPath
191 i += 1
192 del self.db[date]
193 self.ind -= 1
194
195 def setPic(date):
196 if self.pic != None:
197 vbox1.remove(self.pic)
198 vbox1.remove(hbox2)
199 if date in self.db:
200 self.pic = gtk.Image()
201 self.pic.set_from_file(self.db[date])
202 takeBut.set_label("Photo taken for this day.")
203 takeBut.set_sensitive(False)
204 else:
205 if date == todayDate:
206 takeBut.set_label("Take today's photo")
207 takeBut.set_sensitive(True)
208 else:
209 takeBut.set_label("Take today's photo")
210 takeBut.set_sensitive(False)
211 self.pic = gtk.Label()
212 self.pic.set_justify(gtk.JUSTIFY_CENTER)
213 self.pic.set_markup("<span size='54000'>No Photo\nToday</span>");
214 self.pic.set_size_request(640, 480)
215 vbox1.pack_start(self.pic)
216 vbox1.pack_start(hbox2)
217 vbox1.show_all()
218
219 #Interface
220 self.win = gtk.Window(gtk.WINDOW_TOPLEVEL)
221 self.win.connect("destroy", closedown)
222 self.win.set_default_size(900, 600)
223 self.win.set_resizable(False)
224 self.win.set_title("Photostory")
225 if os.path.exists("photostory.svg"):
226 self.win.set_icon_from_file("photostory.svg")
227 movie = gtk.DrawingArea()
228 movie.set_size_request(320, 240)
229 hbox = gtk.HBox(homogeneous=False, spacing=3)
230 vbox1 = gtk.VBox(homogeneous=False)
231 vbox2 = gtk.VBox(homogeneous = False)
232 filmBut = gtk.Button(label="Create Film")
233 filmBut.connect("clicked", movify)
234 deleteBut = gtk.Button(label="Delete Photo")
235 deleteBut.connect("clicked", deletePic)
236 shareBut = gtk.Button(label="Share Video")
237 hbox2 = gtk.HBox(homogeneous=True)
238 aboutBut = gtk.Button(label="About")
239 aboutBut.connect("clicked", about)
240
241 cal = gtk.Calendar()
242 todayDate = cal.get_date()
243 cal.connect("day-selected", chooseDay)
244
245 takeBut = gtk.Button(label="Take today's photo")
246 takeBut.connect("clicked", capture)
247
248 setPic(todayDate)
249
250 self.win.add(hbox)
251 hbox.pack_start(vbox1, expand=False)
252 hbox2.pack_start(filmBut, expand=False)
253 hbox2.pack_start(deleteBut, expand=False)
254 #hbox2.pack_start(shareBut)
255 hbox2.pack_start(aboutBut)
256 vbox2.pack_start(movie)
257 vbox2.pack_start(cal, expand=False, padding=25)
258 vbox2.pack_start(takeBut, expand=False)
259 hbox.pack_start(vbox2)
260
261 self.win.show_all()
262
263 #Pipeline stuff - feed
264 pipeline = gst.Pipeline("mypipeline")
265
266 camera = gst.element_factory_make("v4l2src", "camera")
267 camera.set_property("device", "/dev/video0")
268
269 caps = gst.Caps("video/x-raw-yuv,width=640,height=480,framerate=30/1")
270 filt = gst.element_factory_make("capsfilter", "filter")
271 filt.set_property("caps", caps)
272
273 xvimagesink = gst.element_factory_make("xvimagesink", "sink")
274
275 pipeline.add(camera, filt, xvimagesink)
276 gst.element_link_many(camera, filt, xvimagesink)
277
278 xvimagesink.set_xwindow_id(movie.window.xid)139 xvimagesink.set_xwindow_id(movie.window.xid)
279
280 pipeline.set_state(gst.STATE_PLAYING)140 pipeline.set_state(gst.STATE_PLAYING)
281141 setPic(todayDate)
282start=Main()142 ind += 1
143
144 def countdown(n = 3):
145 self.pic.set_markup("<span size='54000'>" + str(n) + "</span>")
146 if n == 0: takePic()
147 else: glib.timeout_add(1000, countdown, n-1)
148
149 countdown()
150
151def deletePic(deleteBut):
152 def getKey(dic, val):
153 return [k for k, v in dic.iteritems() if v == val][0]
154 date = cal.get_date()
155 if date in db:
156 os.remove(db[date])
157 setPic("")
158 if date == todayDate:
159 takeBut.set_label("Take today's photo")
160 takeBut.set_sensitive(True)
161 gaps = 0
162 i = 0
163 for element in db:
164 oldPath = os.path.expanduser('~/.photostory/photos/') + str(i) + ".png"
165 if not os.path.exists(oldPath):
166 gaps += 1
167 i += 1
168 oldPath = os.path.expanduser('~/.photostory/photos/') + str(i) + ".png"
169 if os.path.exists(oldPath):
170 key = getKey(db, oldPath)
171 newPath = os.path.expanduser('~/.photostory/photos/') + str(i-gaps) + ".png"
172 os.rename(oldPath, newPath)
173 db[key] = newPath
174 i += 1
175 del db[date]
176 ind -= 1
177
178def setPic(date):
179 global pic
180 if pic != None:
181 vbox1.remove(pic)
182 vbox1.remove(hbox2)
183 if date in db:
184 pic = gtk.Image()
185 pic.set_from_file(db[date])
186 takeBut.set_label("Photo taken for this day.")
187 takeBut.set_sensitive(False)
188 else:
189 if date == todayDate:
190 takeBut.set_label("Take today's photo")
191 takeBut.set_sensitive(True)
192 else:
193 takeBut.set_label("Take today's photo")
194 takeBut.set_sensitive(False)
195 pic = gtk.Label()
196 pic.set_justify(gtk.JUSTIFY_CENTER)
197 pic.set_markup("<span size='54000'>No Photo\nToday</span>");
198 pic.set_size_request(640, 480)
199 vbox1.pack_start(pic)
200 vbox1.pack_start(hbox2)
201 vbox1.show_all()
202
203#Interface
204self.win = gtk.Window(gtk.WINDOW_TOPLEVEL)
205self.win.connect("destroy", closedown)
206self.win.set_default_size(900, 600)
207self.win.set_resizable(False)
208self.win.set_title("Photostory")
209if os.path.exists("photostory.svg"):
210 self.win.set_icon_from_file("photostory.svg")
211movie = gtk.DrawingArea()
212movie.set_size_request(320, 240)
213hbox = gtk.HBox(homogeneous=False, spacing=3)
214vbox1 = gtk.VBox(homogeneous=False)
215vbox2 = gtk.VBox(homogeneous = False)
216filmBut = gtk.Button(label="Create Film")
217filmBut.connect("clicked", movify)
218deleteBut = gtk.Button(label="Delete Photo")
219deleteBut.connect("clicked", deletePic)
220shareBut = gtk.Button(label="Share Video")
221hbox2 = gtk.HBox(homogeneous=True)
222aboutBut = gtk.Button(label="About")
223aboutBut.connect("clicked", about)
224
225cal = gtk.Calendar()
226todayDate = cal.get_date()
227cal.connect("day-selected", chooseDay)
228
229takeBut = gtk.Button(label="Take today's photo")
230takeBut.connect("clicked", capture)
231
232setPic(todayDate)
233
234self.win.add(hbox)
235hbox.pack_start(vbox1, expand=False)
236hbox2.pack_start(filmBut, expand=False)
237hbox2.pack_start(deleteBut, expand=False)
238#hbox2.pack_start(shareBut)
239hbox2.pack_start(aboutBut)
240vbox2.pack_start(movie)
241vbox2.pack_start(cal, expand=False, padding=25)
242vbox2.pack_start(takeBut, expand=False)
243hbox.pack_start(vbox2)
244
245self.win.show_all()
246
247#Pipeline stuff - feed
248pipeline = gst.Pipeline("mypipeline")
249camera = gst.element_factory_make("v4l2src", "camera")
250camera.set_property("device", "/dev/video0")
251caps = gst.Caps("video/x-raw-yuv,width=640,height=480,framerate=30/1")
252filt = gst.element_factory_make("capsfilter", "filter")
253filt.set_property("caps", caps)
254xvimagesink = gst.element_factory_make("xvimagesink", "sink")
255pipeline.add(camera, filt, xvimagesink)
256gst.element_link_many(camera, filt, xvimagesink)
257xvimagesink.set_xwindow_id(movie.window.xid)
258pipeline.set_state(gst.STATE_PLAYING)
259
260# Start GTK
283gtk.main()261gtk.main()

Subscribers

People subscribed via source and target branches

to all changes: