[xiph-commits] r11692 - trunk/souffleur
daraku at svn.xiph.org
daraku at svn.xiph.org
Mon Jul 3 21:32:51 PDT 2006
Author: daraku
Date: 2006-07-03 21:32:47 -0700 (Mon, 03 Jul 2006)
New Revision: 11692
Modified:
trunk/souffleur/Souffleur.py
trunk/souffleur/Subtitles.py
trunk/souffleur/souffleur.glade
Log:
Subtitle optimize (list object was replaced by map object), sub sink problem solved
Modified: trunk/souffleur/Souffleur.py
===================================================================
--- trunk/souffleur/Souffleur.py 2006-07-03 18:49:27 UTC (rev 11691)
+++ trunk/souffleur/Souffleur.py 2006-07-04 04:32:47 UTC (rev 11692)
@@ -121,9 +121,9 @@
if (self.curSub != -1) and (self.Subtitle != None):
BUF = self.SubEdit.get_buffer()
TEXT = BUF.get_text(BUF.get_start_iter(), BUF.get_end_iter())
- self.Subtitle.subs[int(self.curSub)-1].text = str(TEXT)
- self.Subtitle.subs[int(self.curSub)-1].start_time=self.subStartTime.get_value_as_int()
- self.Subtitle.subs[int(self.curSub)-1].end_time=self.subEndTime.get_value_as_int()
+ self.Subtitle.subs[int(self.curSub)].text = str(TEXT)
+ self.Subtitle.subs[int(self.curSub)].start_time=self.subStartTime.get_value_as_int()
+ self.Subtitle.subs[int(self.curSub)].end_time=self.subEndTime.get_value_as_int()
#==============================================================================
def cb_setSubStartTime(self, widget):
self.subStartTime.set_value(self.p_position/1000000)
@@ -260,11 +260,11 @@
if self.Subtitle:
TText = self.Subtitle.getSub(MSec)
if TText:
- if (TText.N!=self.curSub):
+ if (TText.start_time!=self.curSub):
BUF=gtk.TextBuffer()
BUF.set_text(TText.text)
self.SubEdit.set_buffer(BUF)
- self.curSub=TText.N
+ self.curSub=int(TText.start_time)
self.setSubStartTime(TText.start_time)
self.setSubEndTime(TText.end_time)
else:
Modified: trunk/souffleur/Subtitles.py
===================================================================
--- trunk/souffleur/Subtitles.py 2006-07-03 18:49:27 UTC (rev 11691)
+++ trunk/souffleur/Subtitles.py 2006-07-04 04:32:47 UTC (rev 11692)
@@ -12,7 +12,8 @@
self.start_time=None
self.end_time=None
self.subType=SUB_NONE
- self.N=0
+ #self.N=0
+ self.Attributes=None
def isInTime(self, time):
if( (time>=self.start_time) and (time<=self.end_time) ):
@@ -23,9 +24,10 @@
class Subtitles:
def __init__(self):
- self.subs=[]
+ self.subs={}
self.subSource=None
self.subType=SUB_SRT
+ self.subKeys=[]
def subLoad(self, fileName):
FILE=os.open(fileName, os.O_RDONLY)
@@ -71,15 +73,20 @@
TS.start_time=ST
TS.end_time=ET
TS.subType=self.subType
- TS.N=N
- self.subs.append(TS)
+ #TS.N=N
+ self.subs[int(ST)]=TS
+ self.updateKeys()
+
+ def updateKeys(self):
+ self.subKeys=self.subs.keys()
+ self.subKeys.sort()
def getSub(self, time):
i=0
- while(time>=self.subs[i].start_time):
- if(self.subs[i].isInTime(time)==1):
- return self.subs[i]
- i=i+1
- if(i>=len(self.subs)):
+ for i in self.subKeys:
+ if(time>=i):
+ if(self.subs[i].isInTime(time)==1):
+ return self.subs[i]
+ else:
return None
return None
Modified: trunk/souffleur/souffleur.glade
===================================================================
--- trunk/souffleur/souffleur.glade 2006-07-03 18:49:27 UTC (rev 11691)
+++ trunk/souffleur/souffleur.glade 2006-07-04 04:32:47 UTC (rev 11692)
@@ -772,7 +772,7 @@
<property name="update_policy">GTK_UPDATE_ALWAYS</property>
<property name="snap_to_ticks">False</property>
<property name="wrap">False</property>
- <property name="adjustment">1 0 3600000000 1 10 10</property>
+ <property name="adjustment">0 0 3600000000 1 10 10</property>
</widget>
<packing>
<property name="padding">0</property>
@@ -816,7 +816,7 @@
<property name="update_policy">GTK_UPDATE_ALWAYS</property>
<property name="snap_to_ticks">False</property>
<property name="wrap">False</property>
- <property name="adjustment">1 0 3600000000 1 10 10</property>
+ <property name="adjustment">0 0 3600000000 1 10 10</property>
</widget>
<packing>
<property name="padding">0</property>
More information about the commits
mailing list