mousetrap r27 - in branches/ng/src/mousetrap: . ui
- From: flaper svn gnome org
- To: svn-commits-list gnome org
- Subject: mousetrap r27 - in branches/ng/src/mousetrap: . ui
- Date: Tue, 31 Mar 2009 12:02:22 +0000 (UTC)
Author: flaper
Date: Tue Mar 31 12:02:22 2009
New Revision: 27
URL: http://svn.gnome.org/viewvc/mousetrap?rev=27&view=rev
Log:
Settings handler added, User preferences dialog under construction
Modified:
branches/ng/src/mousetrap/environment.py
branches/ng/src/mousetrap/mousetrap.py
branches/ng/src/mousetrap/start
branches/ng/src/mousetrap/ui/__init__.py
branches/ng/src/mousetrap/ui/main.py
branches/ng/src/mousetrap/ui/widgets.py
Modified: branches/ng/src/mousetrap/environment.py
==============================================================================
--- branches/ng/src/mousetrap/environment.py (original)
+++ branches/ng/src/mousetrap/environment.py Tue Mar 31 12:02:22 2009
@@ -1,7 +1,6 @@
-
# -*- coding: utf-8 -*-
-# mouseTrap
+# MOUSEtrap
#
# Copyright 2008 Flavio Percoco Premoli
#
@@ -20,7 +19,7 @@
# Free Software Foundation, Inc., Franklin Street, Fifth Floor,
# Boston MA 02110-1301 USA.
-""" Holds mouseTrap internal information. """
+""" Holds mousetrap internal information. """
__id__ = "$Id$"
__version__ = "$Revision$"
@@ -32,20 +31,20 @@
import os
import gtk
-## mouseTrap Version
+## mousetrap Version
version = "@MOUSETRAP_VERSION@"
## "--prefix" parameter used when configuring the build.
prefix = "@prefix@"
-## The package name (should be "mouseTrap").
+## The package name (should be "mousetrap").
package = "@PACKAGE@"
## The name of the data directory (usually "share").
datadirname = "%s/@DATADIRNAME@" % prefix
-## Directly mouseTrap data dir
-mTDataDir = "%s/mouseTrap" % datadirname
+## Directly mousetrap data dir
+mTDataDir = "%s/mousetrap" % datadirname
## The actuall running desktop manager.
desktop = os.getenv("DESKTOP_MANAGER")
@@ -60,10 +59,10 @@
home = os.path.expanduser("~")
## Configurations dir
-configPath = home + "/.mouseTrap/"
+configPath = home + "/.mousetrap/"
## Configurations dir
-configPath = "%s/.mouseTrap/" % home
+configPath = "%s/.mousetrap/" % home
## Scripts Path
scriptsPath = "%s/scripts/" % configPath
@@ -75,7 +74,7 @@
configFile = configPath + "userSettings.cfg"
## The debug file
-debugFile = configPath + "mouseTrap_DEBUG.log"
+debugFile = configPath + "mousetrap_DEBUG.log"
## The language path
langPath = "%s/locale/" % datadirname
@@ -86,7 +85,7 @@
## The debugging parts
DEBUG = ['widget']
-## mouseTrap Modules
+## mousetrap Modules
mTModules = { 'lTr' : '_startListener',
'cAm' : '_startCam',
'wTp' : '_startWidgetsTrap'}
Modified: branches/ng/src/mousetrap/mousetrap.py
==============================================================================
--- branches/ng/src/mousetrap/mousetrap.py (original)
+++ branches/ng/src/mousetrap/mousetrap.py Tue Mar 31 12:02:22 2009
@@ -28,13 +28,13 @@
__copyright__ = "Copyright (c) 2008 Flavio Percoco Premoli"
__license__ = "GPLv2"
+
import gtk
import gobject
-import lib.mouse as mouse
-#import ocvfw.idm as idm
from ocvfw import pocv
+from ui.main import MainGui
from ui.scripts.screen import ScriptClass
-from ui.main import MainGui, CoordsGui
+from lib import mouse, httpd, dbusd, settings
class Controller():
@@ -45,7 +45,14 @@
Arguments:
- self: The main object pointer.
"""
+
+ # We don't want to load the settings each time we need them. do we?
+ self.cfg = None
+
print("Start")
+ self.httpd = httpd.HttpdServer(20433)
+ self.dbusd = dbusd.DbusServer()
+
def start(self):
"""
@@ -55,14 +62,16 @@
- self: The main object pointer.
"""
+ if self.cfg is None:
+ self.cfg = settings.load()
+
+ if not self.dbusd.start():
+ self.httpd.start()
+
# Lets start the module
- #idm = __import__("ocvfw.idm.forehead", globals(), locals(), [''])
- #self.idm = idm.Module(self)
- #self.idm.set_capture()
-
- idm = pocv.get_idm("forehead")
- self.idm = idm.Module(self)
- self.idm.set_capture()
+ idm = pocv.get_idm(self.cfg.get("main", "algorithm"))
+ self.idm = idm.Module(self)
+ self.idm.set_capture()
# Lets build the interface
self.itf = MainGui(self)
@@ -86,7 +95,6 @@
return True
-
## This is momentary
loop = gobject.MainLoop()
a = Controller()
Modified: branches/ng/src/mousetrap/start
==============================================================================
--- branches/ng/src/mousetrap/start (original)
+++ branches/ng/src/mousetrap/start Tue Mar 31 12:02:22 2009
@@ -21,4 +21,5 @@
}
getDesktop
-PYTHONPATH=$PYTHONPATH:../ python mousetrap.py
+export PYTHONPATH=$PYTHONPATH:../
+python mousetrap.py
Modified: branches/ng/src/mousetrap/ui/__init__.py
==============================================================================
--- branches/ng/src/mousetrap/ui/__init__.py (original)
+++ branches/ng/src/mousetrap/ui/__init__.py Tue Mar 31 12:02:22 2009
@@ -0,0 +1 @@
+
Modified: branches/ng/src/mousetrap/ui/main.py
==============================================================================
--- branches/ng/src/mousetrap/ui/main.py (original)
+++ branches/ng/src/mousetrap/ui/main.py Tue Mar 31 12:02:22 2009
@@ -20,7 +20,7 @@
# along with mouseTrap. If not, see <http://www.gnu.org/licenses/>.
-"""The main GUI of mouseTrap."""
+"""The main GUI of mousetrap."""
__id__ = "$Id$"
__version__ = "$Revision$"
@@ -29,9 +29,10 @@
__license__ = "GPLv2"
import gtk
-
+import settings_gui
from math import pi
+
class MainGui( gtk.Window ):
"""
MouseTrap main GUI Class
@@ -48,6 +49,7 @@
gtk.Window.__init__( self )
self.ctr = controller
+ self.cfg = controller.cfg
self.script = self.ctr.script()
#self.set_default_size(200, 400)
@@ -94,7 +96,7 @@
self.prefButton = gtk.Button()
self.prefButton.add(self._newStockImageButton("_Preferences", gtk.STOCK_PREFERENCES))
- #self.prefButton.connect("clicked", self._loadPreferences)
+ self.prefButton.connect("clicked", self._show_settings_gui)
self.buttonsBox.pack_start( self.prefButton )
self.closeButton = gtk.Button()
@@ -229,18 +231,17 @@
buttonLabelBox.show_all()
return buttonLabelBox
-#
-# def _loadPreferences( self, *args ):
-# """
-# Starts the preferences GUI
-#
-# Arguments:
-# - self: The main object pointer.
-# - *args: The widget callback arguments.
-# """
-#
-# pref = __import__( "prefGui", globals(), locals(), [''])
-# pref.showPreffGui( self.mTp )
+
+ def _show_settings_gui( self, *args ):
+ """
+ Starts the preferences GUI
+
+ Arguments:
+ - self: The main object pointer.
+ - *args: The widget callback arguments.
+ """
+
+ settings_gui.showPreffGui(self.ctr)
#
# def clickDlgHandler( self, button = False ):
# """
Modified: branches/ng/src/mousetrap/ui/widgets.py
==============================================================================
--- branches/ng/src/mousetrap/ui/widgets.py (original)
+++ branches/ng/src/mousetrap/ui/widgets.py Tue Mar 31 12:02:22 2009
@@ -29,15 +29,13 @@
__license__ = "GPLv2"
import sys
-
-import gobject
-import pango
import gtk
+import pango
import cairo
+import gobject
from gtk import gdk
from math import pi
-TEXT = 'A GtkWidget implemented in PyGTK'
BORDER_WIDTH = 0
# A quite simple gtk.Widget subclass which demonstrates how to subclass
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]