pitivi r1278 - in trunk: pitivi pitivi/ui tests
- From: edwardrv svn gnome org
- To: svn-commits-list gnome org
- Subject: pitivi r1278 - in trunk: pitivi pitivi/ui tests
- Date: Fri, 26 Sep 2008 17:14:48 +0000 (UTC)
Author: edwardrv
Date: Fri Sep 26 17:14:48 2008
New Revision: 1278
URL: http://svn.gnome.org/viewvc/pitivi?rev=1278&view=rev
Log:
Fix tabs-instead-of-spaces wrong indentation
Modified:
trunk/pitivi/bin.py
trunk/pitivi/pitivi.py
trunk/pitivi/ui/mainwindow.py
trunk/pitivi/ui/netstream_managerdialog.py
trunk/pitivi/ui/pluginmanagerdialog.py
trunk/pitivi/ui/screencast_managerdialog.py
trunk/pitivi/ui/sourcefactories.py
trunk/pitivi/ui/webcam_managerdialog.py
trunk/tests/testmagnets.py (contents, props changed)
Modified: trunk/pitivi/bin.py
==============================================================================
--- trunk/pitivi/bin.py (original)
+++ trunk/pitivi/bin.py Fri Sep 26 17:14:48 2008
@@ -103,7 +103,7 @@
if self.has_audio:
self.asinkthread = asinkthread
self.add(self.asinkthread)
- self.atee.get_request_pad("src%d").link(self.asinkthread.get_pad("sink"))
+ self.atee.get_request_pad("src%d").link(self.asinkthread.get_pad("sink"))
return True
def setVideoSinkThread(self, vsinkthread):
@@ -524,47 +524,47 @@
"""
def __init__(self):
- self.videosink = plumber.get_video_sink()
+ self.videosink = plumber.get_video_sink()
- self.vsinkthread = gst.Bin('vsinkthread')
- vqueue = gst.element_factory_make('queue')
- timeoverlay = gst.element_factory_make('timeoverlay')
- cspace = gst.element_factory_make('ffmpegcolorspace')
- vscale = gst.element_factory_make('videoscale')
- vscale.props.method = 1
- self.vsinkthread.add(self.videosink,timeoverlay, vqueue, vscale, cspace)
- vqueue.link(timeoverlay)
- timeoverlay.link(self.videosink)
- timeoverlay.set_property("halign","right")
- timeoverlay.set_property("valign","bottom")
- timeoverlay.set_property("deltax",65)
- timeoverlay.set_property("deltay",20)
-
-
- cspace.link(vscale)
- vscale.link(vqueue)
- self.vsinkthread.videosink = self.videosink
- self.vsinkthread.add_pad(gst.GhostPad("sink", cspace.get_pad('sink')))
-
- gst.debug("Creating audio sink")
- self.audiosink = plumber.get_audio_sink()
- self.asinkthread = gst.Bin('asinkthread')
- aqueue = gst.element_factory_make('queue')
- aconv = gst.element_factory_make('audioconvert')
- self.asinkthread.add(self.audiosink, aqueue, aconv)
- aconv.link(aqueue)
- aqueue.link(self.audiosink)
- self.asinkthread.audiosink = self.audiosink
- self.asinkthread.add_pad(gst.GhostPad("sink", aconv.get_pad('sink')))
+ self.vsinkthread = gst.Bin('vsinkthread')
+ vqueue = gst.element_factory_make('queue')
+ timeoverlay = gst.element_factory_make('timeoverlay')
+ cspace = gst.element_factory_make('ffmpegcolorspace')
+ vscale = gst.element_factory_make('videoscale')
+ vscale.props.method = 1
+ self.vsinkthread.add(self.videosink,timeoverlay, vqueue, vscale, cspace)
+ vqueue.link(timeoverlay)
+ timeoverlay.link(self.videosink)
+ timeoverlay.set_property("halign","right")
+ timeoverlay.set_property("valign","bottom")
+ timeoverlay.set_property("deltax",65)
+ timeoverlay.set_property("deltay",20)
+
+
+ cspace.link(vscale)
+ vscale.link(vqueue)
+ self.vsinkthread.videosink = self.videosink
+ self.vsinkthread.add_pad(gst.GhostPad("sink", cspace.get_pad('sink')))
+
+ gst.debug("Creating audio sink")
+ self.audiosink = plumber.get_audio_sink()
+ self.asinkthread = gst.Bin('asinkthread')
+ aqueue = gst.element_factory_make('queue')
+ aconv = gst.element_factory_make('audioconvert')
+ self.asinkthread.add(self.audiosink, aqueue, aconv)
+ aconv.link(aqueue)
+ aqueue.link(self.audiosink)
+ self.asinkthread.audiosink = self.audiosink
+ self.asinkthread.add_pad(gst.GhostPad("sink", aconv.get_pad('sink')))
def connectSink(self,player,is_video,is_audio):
- if is_video is True :
- player.setVideoSinkThread(self.vsinkthread)
- if is_audio is True :
- player.setAudioSinkThread(self.asinkthread)
+ if is_video is True :
+ player.setVideoSinkThread(self.vsinkthread)
+ if is_audio is True :
+ player.setAudioSinkThread(self.asinkthread)
- gst.debug("success connecting sources to SinkBin")
+ gst.debug("success connecting sources to SinkBin")
class SmartCaptureBin(SmartBin):
@@ -586,9 +586,9 @@
def _addSource(self):
- self.q1 = gst.element_factory_make("queue", "webcam-firstvqueue")
+ self.q1 = gst.element_factory_make("queue", "webcam-firstvqueue")
self.q1.props.max_size_time = 10 * gst.SECOND
- self.q2 = gst.element_factory_make("queue", "webcam-firstaqueue")
+ self.q2 = gst.element_factory_make("queue", "webcam-firstaqueue")
self.q2.props.max_size_time = 30 * gst.SECOND
self.q2.props.max_size_buffers = 0
self.q2.props.max_size_bytes = 0
@@ -596,8 +596,8 @@
def _connectSource(self):
self.debug("connecting sources")
- gst.element_link_many(self.videosrc,self.q1,self.vtee)
- gst.element_link_many(self.audiosrc,self.q2,self.atee)
+ gst.element_link_many(self.videosrc,self.q1,self.vtee)
+ gst.element_link_many(self.audiosrc,self.q2,self.atee)
self.debug("finished connecting sources")
def _asyncReset(self, uri, setting):
@@ -615,12 +615,12 @@
#
# This is fixed in gst-plugins-base cvs 0.10.20.1
self.debug("Setting sources to NULL again to reset their timestamps !")
- self.videosrc.set_state(gst.STATE_NULL)
- self.videosrc.set_state(gst.STATE_READY)
- self.audiosrc.set_state(gst.STATE_NULL)
- self.audiosrc.set_state(gst.STATE_READY)
+ self.videosrc.set_state(gst.STATE_NULL)
+ self.videosrc.set_state(gst.STATE_READY)
+ self.audiosrc.set_state(gst.STATE_NULL)
+ self.audiosrc.set_state(gst.STATE_READY)
- SmartBin.record(self, uri, settings)
+ SmartBin.record(self, uri, settings)
# It makes the recording video lag
def record(self, uri, settings=None):
@@ -636,38 +636,38 @@
# FIXME : what is this and what is it doing here ??
class Discover:
"""
- A Pipeline which return audio/video info about the uri stream
+ A Pipeline which return audio/video info about the uri stream
"""
def __init__(self,uri):
- self.is_audio = False
- self.is_video = True
+ self.is_audio = False
+ self.is_video = True
- try:
+ try:
- self.pipeline = gst.parse_launch(" %s ! decodebin name=dbin ! fakesink" % uri)
- except:
- gst.log("Error occured with Disover, StreamBin Detector")
- return
+ self.pipeline = gst.parse_launch(" %s ! decodebin name=dbin ! fakesink" % uri)
+ except:
+ gst.log("Error occured with Disover, StreamBin Detector")
+ return
- self.dbin = self.pipeline.get_by_name("dbin")
- self.no = 0
- self.dbin.connect("new-decoded-pad", self._new_decoded_pad_cb)
+ self.dbin = self.pipeline.get_by_name("dbin")
+ self.no = 0
+ self.dbin.connect("new-decoded-pad", self._new_decoded_pad_cb)
- self.pipeline.set_state(gst.STATE_PLAYING)
+ self.pipeline.set_state(gst.STATE_PLAYING)
def info(self):
- CallbackThread(self.kill).start()
- return (self.is_video,self.is_audio)
+ CallbackThread(self.kill).start()
+ return (self.is_video,self.is_audio)
def _new_decoded_pad_cb(self, dbin, pad, is_last):
- # Does the file contain got audio or video ?
- if "audio" in pad.get_caps().to_string():
- self.is_audio = True
+ # Does the file contain got audio or video ?
+ if "audio" in pad.get_caps().to_string():
+ self.is_audio = True
- elif "video" in pad.get_caps().to_string():
- self.is_video = True
+ elif "video" in pad.get_caps().to_string():
+ self.is_video = True
class SmartStreamBin(SmartBin):
@@ -677,7 +677,7 @@
def __init__(self,uri):
gst.log("Creating new smartcapturebin")
- (self.is_video,self.is_audio) = (True,True)
+ (self.is_video,self.is_audio) = (True,True)
self.uri = uri
SmartBin.__init__(self, "smartcapturebin", has_video=self.is_video,
has_audio=self.is_audio,
@@ -685,24 +685,24 @@
def _addSource(self):
- self.urisrc = gst.element_make_from_uri(gst.URI_SRC,
+ self.urisrc = gst.element_make_from_uri(gst.URI_SRC,
self.uri)
- self.decodebin = gst.element_factory_make("decodebin","decode-smartbin")
- self.videoq = gst.element_factory_make("queue","video-queue")
- self.audioq = gst.element_factory_make("queue","audio-queue")
+ self.decodebin = gst.element_factory_make("decodebin","decode-smartbin")
+ self.videoq = gst.element_factory_make("queue","video-queue")
+ self.audioq = gst.element_factory_make("queue","audio-queue")
- self.add(self.urisrc,self.decodebin,self.videoq,self.audioq)
+ self.add(self.urisrc,self.decodebin,self.videoq,self.audioq)
def _connectSource(self):
self.debug("connecting sources")
- gst.element_link_many(self.urisrc,self.decodebin)
- if self.is_video :
- gst.element_link_many(self.videoq,self.vtee)
- if self.is_audio:
- gst.element_link_many(self.audioq,self.atee)
+ gst.element_link_many(self.urisrc,self.decodebin)
+ if self.is_video :
+ gst.element_link_many(self.videoq,self.vtee)
+ if self.is_audio:
+ gst.element_link_many(self.audioq,self.atee)
- self.decodebin.connect("new-decoded-pad",
+ self.decodebin.connect("new-decoded-pad",
self.on_new_decoded_pad)
self.debug("finished connecting sources")
@@ -716,7 +716,7 @@
if name.startswith("video"):
pad.link(self.videoq.get_pad('sink'))
- elif name.startswith("audio"):
- pad.link(self.audioq.get_pad('sink'))
+ elif name.startswith("audio"):
+ pad.link(self.audioq.get_pad('sink'))
Modified: trunk/pitivi/pitivi.py
==============================================================================
--- trunk/pitivi/pitivi.py (original)
+++ trunk/pitivi/pitivi.py Fri Sep 26 17:14:48 2008
@@ -118,7 +118,7 @@
# get settings
self.settings = GlobalSettings()
self.threads = ThreadMaster()
- #self.screencast = False
+ #self.screencast = False
self.plugin_manager = PluginManager(
self.settings.get_local_plugin_path(),
Modified: trunk/pitivi/ui/mainwindow.py
==============================================================================
--- trunk/pitivi/ui/mainwindow.py (original)
+++ trunk/pitivi/ui/mainwindow.py Fri Sep 26 17:14:48 2008
@@ -96,11 +96,11 @@
instance.PiTiVi.playground.connect("error", self._playGroundErrorCb)
instance.PiTiVi.current.sources.connect_after("file_added", self._sourcesFileAddedCb)
- # Start dbus service
- session_bus = dbus.SessionBus()
- name = dbus.service.BusName("org.gnome.pitivi", bus=session_bus)
- object = pitivi_dbus(name)
-
+ # Start dbus service
+ session_bus = dbus.SessionBus()
+ name = dbus.service.BusName("org.gnome.pitivi", bus=session_bus)
+ object = pitivi_dbus(name)
+
self.show_all()
def _encodingDialogDestroyCb(self, unused_dialog):
@@ -178,13 +178,13 @@
("PluginManager", gtk.STOCK_PREFERENCES ,
_("_Plugins..."),
None, _("Manage plugins"), self._pluginManagerCb),
- ("ImportfromCam", gtk.STOCK_ADD ,
+ ("ImportfromCam", gtk.STOCK_ADD ,
_("_Import from Webcam.."),
None, _("Import Camera stream"), self._ImportWebcam),
- ("Screencast", gtk.STOCK_ADD ,
+ ("Screencast", gtk.STOCK_ADD ,
_("_Make screencast.."),
None, _("Capture the desktop"), self._Screencast),
- ("NetstreamCapture", gtk.STOCK_ADD ,
+ ("NetstreamCapture", gtk.STOCK_ADD ,
_("_Capture Network Stream.."),
None, _("Capture Network Stream"), self._ImportNetstream),
("Quit", gtk.STOCK_QUIT, None, None, None, self._quitCb),
@@ -330,14 +330,14 @@
def _destroyCb(self, unused_widget, data=None):
- # Quit connection to istanbul/switch off savemode
- try:
- bus = dbus.SessionBus()
- remote_object = bus.get_object("org.gnome.istanbul", "/state")
- self.iface = dbus.Interface(remote_object, "org.gnome.istanbul")
- self.iface.savemode(False)
- except:
- pass
+ # Quit connection to istanbul/switch off savemode
+ try:
+ bus = dbus.SessionBus()
+ remote_object = bus.get_object("org.gnome.istanbul", "/state")
+ self.iface = dbus.Interface(remote_object, "org.gnome.istanbul")
+ self.iface.savemode(False)
+ except:
+ pass
instance.PiTiVi.shutdown()
@@ -420,7 +420,7 @@
"Brandon Lewis <brandon_lewis berkeley edu> (UI)",
"Luca Della Santina <dellasantina farm unipi it>",
"Thijs Vermeir <thijsvermeir gmail com>",
- "Sarath Lakshman <sarathlakshman slynux org>"]
+ "Sarath Lakshman <sarathlakshman slynux org>"]
abt.set_authors(authors)
abt.set_license(_("GNU Lesser General Public License\nSee http://www.gnu.org/copyleft/lesser.html for more details"))
abt.set_icon_from_file(configure.get_global_pixmap_dir() + "/pitivi.png")
@@ -440,18 +440,18 @@
# Import from Webcam callback
def _ImportWebcam(self,unused_action):
- WebcamManagerDialog()
-
+ WebcamManagerDialog()
+
# Capture network stream callback
def _ImportNetstream(self,unused_action):
- NetstreamManagerDialog()
+ NetstreamManagerDialog()
# screencast callback
def _Screencast(self,unused_action):
- ScreencastManagerDialog()
+ ScreencastManagerDialog()
-
+
## PiTiVi main object callbacks
@@ -560,11 +560,11 @@
class pitivi_dbus(dbus.service.Object):
def __init__(self, bus_name, object_path="/import"):
dbus.service.Object.__init__(self, bus_name, object_path)
- self.sourcefactories = SourceFactoriesWidget()
+ self.sourcefactories = SourceFactoriesWidget()
@dbus.service.method("org.gnome.pitivi")
def AddFiles(self, filepath):
- self.sourcefactories.sourcelist.addFiles(filepath)
+ self.sourcefactories.sourcelist.addFiles(filepath)
return True
class EncodingDialog(GladeWindow):
Modified: trunk/pitivi/ui/netstream_managerdialog.py
==============================================================================
--- trunk/pitivi/ui/netstream_managerdialog.py (original)
+++ trunk/pitivi/ui/netstream_managerdialog.py Fri Sep 26 17:14:48 2008
@@ -37,150 +37,150 @@
class NetstreamManagerDialog(object):
- def __init__(self):
- self.sourcefactories = SourceFactoriesWidget()
- self.capture_pipe = None
- self.player = None
+ def __init__(self):
+ self.sourcefactories = SourceFactoriesWidget()
+ self.capture_pipe = None
+ self.player = None
- glade_dir = os.path.dirname(os.path.abspath(__file__))
- self.objectpool_ui = gtk.glade.XML(os.path.join(glade_dir, "net_capture.glade"))
- self.stream_window = self.objectpool_ui.get_widget("network_capture")
- self.screen = self.objectpool_ui.get_widget("screen")
- self.capture_btn = self.objectpool_ui.get_widget("capture_btn")
- self.preview_btn = self.objectpool_ui.get_widget("preview_btn")
- self.close_btn = self.objectpool_ui.get_widget("close_btn")
- self.port = self.objectpool_ui.get_widget("port")
- self.address = self.objectpool_ui.get_widget("address")
- self.uri = self.objectpool_ui.get_widget("url")
- self.status = self.objectpool_ui.get_widget("status")
+ glade_dir = os.path.dirname(os.path.abspath(__file__))
+ self.objectpool_ui = gtk.glade.XML(os.path.join(glade_dir, "net_capture.glade"))
+ self.stream_window = self.objectpool_ui.get_widget("network_capture")
+ self.screen = self.objectpool_ui.get_widget("screen")
+ self.capture_btn = self.objectpool_ui.get_widget("capture_btn")
+ self.preview_btn = self.objectpool_ui.get_widget("preview_btn")
+ self.close_btn = self.objectpool_ui.get_widget("close_btn")
+ self.port = self.objectpool_ui.get_widget("port")
+ self.address = self.objectpool_ui.get_widget("address")
+ self.uri = self.objectpool_ui.get_widget("url")
+ self.status = self.objectpool_ui.get_widget("status")
- self.http_radiobtn = self.objectpool_ui.get_widget("protocol")
- self.udp_radiobtn = self.objectpool_ui.get_widget("udp")
- self.rtsp_radiobtn = self.objectpool_ui.get_widget("rtsp")
+ self.http_radiobtn = self.objectpool_ui.get_widget("protocol")
+ self.udp_radiobtn = self.objectpool_ui.get_widget("udp")
+ self.rtsp_radiobtn = self.objectpool_ui.get_widget("rtsp")
- self.http_radiobtn.connect("toggled",self.on_protocol_toggled,"http")
- self.udp_radiobtn.connect("toggled",self.on_protocol_toggled,"udp")
- self.rtsp_radiobtn.connect("toggled",self.on_protocol_toggled,"rtsp")
- self.address.connect("changed",self.on_address_port_changed,"address")
- self.port.connect("changed",self.on_address_port_changed,"port")
+ self.http_radiobtn.connect("toggled",self.on_protocol_toggled,"http")
+ self.udp_radiobtn.connect("toggled",self.on_protocol_toggled,"udp")
+ self.rtsp_radiobtn.connect("toggled",self.on_protocol_toggled,"rtsp")
+ self.address.connect("changed",self.on_address_port_changed,"address")
+ self.port.connect("changed",self.on_address_port_changed,"port")
- self.close_btn.connect("clicked",self.close)
- self.stream_window.connect("destroy",self.close)
+ self.close_btn.connect("clicked",self.close)
+ self.stream_window.connect("destroy",self.close)
- dic = { "on_close_clicked" : self.close, "on_preview_btn_clicked":self.live_pipeline,"on_capture_btn_clicked":self.capture_pipeline}
+ dic = { "on_close_clicked" : self.close, "on_preview_btn_clicked":self.live_pipeline,"on_capture_btn_clicked":self.capture_pipeline}
- self.objectpool_ui.signal_autoconnect(dic)
+ self.objectpool_ui.signal_autoconnect(dic)
- self.capture_btn = self.capture_btn.get_children()[0]
- self.capture_btn = self.capture_btn.get_children()[0].get_children()[1]
- self.capture_btn.set_label("Capture")
+ self.capture_btn = self.capture_btn.get_children()[0]
+ self.capture_btn = self.capture_btn.get_children()[0].get_children()[1]
+ self.capture_btn.set_label("Capture")
- # For Setting up audio,video sinks
- def setSinks(self,uri):
- gst.debug("SmartStreamBin player created")
- self.player=SmartStreamBin(uri)
- sink = SinkBin()
- sink.connectSink(self.player,self.player.is_video,self.player.is_audio)
- self.player.set_state(gst.STATE_PLAYING)
+ # For Setting up audio,video sinks
+ def setSinks(self,uri):
+ gst.debug("SmartStreamBin player created")
+ self.player=SmartStreamBin(uri)
+ sink = SinkBin()
+ sink.connectSink(self.player,self.player.is_video,self.player.is_audio)
+ self.player.set_state(gst.STATE_PLAYING)
- bus = self.player.get_bus()
- bus.add_signal_watch()
- bus.enable_sync_message_emission()
- bus.connect('sync-message::element', self.on_sync_message)
+ bus = self.player.get_bus()
+ bus.add_signal_watch()
+ bus.enable_sync_message_emission()
+ bus.connect('sync-message::element', self.on_sync_message)
- # Create live display pipeline
- def live_pipeline(self,w=None):
+ # Create live display pipeline
+ def live_pipeline(self,w=None):
- if self.player:
- self.player.set_state(gst.STATE_NULL)
+ if self.player:
+ self.player.set_state(gst.STATE_NULL)
- uri = self.uri.get_text()
+ uri = self.uri.get_text()
- if uri != None :
+ if uri != None :
- if gst.uri_is_valid (uri) is False:
- self.status.set_label("Invalid URI. Please verify.")
- gst.debug("Invalid URI")
- return
- if gst.uri_protocol_is_supported(gst.URI_SRC,uri.split('://')[0]):
- self.setSinks(uri)
- self.player.set_state(gst.STATE_PLAYING)
- self.status.push(self.status_id,"")
- else:
- self.status.set_label("Unsupported Protocol. Please verify the URI.")
- gst.debug("Unsupported Protocol")
+ if gst.uri_is_valid (uri) is False:
+ self.status.set_label("Invalid URI. Please verify.")
+ gst.debug("Invalid URI")
+ return
+ if gst.uri_protocol_is_supported(gst.URI_SRC,uri.split('://')[0]):
+ self.setSinks(uri)
+ self.player.set_state(gst.STATE_PLAYING)
+ self.status.push(self.status_id,"")
+ else:
+ self.status.set_label("Unsupported Protocol. Please verify the URI.")
+ gst.debug("Unsupported Protocol")
- # Stream capture pipeline
- def capture_pipeline(self,w=None):
+ # Stream capture pipeline
+ def capture_pipeline(self,w=None):
- uri = self.uri.get_text()
- if self.capture_btn.get_label() == "Capture":
- if self.player is False and gst.uri_protocol_is_supported(gst.URI_SRC,uri.split('://')[0]) is False :
- self.status.set_label("Unsupported Protocol. Please verify the URI.")
- return
- elif self.player is False:
- self.player.set_state(gst.STATE_NULL)
- self.setSinks(uri)
+ uri = self.uri.get_text()
+ if self.capture_btn.get_label() == "Capture":
+ if self.player is False and gst.uri_protocol_is_supported(gst.URI_SRC,uri.split('://')[0]) is False :
+ self.status.set_label("Unsupported Protocol. Please verify the URI.")
+ return
+ elif self.player is False:
+ self.player.set_state(gst.STATE_NULL)
+ self.setSinks(uri)
- gst.debug("recording started")
- self.filepath = 'file://'+tempfile.mktemp()+'.ogg'
- self.player.record(self.filepath,ExportSettings())
- self.capture_btn.set_label("Stop")
+ gst.debug("recording started")
+ self.filepath = 'file://'+tempfile.mktemp()+'.ogg'
+ self.player.record(self.filepath,ExportSettings())
+ self.capture_btn.set_label("Stop")
- else:
- gst.debug("recording stopped")
- self.player.stopRecording()
- self.sourcefactories.sourcelist.addFiles([self.filepath])
- self.capture_btn.set_label("Capture")
+ else:
+ gst.debug("recording stopped")
+ self.player.stopRecording()
+ self.sourcefactories.sourcelist.addFiles([self.filepath])
+ self.capture_btn.set_label("Capture")
- def on_message(self,bus,message):
- t = message.type
- if t == gst.MESSAGE_EOS:
- if self.player:
- self.player.set_state(gst.gst.STATE_NULL)
- self.capture_btn.set_label("Capture")
+ def on_message(self,bus,message):
+ t = message.type
+ if t == gst.MESSAGE_EOS:
+ if self.player:
+ self.player.set_state(gst.gst.STATE_NULL)
+ self.capture_btn.set_label("Capture")
- elif t == gst.MESSAGE_ERROR:
- err,debug = message.parse_error()
- print "Error: %s" %err, debug
- if self.player:
- self.player.set_state(gst.STATE_NULL)
- self.capture_btn.set_label("Capture")
+ elif t == gst.MESSAGE_ERROR:
+ err,debug = message.parse_error()
+ print "Error: %s" %err, debug
+ if self.player:
+ self.player.set_state(gst.STATE_NULL)
+ self.capture_btn.set_label("Capture")
- def on_sync_message(self,bus,message):
- if message.structure is None :
- return
- message_name = message.structure.get_name()
- if message_name == 'prepare-xwindow-id':
- imagesink = message.src
- imagesink.set_property('force-aspect-ratio',True)
- imagesink.set_xwindow_id(self.screen.window.xid)
+ def on_sync_message(self,bus,message):
+ if message.structure is None :
+ return
+ message_name = message.structure.get_name()
+ if message_name == 'prepare-xwindow-id':
+ imagesink = message.src
+ imagesink.set_property('force-aspect-ratio',True)
+ imagesink.set_xwindow_id(self.screen.window.xid)
- # radio buttons address set callback
- def on_protocol_toggled(self,widget,data=None):
- self.uri.set_text(data+"://"+self.uri.get_text().split('://')[1])
+ # radio buttons address set callback
+ def on_protocol_toggled(self,widget,data=None):
+ self.uri.set_text(data+"://"+self.uri.get_text().split('://')[1])
- def on_address_port_changed(self,widget,data=None):
- self.uri.set_text(self.uri.get_text().split('://')[0] + '://' + self.address.get_text() + ['',':'][self.port.get_text().isdigit()] + self.port.get_text())
+ def on_address_port_changed(self,widget,data=None):
+ self.uri.set_text(self.uri.get_text().split('://')[0] + '://' + self.address.get_text() + ['',':'][self.port.get_text().isdigit()] + self.port.get_text())
- def close(self,w):
- self.stream_window.destroy()
- if self.player:
- self.player.set_state(gst.STATE_NULL)
- if self.capture_pipe:
- self.capture_pipe.set_state(gst.STATE_NULL)
+ def close(self,w):
+ self.stream_window.destroy()
+ if self.player:
+ self.player.set_state(gst.STATE_NULL)
+ if self.capture_pipe:
+ self.capture_pipe.set_state(gst.STATE_NULL)
Modified: trunk/pitivi/ui/pluginmanagerdialog.py
==============================================================================
--- trunk/pitivi/ui/pluginmanagerdialog.py (original)
+++ trunk/pitivi/ui/pluginmanagerdialog.py Fri Sep 26 17:14:48 2008
@@ -67,13 +67,13 @@
def _initialize_plugin_tree(self, tree):
""" Perform treeview initialization """
- self.model = gtk.ListStore( gobject.TYPE_BOOLEAN,
+ self.model = gtk.ListStore( gobject.TYPE_BOOLEAN,
gobject.TYPE_STRING,
gobject.TYPE_STRING,
object)
# init tree view
- tree.set_model(self.model)
+ tree.set_model(self.model)
tree.get_selection().set_mode(gtk.SELECTION_MULTIPLE)
# Enable Drag&Drop
Modified: trunk/pitivi/ui/screencast_managerdialog.py
==============================================================================
--- trunk/pitivi/ui/screencast_managerdialog.py (original)
+++ trunk/pitivi/ui/screencast_managerdialog.py Fri Sep 26 17:14:48 2008
@@ -39,66 +39,66 @@
class ScreencastManagerDialog(object):
- def __init__(self):
- gst.log("Creating new ScreencastManager Dialog")
+ def __init__(self):
+ gst.log("Creating new ScreencastManager Dialog")
- # Create gtk widget using glade model
- glade_dir = os.path.dirname(os.path.abspath(__file__))
- pool_ui = gtk.glade.XML(os.path.join(glade_dir, "screencast_manager.glade"))
+ # Create gtk widget using glade model
+ glade_dir = os.path.dirname(os.path.abspath(__file__))
+ pool_ui = gtk.glade.XML(os.path.join(glade_dir, "screencast_manager.glade"))
- self.window = pool_ui.get_widget("screencast_window")
- self.close_btn = pool_ui.get_widget("btn_close")
- self.ok_btn = pool_ui.get_widget("btn_ok")
- self.screencast_btn = pool_ui.get_widget("btn_screencast")
- self.istanbul_btn = pool_ui.get_widget("btn_istanbul")
+ self.window = pool_ui.get_widget("screencast_window")
+ self.close_btn = pool_ui.get_widget("btn_close")
+ self.ok_btn = pool_ui.get_widget("btn_ok")
+ self.screencast_btn = pool_ui.get_widget("btn_screencast")
+ self.istanbul_btn = pool_ui.get_widget("btn_istanbul")
- self.close_btn.connect("clicked",self.close)
- self.ok_btn.connect("clicked",self.ok)
- self.istanbul_btn.connect("clicked",self.start_istanbul)
- self.screencast_btn.set_active(instance.PiTiVi.screencast)
+ self.close_btn.connect("clicked",self.close)
+ self.ok_btn.connect("clicked",self.ok)
+ self.istanbul_btn.connect("clicked",self.start_istanbul)
+ self.screencast_btn.set_active(instance.PiTiVi.screencast)
- self.dbus_connect()
+ self.dbus_connect()
- def dbus_connect(self):
- # Connect to istanbul dbus service
- try:
- bus = dbus.SessionBus()
- remote_object = bus.get_object("org.gnome.istanbul", "/state")
- self.iface = dbus.Interface(remote_object, "org.gnome.istanbul")
- self.istanbul_btn.hide()
- self.screencast_btn.set_sensitive(True)
- self.ok_btn.set_sensitive(True)
+ def dbus_connect(self):
+ # Connect to istanbul dbus service
+ try:
+ bus = dbus.SessionBus()
+ remote_object = bus.get_object("org.gnome.istanbul", "/state")
+ self.iface = dbus.Interface(remote_object, "org.gnome.istanbul")
+ self.istanbul_btn.hide()
+ self.screencast_btn.set_sensitive(True)
+ self.ok_btn.set_sensitive(True)
- except:
- self.screencast_btn.set_sensitive(False)
- self.ok_btn.set_sensitive(False)
+ except:
+ self.screencast_btn.set_sensitive(False)
+ self.ok_btn.set_sensitive(False)
- def close(self,w):
- self.window.destroy()
+ def close(self,w):
+ self.window.destroy()
- def ok(self,w):
- self.screencast(None)
- self.close(None)
+ def ok(self,w):
+ self.screencast(None)
+ self.close(None)
- def start_thread_istanbul(self):
- os.system("istanbul")
+ def start_thread_istanbul(self):
+ os.system("istanbul")
- # Start istanbul using thread module
- def start_istanbul(self,w):
- thread.start_new_thread(self.start_thread_istanbul,())
- time.sleep(2)
- self.dbus_connect()
+ # Start istanbul using thread module
+ def start_istanbul(self,w):
+ thread.start_new_thread(self.start_thread_istanbul,())
+ time.sleep(2)
+ self.dbus_connect()
- def screencast(self,w):
- if self.screencast_btn.get_active():
- self.iface.savemode(True)
- instance.PiTiVi.screencast = True
- else:
- self.iface.savemode(False)
- instance.PiTiVi.screencast = False
+ def screencast(self,w):
+ if self.screencast_btn.get_active():
+ self.iface.savemode(True)
+ instance.PiTiVi.screencast = True
+ else:
+ self.iface.savemode(False)
+ instance.PiTiVi.screencast = False
Modified: trunk/pitivi/ui/sourcefactories.py
==============================================================================
--- trunk/pitivi/ui/sourcefactories.py (original)
+++ trunk/pitivi/ui/sourcefactories.py Fri Sep 26 17:14:48 2008
@@ -413,7 +413,7 @@
self.addFolders(filenames)
else:
self.addFiles(filenames)
- print filenames
+ print filenames
else:
dialogbox.destroy()
self._importDialog = None
Modified: trunk/pitivi/ui/webcam_managerdialog.py
==============================================================================
--- trunk/pitivi/ui/webcam_managerdialog.py (original)
+++ trunk/pitivi/ui/webcam_managerdialog.py Fri Sep 26 17:14:48 2008
@@ -35,80 +35,80 @@
class WebcamManagerDialog(object):
- def __init__(self):
- gst.log("Creating new WebcamManager Dialog")
+ def __init__(self):
+ gst.log("Creating new WebcamManager Dialog")
- # Create gtk widget using glade model
- glade_dir = os.path.dirname(os.path.abspath(__file__))
- self.cam_ui = gtk.glade.XML(os.path.join(glade_dir, "cam_capture.glade"))
- self.cam_window = self.cam_ui.get_widget("cam_capture")
- self.draw_window = self.cam_ui.get_widget("draw_window")
- self.record_btn = self.cam_ui.get_widget("record_btn")
- self.close_btn = self.cam_ui.get_widget("close_btn")
-
- self.close_btn.connect("clicked",self.close)
- self.record_btn.connect("clicked", self.threaded_recording)
- self.cam_window.connect("destroy",self.close)
-
- self.record_btn = self.record_btn.get_children()[0]
- self.record_btn = self.record_btn.get_children()[0].get_children()[1]
- self.record_btn.set_label("Start Recording")
-
- self.sourcefactories = SourceFactoriesWidget()
-
- gst.debug("SmartCaptureBin player created")
- self.player = SmartCaptureBin()
- self.setSinks()
-
-
-
- self.player.set_state(gst.STATE_PLAYING)
-
- # Perform record in a seperate thread
- def threaded_recording(self,w):
- CallbackThread(self.do_recording,w).start()
-
-
- # Record button action callback
- def do_recording(self, w):
- if self.record_btn.get_label() == "Start Recording":
- gst.debug("recording started")
- self.filepath = 'file://'+tempfile.mktemp()+'.ogg'
- self.player.record(self.filepath,ExportSettings())
- self.record_btn.set_label("Stop Recording")
- self.player.set_state(gst.STATE_PLAYING)
-
-
-
- else:
- gst.debug("recording stopped")
- self.player.stopRecording()
- self.sourcefactories.sourcelist.addFiles([self.filepath])
- self.player.set_state(gst.STATE_PLAYING)
- self.record_btn.set_label("Start Recording")
-
- # For Setting up audio,video sinks
- def setSinks(self):
- sink = SinkBin()
- sink.connectSink(self.player,True,True)
- bus = self.player.get_bus()
- bus.add_signal_watch()
- bus.enable_sync_message_emission()
- bus.connect('sync-message::element', self.on_sync_message)
-
- # Close the Webcamdialog
- def close(self,w):
- self.cam_window.destroy()
- self.player.set_state(gst.STATE_NULL)
-
- # For draw_window syncs
- def on_sync_message(self, bus, message):
- if message.structure is None:
- return
- message_name = message.structure.get_name()
- if message_name == 'prepare-xwindow-id':
- # Assign the viewport
- imagesink = message.src
- imagesink.set_property('force-aspect-ratio', True)
- imagesink.set_xwindow_id(self.draw_window.window.xid)
+ # Create gtk widget using glade model
+ glade_dir = os.path.dirname(os.path.abspath(__file__))
+ self.cam_ui = gtk.glade.XML(os.path.join(glade_dir, "cam_capture.glade"))
+ self.cam_window = self.cam_ui.get_widget("cam_capture")
+ self.draw_window = self.cam_ui.get_widget("draw_window")
+ self.record_btn = self.cam_ui.get_widget("record_btn")
+ self.close_btn = self.cam_ui.get_widget("close_btn")
+
+ self.close_btn.connect("clicked",self.close)
+ self.record_btn.connect("clicked", self.threaded_recording)
+ self.cam_window.connect("destroy",self.close)
+
+ self.record_btn = self.record_btn.get_children()[0]
+ self.record_btn = self.record_btn.get_children()[0].get_children()[1]
+ self.record_btn.set_label("Start Recording")
+
+ self.sourcefactories = SourceFactoriesWidget()
+
+ gst.debug("SmartCaptureBin player created")
+ self.player = SmartCaptureBin()
+ self.setSinks()
+
+
+
+ self.player.set_state(gst.STATE_PLAYING)
+
+ # Perform record in a seperate thread
+ def threaded_recording(self,w):
+ CallbackThread(self.do_recording,w).start()
+
+
+ # Record button action callback
+ def do_recording(self, w):
+ if self.record_btn.get_label() == "Start Recording":
+ gst.debug("recording started")
+ self.filepath = 'file://'+tempfile.mktemp()+'.ogg'
+ self.player.record(self.filepath,ExportSettings())
+ self.record_btn.set_label("Stop Recording")
+ self.player.set_state(gst.STATE_PLAYING)
+
+
+
+ else:
+ gst.debug("recording stopped")
+ self.player.stopRecording()
+ self.sourcefactories.sourcelist.addFiles([self.filepath])
+ self.player.set_state(gst.STATE_PLAYING)
+ self.record_btn.set_label("Start Recording")
+
+ # For Setting up audio,video sinks
+ def setSinks(self):
+ sink = SinkBin()
+ sink.connectSink(self.player,True,True)
+ bus = self.player.get_bus()
+ bus.add_signal_watch()
+ bus.enable_sync_message_emission()
+ bus.connect('sync-message::element', self.on_sync_message)
+
+ # Close the Webcamdialog
+ def close(self,w):
+ self.cam_window.destroy()
+ self.player.set_state(gst.STATE_NULL)
+
+ # For draw_window syncs
+ def on_sync_message(self, bus, message):
+ if message.structure is None:
+ return
+ message_name = message.structure.get_name()
+ if message_name == 'prepare-xwindow-id':
+ # Assign the viewport
+ imagesink = message.src
+ imagesink.set_property('force-aspect-ratio', True)
+ imagesink.set_xwindow_id(self.draw_window.window.xid)
Modified: trunk/tests/testmagnets.py
==============================================================================
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]