jdahlin - in flumotion/trunk: . flumotion/admin flumotion/common flumotion/component/producers/audiotest flumotion/component/producers/bttv flumotion/component/producers/firewire flumotion/component/producers/soundcard flumotion/component/producers/videotest flumotion/component/producers/webcam flumotion/manager flumotion/wizard po

flumotion-commit at lists.fluendo.com flumotion-commit at lists.fluendo.com
Thu Jan 10 18:49:46 CET 2008


Author: jdahlin
Date: Thu Jan 10 18:47:43 2008
New Revision: 6090

Modified:
   flumotion/trunk/   (props changed)
   flumotion/trunk/ChangeLog
   flumotion/trunk/Makefile.am
   flumotion/trunk/autogen.sh
   flumotion/trunk/configure.ac
   flumotion/trunk/flumotion/admin/admin.py
   flumotion/trunk/flumotion/common/registry.py
   flumotion/trunk/flumotion/component/producers/audiotest/audiotest.xml
   flumotion/trunk/flumotion/component/producers/bttv/bttv.xml
   flumotion/trunk/flumotion/component/producers/firewire/firewire.xml
   flumotion/trunk/flumotion/component/producers/soundcard/soundcard.xml
   flumotion/trunk/flumotion/component/producers/videotest/videotest.xml
   flumotion/trunk/flumotion/component/producers/webcam/webcam.xml
   flumotion/trunk/flumotion/manager/admin.py
   flumotion/trunk/flumotion/wizard/productionsteps.py
   flumotion/trunk/po/POTFILES.in
Log:
2008-01-10  Johan Dahlin  <johan at gnome.org>

	* configure.ac:
	* Makefile.am:
	* autogen.sh:
	* flumotion/admin/admin.py:
	* flumotion/common/registry.py:
	* flumotion/wizard/productionsteps.py:
	* flumotion/component/producers/bttv/bttv.xml:
	* flumotion/component/producers/soundcard/soundcard.xml:
	* flumotion/component/producers/webcam/webcam.xml:
	* flumotion/component/producers/audiotest/audiotest.xml:
	* flumotion/component/producers/videotest/videotest.xml:
	* flumotion/component/producers/firewire/firewire.xml:
	* flumotion/manager/admin.py:
	* po/POTFILES.in:
	Add a new registry entry <wizard>, which specifies how
	a page should appear in the wizard.
	Annotate all old production plugins.
	Add a new method for fetching wizard entries and use it in the 
	wizard, removing the old hard coded list of components.
	Add intltool support, add the xml files to POTFILES.in



Modified: flumotion/trunk/ChangeLog
==============================================================================
--- flumotion/trunk/ChangeLog	(original)
+++ flumotion/trunk/ChangeLog	Thu Jan 10 18:47:43 2008
@@ -1,5 +1,28 @@
 2008-01-10  Johan Dahlin  <johan at gnome.org>
 
+	* configure.ac:
+	* Makefile.am:
+	* autogen.sh:
+	* flumotion/admin/admin.py:
+	* flumotion/common/registry.py:
+	* flumotion/wizard/productionsteps.py:
+	* flumotion/component/producers/bttv/bttv.xml:
+	* flumotion/component/producers/soundcard/soundcard.xml:
+	* flumotion/component/producers/webcam/webcam.xml:
+	* flumotion/component/producers/audiotest/audiotest.xml:
+	* flumotion/component/producers/videotest/videotest.xml:
+	* flumotion/component/producers/firewire/firewire.xml:
+	* flumotion/manager/admin.py:
+	* po/POTFILES.in:
+	Add a new registry entry <wizard>, which specifies how
+	a page should appear in the wizard.
+	Annotate all old production plugins.
+	Add a new method for fetching wizard entries and use it in the 
+	wizard, removing the old hard coded list of components.
+	Add intltool support, add the xml files to POTFILES.in
+
+2008-01-10  Johan Dahlin  <johan at gnome.org>
+
 	* data/glade/Makefile.am:
 	* data/glade/wizard_firewire.glade:
 	* flumotion/component/producers/audiotest/audiotest_wizard.py:

