pitivi r1264 - trunk/pitivi/ui



Author: edwardrv
Date: Fri Sep 26 17:12:05 2008
New Revision: 1264
URL: http://svn.gnome.org/viewvc/pitivi?rev=1264&view=rev

Log:
Screencast support added

Added:
   trunk/pitivi/ui/screencast_manager.glade
   trunk/pitivi/ui/screencast_managerdialog.py
Modified:
   trunk/pitivi/ui/actions.xml
   trunk/pitivi/ui/mainwindow.py

Modified: trunk/pitivi/ui/actions.xml
==============================================================================
--- trunk/pitivi/ui/actions.xml	(original)
+++ trunk/pitivi/ui/actions.xml	Fri Sep 26 17:12:05 2008
@@ -11,6 +11,7 @@
       <menuitem action="ImportSourcesFolder" />
       <menuitem action="ImportfromCam" />
       <menuitem action="NetstreamCapture" />
+      <menuitem action="Screencast" />
       <separator />
       <menuitem action="RenderProject" />
       <separator />

Modified: trunk/pitivi/ui/mainwindow.py
==============================================================================
--- trunk/pitivi/ui/mainwindow.py	(original)
+++ trunk/pitivi/ui/mainwindow.py	Fri Sep 26 17:12:05 2008
@@ -50,10 +50,15 @@
 from pluginmanagerdialog import PluginManagerDialog
 from webcam_managerdialog import WebcamManagerDialog
 from netstream_managerdialog import NetstreamManagerDialog
+from screencast_managerdialog import ScreencastManagerDialog
 from pitivi.configure import pitivi_version, APPNAME
 from glade import GladeWindow
 from exportsettingswidget import ExportSettingsDialog
 
+import dbus
+import dbus.service
+import dbus.glib
+
 if have_gconf:
     D_G_INTERFACE = "/desktop/gnome/interface"
 
@@ -91,6 +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)
+	
         self.show_all()
 
     def _encodingDialogDestroyCb(self, unused_dialog):
@@ -171,6 +181,9 @@
 	    ("ImportfromCam", gtk.STOCK_ADD ,
              _("_Import from Webcam.."),
              None, _("Import Camera stream"), self._ImportWebcam),   
+	    ("Screencast", gtk.STOCK_ADD ,
+             _("_Make screencast.."),
+             None, _("Capture the desktop"), self._Screencast),   
 	    ("NetstreamCapture", gtk.STOCK_ADD ,
              _("_Capture Network Stream.."),
              None, _("Capture Network Stream"), self._ImportNetstream), 
@@ -205,7 +218,7 @@
             elif action.get_name() in [
                 "ProjectSettings", "Quit", "File", "Edit", "Help",
                 "About", "View", "FullScreen", "ImportSources",
-                "ImportSourcesFolder", "AdvancedView", "PluginManager","ImportfromCam","NetstreamCapture"]:
+                "ImportSourcesFolder", "AdvancedView", "PluginManager","ImportfromCam","NetstreamCapture","Screencast"]:
                 action.set_sensitive(True)
             elif action.get_name() in ["SaveProject", "SaveProjectAs",
                     "NewProject", "OpenProject"]:
@@ -423,6 +436,10 @@
     def _ImportNetstream(self,unused_action):
 	NetstreamManagerDialog()
 
+    # screencast callback
+    def _Screencast(self,unused_action):
+	ScreencastManagerDialog()
+
 	
 
     ## PiTiVi main object callbacks
@@ -528,6 +545,17 @@
         return ret
 
 
+# dbus object class
+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()
+
+    @dbus.service.method("org.gnome.pitivi")
+    def AddFiles(self, filepath):
+	self.sourcefactories.sourcelist.addFiles(filepath)
+        return True
+
 class EncodingDialog(GladeWindow):
     """ Encoding dialog box """
     glade_file = "encodingdialog.glade"

