Bonjour,
Bon je me suis lancé, DivXFixTux (en fait une simple GUI en Python/Glade) est dans les bacs 😃
En image :
Principales options :
- Verification du fichier Video.
- Reparation.
La barre de progression fonctionne quand elle veux, et l'autoscroll dans la zone text n'est pas autoScroll en fait 😃
Mais le script perl de DivxFix fonctionne sans mettre les mains dans le cambouis 😛
Si quelqu'un pouvez améliorer cette GUI, se serai vraiment cool !!
Utilisation et Installation :
1) avoir les dépendances Python + glade installé.es Python + glade installé.
2) On telecharge le Soft :
http://ordiboy.free.fr/open/Linux/DivxFixTux/DivxFixTux_1.10.tar.gz
3) on dezippe l'archive "DivxFixTux_1.10.tar.gz" sur le bureau par exemple.
4) Puis doubleclik sur "DivxFixGui.py" puis choisir lancer dans un terminal.
5) Puis on repare son Divx 😃
Voici le code en lecture directe :
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys,os
import gobject
import time
try:
import pygtk
pygtk.require("2.0")
except:
pass
try:
import gtk
import gtk.glade
except:
sys.exit(1)
file_1="Fichier Video"
fold_1="Selecteur de Fichier"
sortie_console=""
#========================= je declare la class GtkWindow recupere dans fichier glade
class GtkWindow:
def __init__(self):
#J'active le fichier Glade
self.gladefile = "DivxFixGui.glade"
self.wTree = gtk.glade.XML(self.gladefile)
#========================= je declare les attributs recupere de l'interface Graphique
self.reparer = self.wTree.get_widget("button1") # Reparer
self.verifier = self.wTree.get_widget("button2") # Verifier
self.annuler = self.wTree.get_widget("button3") # Annuler
self.selecteurdefichier = self.wTree.get_widget("filechooserbutton1") # Selecteur de fichier
self.saisiedetexte = self.wTree.get_widget("entry1") # Saisie de texte
self.sortiezonedetexte = self.wTree.get_widget("textview1") # Recup de texte
self.progressbar1 = self.wTree.get_widget("progressbar1") # Barre de progression
# Ici on initialise la self.sortiezonedetexte "textview1" ceci n'est pas obligatoire
self.create_text()
#========================= le dictionnaire de connection entre Action et bouton de la GUI
dic = {
"on_window1_destroy" : gtk.main_quit,
"on_button1_clicked" : self.reparer_clicked,
"on_button2_clicked" : self.verifier_clicked,
"on_button3_clicked" : self.annuler_clicked,
"on_filechooserbutton1_selection_changed" : self.selecteurdefichier_clicked,
}
self.wTree.signal_autoconnect(dic)
#================ Action / code et interactions sur l'interface ===========================
#-- Voici la zone self.sortiezonedetexte "textview1" ------------------------
def insert_text(self, buffer):
iter = buffer.get_iter_at_offset(0)
buffer.insert(iter,sortie_console) #1
#2 end_iter = buffer.get_end_iter()
#2 buffer.insert(end_iter, sortie_console)
#2 self.sortiezonedetexte.scroll_to_mark(buffer.get_insert(), 0)
#3 buffer.insert(iter,sortie_console)
#3 mark = buffer.create_mark("end", buffer.get_end_iter(), False)
#3 self.sortiezonedetexte.scroll_to_mark(mark, 0.05, True, 0.0, 1.0)
# Ici on recupere les infos du Buffer "textview1" qu'on redirige vers "insert_text(self, buffer)"
def create_text(self):
view = self.sortiezonedetexte
buffer = view.get_buffer()
self.insert_text(buffer)
#-------------------------------------------------------------------------------
def evolution_barre(self):
print "...Debut..."
for i in [ 0.2, 0.4, 0.6, 0.8, 1]:
time.sleep(0.1)
print i
self.progressbar1.set_fraction(i)
print "...Fin..."
yield True
yield False
def declenche_progressbar(self, widget):
task = self.evolution_barre()
gobject.idle_add(task.next)
def reparer_clicked(self, widget):
global sortie_console
print "..............reparer_clicked..........."
file_1 =self.saisiedetexte.get_text() # Recupere text de entry1
sortie_console = " perl divfix -v -bd "+file_1 #" xterm -e perl divfix -v -bd "+file_1
print sortie_console
#os.system(sortie_console)
sortie_console = os.popen(sortie_console)
sortie_console = sortie_console.read()
self.progressbar1.set_fraction(0)
self.declenche_progressbar(widget)
self.create_text()
def verifier_clicked(self, widget):
print "..............verifier_clicked..........."
global sortie_console
file_1 =self.saisiedetexte.get_text() # Recupere text de entry1
sortie_console = " perl divfix -v "+file_1 #"xterm -e perl divfix -v "+file_1 #
print sortie_console
#os.system(sortie_console)
sortie_console = os.popen(sortie_console)
sortie_console = sortie_console.read()
self.progressbar1.set_fraction(0)
self.declenche_progressbar(widget)
self.create_text()
def annuler_clicked(self, widget):
print "..............annuler_clicked..........."
gtk.main_quit()
def selecteurdefichier_clicked(self, widget):
global fold_1
global file_1
print "..............selecteurdefichier_clicked..........."
fold_1 = self.selecteurdefichier.get_filename() # Recupere le texte de selecteurdefichier
file_1 =self.saisiedetexte.set_text(fold_1) # applique texte de selecteurdefichier dans entry1
#================== Active la GuiWindow
if __name__ == "__main__":
hwg = GtkWindow()
gtk.main()
Code Glade : DivxFixGui.glade
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
<glade-interface>
<widget class="GtkWindow" id="window1">
<property name="visible">True</property>
<property name="title" translatable="yes">- DivxFix 1.10 Tux -</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_CENTER</property>
<property name="modal">False</property>
<property name="default_width">600</property>
<property name="default_height">100</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property>
<property name="urgency_hint">False</property>
<signal name="destroy" handler="on_window1_destroy" last_modification_time="Sun, 03 May 2009 03:13:31 GMT"/>
<child>
<widget class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkHBox" id="hbox2">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkVBox" id="vbox2">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkEntry" id="entry1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char">●</property>
<property name="activates_default">False</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">False</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="label" translatable="yes">Fichier Video</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkFileChooserButton" id="filechooserbutton1">
<property name="visible">True</property>
<property name="title" translatable="yes">Sélectionner un fichier</property>
<property name="action">GTK_FILE_CHOOSER_ACTION_OPEN</property>
<property name="local_only">True</property>
<property name="show_hidden">False</property>
<property name="do_overwrite_confirmation">True</property>
<property name="width_chars">-1</property>
<signal name="selection_changed" handler="on_filechooserbutton1_selection_changed" last_modification_time="Sun, 03 May 2009 01:59:24 GMT"/>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkProgressBar" id="progressbar1">
<property name="visible">True</property>
<property name="orientation">GTK_PROGRESS_LEFT_TO_RIGHT</property>
<property name="fraction">0</property>
<property name="pulse_step">0.10000000149</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkScrolledWindow" id="scrolledwindow1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_ALWAYS</property>
<property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property>
<property name="shadow_type">GTK_SHADOW_IN</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
<widget class="GtkTextView" id="textview1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="overwrite">False</property>
<property name="accepts_tab">True</property>
<property name="justification">GTK_JUSTIFY_LEFT</property>
<property name="wrap_mode">GTK_WRAP_NONE</property>
<property name="cursor_visible">True</property>
<property name="pixels_above_lines">0</property>
<property name="pixels_below_lines">0</property>
<property name="pixels_inside_wrap">0</property>
<property name="left_margin">0</property>
<property name="right_margin">0</property>
<property name="indent">0</property>
<property name="text" translatable="yes"></property>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="hbox1">
<property name="visible">True</property>
<property name="homogeneous">True</property>
<property name="spacing">0</property>
<child>
<widget class="GtkButton" id="button1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">reparer</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="on_button1_clicked" last_modification_time="Sun, 03 May 2009 01:58:31 GMT"/>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="button2">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">verifier</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="on_button2_clicked" last_modification_time="Sun, 03 May 2009 01:58:22 GMT"/>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="button3">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">fermer</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="destroy" handler="on_button3_destroy" last_modification_time="Sun, 03 May 2009 03:16:31 GMT"/>
<signal name="clicked" handler="on_button3_clicked" last_modification_time="Sun, 03 May 2009 03:16:38 GMT"/>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkStatusbar" id="statusbar1">
<property name="visible">True</property>
<property name="has_resize_grip">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>
<widget class="GtkFileChooserDialog" id="filechooserdialog1">
<property name="border_width">5</property>
<property name="action">GTK_FILE_CHOOSER_ACTION_OPEN</property>
<property name="local_only">True</property>
<property name="select_multiple">False</property>
<property name="show_hidden">False</property>
<property name="do_overwrite_confirmation">False</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
<property name="resizable">False</property>
<property name="destroy_with_parent">False</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property>
<property name="urgency_hint">False</property>
<signal name="selection_changed" handler="on_filechooserdialog1_selection_changed" last_modification_time="Sun, 03 May 2009 02:01:50 GMT"/>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">2</property>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="button4">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-cancel</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-6</property>
</widget>
</child>
<child>
<widget class="GtkButton" id="button5">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-open</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-5</property>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>
Bonne journée @ Tous