Modified: flumotion/trunk/Makefile.am
==============================================================================
--- flumotion/trunk/Makefile.am	(original)
+++ flumotion/trunk/Makefile.am	Thu Jan 10 18:47:43 2008
@@ -16,7 +16,10 @@
 	LICENSE.Flumotion \
 	flumotion.spec \
 	flumotion.doap \
-	misc/pycheckerhelp.py
+	misc/pycheckerhelp.py \
+	intltool-extract.in \
+	intltool-merge.in \
+	intltool-update.in
 
 all-local: locale-uninstalled
 clean-local: locale-uninstalled-clean
@@ -58,5 +61,11 @@
 
 integration:
 	trial tests.integration
+
 # generated by make check during make distcheck
-DISTCLEANFILES = cache/registry/registry.xml
+DISTCLEANFILES = \
+	cache/registry/registry.xml \
+	intltool-extract \
+	intltool-merge \
+	intltool-update
+

Modified: flumotion/trunk/autogen.sh
==============================================================================
--- flumotion/trunk/autogen.sh	(original)
+++ flumotion/trunk/autogen.sh	Thu Jan 10 18:47:43 2008
@@ -4,9 +4,11 @@
 autopoint || exit 1
 aclocal -I m4 -I common || exit 1
 libtoolize --force || exit 1
+intltoolize --copy --force --automake
 # autoheader || exit 1
 autoconf || exit 1
 automake -a || exit 1
+
 echo "./autogen.sh $@" > autoregen.sh
 chmod +x autoregen.sh
 ./configure $@

Modified: flumotion/trunk/configure.ac
==============================================================================
--- flumotion/trunk/configure.ac	(original)
+++ flumotion/trunk/configure.ac	Thu Jan 10 18:47:43 2008
@@ -27,6 +27,8 @@
 GETTEXT_PACKAGE=$PACKAGE
 AC_SUBST(GETTEXT_PACKAGE)
 
+AC_PROG_INTLTOOL([0.34.2])
+
 AS_AC_EXPAND(LIBDIR, $libdir)
 AC_MSG_NOTICE(Storing library files in $LIBDIR)
 

Modified: flumotion/trunk/flumotion/admin/admin.py
==============================================================================
--- flumotion/trunk/flumotion/admin/admin.py	(original)
+++ flumotion/trunk/flumotion/admin/admin.py	Thu Jan 10 18:47:43 2008
@@ -439,5 +439,8 @@
         return self.workerCallRemote(workerName, 'runFunction', moduleName,
                                      functionName, *args, **kwargs)
 
+    def getWizardEntries(self, wizard_types=None, provides=None, accepts=None):
+        return self.callRemote('getWizardEntries', wizard_types, provides, accepts)
+
     def getWorkerHeavenState(self):
         return self._workerHeavenState

Modified: flumotion/trunk/flumotion/common/registry.py
==============================================================================
--- flumotion/trunk/flumotion/common/registry.py	(original)
+++ flumotion/trunk/flumotion/common/registry.py	Thu Jan 10 18:47:43 2008
@@ -53,12 +53,12 @@
     """
     # RegistryEntryComponent has a constructor with a lot of arguments,
     # but that's ok here. Allow it through pychecker.
-    __pychecker__ = 'maxargs=14'
+    __pychecker__ = 'maxargs=15'
 
     def __init__(self, filename, type,
                  source, description, base, properties, files,
                  entries, eaters, feeders, needs_sync, clock_priority,
-                 sockets):
+                 sockets, wizards):
         """
         @param filename:   name of the XML file this component is parsed from
         @type  filename:   str
@@ -68,6 +68,8 @@
         @type  entries:    dict of str -> L{RegistryEntryEntry}
         @param sockets:    list of sockets supported by the element
         @type  sockets:    list of str
+        @param wizards:    list of wizard entries
+        @type  wizards:    list of L{RegistryEntryWizard}
         """
         self.filename = filename
         self.type = type
@@ -85,6 +87,7 @@
         self.needs_sync = needs_sync
         self.clock_priority = clock_priority
         self.sockets = sockets
+        self.wizards = wizards
 
     def getProperties(self):
         """
@@ -370,6 +373,29 @@
     def getMultiple(self):
         return self.multiple
 
