Merge lp:~joel-dimbernat-gmail/photostory/gettext into lp:photostory

Proposed by Joel Auterson
Status: Merged
Approved by: Joel Auterson
Approved revision: 43
Merged at revision: 46
Proposed branch: lp:~joel-dimbernat-gmail/photostory/gettext
Merge into: lp:photostory
Diff against target: 178 lines (+53/-25) (has conflicts)
1 file modified
photostory (+53/-25)
Text conflict in photostory
To merge this branch: bzr merge lp:~joel-dimbernat-gmail/photostory/gettext
Reviewer Review Type Date Requested Status
Joel Auterson Approve
Review via email: mp+51386@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Joel Auterson (joel-auterson) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'photostory'
2--- photostory 2011-02-25 11:30:57 +0000
3+++ photostory 2011-02-25 23:11:24 +0000
4@@ -1,4 +1,4 @@
5-#!/usr/bin/env python
6+#!/usr/bin/env python2
7
8 # Photostory 1.0
9 # Joel Auterson <joel.auterson@googlemail.com>
10@@ -7,6 +7,11 @@
11 import time, os, glib, glob, shutil, gtk, pygtk, pygst
12 pygst.require("0.10")
13 import gst
14+import gettext
15+import locale
16+locale.setlocale(locale.LC_ALL, '')
17+gettext.install('photostory', unicode=True)
18+import locale
19
20 DB = os.path.expanduser('~/.photostory/photos/')
21
22@@ -15,6 +20,7 @@
23 pipeline = None
24 xvimagesink = None
25 movie = None
26+ is_playing = False
27 self.movPath = None
28 self.adj = gtk.Adjustment(5, 1, 10, 1)
29 self.pic=None
30@@ -36,7 +42,7 @@
31 def about(aboutBut):
32 dAbout = gtk.AboutDialog()
33 dAbout.set_name("Photostory")
34- 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.")
35+ 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."))
36 dAbout.set_artists(("Josh Brown", ""))
37 dAbout.set_authors(("Joel Auterson", "David Turner", "Josh Brown"))
38 dAbout.set_website("http://launchpad.net/photostory")
39@@ -46,7 +52,7 @@
40
41 def movify(filmBut):
42 def movPick(movFileButton):
43- movPicker = gtk.FileChooserDialog(title="Choose a save location", parent=movDia, action=gtk.FILE_CHOOSER_ACTION_SAVE, buttons=(("Save Here", -6)), backend=None)
44+ movPicker = gtk.FileChooserDialog(title=_("Choose a save location"), parent=movDia, action=gtk.FILE_CHOOSER_ACTION_SAVE, buttons=((_("Save Here"), -6)), backend=None)
45 movRes = movPicker.run()
46 if movRes == -6:
47 self.movPath = movPicker.get_filename()
48@@ -97,13 +103,13 @@
49 shutil.rmtree('/tmp/photostory')
50
51 movDia = gtk.Window(gtk.WINDOW_TOPLEVEL)
52- movDia.set_title("Create Film")
53+ movDia.set_title(_("Create Film"))
54 movDia.set_resizable(False)
55 filmBut.set_sensitive(False)
56 movVbox = gtk.VBox(homogeneous=False, spacing=2)
57- 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")
58- movFileButton = gtk.Button(label="Choose a location")
59- movButton = gtk.Button(label="Create")
60+ 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"))
61+ movFileButton = gtk.Button(label=_("Choose a location"))
62+ movButton = gtk.Button(label=_("Create"))
63
64 #FPS Slider
65 movSliderBox = gtk.HBox(homogeneous=False, spacing=3)
66@@ -123,9 +129,10 @@
67 movDia.show_all()
68
69 def capture(takeBut):
70- def takePic():
71- pipeline.set_state(gst.STATE_NULL)
72- stillPipe = gst.Pipeline("stillPipe")
73+ self.stillPipe = None
74+
75+ def prepare():
76+ self.stillPipe = gst.Pipeline("stillPipe")
77 stillCam = gst.element_factory_make("v4l2src", "stillPipe")
78 stillFilt = gst.element_factory_make("capsfilter", "stillFilt")
79 stillCap = gst.Caps("video/x-raw-yuv,width=640,height=480")
80@@ -133,21 +140,42 @@
81 ffmpegcolorspace = gst.element_factory_make("ffmpegcolorspace", "ffmpegcolorspace")
82 pngEnc = gst.element_factory_make("pngenc", "pngenc")
83 filesink = gst.element_factory_make("filesink", "filesink")
84+<<<<<<< TREE
85 filesink.set_property("location", DB + self.dateString + ".png")
86 stillPipe.add(stillCam, stillFilt, ffmpegcolorspace, pngEnc, filesink)
87+=======
88+ filesink.set_property("location", os.path.expanduser('~/.photostory/photos/') + self.dateString + ".png")
89+ self.stillPipe.add(stillCam, stillFilt, ffmpegcolorspace, pngEnc, filesink)
90+>>>>>>> MERGE-SOURCE
91 gst.element_link_many(stillCam, stillFilt, ffmpegcolorspace, pngEnc, filesink)
92- stillPipe.set_state(gst.STATE_PLAYING)
93- time.sleep(1)
94- stillPipe.set_state(gst.STATE_NULL)
95- xvimagesink.set_xwindow_id(movie.window.xid)
96- pipeline.set_state(gst.STATE_PLAYING)
97- setPic(self.todayDate)
98-
99+ bus = self.stillPipe.get_bus()
100+ bus.add_signal_watch()
101+ bus.connect("message", message_handler)
102+
103+ def takePic():
104+ pipeline.set_state(gst.STATE_NULL)
105+ self.stillPipe.set_state(gst.STATE_PLAYING)
106+
107 def countdown(n = 3):
108 self.pic.set_markup("<span size='54000'>" + str(n) + "</span>")
109 if n == 0: takePic()
110 else: glib.timeout_add(1000, countdown, n-1)
111
112+ def message_handler(bus, message):
113+ msgType = message.type
114+ if msgType == gst.MESSAGE_EOS:
115+ self.stillPipe.set_state(gst.STATE_NULL)
116+ xvimagesink.set_xwindow_id(movie.window.xid)
117+ pipeline.set_state(gst.STATE_PLAYING)
118+ setPic(self.todayDate)
119+ if msgType == gst.MESSAGE_ERROR:
120+ err, debug = message.parse_error()
121+ print "Error: %s" % err, debug
122+ if msgType == gst.MESSAGE_WARNING:
123+ err, debug = message.parse_error()
124+ print "Warning: %s" % err, debug
125+
126+ prepare()
127 countdown()
128
129 def deletePic(deleteBut):
130@@ -164,19 +192,19 @@
131 if os.path.exists(picPath):
132 self.pic = gtk.Image()
133 self.pic.set_from_file(picPath)
134- takeBut.set_label("Photo taken for this day.")
135+ takeBut.set_label(_("Photo taken for this day."))
136 takeBut.set_sensitive(False)
137 deleteBut.set_sensitive(True)
138 else:
139 if date == self.todayDate:
140- takeBut.set_label("Take today's photo")
141+ takeBut.set_label(_("Take today's photo"))
142 takeBut.set_sensitive(True)
143 else:
144- takeBut.set_label("Take today's photo")
145+ takeBut.set_label(_("Take today's photo"))
146 takeBut.set_sensitive(False)
147 self.pic = gtk.Label()
148 self.pic.set_justify(gtk.JUSTIFY_CENTER)
149- self.pic.set_markup("<span size='54000'>No Photo\nToday</span>");
150+ self.pic.set_markup(_("<span size='54000'>No Photo\nToday</span>"));
151 self.pic.set_size_request(640, 480)
152 deleteBut.set_sensitive(False)
153 vbox1.pack_start(self.pic)
154@@ -198,13 +226,13 @@
155 hbox = gtk.HBox(homogeneous=False, spacing=3)
156 vbox1 = gtk.VBox(homogeneous=False)
157 vbox2 = gtk.VBox(homogeneous = False)
158- filmBut = gtk.Button(label="Create Film")
159+ filmBut = gtk.Button(label=_("Create Film"))
160 filmBut.connect("clicked", movify)
161- deleteBut = gtk.Button(label="Delete Photo")
162+ deleteBut = gtk.Button(label=_("Delete Photo"))
163 deleteBut.connect("clicked", deletePic)
164 # shareBut = gtk.Button(label="Share Video")
165 hbox2 = gtk.HBox(homogeneous=True)
166- aboutBut = gtk.Button(label="About")
167+ aboutBut = gtk.Button(label=_("About"))
168 aboutBut.connect("clicked", about)
169
170 cal = gtk.Calendar()
171@@ -212,7 +240,7 @@
172 year, month, day = self.todayDateTuple = cal.get_date()
173 self.dateString = '{0:04d}-{1:02d}-{2:02d}'.format(year, month+1, day)
174 self.todayDate = self.dateString
175- takeBut = gtk.Button(label="Take today's photo")
176+ takeBut = gtk.Button(label=_("Take today's photo"))
177 takeBut.connect("clicked", capture)
178 setPic(self.todayDate)
179

Subscribers

People subscribed via source and target branches