Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/screencast_activity.py
diff options
context:
space:
mode:
Diffstat (limited to 'screencast_activity.py')
-rw-r--r--screencast_activity.py158
1 files changed, 0 insertions, 158 deletions
diff --git a/screencast_activity.py b/screencast_activity.py
deleted file mode 100644
index a9f6e4b..0000000
--- a/screencast_activity.py
+++ /dev/null
@@ -1,158 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Copyright 2012 Ariel Calzada - ariel@activitycentral.com
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 2 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 General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-"""
-Screencast Activity: An activity for producing XO tutorials.
-Based on http://git.sugarlabs.org/screencast
-"""
-
-# Localization
-from gettext import gettext as _
-
-# Activity base class
-from sugar.activity import activity
-
-# Toolbar
-from sugar.activity.activity import ActivityToolbox
-
-# GTK
-import gtk
-
-# UI
-import screencast_ui
-
-# Process
-import screencast_process
-
-# GObject
-import gobject
-
-# OS
-import os
-
-# Bundlepath
-from sugar.activity.activity import get_bundle_path
-
-class ScreencastActivity(activity.Activity):
- """ Screencast Activity
- """
-
- # Attributes
- _ui = None
- _process = None
- _outfile = None
- _state = None
-
- def __init__(self, handle):
- """ Constructor
- """
-
- # Call super class "Activity" constructor method
- super(ScreencastActivity, self).__init__(handle)
-
- # State
- self._state = "stop"
-
- # Out file
- self._outfile = os.path.join( get_bundle_path(), "screencast.ogv" )
-
- # Build GUI
- self._ui = screencast_ui.ScreencastUI(self)
- self._ui.buildGUI()
-
- # Show GUI
- self._ui.showGUI()
-
- # Process
- self._process = screencast_process.ScreencastProcess()
- self._process.connect('encode-start', self.startEncode)
- self._process.connect('encode-finished', self.finishEncode)
- self._process.connect('update-statusbar', self.updateStatusbar)
-
- # Connect UI signals
- self._ui.connect('record-button-clicked-signal', self.recordButtonClicked)
- self._ui.connect('stop-button-clicked-signal', self.stopButtonClicked)
-
- def recordButtonClicked(self, widget):
- """ Record button clicked event
- """
- self.waitStart()
- self._process.runProcess(self._ui.getCurrentQuality(), self._ui.isSoundCheckActive(), self._outfile)
- self._state = "record"
-
- def stopButtonClicked(self, widget):
- """ Stop button clicked event
- """
- self._ui.changeButtonsState("encode")
- self._process.stopProcess()
-
- def startEncode(self,widget):
- """ Start encoding
- """
- self._ui.showProgressbar()
- self._state = "encode"
-
- def finishEncode(self,widget):
- """ Finish encoding
- """
- self._ui.changeButtonsState("stop")
- self._ui.hideProgressbar()
- self._state = "stop"
- self._ui.alert("Encode finished")
-
-
- def updateStatusbar(self, widget, text, percentage):
- """ Update status bar
- """
- text = "Status: Encoding"
- self._ui.changeStatusbarText(text)
- self._ui.updateProgressbar(percentage)
-
- def write_file(self, filePath):
- """ Journal write file method
- """
-
- if os.path.exists(self._outfile) and self._state == "stop":
- self.metadata['mime_type'] = 'video/ogg'
-
- if self._jobject.metadata['title_set_by_user'] == '1':
- title = self.metadata['title']
- else:
- title = "My Screencast"
-
- cmd = "copy-to-journal %s -m video/ogg -t \"%s\"" % ( self._outfile, title )
- os.system(cmd)
-
- def can_close(self):
- """ Close before verification
- """
-
- return True
-
- if self._state == "stop":
- return True
-
- self._ui.alert("You need to finish current operation before quitting")
- return False
-
- def waitStart(self):
- """ Wait started
- """
- self._ui.changeButtonsState("wait")
- self._ui.waitSomeTime(5)
- self._ui.changeButtonsState("record")