Added settings window

Added support for VLC as player
Added support for comboboxes in the interfaces
Fixed a bug in the names of the NTSC resolutions
This commit is contained in:
Sergio Costas 2014-07-27 23:52:14 +02:00
parent cba0352d33
commit c7963d8394
14 changed files with 862 additions and 293 deletions

View file

@ -141,6 +141,49 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="left_padding">12</property>
<child>
<object class="GtkBox" id="box20">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox" id="box21">
<property name="visible">True</property>
<property name="can_focus">False</property>
<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">Path:</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="file_name">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="xalign">0</property>
<property name="ellipsize">middle</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkGrid" id="grid1">
<property name="visible">True</property>
@ -156,7 +199,7 @@
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
@ -169,7 +212,7 @@
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
@ -183,7 +226,7 @@
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
@ -196,7 +239,7 @@
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">2</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
@ -211,7 +254,7 @@
</object>
<packing>
<property name="left_attach">4</property>
<property name="top_attach">1</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
@ -226,7 +269,7 @@
</object>
<packing>
<property name="left_attach">4</property>
<property name="top_attach">2</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
@ -239,7 +282,7 @@
</object>
<packing>
<property name="left_attach">5</property>
<property name="top_attach">1</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
@ -252,40 +295,11 @@
</object>
<packing>
<property name="left_attach">5</property>
<property name="top_attach">2</property>
<property name="top_attach">1</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">Path:</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="file_name">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="xalign">0</property>
<property name="ellipsize">middle</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
<property name="width">5</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="original_audiorate">
<property name="visible">True</property>
@ -295,7 +309,7 @@
</object>
<packing>
<property name="left_attach">3</property>
<property name="top_attach">2</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
@ -308,7 +322,7 @@
</object>
<packing>
<property name="left_attach">3</property>
<property name="top_attach">1</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
@ -323,7 +337,7 @@
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">2</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
@ -332,19 +346,25 @@
<object class="GtkLabel" id="label5">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">baseline</property>
<property name="margin_left">8</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Original video rate (Kbits/sec):</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">1</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</child>
@ -1025,7 +1045,7 @@
</packing>
</child>
<child>
<object class="GtkRadioButton" id="size_720x480">
<object class="GtkRadioButton" id="size_720x480_ntsc">
<property name="label" translatable="yes">720x480</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
@ -1042,7 +1062,7 @@
</packing>
</child>
<child>
<object class="GtkRadioButton" id="size_704x480">
<object class="GtkRadioButton" id="size_704x480_ntsc">
<property name="label" translatable="yes">704x480</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
@ -1059,7 +1079,7 @@
</packing>
</child>
<child>
<object class="GtkRadioButton" id="size_480x480">
<object class="GtkRadioButton" id="size_480x480_ntsc">
<property name="label" translatable="yes">480x480</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
@ -1076,7 +1096,7 @@
</packing>
</child>
<child>
<object class="GtkRadioButton" id="size_352x480">
<object class="GtkRadioButton" id="size_352x480_ntsc">
<property name="label" translatable="yes">352x480</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
@ -1093,7 +1113,7 @@
</packing>
</child>
<child>
<object class="GtkRadioButton" id="size_352x240">
<object class="GtkRadioButton" id="size_352x240_ntsc">
<property name="label" translatable="yes">352x240</property>
<property name="visible">True</property>
<property name="can_focus">True</property>

View file

@ -129,53 +129,19 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkImageMenuItem" id="imagemenuitem6">
<property name="label">gtk-cut</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
</object>
</child>
<child>
<object class="GtkImageMenuItem" id="imagemenuitem7">
<property name="label">gtk-copy</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
</object>
</child>
<child>
<object class="GtkImageMenuItem" id="imagemenuitem8">
<property name="label">gtk-paste</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
</object>
</child>
<child>
<object class="GtkImageMenuItem" id="imagemenuitem9">
<property name="label">gtk-delete</property>
<object class="GtkImageMenuItem" id="settings">
<property name="label">gtk-preferences</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
<signal name="activate" handler="on_settings_activate" swapped="no"/>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkMenuItem" id="menuitem3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">_Ver</property>
<property name="use_underline">True</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="menuitem4">
<property name="visible">True</property>

379
data/interface/wsettings.ui Normal file
View file

@ -0,0 +1,379 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.16.1 -->
<interface>
<requires lib="gtk+" version="3.10"/>
<object class="GtkListStore" id="analizer_store">
<columns>
<!-- column-name gchararray3 -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkListStore" id="converter_store">
<columns>
<!-- column-name backend -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkListStore" id="menuer_store">
<columns>
<!-- column-name gchararray2 -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkListStore" id="multicore_store">
<columns>
<!-- column-name gchararray5 -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkListStore" id="player_store">
<columns>
<!-- column-name gchararray4 -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkDialog" id="settings">
<property name="can_focus">False</property>
<property name="resizable">False</property>
<property name="modal">True</property>
<property name="window_position">center</property>
<property name="type_hint">dialog</property>
<property name="has_resize_grip">False</property>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="dialog-action_area1">
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="button1">
<property name="label">gtk-cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="button2">
<property name="label">gtk-ok</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkFrame" id="frame1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="left_padding">12</property>
<child>
<object class="GtkComboBox" id="multicore">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="model">multicore_store</property>
<child>
<object class="GtkCellRendererText" id="cellrenderertext5"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">&lt;b&gt;Multicore CPUs&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkFrame" id="frame2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkAlignment" id="alignment2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="left_padding">12</property>
<child>
<object class="GtkBox" id="box2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Temporary files folder:</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">2</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkFileChooserButton" id="tempo_path">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="action">select-folder</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">&lt;b&gt;Folders&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkFrame" id="frame3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkAlignment" id="alignment3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="left_padding">12</property>
<child>
<object class="GtkGrid" id="grid1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkLabel" id="label5">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_right">4</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">Play preview:</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label6">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_right">4</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">Get video info:</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label7">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_right">4</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">Convert menus:</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="label8">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_right">4</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">Convert videos:</property>
<property name="ellipsize">end</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="player">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="model">player_store</property>
<property name="active">0</property>
<property name="id_column">0</property>
<child>
<object class="GtkCellRendererText" id="cellrenderertext4"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="analizer">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="model">analizer_store</property>
<child>
<object class="GtkCellRendererText" id="cellrenderertext3"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="menuer">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="model">menuer_store</property>
<child>
<object class="GtkCellRendererText" id="cellrenderertext2"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</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="GtkComboBox" id="converter">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="model">converter_store</property>
<child>
<object class="GtkCellRendererText" id="cellrenderertext1"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">3</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="label4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">&lt;b&gt;Backends&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
<action-widgets>
<action-widget response="0">button1</action-widget>
<action-widget response="1">button2</action-widget>
</action-widgets>
</object>
</interface>

View file

