[transmageddon] Commit current dvd enabling changes (non-functional)



commit c3dd6fef5df955b7d1c9198a6a4067c3806f2e34
Author: Christian Fredrik Kalager Schaller <uraeus linuxrising org>
Date:   Fri Mar 29 17:38:26 2013 +0100

    Commit current dvd enabling changes (non-functional)

 src/dvdtrackchooser.py                |   21 +++++-----
 src/transmageddon-dvdtrack-chooser.ui |   16 +-------
 src/transmageddon.py                  |   68 ++++++++++++++++++---------------
 3 files changed, 49 insertions(+), 56 deletions(-)
---
diff --git a/src/dvdtrackchooser.py b/src/dvdtrackchooser.py
index 6f67fb3..4f7a51a 100644
--- a/src/dvdtrackchooser.py
+++ b/src/dvdtrackchooser.py
@@ -1,12 +1,12 @@
-import os
+import os,datetime
 from gi.repository import Gtk, GLib, Gst, GstTag
 from gi.repository import GUdev
 
 class dvdtrackchooser(Gtk.Dialog): 
-   def __init__(self): #, parent): 
+   def __init__(self, parent): 
        self.dvdpickui = Gtk.Builder()
        self.dvdpickui.add_from_file("transmageddon-dvdtrack-chooser.ui")
-       langscroll = self.dvdpickui.get_object("dvdscroll")
+       dvdscroll = self.dvdpickui.get_object("dvdscroll")
        cancelbutton = self.dvdpickui.get_object("cancelbutton")
        selectbutton = self.dvdpickui.get_object("selectbutton")
 
@@ -28,13 +28,14 @@ class dvdtrackchooser(Gtk.Dialog):
        print(self.Title)
        scounter=0
        longesttime = 0
+       self.listoftracks=[]
        while scounter < len(self.Tracks):
            tcounter=0
            self.ix=int(self.Tracks[scounter]['ix'])
            while tcounter <  len(self.Tracks[scounter]['audio']):
                if self.Tracks[scounter]['audio']:
                    if GstTag.tag_check_language_code(self.Tracks[scounter]['audio'][tcounter]['langcode']):
-                       
print(GstTag.tag_get_language_name(self.Tracks[scounter]['audio'][tcounter]['langcode']) + " " 
+(self.Tracks[scounter]['audio'][tcounter]['format']+ " " 
+str((self.Tracks[scounter]['audio'][tcounter]['channels']))))
+                       self.listoftracks.append("Track " + str(scounter) + " " + 
GstTag.tag_get_language_name(self.Tracks[scounter]['audio'][tcounter]['langcode']) + " " 
+(self.Tracks[scounter]['audio'][tcounter]['format']+ " " 
+str((self.Tracks[scounter]['audio'][tcounter]['channels']))))
                tcounter=tcounter+1
 
            # For testing purposes look for longest track
@@ -47,8 +48,8 @@ class dvdtrackchooser(Gtk.Dialog):
        print("THE longest track " + str(self.longestrack))   
 
 
-       for act in self.Tracks:
-           store.append([act[0]])
+       for act in self.listoftracks:
+           store.append([act])
                            
        self.dvdtrackview = Gtk.TreeView(store)
        self.dvdtrackview.set_reorderable(False)
@@ -66,20 +67,20 @@ class dvdtrackchooser(Gtk.Dialog):
        rendererText = Gtk.CellRendererText()
        column = Gtk.TreeViewColumn(None, rendererText, text=0)
        column.set_sort_indicator(False)
-       self.langview.append_column(column)
+       self.dvdtrackview.append_column(column)
 
    def on_cancelbutton_clicked(self, widget):
-       self.languagewindow.destroy()
+       self.dvdwindow.destroy()
 
 
    def on_selectbutton_clicked(self, widget):
        dvdtrack=self.dvdtrackview.get_selection()
-       (model, pathlist) = language.get_selected_rows()
+       (model, pathlist) = dvdtrack.get_selected_rows()
        for path in pathlist :
            tree_iter = model.get_iter(path)
            value = model.get_value(tree_iter,0)
            numvalue=path.to_string()
-           self.langcode=self.langcodeList[int(numvalue)]
+           self.dvdtrack=1 #FIXME
        self.dvdwindow.destroy()
 
    def dvdread(self, device):
diff --git a/src/transmageddon-dvdtrack-chooser.ui b/src/transmageddon-dvdtrack-chooser.ui
index bb1bb56..11d325b 100644
--- a/src/transmageddon-dvdtrack-chooser.ui
+++ b/src/transmageddon-dvdtrack-chooser.ui
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <!-- interface-requires gtk+ 3.0 -->
-  <object class="GtkDialog" id="dvdtrackpicker">
+  <object class="GtkDialog" id="dvdpickui">
     <property name="height_request">400</property>
     <property name="can_focus">False</property>
     <property name="border_width">5</property>
@@ -83,20 +83,6 @@
             <property name="position">1</property>
           </packing>
         </child>
-        <child>
-          <object class="GtkEntry" id="textfilterentry1">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="invisible_char">●</property>
-            <property name="invisible_char_set">True</property>
-            <property name="secondary_icon_name">edit-find-symbolic</property>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">False</property>
-            <property name="position">4</property>
-          </packing>
-        </child>
       </object>
     </child>
     <action-widgets>
diff --git a/src/transmageddon.py b/src/transmageddon.py
index 816b19c..4012b87 100644
--- a/src/transmageddon.py
+++ b/src/transmageddon.py
@@ -1220,13 +1220,13 @@ class TransmageddonUI(Gtk.ApplicationWindow):
            self.source_hbox.remove(self.combo)
            self.combo.destroy()
         
-       # udev code to find DVD drive on system - This code needs to go into Transmageddon proper
+       # udev code to find DVD drive on system
        client = GUdev.Client(subsystems=['block'])
        for device in client.query_by_subsystem("block"):
            if device.has_property("ID_CDROM"):
-               self.path=device.get_device_file()
+               self.dvdpath=device.get_device_file()
 
-       if self.path:
+       if self.dvdpath:
 
            theme = Gtk.IconTheme.get_default()
            size= Gtk.icon_size_lookup(Gtk.IconSize.MENU)[1]
@@ -1235,8 +1235,9 @@ class TransmageddonUI(Gtk.ApplicationWindow):
 
 
            liststore = Gtk.ListStore(GdkPixbuf.Pixbuf, GObject.TYPE_STRING)
-           liststore.append([cdrom, "dvd://" +str(self.path)])
+           liststore.append([None, ""])
            liststore.append([fileopen, "Choose File..."])
+           liststore.append([cdrom, "dvd://" +str(self.dvdpath)])
 
            self.combo = Gtk.ComboBox(model=liststore)
 
@@ -1263,36 +1264,41 @@ class TransmageddonUI(Gtk.ApplicationWindow):
        self.source_hbox.show_all()
 
    def on_source_changed(self, widget):
-        """
-            The source combo box or file chooser button has changed, update!
-        """
-        theme = Gtk.IconTheme.get_default()
+       """
+           The source combo box or file chooser button has changed, update!
+       """
+       theme = Gtk.IconTheme.get_default()
         
-        iter = widget.get_active_iter()
-        model = widget.get_model()
-        item = model.get_value(iter, 1)
-        if item == _("Choose File..."):
-            dialog = Gtk.FileChooserDialog(title=_("Choose Source File..."),
+       iter = widget.get_active_iter()
+       model = widget.get_model()
+       item = model.get_value(iter, 1)
+       if item == _("Choose File..."):
+           dialog = Gtk.FileChooserDialog(title=_("Choose Source File..."),
                         buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.REJECT,
                                  Gtk.STOCK_OPEN, Gtk.ResponseType.ACCEPT))
-            dialog.set_property("local-only", False)
-            dialog.set_current_folder(self.videodirectory)
-            response = dialog.run()
-            dialog.hide()
-            filename = None
-            if response == Gtk.ResponseType.ACCEPT:
-                if self.fileiter:
-                    model.remove(self.fileiter)
-                self.streamdata['filename'] = dialog.get_filename()
-                self.streamdata['filechoice'] = dialog.get_uri()
-
-                self.set_source_to_path(self.streamdata['filename'])
-            else:
-                if self.fileiter:
-                    pos = widget.get_active()
-                    widget.set_active(pos - 1)
-                else:
-                    widget.set_active(0)
+           dialog.set_property("local-only", False)
+           dialog.set_current_folder(self.videodirectory)
+           response = dialog.run()
+           dialog.hide()
+           filename = None
+           if response == Gtk.ResponseType.ACCEPT:
+               if self.fileiter:
+                   model.remove(self.fileiter)
+               self.streamdata['filename'] = dialog.get_filename()
+               self.streamdata['filechoice'] = dialog.get_uri()
+               self.set_source_to_path(self.streamdata['filename'])
+           else:
+               if self.fileiter:
+                   pos = widget.get_active()
+                   widget.set_active(pos - 1)
+               else:
+                   widget.set_active(0)
+       else:
+           print("dvd")
+           dvd=dvdtrackchooser.dvdtrackchooser(self)
+           dvd.dvdwindow.run()
+           print("track number is " +str(dvd.dvdtrack))
+           self.on_filechooser_file_set(self,self.dvdpath)
 
     
    def set_source_to_path(self, path):


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]