pitivi r1333 - in trunk: . pitivi pitivi/timeline pitivi/ui



Author: edwardrv
Date: Thu Oct 16 14:21:17 2008
New Revision: 1333
URL: http://svn.gnome.org/viewvc/pitivi?rev=1333&view=rev

Log:
	* pitivi/playground.py:
	* pitivi/project.py:
	* pitivi/settings.py:
	* pitivi/timeline/composition.py:
	* pitivi/timeline/objects.py:
	* pitivi/timeline/source.py:
	* pitivi/timeline/timeline.py:
	Switch more objects to gobject-less signalling and properties.

Modified:
   trunk/ChangeLog
   trunk/pitivi/playground.py
   trunk/pitivi/pluginmanager.py
   trunk/pitivi/project.py
   trunk/pitivi/settings.py
   trunk/pitivi/timeline/composition.py
   trunk/pitivi/timeline/objects.py
   trunk/pitivi/timeline/source.py
   trunk/pitivi/timeline/timeline.py
   trunk/pitivi/ui/filelisterrordialog.py

Modified: trunk/pitivi/playground.py
==============================================================================
--- trunk/pitivi/playground.py	(original)
+++ trunk/pitivi/playground.py	Thu Oct 16 14:21:17 2008
@@ -28,10 +28,11 @@
 import gst
 from bin import SmartBin, SmartDefaultBin, SmartFileBin, SmartTimelineBin
 from utils import bin_contains
+from signalinterface import Signallable
 
 from gettext import gettext as _
 
-class PlayGround(gobject.GObject):
+class PlayGround(object, Signallable):
     """
     Holds all the applications pipelines.
     Multimedia sinks can be shared amongst the various pipelines, to offer
@@ -51,33 +52,19 @@
       element-message : messages received of type gst.MESSAGE_ELEMENT
     """
 