@ -33,10 +33,16 @@ class configuration(GObject.GObject):
configuration.current_configuration = None
return configuration.current_configuration
def __init__(self):
GObject.GObject.__init__(self)
def fill_config(self):
GObject.GObject.__init__(self)
self.cores = 0
proc_file = open("/proc/cpuinfo","r")
for line in proc_file:
if (line.startswith("processor")):
self.cores += 1
is_local = None
self.log = ""
@ -78,7 +84,7 @@ class configuration(GObject.GObject):
self.PAL = True
self.tmp_folder = "/var/tmp"
self.multicore = True
self.multicore = self.cores
self.final_folder = os.environ.get("HOME")
self.sub_language = None
self.sub_codepage = None
@ -89,7 +95,6 @@ class configuration(GObject.GObject):
self.subtitles_font_size = 28
self.sub_language = None
self.sub_codepage = None
self.menu_dynamic_preview = False
config_path = os.path.join(os.environ.get("HOME"),".devede")
try:
@ -135,11 +140,6 @@ class configuration(GObject.GObject):
continue
if linea[:19]=="subtitle_font_size:":
self.subtitles_font_size = int(linea[19:].strip())
if linea[:21]=="menu_dynamic_preview:":
if linea[21] == '0':
self.menu_dynamic_preview = False
else:
self.menu_dynamic_preview = True
config_data.close()
except:
pass
@ -163,7 +163,7 @@ class configuration(GObject.GObject):
config_data.write("ntsc\n")
if (self.tmp_folder != None):
config_data.write("temp_folder:"+str(self.tmp_folder)+"\n")
config_data.write("multicore:"+str(self.multicore))
config_data.write("multicore:"+str(self.multicore)+"\n")
if (self.final_folder != None):
config_data.write("final_folder:"+str(self.final_folder)+"\n")
if (self.sub_language != None):
@ -182,11 +182,6 @@ class configuration(GObject.GObject):
config_data.write("sub_codepage:"+str(self.sub_codepage)+"\n")
if (self.sub_language != None):
config_data.write("sub_language:"+str(self.sub_language)+"\n")
config_data.write("menu_dynamic_preview:")
if (self.menu_dynamic_preview):
config_data.write("1\n")
else:
config_data.write("0\n")
config_data.write("subtitle_font_size:"+str(self.subtitles_font_size)+"\n")
config_data.close()
except:

View file

