Added support for reading the base config
This commit is contained in:
parent
ae172c785f
commit
d4ed74ae5f
6 changed files with 164 additions and 133 deletions
|
|
@ -265,47 +265,6 @@
|
|||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label9">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Original aspect ratio:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label_aspect_ratio">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label11">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Frames per second:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label_original_videorate">
|
||||
<property name="visible">True</property>
|
||||
|
|
@ -333,79 +292,53 @@
|
|||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label9">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Original aspect ratio:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">4</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label11">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Frames per second:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">4</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label_aspect_ratio">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">5</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label_fps">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">3</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label15">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Final size (pixels):</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">4</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label16">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Estimated final length (MBytes):</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">4</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label17">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">4</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label_final_size">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">5</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label_final_length">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">5</property>
|
||||
<property name="top_attach">1</property>
|
||||
|
|
@ -413,19 +346,6 @@
|
|||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label20">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">5</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
|
@ -1099,16 +1019,9 @@
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRadioButton" id="size_160x128">
|
||||
<property name="label" translatable="yes">160x128</property>
|
||||
<object class="GtkLabel" id="label39">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0.52999997138977051</property>
|
||||
<property name="active">True</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<property name="group">size_auto</property>
|
||||
<property name="can_focus">False</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
|
|
@ -2111,6 +2024,17 @@
|
|||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkRadioButton" id="size_176x120">
|
||||
<property name="label" translatable="yes">160x120</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0.52999997138977051</property>
|
||||
<property name="active">True</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<property name="group">size_auto</property>
|
||||
</object>
|
||||
<object class="GtkSizeGroup" id="sizegroup1">
|
||||
<widgets>
|
||||
<widget name="notebook1"/>
|
||||
|
|
|
|||
|
|
@ -556,6 +556,7 @@
|
|||
<property name="active">True</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<property name="group">use_ntsc</property>
|
||||
<signal name="toggled" handler="on_use_pal_toggled" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
|
|
@ -572,6 +573,7 @@
|
|||
<property name="receives_default">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="on_use_pal_toggled" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
|
|
|
|||
|
|
@ -59,3 +59,70 @@ class configuration:
|
|||
self.help_path="/usr/share/doc/devede_ng"
|
||||
|
||||
self.gettext_domain = "devede_ng"
|
||||
|
||||
self.PAL = True
|
||||
self.tmp_folder = "/var/tmp"
|
||||
self.multicore = True
|
||||
self.final_folder = None
|
||||
self.sub_language = None
|
||||
self.sub_codepage = None
|
||||
|
||||
config_path = os.path.join(os.environ.get("HOME"),".devede")
|
||||
try:
|
||||
config_data = open(config_path,"r")
|
||||
for linea in config_data:
|
||||
linea = linea.strip()
|
||||
if linea == "":
|
||||
continue
|
||||
if linea[0] == "#":
|
||||
continue
|
||||
if linea[:13]=="video_format:":
|
||||
if linea[13:].strip() =="pal":
|
||||
self.PAL=True
|
||||
continue
|
||||
if linea[13:].strip()=="ntsc":
|
||||
self.PAL=False
|
||||
continue
|
||||
if linea[:12]=="temp_folder:":
|
||||
self.tmp_folder=linea[12:].strip()
|
||||
if linea[:10]=="multicore:":
|
||||
if linea[10:].strip()=="1":
|
||||
self.multicore = False
|
||||
else:
|
||||
self.multicore = True
|
||||
if linea[:13]=="final_folder:":
|
||||
self.final_folder=linea[13:].strip()
|
||||
if linea[:13]=="sub_language:":
|
||||
self.sub_language=linea[13:].strip()
|
||||
if linea[:13]=="sub_codepage:":
|
||||
self.sub_codepage=linea[13:].strip()
|
||||
config_data.close()
|
||||
except:
|
||||
pass
|
||||
|
||||
def save_config(self):
|
||||
|
||||
config_path = os.path.join(os.environ.get("HOME"),".devede")
|
||||
try:
|
||||
config_data = open(config_path,"w")
|
||||
config_data.write("video_format:")
|
||||
if (self.PAL):
|
||||
config_data.write("pal\n")
|
||||
else:
|
||||
config_data.write("ntsc\n")
|
||||
if (self.tmp_folder != None):
|
||||
config_data.write("temp_folder:"+str(self.tmp_folder)+"\n")
|
||||
config_data.write("multicore:")
|
||||
if (self.multicore):
|
||||
config_data.write("2\n")
|
||||
else:
|
||||
config_data.write("1\n")
|
||||
if (self.final_folder != None):
|
||||
config_data.write("final_folder:"+str(self.final_folder)+"\n")
|
||||
if (self.sub_language != None):
|
||||
config_data.write("sub_language:"+str(self.sub_language)+"\n")
|
||||
if (self.sub_codepage != None):
|
||||
config_data.write("sub_codepage:"+str(self.sub_codepage)+"\n")
|
||||
config_data.close()
|
||||
except:
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -32,12 +32,42 @@ class file_movie(GObject.GObject):
|
|||
self.model = None
|
||||
self.treeiter = None
|
||||
self.builder = None
|
||||
|
||||
self.video_rate = 0
|
||||
self.audio_rate = 0
|
||||
self.final_size = None
|
||||
self.aspect_ratio = None
|
||||
|
||||
def set_type(self,disc_type = None):
|
||||
|
||||
if (disc_type != None):
|
||||
self.disc_type = disc_type
|
||||
|
||||
if (disc_type == "dvd"):
|
||||
self.video_rate = 5000
|
||||
self.audio_rate = 224
|
||||
self.final_size = "size_auto"
|
||||
self.aspect_ratio = "aspect_auto"
|
||||
elif (disc_type == "vcd"):
|
||||
self.video_rate = 1152
|
||||
self.audio_rate = 224
|
||||
self.final_size = "size_352x288"
|
||||
self.aspect_ratio = "aspect_classic"
|
||||
elif (disc_type == "svcd"):
|
||||
self.video_rate = 2000
|
||||
self.audio_rate = 224
|
||||
self.final_size = "size_480x576"
|
||||
self.aspect_ratio = "aspect_classic"
|
||||
elif (disc_type == "cvd"):
|
||||
self.video_rate = 2000
|
||||
self.audio_rate = 224
|
||||
self.final_size = "size_352x576"
|
||||
self.aspect_ratio = "aspect_classic"
|
||||
elif (disc_type == "divx"):
|
||||
self.video_rate = 5000
|
||||
self.audio_rate = 224
|
||||
self.final_size = "size_auto"
|
||||
self.aspect_ratio = "aspect_auto"
|
||||
|
||||
|
||||
def delete_file(self):
|
||||
|
||||
|
|
@ -67,8 +97,7 @@ class file_movie(GObject.GObject):
|
|||
self.wtitle.set_text(self.title_name)
|
||||
|
||||
def on_button_accept_clicked(self,b):
|
||||
|
||||
|
||||
|
||||
self.title_name = self.wtitle.get_text()
|
||||
self.model.set_value(self.treeiter,1,self.title_name)
|
||||
self.on_button_cancel_clicked(None)
|
||||
|
|
|
|||
|
|
@ -193,9 +193,17 @@ class devede_project:
|
|||
selection = self.wfiles.get_selection()
|
||||
selection.mode = Gtk.SelectionMode.SINGLE
|
||||
|
||||
if (self.config.PAL):
|
||||
self.wuse_pal.set_active(True)
|
||||
else:
|
||||
self.wuse_ntsc.set_active(True)
|
||||
self.wmain_window.show_all()
|
||||
self.set_interface_status(None)
|
||||
|
||||
def on_use_pal_toggled(self,b):
|
||||
|
||||
self.config.PAL = self.wuse_pal.get_active()
|
||||
|
||||
def on_wmain_window_delete_event(self,b,e=None):
|
||||
|
||||
ask = devede.ask.ask_window(self.config)
|
||||
|
|
|
|||
|
|
@ -46,3 +46,4 @@ Gtk.init(sys.argv)
|
|||
mwindow = devede.project.devede_project(config_data)
|
||||
mwindow.ask_type()
|
||||
Gtk.main()
|
||||
config_data.save_config()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue