pitivi r1164 - in branches/SOC_2008_BLEWIS: . pitivi pitivi/ui



Author: blewis
Date: Fri Jul 11 08:59:05 2008
New Revision: 1164
URL: http://svn.gnome.org/viewvc/pitivi?rev=1164&view=rev

Log:
* pitivi/project.py:
fix bug in which project timeline is recreated after new-project-loading
signl emitted, thereby preventing UI from catching project load signals.
also made sure that settings-changed, and source added signals are emitted
when project loads.
* pitivi/ui/timelineobjects.py:
made sure that UI does appropriate thing in response to new-project-*
signals. File load support works again in simple UI! \0/


Modified:
   branches/SOC_2008_BLEWIS/ChangeLog
   branches/SOC_2008_BLEWIS/pitivi/project.py
   branches/SOC_2008_BLEWIS/pitivi/ui/timelineobjects.py

Modified: branches/SOC_2008_BLEWIS/pitivi/project.py
==============================================================================
--- branches/SOC_2008_BLEWIS/pitivi/project.py	(original)
+++ branches/SOC_2008_BLEWIS/pitivi/project.py	Fri Jul 11 08:59:05 2008
@@ -116,7 +116,6 @@
         # FIXME : This should be discovered !
         saveformat = "pickle"
         if self.uri and file_is_project(self.uri):
-            self.timeline = Timeline(self)
             loader = ProjectSaver.newProjectSaver(saveformat)
             path = gst.uri_get_location(self.uri)
             fileobj = open(path, "r")
@@ -126,7 +125,8 @@
             except ProjectLoadError:
                 gst.error("Error while loading the project !!!")
                 return False
-            fileobj.close()
+            finally:
+                fileobj.close()
             self.format = saveformat
             self.urichanged = False
             return True
@@ -282,9 +282,12 @@
     def fromDataFormat(self, obj):
         Serializable.fromDataFormat(self, obj)
         self.name = obj["name"]
-        self.settings = to_object_from_data_type(obj["settings"])
-        self.sources = to_object_from_data_type(obj["sources"])
-        self.timeline = to_object_from_data_type(obj["timeline"])
+        # calling this makes sure settigns-changed signal is emitted
+        self.setSettings(to_object_from_data_type(obj["settings"]))
+        # these objects already exist, so we initialize them from file
+        # to make sure UI catches signals
+        self.sources.fromDataFormat(obj["sources"])
+        self.timeline.fromDataFormat(obj["timeline"])
 
 def uri_is_valid(uri):
     return gst.uri_get_protocol(uri) == "file"

Modified: branches/SOC_2008_BLEWIS/pitivi/ui/timelineobjects.py
==============================================================================
--- branches/SOC_2008_BLEWIS/pitivi/ui/timelineobjects.py	(original)
+++ branches/SOC_2008_BLEWIS/pitivi/ui/timelineobjects.py	Fri Jul 11 08:59:05 2008
@@ -185,6 +185,7 @@
         self.elements = {}
 
     def set_timeline(self, timeline):
+        self.remove_all()
         if self.timeline:
             for sig in self.sig_ids:
                 self.timeline.videocomp.disconnect(sig)
@@ -218,13 +219,11 @@
     def _condensedListChangedCb(self, unused_videocomp, clist):
         """ add/remove the widgets """
         gst.debug("condensed list changed in videocomp")
-        #print "condensed list changed"
         order = [self.index(self.widgets[e]) for e in clist]
         self.reorder(order)
 
     def _sourceAddedCb(self, timeline, element):
         gst.debug("Adding new element to the layout")
-        #print "source added"
         if isinstance(element, TimelineFileSource):
             widget = SimpleSourceWidget(element)
             widget.connect("delete-me", self._sourceDeleteMeCb, element)
@@ -246,7 +245,6 @@
 
     def _sourceRemovedCb(self, timeline, element):
         gst.debug("Removing element")
-        #print "source removed"
         self.remove_child(self.widgets[element])
         del self.elements[self.widgets[element]]
         del self.widgets[element]
@@ -341,18 +339,11 @@
     def _newProjectLoadedCb(self, unused_inst, project):
         assert(instance.PiTiVi.current == project)
 
-        #signals that might be emitted while the project is loading
-
     def _newProjectFailedCb(self, unused_inst, unused_reason, unused_uri):
-        # oops the project failed to load
-        self._clearTimeline()
-
-    def _clearTimeline(self):
         self.items.set_timeline(None)
-        self.items.remove_all()
 
     def _projectClosedCb(self, unused_pitivi, unused_project):
-        self._clearTimeline()
+        self.items.set_timeline(None)
 
 ## Editing mode
 



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