@ -18,6 +18,7 @@
import devede.configuration_data
import devede.mplayer_detector
import devede.avconv_converter
import devede.vlc
class converter:
@ -26,7 +27,7 @@ class converter:
@staticmethod
def get_converter():
if converter.current_converter == None:
converter.current_converter = converter.converter()
converter.current_converter = converter()
return converter.current_converter
@ -34,7 +35,7 @@ class converter:
self.config = devede.configuration_data.configuration.get_config()
# List of classes with conversion capabilities, in order of preference
self.c = [devede.mplayer_detector.mplayer_detector, devede.avconv_converter.avconv_converter]
self.c = [devede.vlc.vlc_player, devede.mplayer_detector.mplayer_detector, devede.avconv_converter.avconv_converter]
self.analizers = {}
self.default_analizer = None
@ -70,6 +71,23 @@ class converter:
if (self.default_menuer == None):
self.default_menuer = element
def get_available_programs(self):
players = []
menuers = []
converters = []
analizers = []
for e in self.analizers:
analizers.append(e)
for e in self.players:
players.append(e)
for e in self.menuers:
menuers.append(e)
for e in self.converters:
converters.append(e)
return (analizers, players, menuers, converters)
def get_needed_programs(self):
""" returns a tupla with four lists. When a list is NONE, there are installed in the system
@ -112,15 +130,15 @@ class converter:
def get_film_player(self):
""" returns a class for the desired film player, or the most priviledged if the desired is not installed """
if (self.config.film_player == None) or (self.players.has_key(self.config.film_player) == False):
if (self.config.film_player == None) or (self.config.film_player not in self.players):
return self.default_player
else:
return self.players[self.config.film_analizer]
return self.players[self.config.film_player]
def get_film_analizer(self):
""" returns a class for the desired film analizer, or the most priviledged if the desired is not installed """
if (self.config.film_analizer == None) or (self.analizers.has_key(self.config.film_analizer) == False):
if (self.config.film_analizer == None) or (self.config.film_analizer not in self.analizers):
return self.default_analizer
else:
return self.analizers[self.config.film_analizer]
@ -128,7 +146,7 @@ class converter:
def get_menu_converter(self):
""" returns a class for the desired menu converter, or the most priviledged if the desired is not installed """
if (self.config.menu_converter == None) or (self.analizers.has_key(self.config.menu_converter) == False):
if (self.config.menu_converter == None) or (self.config.menu_converter not in self.analizers):
return self.default_menuer
else:
return self.menuers[self.config.menu_converter]
@ -136,7 +154,7 @@ class converter:
def get_disc_converter(self):
""" returns a class for the desired disc converter, or the most priviledged if the desired is not installed """
if (self.config.film_converter == None) or (self.analizers.has_key(self.config.film_converter) == False):
if (self.config.film_converter == None) or (self.config.film_converter not in self.analizers):
return self.default_converter
else:
return self.converters[self.config.film_converter]

View file

@ -70,7 +70,7 @@ class dvd_menu(devede.interface_manager.interface_manager):
def update_music(self,b=None):
self.store_ui(self.builder)
cv = devede.converter.converter()
cv = devede.converter.converter.get_converter()
film_analizer = (cv.get_film_analizer())()
(video, audio, length) = film_analizer.analize_film_data(self.background_music,True)
if (video != 0):
@ -515,7 +515,7 @@ class dvd_menu(devede.interface_manager.interface_manager):
self.file_list = file_list
self.refresh_static_data()
cv = devede.converter.converter()
cv = devede.converter.converter.get_converter()
menu_folder = os.path.join(base_path,"menu")
try:
os.makedirs(menu_folder)

View file

@ -113,7 +113,7 @@ class file_movie(devede.interface_manager.interface_manager):
self.add_enable_disable("is_mpeg_ps", [], is_mpeg_ps_list)
self.add_enable_disable("no_reencode_audio_video", [], no_reencode_audio_video_list)
cv = devede.converter.converter()
cv = devede.converter.converter.get_converter()
film_analizer = (cv.get_film_analizer())()
if (film_analizer.get_film_data(self.file_name)):
self.error = True
@ -435,7 +435,7 @@ class file_movie(devede.interface_manager.interface_manager):
def do_conversion(self, output_path, duration = 0):
self.set_final_size_aspect()
cv = devede.converter.converter()
cv = devede.converter.converter.get_converter()
disc_converter = cv.get_disc_converter()
converter = disc_converter()
converter.convert_file(self,output_path,duration)
@ -459,6 +459,6 @@ class file_movie(devede.interface_manager.interface_manager):
def preview_done(self,o,retval):
if (retval == 0):
cv = devede.converter.converter()
cv = devede.converter.converter.get_converter()
disc_player = (cv.get_film_player())()
disc_player.play_film(os.path.join(self.config.tmp_folder,"movie_preview.mpg"))

View file

@ -37,6 +37,7 @@ class interface_manager(GObject.GObject):
self.interface_colorbuttons = []
self.interface_fontbuttons = []
self.interface_filebuttons = []
self.interface_comboboxes = []
def add_group(self,group_name,radiobutton_list,default_value,callback = None):
""" Adds a group of radiobuttons and creates an internal variable with
@ -102,7 +103,7 @@ class interface_manager(GObject.GObject):
self.interface_lists.append( (liststore_name, callback ))
def add_colorbutton(self,colorbutton_name, default_value,callback = None):
""" Adds an internal variable with the name text_name, linked to an
""" Adds an internal variable with the name colorbutton_name, linked to an
element with the same name (must be a Gtk.ColorButton).
The default value must be a set with RGBA values """
@ -110,7 +111,7 @@ class interface_manager(GObject.GObject):
self.interface_colorbuttons.append( (colorbutton_name, callback ))
def add_fontbutton(self,fontbutton_name, default_value, callback = None):
""" Adds an internal variable with the name text_name, linked to an
""" Adds an internal variable with the name fontbutton_name, linked to an
element with the same name (must be a Gtk.FontButton).
The default value must be a string with the font values """
@ -118,13 +119,21 @@ class interface_manager(GObject.GObject):
self.interface_fontbuttons.append( (fontbutton_name, callback ))
def add_filebutton(self,filebutton_name, default_value, callback = None):
""" Adds an internal variable with the name text_name, linked to an
""" Adds an internal variable with the name filebutton_name, linked to an
element with the same name (must be a Gtk.FileButton).
The default value must be a string with the font values """
exec('self.'+filebutton_name+' = default_value')
self.interface_filebuttons.append( (filebutton_name, callback ) )
def add_combobox(self,combobox_name,values,default_value,callback = None):
""" Adds an internal variable with the name combobox_name, linked to an
element with the same name (must be a Gtk.Combobox).
The default value must be an integer with the entry selected """
exec('self.'+combobox_name+' = default_value')
self.interface_comboboxes.append ( (combobox_name, values, callback) )
def add_show_hide(self,element_name,to_show,to_hide):
""" Adds an element that can be active or inactive, and two lists of elements.
The first one contains elements that will be visible when the element is
@ -238,6 +247,23 @@ class interface_manager(GObject.GObject):
if (callback != None):
obj.connect("file_set",callback)
for element in self.interface_comboboxes:
obj = eval('self.'+element[0])
the_combo = builder.get_object(element[0])
the_list = the_combo.get_model()
the_list.clear()
counter = 0
dv = 0
for item in element[1]:
the_list.append([item])
if (item == obj):
dv = counter
counter += 1
the_combo.set_active(dv)
callback = element[2]
if (callback != None):
the_liststore.connect("changed",callback)
self.interface_show_hide_obj = {}
for element in self.interface_show_hide:
obj = builder.get_object(element[0])
@ -257,9 +283,13 @@ class interface_manager(GObject.GObject):
to_enable = []
for e2 in element[1]:
to_enable.append(builder.get_object(e2))
if (builder.get_object(e2) == None):
print("Error en "+str(e2))
to_disable = []
for e3 in element[2]:
to_disable.append(builder.get_object(e3))
if (builder.get_object(e3) == None):
print("Error en "+str(e3))
self.interface_enable_disable_obj[obj] = [to_enable, to_disable]
obj.connect('toggled',self.toggled_element2)
self.toggled_element2(obj)
@ -385,6 +415,11 @@ class interface_manager(GObject.GObject):
print (final_row)
exec('self.'+element[0]+'.append(final_row)')
for element in self.interface_comboboxes:
obj = builder.get_object(element[0])
exec('self.'+element[0]+' = element[1][obj.get_active()]')
def save_ui(self):
""" Makes a copy of all the UI variables """
@ -406,6 +441,8 @@ class interface_manager(GObject.GObject):
exec('self.'+element[0]+'_backup = self.'+element[0])
for element in self.interface_lists:
exec('self.'+element[0]+'_backup = self.'+element[0])
for element in self.interface_comboboxes:
exec('self.'+element[0]+'_backup = self.'+element[0])
def restore_ui(self):
""" Restores a copy of all the UI variables """
@ -428,3 +465,5 @@ class interface_manager(GObject.GObject):
exec('self.'+element[0]+' = self.'+element[0]+'_backup')
for element in self.interface_lists:
exec('self.'+element[0]+' = self.'+element[0]+'_backup')
for element in self.interface_comboboxes:
exec('self.'+element[0]+' = self.'+element[0]+'_backup')