Added: trunk/pitivi/ui/screencast_manager.glade
==============================================================================
--- (empty file)
+++ trunk/pitivi/ui/screencast_manager.glade	Fri Sep 26 17:12:05 2008
@@ -0,0 +1,288 @@
+<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
+<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd";>
+
+<glade-interface>
+<requires lib="gnome"/>
+
+<widget class="GtkDialog" id="screencast_window">
+  <property name="width_request">0</property>
+  <property name="visible">True</property>
+  <property name="title" translatable="yes">Screencast Desktop</property>
+  <property name="type">GTK_WINDOW_TOPLEVEL</property>
+  <property name="window_position">GTK_WIN_POS_NONE</property>
+  <property name="modal">False</property>
+  <property name="resizable">True</property>
+  <property name="destroy_with_parent">False</property>
+  <property name="decorated">True</property>
+  <property name="skip_taskbar_hint">False</property>
+  <property name="skip_pager_hint">False</property>
+  <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
+  <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+  <property name="focus_on_map">True</property>
+  <property name="urgency_hint">False</property>
+  <property name="has_separator">True</property>
+
+  <child internal-child="vbox">
+    <widget class="GtkVBox" id="dialog-vbox4">
+      <property name="width_request">266</property>
+      <property name="visible">True</property>
+      <property name="homogeneous">False</property>
+      <property name="spacing">0</property>
+
+      <child internal-child="action_area">
+	<widget class="GtkHButtonBox" id="dialog-action_area4">
+	  <property name="visible">True</property>
+	  <property name="layout_style">GTK_BUTTONBOX_END</property>
+
+	  <child>
+	    <widget class="GtkButton" id="btn_close">
+	      <property name="visible">True</property>
+	      <property name="can_default">True</property>
+	      <property name="can_focus">True</property>
+	      <property name="label">gtk-cancel</property>
+	      <property name="use_stock">True</property>
+	      <property name="relief">GTK_RELIEF_NORMAL</property>
+	      <property name="focus_on_click">True</property>
+	      <property name="response_id">-6</property>
+	    </widget>
+	  </child>
+
+	  <child>
+	    <widget class="GtkButton" id="btn_ok">
+	      <property name="visible">True</property>
+	      <property name="can_default">True</property>
+	      <property name="can_focus">True</property>
+	      <property name="label">gtk-ok</property>
+	      <property name="use_stock">True</property>
+	      <property name="relief">GTK_RELIEF_NORMAL</property>
+	      <property name="focus_on_click">True</property>
+	      <property name="response_id">-5</property>
+	      <signal name="clicked" handler="on_btn_ok_clicked" last_modification_time="Sat, 26 Jul 2008 01:54:46 GMT"/>
+	    </widget>
+	  </child>
+	</widget>
+	<packing>
+	  <property name="padding">0</property>
+	  <property name="expand">False</property>
+	  <property name="fill">True</property>
+	  <property name="pack_type">GTK_PACK_END</property>
+	</packing>
+      </child>
+
+      <child>
+	<widget class="GtkHBox" id="hbox1">
+	  <property name="visible">True</property>
+	  <property name="homogeneous">False</property>
+	  <property name="spacing">0</property>
+
+	  <child>
+	    <widget class="GtkLabel" id="label3">
+	      <property name="width_request">40</property>
+	      <property name="visible">True</property>
+	      <property name="label" translatable="yes"></property>
+	      <property name="use_underline">False</property>
+	      <property name="use_markup">False</property>
+	      <property name="justify">GTK_JUSTIFY_LEFT</property>
+	      <property name="wrap">False</property>
+	      <property name="selectable">False</property>
+	      <property name="xalign">0.5</property>
+	      <property name="yalign">0.5</property>
+	      <property name="xpad">0</property>
+	      <property name="ypad">0</property>
+	      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+	      <property name="width_chars">-1</property>
+	      <property name="single_line_mode">False</property>
+	      <property name="angle">0</property>
+	    </widget>
+	    <packing>
+	      <property name="padding">0</property>
+	      <property name="expand">False</property>
+	      <property name="fill">False</property>
+	    </packing>
+	  </child>
+
+	  <child>
+	    <widget class="GtkVBox" id="vbox1">
+	      <property name="visible">True</property>
+	      <property name="homogeneous">False</property>
+	      <property name="spacing">0</property>
+
+	      <child>
+		<widget class="GtkLabel" id="label4">
+		  <property name="height_request">21</property>
+		  <property name="visible">True</property>
+		  <property name="label" translatable="yes"></property>
+		  <property name="use_underline">False</property>
+		  <property name="use_markup">False</property>
+		  <property name="justify">GTK_JUSTIFY_LEFT</property>
+		  <property name="wrap">False</property>
+		  <property name="selectable">False</property>
+		  <property name="xalign">0.5</property>
+		  <property name="yalign">0.5</property>
+		  <property name="xpad">0</property>
+		  <property name="ypad">0</property>
+		  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		  <property name="width_chars">-1</property>
+		  <property name="single_line_mode">False</property>
+		  <property name="angle">0</property>
+		</widget>
+		<packing>
+		  <property name="padding">0</property>
+		  <property name="expand">False</property>
+		  <property name="fill">False</property>
+		</packing>
+	      </child>
+
+	      <child>
+		<widget class="GtkToggleButton" id="btn_screencast">
+		  <property name="width_request">125</property>
+		  <property name="height_request">51</property>
+		  <property name="visible">True</property>
+		  <property name="can_focus">True</property>
+		  <property name="relief">GTK_RELIEF_HALF</property>
+		  <property name="focus_on_click">True</property>
+		  <property name="active">False</property>
+		  <property name="inconsistent">False</property>
+		  <signal name="toggled" handler="on_btn_screencast_toggled" last_modification_time="Sat, 26 Jul 2008 01:54:32 GMT"/>
+
+		  <child>
+		    <widget class="GtkAlignment" id="alignment1">
+		      <property name="visible">True</property>
+		      <property name="xalign">0.5</property>
+		      <property name="yalign">0.5</property>
+		      <property name="xscale">0</property>
+		      <property name="yscale">0</property>
+		      <property name="top_padding">0</property>
+		      <property name="bottom_padding">0</property>
+		      <property name="left_padding">0</property>
+		      <property name="right_padding">0</property>
+
+		      <child>
+			<widget class="GtkHBox" id="hbox2">
+			  <property name="visible">True</property>
+			  <property name="homogeneous">False</property>
+			  <property name="spacing">2</property>
+
+			  <child>
+			    <widget class="GtkImage" id="image1">
+			      <property name="visible">True</property>
+			      <property name="stock">gtk-select-color</property>
+			      <property name="icon_size">4</property>
+			      <property name="xalign">0.5</property>
+			      <property name="yalign">0.5</property>
+			      <property name="xpad">0</property>
+			      <property name="ypad">0</property>
+			    </widget>
+			    <packing>
+			      <property name="padding">0</property>
+			      <property name="expand">False</property>
+			      <property name="fill">False</property>
+			    </packing>
+			  </child>
+
+			  <child>
+			    <widget class="GtkLabel" id="label1">
+			      <property name="visible">True</property>
+			      <property name="label" translatable="yes">Screen Cast</property>
+			      <property name="use_underline">True</property>
+			      <property name="use_markup">False</property>
+			      <property name="justify">GTK_JUSTIFY_LEFT</property>
+			      <property name="wrap">False</property>
+			      <property name="selectable">False</property>
+			      <property name="xalign">0.5</property>
+			      <property name="yalign">0.5</property>
+			      <property name="xpad">0</property>
+			      <property name="ypad">0</property>
+			      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+			      <property name="width_chars">-1</property>
+			      <property name="single_line_mode">False</property>
+			      <property name="angle">0</property>
+			    </widget>
+			    <packing>
+			      <property name="padding">0</property>
+			      <property name="expand">False</property>
+			      <property name="fill">False</property>
+			    </packing>
+			  </child>
+			</widget>
+		      </child>
+		    </widget>
+		  </child>
+		</widget>
+		<packing>
+		  <property name="padding">0</property>
+		  <property name="expand">False</property>
+		  <property name="fill">False</property>
+		</packing>
+	      </child>
+
+	      <child>
+		<widget class="GtkLabel" id="label5">
+		  <property name="height_request">21</property>
+		  <property name="visible">True</property>
+		  <property name="label" translatable="yes"></property>
+		  <property name="use_underline">False</property>
+		  <property name="use_markup">False</property>
+		  <property name="justify">GTK_JUSTIFY_LEFT</property>
+		  <property name="wrap">False</property>
+		  <property name="selectable">False</property>
+		  <property name="xalign">0.5</property>
+		  <property name="yalign">0.5</property>
+		  <property name="xpad">0</property>
+		  <property name="ypad">0</property>
+		  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		  <property name="width_chars">-1</property>
+		  <property name="single_line_mode">False</property>
+		  <property name="angle">0</property>
+		</widget>
+		<packing>
+		  <property name="padding">0</property>
+		  <property name="expand">False</property>
+		  <property name="fill">False</property>
+		</packing>
+	      </child>
+	    </widget>
+	    <packing>
+	      <property name="padding">0</property>
+	      <property name="expand">True</property>
+	      <property name="fill">True</property>
+	    </packing>
+	  </child>
+
+	  <child>
+	    <widget class="GtkLabel" id="label2">
+	      <property name="width_request">40</property>
+	      <property name="visible">True</property>
+	      <property name="label" translatable="yes"></property>
+	      <property name="use_underline">False</property>
+	      <property name="use_markup">False</property>
+	      <property name="justify">GTK_JUSTIFY_LEFT</property>
+	      <property name="wrap">False</property>
+	      <property name="selectable">False</property>
+	      <property name="xalign">0.5</property>
+	      <property name="yalign">0.5</property>
+	      <property name="xpad">0</property>
+	      <property name="ypad">0</property>
+	      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+	      <property name="width_chars">-1</property>
+	      <property name="single_line_mode">False</property>
+	      <property name="angle">0</property>
+	    </widget>
+	    <packing>
+	      <property name="padding">0</property>
+	      <property name="expand">False</property>
+	      <property name="fill">False</property>
+	    </packing>
+	  </child>
+	</widget>
+	<packing>
+	  <property name="padding">0</property>
+	  <property name="expand">False</property>
+	  <property name="fill">False</property>
+	</packing>
+      </child>
+    </widget>
+  </child>
+</widget>
+
+</glade-interface>