+class RegistryEntryWizard:
+    "This class represents a <wizard> entry in the registry"
+    def __init__(self, type, description, feeder, eater, accepts, provides):
+        self.type = type
+        self.description = description
+        self.feeder = feeder
+        self.eater = eater
+        self.accepts = accepts
+        self.provides = provides
+
+    def __repr__(self):
+        return '<wizard type=%s, feeder=%s>' % (self.type, self.feeder)
+
+
+class RegistryWizardFormat:
+    """
+    This class represents an <accept-format> or <provide-format>
+    entry in the registry
+    """
+    def __init__(self, media_type):
+        self.media_type = media_type
+
+
 class RegistryParser(fxml.Parser):
     """
     Registry parser
@@ -436,6 +462,7 @@
         #   <entries>
         #   <synchronization>
         #   <sockets>
+        #   <wizard>
         # </component>
 
         type, baseDir, description = self.parseAttributes(node,
@@ -449,6 +476,7 @@
         synchronization = fxml.Box((False, 100))
         sockets = []
         properties = {}
+        wizards = []
 
         # Merge in options for inherit
         #if node.hasAttribute('inherit'):
@@ -467,8 +495,8 @@
             'synchronization': (self._parseSynchronization,
                                 synchronization.set),
             'sockets':         (self._parseSockets, sockets.extend),
+            'wizard':          (self._parseWizard, wizards.append),
         }
-
         self.parseFromTable(node, parsers)
 
         source = source.unbox()
@@ -479,7 +507,7 @@
                                       properties, files,
                                       entries, eaters, feeders,
                                       needs_sync, clock_priority,
-                                      sockets)
+                                      sockets, wizards)
 
     def _parseSource(self, node):
         # <source location="..."/>
@@ -860,6 +888,40 @@
         filename, = self.parseAttributes(node, ('filename',))
         return RegistryDirectory(filename)
 
+    def _parseWizard(self, node):
+        # <wizard type="..." _description=" " feeder="..." eater="..."]/>
+        #
+        # NOTE: We are using _description with the leading underscore for
+        #       the case of intltool, it is not possible for it to pickup
+        #       translated attributes otherwise. Ideally we would use another
+        #       tool so we can avoid underscores in our xml schema.
+        attrs = self.parseAttributes(node,
+                                     ('type', '_description'),
+                                     ('feeder', 'eater'))
+        type, description, feeder, eater = attrs
+
+        accepts = []
+        provides = []
+        self.parseFromTable(
+            node,
+            { 'accept-format': (self._parseAcceptFormat,
+                                lambda n: accepts.append(n)),
+              'provide-format': (self._parseProvideFormat,
+                                 lambda n: provides.append(n)),
+            })
+
+        return RegistryEntryWizard(type, description, feeder, eater, accepts, provides)
+
+    def _parseAcceptFormat(self, node):
+        # <accept-format media-type="..."/>
+        media_type, = self.parseAttributes(node, ('media-type',))
+        return RegistryWizardFormat(media_type)
+
+    def _parseProvideFormat(self, node):
+        # <provide-format media-type="..."/>
+        media_type, = self.parseAttributes(node, ('media-type',))
+        return RegistryWizardFormat(media_type)
+
 
 # FIXME: filename -> path
 class RegistryDirectory(log.Loggable):
@@ -1030,6 +1092,19 @@
             _dump_proplist(8, component.getProperties())
             w(6, '</properties>')
 
+            for wizard in component.wizards:
+                w(6, '<wizard type="%s" _description="%s" feeder="%s">' % (
+                        wizard.type,
+                        e(wizard.description),
+                        wizard.feeder))
+                for accept in wizard.accepts:
+                    w(8, '<accept-format media-type="%s"/>' % (
+                            accept.media_type))
+                for provide in wizard.provides:
+                    w(8, '<provide-format media-type="%s"/>' % (
+                            provide.media_type))
+                w(6, '</wizard>')
+
             files = component.getFiles()
             if files:
                 w(6, '<files>')

Modified: flumotion/trunk/flumotion/component/producers/audiotest/audiotest.xml
==============================================================================
--- flumotion/trunk/flumotion/component/producers/audiotest/audiotest.xml	(original)
+++ flumotion/trunk/flumotion/component/producers/audiotest/audiotest.xml	Thu Jan 10 18:47:43 2008
@@ -17,6 +17,9 @@
                function="AudioTestWizardPlugin" />
       </entries>
 
+      <wizard type="audio-producer" _description="Test audio source" 
+              feeder="default" />
+
       <!-- priority to this clock so that when testing, clock choice is
            deterministic -->
       <synchronization required="yes" clock-priority="110" />

Modified: flumotion/trunk/flumotion/component/producers/bttv/bttv.xml
==============================================================================
--- flumotion/trunk/flumotion/component/producers/bttv/bttv.xml	(original)
+++ flumotion/trunk/flumotion/component/producers/bttv/bttv.xml	Thu Jan 10 18:47:43 2008
@@ -16,6 +16,9 @@
                function="BTTVWizardPlugin" />
       </entries>
       
+      <wizard type="video-producer" _description="TV card" 
+              feeder="default" />
+
       <synchronization required="yes" />
 
       <properties>

Modified: flumotion/trunk/flumotion/component/producers/firewire/firewire.xml
==============================================================================
--- flumotion/trunk/flumotion/component/producers/firewire/firewire.xml	(original)
+++ flumotion/trunk/flumotion/component/producers/firewire/firewire.xml	Thu Jan 10 18:47:43 2008
@@ -18,6 +18,11 @@
 
       <synchronization required="yes" clock-priority="160" />
 
+      <wizard type="audio-producer" _description="Firewire audio" 
+              feeder="audio" />
+      <wizard type="video-producer" _description="Firewire video" 
+              feeder="video" />
+
       <properties>
         <property name="height" type="int"
                   description="The height to scale to" />

Modified: flumotion/trunk/flumotion/component/producers/soundcard/soundcard.xml
==============================================================================
--- flumotion/trunk/flumotion/component/producers/soundcard/soundcard.xml	(original)
+++ flumotion/trunk/flumotion/component/producers/soundcard/soundcard.xml	Thu Jan 10 18:47:43 2008
@@ -17,6 +17,8 @@
         <entry type="wizard" location="soundcard_wizard.py"
                function="SoundcardWizardPlugin" />
       </entries>
+      <wizard type="audio-producer" _description="Sound card" 
+              feeder="default" />
       <properties>
         <property name="source-element" type="string"
                   description="The GStreamer element factory to use as source" />

Modified: flumotion/trunk/flumotion/component/producers/videotest/videotest.xml
==============================================================================
--- flumotion/trunk/flumotion/component/producers/videotest/videotest.xml	(original)
+++ flumotion/trunk/flumotion/component/producers/videotest/videotest.xml	Thu Jan 10 18:47:43 2008
@@ -9,6 +9,9 @@
 
       <synchronization required="yes" />
 
+      <wizard type="video-producer" feeder="default"
+              _description="Test video source"/>
+
       <entries>
         <entry type="component" location="videotest.py"
                function="VideoTest" />

Modified: flumotion/trunk/flumotion/component/producers/webcam/webcam.xml
==============================================================================
--- flumotion/trunk/flumotion/component/producers/webcam/webcam.xml	(original)
+++ flumotion/trunk/flumotion/component/producers/webcam/webcam.xml	Thu Jan 10 18:47:43 2008
@@ -9,6 +9,9 @@
 
       <synchronization required="yes" />
 
+      <wizard type="video-producer" _description="Web camera" 
+              feeder="default" />
+
       <entries>
         <entry type="component" location="webcam.py"
                function="Webcam" />

Modified: flumotion/trunk/flumotion/manager/admin.py
==============================================================================
--- flumotion/trunk/flumotion/manager/admin.py	(original)
+++ flumotion/trunk/flumotion/manager/admin.py	Thu Jan 10 18:47:43 2008
@@ -368,6 +368,46 @@
         return self.vishnu.emptyPlanet()
 
 
+    def perspective_getWizardEntries(self, types=None, provides=None,
+                                     accepts=None):
+        """
+        Fetches the wizard entries which matches the parameters sent in
+
+        @param types: list of component types to fetch, is usually
+          something like ['video-producer'] or ['audio-encoder']
+        @type  types: list of strings
+        @param provides: formats provided, eg ['jpeg', 'speex']
+        @type  provides: list of strings
+        @param accepts: formats accepted, eg ['theora']
+        @type  accepts: list of strings
+        @returns: tuple: (component_type, description, feeder, name)
+        """
+        retval = []
+
+        for component in registry.getRegistry().getComponents():
+            for wizard in component.wizards:
+                if types is not None:
+                    if wizard.type not in types:
+                        continue
+                if provides is not None:
+                    for format in wizard.provides:
+                        if format.media_type in provides:
+                            break
+                    else:
+                        continue
+                if accepts is not None:
+                    for format in wizard.accepts:
+                        if format.media_type in accepts:
+                            break
+                    else:
+                        continue
+                retval.append((wizard.type,
+                               wizard.description,
+                               wizard.feeder,
+                               component.type))
+        return retval
+
+
 class AdminHeaven(base.ManagerHeaven):
     """
     I interface between the Manager and administrative clients.

