Navigation Menu

Skip to content

Commit

Permalink
Let set subtitles color
Browse files Browse the repository at this point in the history
  • Loading branch information
staaas committed Mar 1, 2013
1 parent 757d20a commit 0d14d49
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 1 deletion.
4 changes: 4 additions & 0 deletions devede_loadsave.py
Expand Up @@ -134,6 +134,10 @@ def load(self,file_name):
element2["turbo1stpass"]=False # for backward compatibility
if False==element2.has_key("subfont_size"):
element2["subfont_size"]=28 # subtitle font size
if False==element2.has_key("sub_fill_color"):
element2["sub_fill_color"]=[65535,65535,65535,65535] # subtitle fill color
if False==element2.has_key("sub_outline_color"):
element2["sub_outline_color"]=[0,0,0,65535] # subtitle outline color
if False==element2.has_key("volume"):
element2["volume"]=100 # default volume (in percentage)
if False==element2.has_key("force_subs"):
Expand Down
24 changes: 23 additions & 1 deletion devede_newfiles.py
Expand Up @@ -350,6 +350,8 @@ def create_default_video_parameters(self,filename):
self.file_properties["isvob"]=False # recompress both audio and video
self.file_properties["swap_fields"]=False # swap fields in interlaced videos
self.file_properties["subfont_size"]=28 # subtitle font size
self.file_properties["sub_fill_color"]=[65535,65535,65535,65535] # subtitle outline color
self.file_properties["sub_outline_color"]=[0,0,0,65535] # subtitle outline color
self.file_properties["sound51"]=False # don't use 5.1 sound
self.file_properties["gop12"]=True # GOP of 12 by default to increase compatibility
self.file_properties["filesize"]=os.stat(filename)[stat.ST_SIZE] # file size
Expand Down Expand Up @@ -732,7 +734,15 @@ def get_widgets(self):

w=self.tree.get_object("subfont_size")
self.file_properties["subfont_size"]=int(w.get_value())


w=self.tree.get_object("sub_fill_color")
color=w.get_color()
self.file_properties["sub_fill_color"]=[color.red,color.green,color.blue,w.get_alpha()]

w=self.tree.get_object("sub_outline_color")
color=w.get_color()
self.file_properties["sub_outline_color"]=[color.red,color.green,color.blue,w.get_alpha()]

w=self.tree.get_object("audiodelay")
self.file_properties["adelay"]=float(w.get_value())

Expand Down Expand Up @@ -1217,6 +1227,18 @@ def set_widgets(self):
w=self.tree.get_object("subfont_size")
w.set_value(self.file_properties["subfont_size"])

w=self.tree.get_object("sub_fill_color")
color=self.file_properties["sub_fill_color"]
gdk_color=gtk.gdk.Color(color[0],color[1],color[2])
w.set_color(gdk_color)
w.set_alpha(color[3])

w=self.tree.get_object("sub_outline_color")
color=self.file_properties["sub_outline_color"]
gdk_color=gtk.gdk.Color(color[0],color[1],color[2])
w.set_color(gdk_color)
w.set_alpha(color[3])

w=self.tree.get_object("swap_fields")
w.set_active(self.file_properties["swap_fields"])

Expand Down
10 changes: 10 additions & 0 deletions devede_subtitles.py
Expand Up @@ -136,6 +136,16 @@ def __init__(self,videofile,filename,filefolder,progresbar,proglabel,disctype,ti

fichero.write('\n\t\tfontsize="'+str(tamanofont)+'.0"')

fill_color = 'rgba(%.0f%%, %.0f%%, %.0f%%, %.0f%%)' % tuple(
float(item)/655.35 for item in videofile["sub_fill_color"]
)
fichero.write('\n\t\tfill-color="%s"' % fill_color)

outline_color = 'rgba(%.0f%%, %.0f%%, %.0f%%, %.0f%%)' % tuple(
float(item)/655.35 for item in videofile["sub_outline_color"]
)
fichero.write('\n\t\toutline-color="%s"' % outline_color)

if (videofile["fps"]==30):
if (videofile["ofps"]==24) and ((disctype=="dvd") or (disctype=="divx")):
fps_out="24000/1001"
Expand Down
71 changes: 71 additions & 0 deletions interface/wfile.ui
Expand Up @@ -885,6 +885,77 @@
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkTable" id="table8">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="n_rows">2</property>
<property name="n_columns">2</property>
<child>
<object class="GtkColorButton" id="sub_fill_color">
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_alpha">True</property>
<property name="color">#ffffffffffff</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label52">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">Fill color: </property>
</object>
<packing>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkColorButton" id="sub_outline_color">
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_alpha">True</property>
<property name="color">#000000000000</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label102">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">Outline color: </property>
<property name="justify">right</property>
</object>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox7">
<property name="visible">True</property>
Expand Down

0 comments on commit 0d14d49

Please sign in to comment.