View file

@ -25,6 +25,7 @@ import devede.message
import devede.dvd_menu
import devede.create_disk_window
import devede.runner
import devede.settings
class devede_project:
@ -289,3 +290,7 @@ class devede_project:
if (element == None):
return
element.do_preview()
def on_settings_activate(self,b):
w = devede.settings.settings_window()

View file

@ -29,14 +29,14 @@ class runner(GObject.GObject):
GObject.GObject.__init__(self)
self.config = devede.configuration_data.configuration.get_config()
max_cores = self.count_cores()
if (self.config.multicore > 0):
if max_cores < self.config.multicore:
self.cores = max_cores
if self.config.cores < self.config.multicore:
self.cores = self.config.cores
else:
self.cores = self.config.multicore
else:
self.cores = max_cores - self.config.multicore
self.cores = self.config.cores - self.config.multicore
if (self.cores <= 0):
self.cores = 1
@ -84,15 +84,6 @@ class runner(GObject.GObject):
def on_cancel_clicked(self,b):
pass
def count_cores(self):
cores = 0
proc_file = open("/proc/cpuinfo","r")
for line in proc_file:
if (line.startswith("processor")):
cores += 1
return cores
def run(self, clear_log = True):
if clear_log:

100
src/devede/settings.py Normal file
View file

