mousetrap r17 - in trunk: . src/mouseTrap



Author: flaper
Date: Tue Feb  3 10:45:53 2009
New Revision: 17
URL: http://svn.gnome.org/viewvc/mousetrap?rev=17&view=rev

Log:
Changed the name of script.py to scripthdlr.py

Added:
   trunk/src/mouseTrap/scriptHdlr.py   (contents, props changed)
Removed:
   trunk/src/mouseTrap/scripts.py
Modified:
   trunk/ChangeLog
   trunk/mousetrap.desktop.in
   trunk/src/mouseTrap/Makefile.am
   trunk/src/mouseTrap/mainGui.py
   trunk/src/mouseTrap/prefGui.py

Modified: trunk/mousetrap.desktop.in
==============================================================================
--- trunk/mousetrap.desktop.in	(original)
+++ trunk/mousetrap.desktop.in	Tue Feb  3 10:45:53 2009
@@ -7,5 +7,4 @@
 Terminal=false
 Type=Application
 StartupNotify=true
-Categories=GNOME;GTK;Accessibility;
-
+Categories=Utility;GNOME;GTK;Accessibility;
\ No newline at end of file

Modified: trunk/src/mouseTrap/Makefile.am
==============================================================================
--- trunk/src/mouseTrap/Makefile.am	(original)
+++ trunk/src/mouseTrap/Makefile.am	Tue Feb  3 10:45:53 2009
@@ -24,7 +24,7 @@
 	ocvfw.py \
 	prefGui.py \
 	profiling.py \
-	scripts.py
+	scriptHdlr.py
  
 
 SUBDIRS = haarcascade scripts

Modified: trunk/src/mouseTrap/mainGui.py
==============================================================================
--- trunk/src/mouseTrap/mainGui.py	(original)
+++ trunk/src/mouseTrap/mainGui.py	Tue Feb  3 10:45:53 2009
@@ -31,7 +31,7 @@
 import gtk
 import debug
 import events
-import scripts
+import scriptHdlr
 import dialogs
 import mouseTrap
 import environment as env
@@ -586,6 +586,6 @@
     gui = MainGui()
     gui.setWindowsIcon()
     gui.buildInterface()
-    scripts.loadProfile( gui )
+    scriptHdlr.loadProfile( gui )
     return gui
 

Modified: trunk/src/mouseTrap/prefGui.py
==============================================================================
--- trunk/src/mouseTrap/prefGui.py	(original)
+++ trunk/src/mouseTrap/prefGui.py	Tue Feb  3 10:45:53 2009
@@ -30,7 +30,7 @@
 
 import gtk
 import sys
-import scripts
+import scriptHdlr
 import mouseTrap
 import mouseTrapPref as mTPref
 import environment as env
@@ -106,7 +106,7 @@
         self.debugTab()
         
         try:
-            scripts.loaded.prefTab( self )
+            scriptHdlr.loaded.prefTab( self )
         except:
             # The loaded profile doesn't have preferences tab
             pass

Added: trunk/src/mouseTrap/scriptHdlr.py
==============================================================================
--- (empty file)
+++ trunk/src/mouseTrap/scriptHdlr.py	Tue Feb  3 10:45:53 2009
@@ -0,0 +1,77 @@
+# -*- coding: utf-8 -*-
+
+# mouseTrap
+#
+# Copyright 2008 Flavio Percoco Premoli
+#
+# This file is part of mouseTrap.
+#
+# mouseTrap 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.
+#
+# mouseTrap 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 mouseTrap.  If not, see <http://www.gnu.org/licenses/>.
+
+"""The Camera module of mouseTrap."""
+
+__id__        = "$Id$"
+__version__   = "$Revision$"
+__date__      = "$Date$"
+__copyright__ = "Copyright (c) 2008 Flavio Percoco Premoli"
+__license__   = "GPLv2"
+
+import os
+import debug
+import environment as env
+
+from mouseTrap import settings
+from mTi18n import _
+
+## A dict to store the diferente loaded modes profiles.
+modes = {}
+
+## loaded profile
+loaded = None
+                       
+def _loadThirdProfiles():
+    """
+    This function loads the external profiles created by the users
+    """
+    
+    global modes
+    
+    os.chdir( env.profilesPath )
+    
+    mods = [ file.split(".py")[0] for file in os.listdir( env.profilesPath ) if file.endswith(".py") ]
+
+    for mod in mods:
+        try:
+            prof = __import__( mod, globals(), locals(), [''] )
+            modes[prof.setName] = prof.Profile
+            env.mouseModes.update( prof.modes )
+            debug.debug( "scripts", "Mousetrap %s Profile has been loaded" % mod )
+        except:
+            debug.exception( "scripts", "The Profile load failed" )
+
+def loadProfile( gui ):
+    """
+    Loads the profile selected in the settings
+    
+    Arguments:
+    - gui: The main gui object pointer.
+    """
+    global loaded
+    
+    if not modes:
+        _loadThirdProfiles()
+        
+    loaded = modes[settings.get( "cam", "mouseMode" ).split("|")[0]]( gui )
+    debug.debug( "scripts", "Profile Started" )
+



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