From d4ed74ae5f5d6873c5707731a79342dd425ea407 Mon Sep 17 00:00:00 2001 From: Sergio Costas Date: Sun, 13 Jul 2014 20:50:02 +0200 Subject: [PATCH] Added support for reading the base config --- data/interface/wfile_properties.ui | 184 +++++++++-------------------- data/interface/wmain.ui | 2 + src/devede/configuration_data.py | 67 +++++++++++ src/devede/file_movie.py | 35 +++++- src/devede/project.py | 8 ++ src/devede_ng.py | 1 + 6 files changed, 164 insertions(+), 133 deletions(-) diff --git a/data/interface/wfile_properties.ui b/data/interface/wfile_properties.ui index 847230f..9b1dfac 100644 --- a/data/interface/wfile_properties.ui +++ b/data/interface/wfile_properties.ui @@ -265,47 +265,6 @@ 1 - - - True - False - 0 - Original aspect ratio: - - - 0 - 2 - 1 - 1 - - - - - True - False - 0 - - - 1 - 2 - 1 - 1 - - - - - True - False - 0 - Frames per second: - - - 2 - 2 - 1 - 1 - - True @@ -333,79 +292,53 @@ 1 + + + True + False + 0 + Original aspect ratio: + + + 4 + 0 + 1 + 1 + + + + + True + False + 0 + Frames per second: + + + 4 + 1 + 1 + 1 + + + + + True + False + 0 + + + 5 + 0 + 1 + 1 + + True False 0 - - 3 - 2 - 1 - 1 - - - - - True - False - 0 - Final size (pixels): - - - 4 - 0 - 1 - 1 - - - - - True - False - 0 - Estimated final length (MBytes): - - - 4 - 1 - 1 - 1 - - - - - True - False - 0 - - - 4 - 2 - 1 - 1 - - - - - True - False - 0 - - - 5 - 0 - 1 - 1 - - - - - True - False - 0 - 5 1 @@ -413,19 +346,6 @@ 1 - - - True - False - 0 - - - 5 - 2 - 1 - 1 - - @@ -1099,16 +1019,9 @@ - - 160x128 + True - True - False - 0 - 0.52999997138977051 - True - True - size_auto + False 2 @@ -2111,6 +2024,17 @@ + + 160x120 + True + True + False + 0 + 0.52999997138977051 + True + True + size_auto + diff --git a/data/interface/wmain.ui b/data/interface/wmain.ui index 50c7f66..7c829bd 100644 --- a/data/interface/wmain.ui +++ b/data/interface/wmain.ui @@ -556,6 +556,7 @@ True True use_ntsc + False @@ -572,6 +573,7 @@ False 0 True + False diff --git a/src/devede/configuration_data.py b/src/devede/configuration_data.py index 7189d5f..16ce94b 100644 --- a/src/devede/configuration_data.py +++ b/src/devede/configuration_data.py @@ -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 diff --git a/src/devede/file_movie.py b/src/devede/file_movie.py index 9b347cd..1e6ad94 100644 --- a/src/devede/file_movie.py +++ b/src/devede/file_movie.py @@ -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) diff --git a/src/devede/project.py b/src/devede/project.py index c076bf0..74c330e 100644 --- a/src/devede/project.py +++ b/src/devede/project.py @@ -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) diff --git a/src/devede_ng.py b/src/devede_ng.py index 1ddf056..1d976b7 100755 --- a/src/devede_ng.py +++ b/src/devede_ng.py @@ -46,3 +46,4 @@ Gtk.init(sys.argv) mwindow = devede.project.devede_project(config_data) mwindow.ask_type() Gtk.main() +config_data.save_config()