[Cvs-annodex] commit (annodex): keystroke/trunk/clip.py
keystroke/trunk/cliplist.py keystroke/trunk/cliplistiter.py
keystroke/trunk/keystroke.py keystroke/trunk/scriptview.py
scott
nobody at lists.annodex.net
Tue Nov 14 10:20:49 UTC 2006
Update of /var/local/lib/svn/annodex (new revision 2546)
Modified files:
keystroke/trunk/clip.py
keystroke/trunk/cliplist.py
keystroke/trunk/cliplistiter.py
keystroke/trunk/keystroke.py
keystroke/trunk/scriptview.py
Log Message:
Fixed a few bugs. Transcribing works a bit now although tracks are still off. Opening a file sets the right initial conditions too.
Modified: keystroke/trunk/clip.py
===================================================================
--- keystroke/trunk/clip.py 2006-11-10 09:13:50 UTC (rev 2545)
+++ keystroke/trunk/clip.py 2006-11-14 10:20:46 UTC (rev 2546)
@@ -41,7 +41,6 @@
self.__start = start
self.__end = end
self.__text = text
- self.__track = track
self.__speaker = speaker
def set_start(self,time):
Modified: keystroke/trunk/cliplist.py
===================================================================
--- keystroke/trunk/cliplist.py 2006-11-10 09:13:50 UTC (rev 2545)
+++ keystroke/trunk/cliplist.py 2006-11-14 10:20:46 UTC (rev 2546)
@@ -79,7 +79,10 @@
return None
def get_last_clip(self):
- return self.__data[-1]
+ if len(self.__data)>0:
+ return self.__data[-1]
+ else:
+ return None
def get_at_index(self, index):
return self.__data[index]
Modified: keystroke/trunk/cliplistiter.py
===================================================================
--- keystroke/trunk/cliplistiter.py 2006-11-10 09:13:50 UTC (rev 2545)
+++ keystroke/trunk/cliplistiter.py 2006-11-14 10:20:46 UTC (rev 2546)
@@ -17,4 +17,4 @@
self.__iter = -1
def length(self):
- return self.__cliplist.length()
\ No newline at end of file
+ return self.__data.length()
\ No newline at end of file
Modified: keystroke/trunk/keystroke.py
===================================================================
--- keystroke/trunk/keystroke.py 2006-11-10 09:13:50 UTC (rev 2545)
+++ keystroke/trunk/keystroke.py 2006-11-14 10:20:46 UTC (rev 2546)
@@ -92,8 +92,9 @@
self.current_file = dialog.get_filename()
self.playbin.props.uri = "file://" + self.current_file
self.pipeline.set_state(gst.STATE_PAUSED);
- self.pipeline_duration = 10
+ self.pipeline_duration = 1000
self.push_text()
+ self.mode = self.MODE_TRANSCRIBE
dialog.destroy()
def import_file(self, accel_group, window, keyval, modifier):
@@ -229,30 +230,47 @@
self.textsource.set_cliplist(data["default"])
def enter_activated(self, accel_group, window, keyval, modifier):
- #Handles clip to text buffer, formatting and pipeline control.
+ '''Callback which handles actions upon enter activation.'''
+
+ # Output key.
if self.show_keystrokes: print "Enter"
+
+ # Current time.
current_time = self.pipeline.query_position(gst.FORMAT_TIME)[0]/gst.MSECOND
+
+ # If going from playing to paused.
if (self.pipeline.get_state()[1] == gst.STATE_PLAYING):
+
self.pipeline.set_state(gst.STATE_PAUSED);
- current_time = self.pipeline.query_position(gst.FORMAT_TIME)[0]/gst.MSECOND
+
+ # Update time.
if self.mode==self.MODE_TRANSCRIBE:
self.end_time.set_text(format_time(current_time))
+
+ # Update all fields.
elif self.mode==self.MODE_REVIEW:
current = self.scriptview.current_clip(current_time)
- if current:
+ if current!=-2:
self.scriptview.highlight(current)
- self.start_time.set_text(format_time(current.get_start()))
- self.end_time.set_text(format_time(current.get_end()))
- self.clip_text.set_text(current.get_text())
+ self.start_time.set_text(format_time(current.get_start()))
+ self.end_time.set_text(format_time(current.get_end()))
+ self.clip_text.set_text(current.get_text())
+
+ # Update progress bar.
self.progress.props.text = self.current_file + ": Paused."
- if self.pipeline_duration==10:
+ if self.pipeline_duration==1000:
self.pipeline_duration = self.pipeline.query_duration(gst.FORMAT_TIME)[0]/gst.MSECOND
self.progress.props.fraction = float(current_time)/self.pipeline_duration
- elif self.pipeline.get_state()[1] == gst.STATE_PAUSED:
+
+ # If going from paused to play
+ elif self.pipeline.get_state()[1] == gst.STATE_PAUSED:
+
+ # If transcribing.
if self.mode==self.MODE_TRANSCRIBE:
text = self.clip_text.get_text()
if text[:1] == ")" or (text.find(":")==-1 and text != "") and self.start_time.get_text() != 'xx:xx:xx.xxx':
- self.scriptview.append(clip.clip(self.start_time.get_text(),self.end_time.get_text(),text.strip().strip(")"),"default"))
+ print "Chapter.";
+ self.scriptview.append(clip.clip(to_ms(self.start_time.get_text()),to_ms(self.end_time.get_text()),text.strip().strip(")"),track="default"))
elif text != "" and self.start_time.get_text() != 'xx:xx:xx.xxx':
# If using the last type def make sure doesn't have ';' instead of intended ':'
if text.find(":")==-1 and text.find(";")!=-1:
@@ -269,7 +287,8 @@
speaker = text[:text.find(":")+1]
else:
speaker = None
- self.scriptview.append(clip.clip(to_ms(self.start_time.get_text()),to_ms(self.end_time.get_text()),text.strip().strip(")"),"default",speaker))
+ print "Dialog"
+ self.scriptview.append(clip.clip(to_ms(self.start_time.get_text()),to_ms(self.end_time.get_text()),text[text.find(":")+1:],speaker=speaker))
elif text != "":
self.scriptview.append(clip.clip(to_ms(self.start_time.get_text()),to_ms(self.end_time.get_text()),text.strip()))
self.clip_text.set_text("")
Modified: keystroke/trunk/scriptview.py
===================================================================
--- keystroke/trunk/scriptview.py 2006-11-10 09:13:50 UTC (rev 2545)
+++ keystroke/trunk/scriptview.py 2006-11-14 10:20:46 UTC (rev 2546)
@@ -43,7 +43,7 @@
self.set_buffer(self.__text)
self.__tracks = {"default" : cliplist.cliplist()}
- self.__last_track = "default"
+ self.__last_track = "subtitle-en"
self.__last_speaker = None
self.__current_track = "default"
self.__visible_marks = True
--
scott
More information about the cvs-annodex
mailing list