-    __gsignals__ = {
-        "current-changed" : ( gobject.SIGNAL_RUN_LAST,
-                              gobject.TYPE_NONE,
-                              (gobject.TYPE_PYOBJECT, )),
-        "current-state" : ( gobject.SIGNAL_RUN_LAST,
-                            gobject.TYPE_NONE,
-                            (gobject.TYPE_PYOBJECT, )),
-        "bin-added" : ( gobject.SIGNAL_RUN_LAST,
-                       gobject.TYPE_NONE,
-                       ( gobject.TYPE_PYOBJECT, )),
-        "bin-removed" : ( gobject.SIGNAL_RUN_LAST,
-                          gobject.TYPE_NONE,
-                          ( gobject.TYPE_PYOBJECT, )),
-        "error" : ( gobject.SIGNAL_RUN_LAST,
-                    gobject.TYPE_NONE,
-                    ( gobject.TYPE_STRING, gobject.TYPE_STRING )),
-        "position" : ( gobject.SIGNAL_RUN_LAST,
-                       gobject.TYPE_NONE,
-                       ( gobject.TYPE_PYOBJECT, gobject.TYPE_UINT64 )),
-        "element-message" : ( gobject.SIGNAL_RUN_LAST,
-                              gobject.TYPE_NONE,
-                              ( gst.Message, ))
+    __signals__ = {
+        "current-changed" : ["smartbin"],
+        "current-state" : ["smartbin"],
+        "bin-added" : ["smartbin"],
+        "bin-removed" : ["smartbin"],
+        "error" : ["string1", "string2"],
+        "position" : ["bin", "position"],
+        "element-message" : ["message"]
         }
 
     def __init__(self):
         gst.log("Starting up playground")
-        gobject.GObject.__init__(self)
+
         # List of used pipelines
         self.pipelines = []
 

Modified: trunk/pitivi/pluginmanager.py
==============================================================================
--- trunk/pitivi/pluginmanager.py	(original)
+++ trunk/pitivi/pluginmanager.py	Thu Oct 16 14:21:17 2008
@@ -31,12 +31,12 @@
     import pickle
 import pkg_resources
 import gtk
-import gobject
-import zope.interface.verify 
+import zope.interface.verify
 
+from signalinterface import Signallable
 import plugincore
 
-class PluginManager(gobject.GObject):
+class PluginManager(object, Signallable):
     """
     Manages plugins in a centralized way.
 
@@ -59,27 +59,20 @@
 
     """
 
-    __gsignals__ = {
-        "plugin-enabled-changed" : (gobject.SIGNAL_RUN_LAST,\
-                                      gobject.TYPE_NONE,\
-                                      (gobject.TYPE_PYOBJECT,)),
-        "plugin-installed" : (gobject.SIGNAL_RUN_LAST,\
-                                      gobject.TYPE_NONE,\
-                                      (gobject.TYPE_PYOBJECT,)),
-        "plugin-uninstalled" : (gobject.SIGNAL_RUN_LAST,\
-                                      gobject.TYPE_NONE,\
-                                      (gobject.TYPE_PYOBJECT,)),
+    __signals__ = {
+        "plugin-enabled-changed" : ["plugin_names"],
+        "plugin-installed" : ["plugin_name"],
+        "plugin-uninstalled" : ["plugin_name"],
 
         }
 
     def __init__(self, local_plugin_path, settings_path):
-        """ 
-        Initialize a new plugin manager 
+        """
+        Initialize a new plugin manager
 
         @param local_plugin_path: local path where new plugins will be installed
         @param settings_path: path where all plugin settings are stored
         """
-        gobject.GObject.__init__(self)
 
         # plugins are collected in a bag (a structure relatng 1->many)
         # {"my_plugin":{"plugin":plugin_object, "filename":"/home/luca/plugins/my_plugin.py"}}

Modified: trunk/pitivi/project.py
==============================================================================
--- trunk/pitivi/project.py	(original)
+++ trunk/pitivi/project.py	Thu Oct 16 14:21:17 2008
@@ -25,8 +25,8 @@
 """
 
 import os.path
-import gobject
 import gst
+import traceback
 from timeline.timeline import Timeline
 from sourcelist import SourceList
 from bin import SmartTimelineBin
@@ -35,8 +35,9 @@
 from gettext import gettext as _
 from serializable import Serializable, to_object_from_data_type
 from projectsaver import ProjectSaver, ProjectSaveError, ProjectLoadError
+from signalinterface import Signallable
 
-class Project(gobject.GObject, Serializable):
+class Project(Serializable, Signallable):
     """ The base class for PiTiVi projects
     Signals
 
@@ -59,16 +60,10 @@
             The project settings have changed
     """
 
-    __gsignals__ = {
-        "save-uri-requested" : ( gobject.SIGNAL_RUN_LAST,
-                                     gobject.TYPE_BOOLEAN,
-                                     ( )),
-        "confirm-overwrite" : ( gobject.SIGNAL_RUN_LAST,
-                                gobject.TYPE_BOOLEAN,
-                                (gobject.TYPE_STRING, )),
-        "settings-changed" : ( gobject.SIGNAL_RUN_LAST,
-                               gobject.TYPE_NONE,
-                               (  ))
+    __signals__ = {
+        "save-uri-requested" : None,
+        "confirm-overwrite" : ["location"],
+        "settings-changed" : None
         }
 
     __data_type__ = "project"
@@ -79,7 +74,6 @@
         uri : the uri of the project
         """
         gst.log("name:%s, uri:%s" % (name, uri))
-        gobject.GObject.__init__(self)
         self.name = name
         self.settings = None
         self.description = ""
@@ -104,7 +98,14 @@
             # should this return false?
             gst.warning("Already loaded !!!")
             return True
-        return self._load()
+        try:
+            res = self._load()
+        except:
+            gst.error("An Exception was raised during loading !")
+            traceback.print_exc()
+            res = False
+        finally:
+            return res
 
     def _load(self):
         """
@@ -129,6 +130,7 @@
                 fileobj.close()
             self.format = saveformat
             self.urichanged = False
+            gst.debug("Done loading !")
             return True
         return False
 
@@ -150,7 +152,8 @@
 
         #TODO: a bit more sophisticated overwite detection
         if os.path.exists(path) and self.urichanged:
-            if not self.emit("confirm-overwrite", self.uri):
+            overwriteres = self.emit("confirm-overwrite", self.uri)
+            if overwriteres == False:
                 gst.log("aborting save because overwrite was denied")
                 return False
 
@@ -173,7 +176,8 @@
             return self._save()
 
         gst.log("requesting for a uri to save to...")
-        if self.emit("save-uri-requested"):
+        saveres = self.emit("save-uri-requested")
+        if saveres == None or saveres == True:
             gst.log("'save-uri-requested' returned True, self.uri:%s" % self.uri)
             if self.uri:
                 return self._save()
@@ -262,13 +266,6 @@
     def hasUnsavedModifications(self):
         return self._dirty
 
-    # signals default handlers
-    def do_save_uri_requested(self):
-        return True
-
-    def do_confirm_overwrite(self, unused_uri):
-        return True
-
     # Serializable methods
 
     def toDataFormat(self):

Modified: trunk/pitivi/settings.py
==============================================================================
--- trunk/pitivi/settings.py	(original)
+++ trunk/pitivi/settings.py	Thu Oct 16 14:21:17 2008
@@ -25,11 +25,11 @@
 """
 
 import os
-import gobject
 import gst
 import string
 
 from serializable import Serializable, to_object_from_data_type
+from signalinterface import Signallable
 
 from gettext import gettext as _
 
@@ -121,7 +121,7 @@
 
         return repository_path
 
-class ExportSettings(gobject.GObject, Serializable):
+class ExportSettings(Serializable, Signallable):
     """
     Multimedia export settings
 
@@ -130,13 +130,9 @@
     'settings-changed' : the settings have changed
     'encoders-changed' : The encoders or muxer have changed
     """
-    __gsignals__ = {
-        "settings-changed" : ( gobject.SIGNAL_RUN_LAST,
-                              gobject.TYPE_NONE,
-                              (  )),
-        "encoders-changed" : ( gobject.SIGNAL_RUN_LAST,
-                               gobject.TYPE_NONE,
-                               ( ))
+    __signals__ = {
+        "settings-changed" : None,
+        "encoders-changed" : None,
         }
 
     __data_type__ = "export-settings"
@@ -147,7 +143,6 @@
     # TODO : switch to using GstFraction internally where appliable
 
     def __init__(self, **unused_kw):
-        gobject.GObject.__init__(self)
         self.videowidth = 720
         self.videoheight = 576
         self.videorate = gst.Fraction(25,1)

Modified: trunk/pitivi/timeline/composition.py
==============================================================================
--- trunk/pitivi/timeline/composition.py	(original)
+++ trunk/pitivi/timeline/composition.py	Thu Oct 16 14:21:17 2008
@@ -23,7 +23,6 @@
 Timeline Composition object
 """
 
-import gobject
 import gst
 
 from source import TimelineSource
@@ -37,9 +36,6 @@
 
     __data_type__ = "timeline-layer"
 
-    def __init__(self):
-        gobject.GObject.__init__(self)
-
 
 class EffectsLayer(Layer):
     """
@@ -137,40 +133,18 @@
     * (optional) 'default-source' (TimelineSource) : Default source for the composition.
     """
 
-    __gsignals__ = {
-        'condensed-list-changed' : ( gobject.SIGNAL_RUN_LAST,
-                                     gobject.TYPE_NONE,
-                                     (gobject.TYPE_PYOBJECT, )),
-        'global-effect-added' : ( gobject.SIGNAL_RUN_LAST,
-                                  gobject.TYPE_NONE,
-                                  (gobject.TYPE_PYOBJECT, )),
-        'global-effect-removed' : ( gobject.SIGNAL_RUN_LAST,
-                                    gobject.TYPE_NONE,
-                                    (gobject.TYPE_PYOBJECT, )),
-        'simple-effect-added' : ( gobject.SIGNAL_RUN_LAST,
-                                  gobject.TYPE_NONE,
-                                  (gobject.TYPE_PYOBJECT, )),
-        'simple-effect-removed' : ( gobject.SIGNAL_RUN_LAST,
-                                    gobject.TYPE_NONE,
-                                    (gobject.TYPE_PYOBJECT, )),
-        'complex-effect-added' : ( gobject.SIGNAL_RUN_LAST,
-                                   gobject.TYPE_NONE,
-                                   (gobject.TYPE_PYOBJECT, )),
-        'complex-effect-removed' : ( gobject.SIGNAL_RUN_LAST,
-                                     gobject.TYPE_NONE,
-                                     (gobject.TYPE_PYOBJECT, )),
-        'transitions-added' : ( gobject.SIGNAL_RUN_LAST,
-                                gobject.TYPE_NONE,
-                                (gobject.TYPE_PYOBJECT, )),
-        'transition-removed' : ( gobject.SIGNAL_RUN_LAST,
-                                 gobject.TYPE_NONE,
-                                 (gobject.TYPE_PYOBJECT, )),
-        'source-added' : ( gobject.SIGNAL_RUN_LAST,
-                           gobject.TYPE_NONE,
-                           (gobject.TYPE_PYOBJECT, )),
-        'source-removed' : ( gobject.SIGNAL_RUN_LAST,
-                             gobject.TYPE_NONE,
-                             (gobject.TYPE_PYOBJECT, )),
+    __signals__ = {
+        'condensed-list-changed' : ["condensed_list"],
+        'global-effect-added' : ["effect"],
+        'global-effect-removed' : ["effect"],
+        'simple-effect-added' : ["effect"],
+        'simple-effect-removed' : ["effect"],
+        'complex-effect-added' : ["effect"],
+        'complex-effect-removed' : ["effect"],
+        'transitions-added' : ["transition"],
+        'transition-removed' : ["transition"],
+        'source-added' : ["source"],
+        'source-removed' : ["source"]
         }
 
     __data_type__ = "timeline-composition"

Modified: trunk/pitivi/timeline/objects.py
==============================================================================
--- trunk/pitivi/timeline/objects.py	(original)
+++ trunk/pitivi/timeline/objects.py	Thu Oct 16 14:21:17 2008
@@ -25,10 +25,10 @@
 
 import weakref
 from random import randint
-import gobject
 import gst
 from pitivi.serializable import Serializable
 from pitivi.objectfactory import ObjectFactory
+from pitivi.signalinterface import Signallable
 
 MEDIA_TYPE_NONE = 0
 MEDIA_TYPE_AUDIO = 1
@@ -54,7 +54,7 @@
 ##         |
 ##         +---- Complex Effect (N->1)
 
-class BrotherObjects(gobject.GObject, Serializable):
+class BrotherObjects(Serializable, Signallable):
     """
     Base class for objects that can have a brother and be linked to something else
 
@@ -65,10 +65,8 @@
 
     __data_type__ = "timeline-brother-objects"
 
-    __gsignals__ = {
-        "linked-changed" : (gobject.SIGNAL_RUN_LAST,
-                            gobject.TYPE_NONE,
-                            (gobject.TYPE_PYOBJECT, ))
+    __signals__ = {
+        "linked-changed" : ["brother"]
         }
 
     # UID (int) => object (BrotherObjects) mapping.
@@ -79,7 +77,6 @@
     __waiting_for_pending_objects__ = {}
 
     def __init__(self, **unused_kw):
-        gobject.GObject.__init__(self)
         self.linked = None
         self.brother = None
         self.uid = -1
@@ -104,7 +101,6 @@
             self.unlinkObject()
         self._linkObject(object)
         self.linked._linkObject(self)
-        pass
 
     def getLinkedObject(self):
         """
@@ -273,8 +269,6 @@
             cls.__waiting_for_pending_objects__[uid] = []
         cls.__waiting_for_pending_objects__[uid].append((weakref.proxy(obj), extra))
 
-gobject.type_register(BrotherObjects)
-
 class TimelineObject(BrotherObjects):
     """
     Base class for all timeline objects
@@ -307,10 +301,8 @@
     # order to create their gnlobject.
     __requires_factory__ = True
 
-    __gsignals__ = {
-        "start-duration-changed" : ( gobject.SIGNAL_RUN_LAST,
-                                 gobject.TYPE_NONE,
-                                 (gobject.TYPE_PYOBJECT, gobject.TYPE_PYOBJECT, ))
+    __signals__ = {
+        "start-duration-changed" : ["start", "duration"]
         }
 
     def __init__(self, factory=None, start=gst.CLOCK_TIME_NONE,

Modified: trunk/pitivi/timeline/source.py
==============================================================================
--- trunk/pitivi/timeline/source.py	(original)
+++ trunk/pitivi/timeline/source.py	Thu Oct 16 14:21:17 2008
@@ -36,10 +36,8 @@
     * 'media-start' (int) : start position of the media
     * 'media-duration' (int) : duration of the media
     """
-    __gsignals__ = {
-        "media-start-duration-changed" : ( gobject.SIGNAL_RUN_LAST,
-                                       gobject.TYPE_NONE,
-                                       (gobject.TYPE_UINT64, gobject.TYPE_UINT64))
+    __signals__ = {
+        "media-start-duration-changed" : ["media-start", "media-duration"]
         }
 
 
@@ -305,8 +303,6 @@
             volume = obj["volume"]
             self.setVolume(volume)
 
-gobject.type_register(TimelineFileSource)
-
 class TimelineLiveSource(TimelineSource):
     """
     Non-seekable sources (like cameras)

Modified: trunk/pitivi/timeline/timeline.py
==============================================================================
--- trunk/pitivi/timeline/timeline.py	(original)
+++ trunk/pitivi/timeline/timeline.py	Thu Oct 16 14:21:17 2008
@@ -23,7 +23,6 @@
 Timeline and timeline objects
 """
 
-import gobject
 import gst
 
 from pitivi.settings import ExportSettings
@@ -32,7 +31,7 @@
 from source import TimelineBlankSource
 from pitivi.serializable import Serializable
 
-class Timeline(gobject.GObject, Serializable):
+class Timeline(Serializable):
     """
     Fully fledged timeline
     """
@@ -44,7 +43,6 @@
 
     def __init__(self, project=None, **unused_kw):
         gst.log("new Timeline for project %s" % project)
-        gobject.GObject.__init__(self)
         self.project = project
 
         if self.project:

Modified: trunk/pitivi/ui/filelisterrordialog.py
==============================================================================
--- trunk/pitivi/ui/filelisterrordialog.py	(original)
+++ trunk/pitivi/ui/filelisterrordialog.py	Thu Oct 16 14:21:17 2008
@@ -30,16 +30,14 @@
 
 from gettext import gettext as _
 
-class FileListErrorDialog(GladeWindow):
+from pitivi.signalinterface import Signallable
+
+class FileListErrorDialog(GladeWindow, Signallable):
     """ Dialog box for showing errors in a list of files """
     glade_file = "filelisterrordialog.glade"
-    __gsignals__ = {
-        'close': (gobject.SIGNAL_RUN_LAST,
-                  gobject.TYPE_NONE,
-                  ( )),
-        'response': (gobject.SIGNAL_RUN_LAST,
-                     gobject.TYPE_NONE,
-                     (gobject.TYPE_PYOBJECT, ))
+    __signals__ = {
+        'close': None,
+        'response': ["something"]
         }
 
     def __init__(self, title, headline):
@@ -65,7 +63,7 @@
         if uri[:7] == "file://":
             uri = uri[7:]
         exp = gtk.Expander(uri.split('/')[-1])
-        
+
         textbuffer = gtk.TextBuffer()
         table = textbuffer.get_tag_table()
         boldtag = gtk.TextTag()
@@ -75,7 +73,7 @@
         # <b>URI :</b> % uri
         end = textbuffer.get_end_iter()
         textbuffer.insert_with_tags(end, _("URI : "), boldtag)
- 
+
         end = textbuffer.get_end_iter()
         textbuffer.insert(end, "%s\n" % uri)
 
@@ -88,7 +86,7 @@
         if extra:
             end = textbuffer.get_end_iter()
             textbuffer.insert_with_tags(end, _("Extra information : "), boldtag)
-            
+
             end = textbuffer.get_end_iter()
             textbuffer.insert(end, "%s\n" % extra)
 



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