Added: trunk/pitivi/ui/screencast_managerdialog.py
==============================================================================
--- (empty file)
+++ trunk/pitivi/ui/screencast_managerdialog.py	Fri Sep 26 17:12:05 2008
@@ -0,0 +1,82 @@
+# PiTiVi , Non-linear video editor
+#
+#       pitivi/ui/screencast_managerdialog.py
+#
+# Copyright (c) 2008, Sarath Lakshman <sarathlakshman slynux org>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this program; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+import gtk
+import os
+import gtk.glade
+import pygst
+from pitivi import instance
+pygst.require("0.10")
+import gst
+import tempfile
+from gettext import gettext as _
+import plumber
+from pitivi.settings import ExportSettings
+from sourcefactories import SourceFactoriesWidget
+import dbus
+import dbus.service
+import dbus.glib
+import gobject
+
+
+class ScreencastManagerDialog(object):
+
+	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"))
+	
+		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.close_btn.connect("clicked",self.close)
+		self.ok_btn.connect("clicked",self.ok)
+		self.screencast_btn.connect("toggled",self.screencast)
+
+		# 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")
+		except:
+			self.screencast_btn.set_sensitive(False)
+
+	def close(self,w):
+		self.window.destroy()
+
+	def ok(self,w):
+		self.screencast(None)
+		self.close(None)
+		
+
+	def screencast(self,w):
+
+
+		if self.screencast_btn.get_active():
+			self.iface.savemode(True)
+		else:
+			self.iface.savemode(False)
+
+		



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