pitivi r1288 - trunk/pitivi
- From: edwardrv svn gnome org
- To: svn-commits-list gnome org
- Subject: pitivi r1288 - trunk/pitivi
- Date: Sat, 27 Sep 2008 17:39:21 +0000 (UTC)
Author: edwardrv
Date: Sat Sep 27 17:39:20 2008
New Revision: 1288
URL: http://svn.gnome.org/viewvc/pitivi?rev=1288&view=rev
Log:
device.py : Add signals for devices being added/removed
Modified:
trunk/pitivi/device.py
Modified: trunk/pitivi/device.py
==============================================================================
--- trunk/pitivi/device.py (original)
+++ trunk/pitivi/device.py Sat Sep 27 17:39:20 2008
@@ -24,6 +24,7 @@
Classes and Methods for Device handling and usage
"""
+import gobject
from objectfactory import ObjectFactory, SourceFactory
try:
@@ -62,7 +63,7 @@
return HalDeviceProbe()
return None
-class DeviceProbe(object):
+class DeviceProbe(gobject.GObject):
"""
Allows listing of the various devices available.
@@ -71,8 +72,17 @@
This should be subclassed
"""
+ __gsignals__ = {
+ "device-added" : (gobject.SIGNAL_RUN_LAST,
+ gobject.TYPE_NONE,
+ (gobject.TYPE_PYOBJECT, )),
+ "device-removed" : (gobject.SIGNAL_RUN_LAST,
+ gobject.TYPE_NONE,
+ (gobject.TYPE_PYOBJECT, ))
+ }
+
def __init__(self):
- pass
+ gobject.GObject.__init__(self)
def getSourceDevices(self, media_type):
""" Returns a list of available SourceDeviceFactory for
@@ -157,8 +167,10 @@
if devobject.QueryCapability("video4linux"):
location = devobject.GetProperty("video4linux.device")
info = devobject.GetProperty("info.product")
- self.__sources[dev] = V4LSourceDeviceFactory(device=location,
- displayname=info)
+ srcdev = V4LSourceDeviceFactory(device=location,
+ displayname=info)
+ self.__sources[dev] = srcdev
+ self.emit("device-added", srcdev)
elif devobject.QueryCapability("alsa"):
alsatype = devobject.GetProperty("alsa.type")
if alsatype in ["capture", "playback"]:
@@ -169,10 +181,12 @@
self.__sources[dev] = AlsaSourceDeviceFactory(card=card,
device=device,
displayname=info)
+ self.emit("device-added", self.__sources[dev])
elif alsatype == "playback":
self.__sinks[dev] = AlsaSinkDeviceFactory(card=card,
device=device,
displayname=info)
+ self.emit("device-added", self.__sinks[dev])
def __deviceAddedCb(self, device_udi, *args):
self.__processUDI(device_udi)
@@ -180,9 +194,11 @@
def __deviceRemovedCb(self, device_udi, *args):
# FIXME : Notify !
if self.__sources.has_key(device_udi):
+ self.emit("device-removed", self.__sources[device_udi])
del self.__sources[device_udi]
- elif self.__sinkss.has_key(device_udi):
- del self.__sinkss[device_udi]
+ elif self.__sinks.has_key(device_udi):
+ self.emit("device-removed", self.__sinks[device_udi])
+ del self.__sinks[device_udi]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]