Modified: flumotion/trunk/flumotion/wizard/productionsteps.py
==============================================================================
--- flumotion/trunk/flumotion/wizard/productionsteps.py	(original)
+++ flumotion/trunk/flumotion/wizard/productionsteps.py	Thu Jan 10 18:47:43 2008
@@ -34,7 +34,7 @@
 # or the extra args we name in callbacks
 __pychecker__ = 'no-classattr no-argsused'
 T_ = messages.gettexter('flumotion')
-_ = gettext.gettext
+N_ = _ = gettext.gettext
 
 
 class ProductionStep(WorkerWizardStep):
@@ -120,16 +120,17 @@
         self.add_proxy(self._audio_producer, ['audio'])
         self.add_proxy(self._video_producer, ['video'])
 
-        self.video.prefill([
-            (_('Test video source'), 'videotest-producer'),
-            (_('Web camera'), 'webcam-producer'),
-            (_('TV card'), 'tvcard-producer'),
-            (_('Firewire video'), 'firewire-producer')])
-        self.audio.prefill([
-            (_('Test audio source'), 'audiotest-producer'),
-            (_('Sound card'), 'soundcard-producer'),
-            (_('Firewire audio'), 'firewire-producer'),
-            ])
+        def got_entries(entries, combo):
+            data = []
+            for type, desc, feed, component_type in entries:
+                data.append((N_(desc), component_type))
+            combo.prefill(data)
+
+        for ctype, combo in [('video-producer', self.video),
+                             ('audio-producer', self.audio)]:
+            d = self.wizard._admin.getWizardEntries(
+                wizard_types=[ctype])
+            d.addCallback(got_entries, combo)
 
     def _load_plugin(self, component_type, type):
         def got_factory(factory):