@ -0,0 +1,100 @@
# Copyright 2014 (C) Raster Software Vigo (Sergio Costas)
#
# This file is part of DeVeDe-NG
#
# DeVeDe-NG is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# DeVeDe-NG is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>
from gi.repository import Gtk
import os
import devede.configuration_data
import devede.interface_manager
import gettext
import devede.converter
class settings_window(devede.interface_manager.interface_manager):
def __init__(self):
devede.interface_manager.interface_manager.__init__(self)
self.config = devede.configuration_data.configuration.get_config()
if (self.config.multicore > 0):
if self.config.cores < self.config.multicore:
cores = self.config.cores
else:
cores = self.config.multicore
else:
if self.config.cores <= -self.config.multicore:
cores = -self.config.cores+1
else:
cores = self.config.multicore
self.core_elements = {}
list_core_elements = []
default_value = _("Use all cores")
counter = 1
for c in range(self.config.cores-1,-self.config.cores, -1):
if c > 0:
translated_string = gettext.ngettext("Use %(X)d core","Use %(X)d cores",c) % {"X":c}
value = c
if c == cores:
default_value = translated_string
counter += 1
elif c < 0:
translated_string = gettext.ngettext("Use all except %(X)d core","Use all except %(X)d cores", -c) % {"X": -c}
value = c
if c == cores:
default_value = translated_string
counter += 1
else:
translated_string = _("Use all cores")
value = c
self.core_elements[translated_string] = value
list_core_elements.append(translated_string)
self.add_combobox("multicore",list_core_elements,default_value)
self.add_filebutton("tempo_path", self.config.tmp_folder)
c = devede.converter.converter.get_converter()
(analizers, players, menuers, converters) = c.get_available_programs()
self.add_combobox("analizer", analizers,self.config.film_analizer)
self.add_combobox("player", players,self.config.film_player)
self.add_combobox("converter", converters,self.config.film_converter)
self.add_combobox("menuer", menuers,self.config.menu_converter)
builder = Gtk.Builder()
builder.set_translation_domain(self.config.gettext_domain)
builder.add_from_file(os.path.join(self.config.glade,"wsettings.ui"))
builder.connect_signals(self)
wsettings_window = builder.get_object("settings")
wsettings_window.show_all()
self.update_ui(builder)
retval = wsettings_window.run()
self.store_ui(builder)
wsettings_window.destroy()
if retval == 1:
self.config.multicore = self.core_elements[self.multicore]
self.config.tmp_folder = self.tempo_path
self.config.film_analizer = self.analizer
self.config.film_player = self.player
self.config.film_converter = self.converter
self.config.menu_converter = self.menuer
self.config.save_config()

56
src/devede/vlc.py Normal file
View file

@ -0,0 +1,56 @@
# Copyright 2014 (C) Raster Software Vigo (Sergio Costas)
#
# This file is part of DeVeDe-NG
#
# DeVeDe-NG is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# DeVeDe-NG is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>
import subprocess
import devede.configuration_data
import devede.executor
class vlc_player(devede.executor.executor):
supports_analize = False
supports_play = True
supports_convert = False
supports_menu = False
display_name = "VLC"
@staticmethod
def check_is_installed():
try:
handle = subprocess.Popen(["vlc","-h"], stdout = subprocess.PIPE, stderr = subprocess.PIPE)
(stdout, stderr) = handle.communicate()
if 0==handle.wait():
return True
else:
return False
except:
return False
def __init__(self):
devede.executor.executor.__init__(self)
self.config = devede.configuration_data.configuration.get_config()
def play_film(self,file_name):
command_line = ["vlc", file_name]
self.launch_process(command_line)
def process_stdout(self,data):
return
def process_stderr(self,data):
return