Modified: flumotion/trunk/po/POTFILES.in
==============================================================================
--- flumotion/trunk/po/POTFILES.in	(original)
+++ flumotion/trunk/po/POTFILES.in	Thu Jan 10 18:47:43 2008
@@ -400,14 +400,20 @@
 data/glade/wizard_shout2.glade
 flumotion/component/producers/audiotest/audiotest.glade
 flumotion/component/producers/audiotest/audiotest-wizard.glade
+flumotion/component/producers/audiotest/audiotest.xml
 flumotion/component/producers/bttv/bttv-wizard.glade
+flumotion/component/producers/bttv/bttv.xml
 flumotion/component/producers/bttv/colorbalance.glade
 flumotion/component/producers/firewire/firewire-wizard.glade
+flumotion/component/producers/firewire/firewire.xml
 flumotion/component/producers/looper/flufileinfo.glade
 flumotion/component/producers/looper/looper.glade
 flumotion/component/producers/soundcard/soundcard-wizard.glade
+flumotion/component/producers/soundcard/soundcard.xml
 flumotion/component/producers/videotest/videotest-wizard.glade
+flumotion/component/producers/videotest/videotest.xml
 flumotion/component/producers/webcam/webcam-wizard.glade
+flumotion/component/producers/webcam/webcam.xml
 flumotion/component/misc/httpfile/httpfile.glade
 flumotion/component/consumers/disker/disker.glade
 flumotion/component/consumers/httpstreamer/http.glade


More information about the flumotion-commit mailing list