[mousetrap/gnome3-wip: 50/240] Move old stuff to old/.



commit 3a2a62df5be5b81096cd138754d787f1761d2d3b
Author: Stoney Jackson <dr stoney gmail com>
Date:   Tue May 20 14:00:12 2014 -0400

    Move old stuff to old/.
    
    My pea-sized brain can't manage two code bases in the same space.
    Moved old stuff to old/. Copied over and customized just what we
    have working. I did not recreate the directory structure we had
    before. It was confusing to know what is done and what needs work.
    Instead, I would like to see us grow the directory structure. Only
    put in place and keep what is working and useful. The less we have
    to look through, the better.
    
    New conventions for files in bin/
      * All files will start with mt- (for mousetrap).
      * Executables are to be ran as normal.
      * Non-executables are to be sourced as needed.
    
    Now when you sit down to work you might do something like
    
      source bin/mt-setup   # adjusts paths and defines variables
      mt-test               # run tests
      mt-install            # build and install mousetrap
    
    No runner exists yet because we don't have an entry point yet.
    
    Need a pylint runner (mt-pylint).

 bin/autogen.sh => autogen.sh                       |    2 +-
 bin/mt-add-bin-to-path                             |    3 +
 bin/mt-add-src-to-pythonpath                       |    9 ++
 bin/mt-define-mousetrap-home                       |    2 +
 bin/mt-install                                     |    8 ++
 bin/mt-setup                                       |    9 ++
 bin/mt-test                                        |    3 +
 configure.ac                                       |   17 +---
 old/Makefile.am                                    |   50 +++++++++
 {bin => old/bin}/autogen.sh                        |    0
 {bin => old/bin}/build.sh                          |    0
 {bin => old/bin}/generate_AUTHORS.sh               |    0
 {bin => old/bin}/install.sh                        |    0
 {bin => old/bin}/lib/environment_up.sh             |    0
 {bin => old/bin}/lib/run_python_tests.py           |    0
 {bin => old/bin}/lib/run_shell_tests.sh            |    0
 {bin => old/bin}/lib/test_environment_up.sh        |    0
 {bin => old/bin}/mousetrap.sh                      |    0
 {bin => old/bin}/pylint.sh                         |    0
 {bin => old/bin}/run_tests.sh                      |    0
 {bin => old/bin}/test_pylint.sh                    |    0
 old/configure.ac                                   |  112 ++++++++++++++++++++
 old/src/Makefile.am                                |    1 +
 old/src/mousetrap/Makefile.am                      |   42 ++++++++
 .../addons => old/src/mousetrap}/__init__.py       |    8 +-
 {src => old/src}/mousetrap/addons/Makefile.am      |    0
 {src => old/src}/mousetrap/addons/__init__.py      |    0
 {src => old/src}/mousetrap/app/Makefile.am         |    0
 {src => old/src}/mousetrap/app/__init__.py         |    0
 {src => old/src}/mousetrap/app/addons/Makefile.am  |    0
 {src => old/src}/mousetrap/app/addons/__init__.py  |    0
 {src => old/src}/mousetrap/app/addons/cpu.py       |    0
 {src => old/src}/mousetrap/app/addons/handler.py   |    0
 {src => old/src}/mousetrap/app/addons/recalc.py    |    0
 {src => old/src}/mousetrap/app/commons.py          |    0
 {src => old/src}/mousetrap/app/debug.py            |    0
 {src => old/src}/mousetrap/app/lib/Makefile.am     |    0
 {src => old/src}/mousetrap/app/lib/__init__.py     |    0
 {src => old/src}/mousetrap/app/lib/dbusd.py        |    0
 {src => old/src}/mousetrap/app/lib/httpd.py        |    0
 {src => old/src}/mousetrap/app/lib/mouse.py        |    0
 {src => old/src}/mousetrap/app/lib/settings.py     |    0
 {src => old/src}/mousetrap/app/ui/Makefile.am      |    0
 {src => old/src}/mousetrap/app/ui/__init__.py      |    0
 {src => old/src}/mousetrap/app/ui/dialogs.py       |    0
 {src => old/src}/mousetrap/app/ui/i18n.py.in       |    0
 {src => old/src}/mousetrap/app/ui/main.py          |    0
 .../src}/mousetrap/app/ui/scripts/Makefile.am      |    0
 .../src}/mousetrap/app/ui/scripts/__init__.py      |    0
 {src => old/src}/mousetrap/app/ui/scripts/color.py |    0
 .../src}/mousetrap/app/ui/scripts/joystick.py      |    0
 .../src}/mousetrap/app/ui/scripts/screen.py        |    0
 {src => old/src}/mousetrap/app/ui/settings_gui.py  |    0
 {src => old/src}/mousetrap/app/ui/widgets.py       |    0
 {src => old/src}/mousetrap/controller.py           |    0
 {src => old/src}/mousetrap/core/Makefile.am        |    0
 {src => old/src}/mousetrap/core/__init__.py        |    0
 {src => old/src}/mousetrap/core/camera.py          |    0
 .../src}/mousetrap/core/feature_detector.py        |    0
 .../src}/mousetrap/core/heads_up_display.py        |    0
 {src => old/src}/mousetrap/core/image_library.py   |    0
 {src => old/src}/mousetrap/core/motion_tracker.py  |    0
 {src => old/src}/mousetrap/core/pointer.py         |    0
 {src => old/src}/mousetrap/core/pointer_manager.py |    0
 {src => old/src}/mousetrap/core/settings.py        |    0
 {src => old/src}/mousetrap/core/test_camera.py     |    0
 {src => old/src}/mousetrap/core/tracker.py         |    0
 {src => old/src}/mousetrap/environment.py.in       |    0
 {src => old/src}/mousetrap/inplace_runner.py       |    0
 {src => old/src}/mousetrap/mousetrap.in            |    0
 {src => old/src}/mousetrap/ocvfw/Makefile.am       |    0
 {src => old/src}/mousetrap/ocvfw/__init__.py       |    0
 {src => old/src}/mousetrap/ocvfw/_ocv.py           |    0
 {src => old/src}/mousetrap/ocvfw/commons.py        |    0
 {src => old/src}/mousetrap/ocvfw/debug.py          |    0
 {src => old/src}/mousetrap/ocvfw/dev/Makefile.am   |    0
 {src => old/src}/mousetrap/ocvfw/dev/__init__.py   |    0
 {src => old/src}/mousetrap/ocvfw/dev/camera.py     |    0
 {src => old/src}/mousetrap/ocvfw/haars/Makefile.am |    0
 {src => old/src}/mousetrap/ocvfw/haars/Mouth.xml   |    0
 .../mousetrap/ocvfw/haars/frontalEyes35x16.xml     |    0
 .../haars/haarcascade_eye_tree_eyeglasses.xml      |    0
 .../ocvfw/haars/haarcascade_frontalface_alt.xml    |    0
 .../ocvfw/haars/haarcascade_frontalface_alt2.xml   |    0
 .../haars/haarcascade_frontalface_alt_tree.xml     |    0
 .../haars/haarcascade_frontalface_default.xml      |    0
 .../mousetrap/ocvfw/idm/EyeLocatorASEF128x128.fel  |  Bin 131230 -> 131230 bytes
 {src => old/src}/mousetrap/ocvfw/idm/Makefile.am   |    0
 {src => old/src}/mousetrap/ocvfw/idm/__init__.py   |    0
 {src => old/src}/mousetrap/ocvfw/idm/color.py      |    0
 {src => old/src}/mousetrap/ocvfw/idm/eyes.py       |    0
 {src => old/src}/mousetrap/ocvfw/idm/finger.py     |    0
 {src => old/src}/mousetrap/ocvfw/idm/forehead.py   |    0
 {src => old/src}/mousetrap/ocvfw/pocv.py           |    0
 {src => old/src}/mousetrap/pylintrc                |    0
 {src => old/src}/mousetrap/ui/Makefile.am          |    0
 {src => old/src}/mousetrap/ui/__init__.py          |    0
 src/mousetrap/Makefile.am                          |   32 +-----
 src/mousetrap/__init__.py                          |   25 -----
 src/mousetrap/camera.py                            |   32 ++++++
 src/mousetrap/{core => }/test_camera.py            |    4 +-
 {bin/lib => src}/run_python_tests.py               |    6 +-
 102 files changed, 282 insertions(+), 83 deletions(-)
---
diff --git a/bin/autogen.sh b/autogen.sh
similarity index 93%
copy from bin/autogen.sh
copy to autogen.sh
index bc5979f..078c2ab 100755
--- a/bin/autogen.sh
+++ b/autogen.sh
@@ -1,7 +1,7 @@
 #!/bin/bash
 # Run this to generate all the initial makefiles, etc.
 
-srcdir=`dirname $0 | xargs dirname`
+srcdir=`dirname $0`
 test -z "$srcdir" && srcdir=.
 
 PKG_NAME="mouseTrap"
diff --git a/bin/mt-add-bin-to-path b/bin/mt-add-bin-to-path
new file mode 100644
index 0000000..b848a69
--- /dev/null
+++ b/bin/mt-add-bin-to-path
@@ -0,0 +1,3 @@
+# Source this file.
+PROJECT_DIRECTORY="$(git rev-parse --show-toplevel)"
+PATH="$PATH:$PROJECT_DIRECTORY/bin"
diff --git a/bin/mt-add-src-to-pythonpath b/bin/mt-add-src-to-pythonpath
new file mode 100644
index 0000000..9759e19
--- /dev/null
+++ b/bin/mt-add-src-to-pythonpath
@@ -0,0 +1,9 @@
+# Source this file.
+PROJECT_DIRECTORY="$(git rev-parse --show-toplevel)"
+SOURCE_DIRECTORY="$PROJECT_DIRECTORY/src"
+if [ -z "$PYTHONPATH" ] ; then
+    PYTHONPATH="$SOURCE_DIRECTORY"
+else
+    PYTHONPATH="$PYTHONPATH:$SOURCE_DIRECTORY"
+fi
+export PYTHONPATH
diff --git a/bin/mt-define-mousetrap-home b/bin/mt-define-mousetrap-home
new file mode 100644
index 0000000..ac84514
--- /dev/null
+++ b/bin/mt-define-mousetrap-home
@@ -0,0 +1,2 @@
+# Source this file.
+export MOUSETRAP_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
diff --git a/bin/mt-install b/bin/mt-install
new file mode 100755
index 0000000..972b053
--- /dev/null
+++ b/bin/mt-install
@@ -0,0 +1,8 @@
+#!/bin/env bash
+set -e
+source "$(dirname "$0")/mt-define-mousetrap-home"
+
+(cd "$MOUSETRAP_HOME"
+    ./autogen.sh
+    make
+    sudo make install)
diff --git a/bin/mt-setup b/bin/mt-setup
new file mode 100644
index 0000000..e90b2f4
--- /dev/null
+++ b/bin/mt-setup
@@ -0,0 +1,9 @@
+SCRIPT_DIRECTORY="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+cd "$SCRIPT_DIRECTORY"
+echo "Adding bin/ to PATH"
+source mt-add-bin-to-path
+echo "Adding src/ to PYTHONPATH"
+source mt-add-src-to-pythonpath
+echo "Defineing MOUSETRAP_HOME"
+source mt-define-mousetrap-home
+cd - &> /dev/null
diff --git a/bin/mt-test b/bin/mt-test
new file mode 100755
index 0000000..0d89727
--- /dev/null
+++ b/bin/mt-test
@@ -0,0 +1,3 @@
+#!/bin/env bash
+source "$(dirname "$0")/mt-define-mousetrap-home"
+"$MOUSETRAP_HOME/src/run_python_tests.py"
diff --git a/configure.ac b/configure.ac
index be15795..408e16d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -70,7 +70,6 @@ DOCBOOK_CHECK()
 #mousetrap.spec
 
 AC_OUTPUT([
-bin/pylint.sh
 Makefile
 mousetrap.desktop
 po/Makefile.in
@@ -83,21 +82,7 @@ docs/doxygen/Doxyfile
 images/Makefile
 src/Makefile
 src/mousetrap/Makefile
-src/mousetrap/addons/Makefile
-src/mousetrap/app/Makefile
-src/mousetrap/core/Makefile
-src/mousetrap/environment.py
-src/mousetrap/app/lib/Makefile
-src/mousetrap/app/ui/Makefile
-src/mousetrap/app/ui/i18n.py
-src/mousetrap/app/ui/scripts/Makefile
-src/mousetrap/app/addons/Makefile
-src/mousetrap/ocvfw/Makefile
-src/mousetrap/ocvfw/dev/Makefile
-src/mousetrap/ocvfw/idm/Makefile
-src/mousetrap/ocvfw/haars/Makefile
-src/mousetrap/ui/Makefile
-],[chmod +x bin/pylint.sh])
+],[])
 
 ###############################################################################
 # Don't include src/mousetrap/app/mousetrap.in in AC_OUTPUT.  It will be
diff --git a/old/Makefile.am b/old/Makefile.am
new file mode 100644
index 0000000..35ceaa1
--- /dev/null
+++ b/old/Makefile.am
@@ -0,0 +1,50 @@
+SUBDIRS = po src docs images
+
+DISTCHECK_CONFIGURE_FLAGS = --enable-pydoc
+
+DISTCLEANFILES =                \
+       intltool-extract        \
+       intltool-merge          \
+       intltool-update         \
+       gnome-doc-utils.make    \
+       mousetrap.desktop
+
+gtk_update_icon_cache = gtk-update-icon-cache -f -t $(datadir)/icons/hicolor
+
+install-data-hook: update-icon-cache
+uninstall-hook: update-icon-cache
+update-icon-cache:
+       @-if test -z "$(DESTDIR)"; then \
+               echo "Updating Gtk icon cache."; \
+               $(gtk_update_icon_cache); \
+       else \
+               echo "*** Icon cache not updated.  After (un)install, run this:"; \
+               echo "***   $(gtk_update_icon_cache)"; \
+       fi
+
+dist-hook:
+               @if test -d "$(srcdir)/.git"; \
+               then \
+                               echo Creating ChangeLog && \
+                               ( cd "$(top_srcdir)" && \
+                                       echo '# Generated by Makefile. Do not edit.'; echo; \
+                                       $(top_srcdir)/missing --run git log --stat ) > ChangeLog.tmp \
+                                       && mv -f ChangeLog.tmp $(top_distdir)/ChangeLog \
+                                       || ( rm -f ChangeLog.tmp ; \
+                                       echo Failed to generate ChangeLog >&2 ); \
+               else \
+                               echo A git clone is required to generate a ChangeLog >&2; \
+               fi
+
+desktopdir      = $(datadir)/applications
+desktop_in_files = mousetrap.desktop.in
+desktop_DATA     = $(desktop_in_files:.desktop.in=.desktop)
+ INTLTOOL_DESKTOP_RULE@
+
+EXTRA_DIST =                \
+       ChangeLog           \
+       MAINTAINERS         \
+       intltool-extract.in \
+       intltool-merge.in   \
+       intltool-update.in
+
diff --git a/bin/autogen.sh b/old/bin/autogen.sh
similarity index 100%
rename from bin/autogen.sh
rename to old/bin/autogen.sh
diff --git a/bin/build.sh b/old/bin/build.sh
similarity index 100%
rename from bin/build.sh
rename to old/bin/build.sh
diff --git a/bin/generate_AUTHORS.sh b/old/bin/generate_AUTHORS.sh
similarity index 100%
rename from bin/generate_AUTHORS.sh
rename to old/bin/generate_AUTHORS.sh
diff --git a/bin/install.sh b/old/bin/install.sh
similarity index 100%
rename from bin/install.sh
rename to old/bin/install.sh
diff --git a/bin/lib/environment_up.sh b/old/bin/lib/environment_up.sh
similarity index 100%
rename from bin/lib/environment_up.sh
rename to old/bin/lib/environment_up.sh
diff --git a/bin/lib/run_python_tests.py b/old/bin/lib/run_python_tests.py
similarity index 100%
copy from bin/lib/run_python_tests.py
copy to old/bin/lib/run_python_tests.py
diff --git a/bin/lib/run_shell_tests.sh b/old/bin/lib/run_shell_tests.sh
similarity index 100%
rename from bin/lib/run_shell_tests.sh
rename to old/bin/lib/run_shell_tests.sh
diff --git a/bin/lib/test_environment_up.sh b/old/bin/lib/test_environment_up.sh
similarity index 100%
rename from bin/lib/test_environment_up.sh
rename to old/bin/lib/test_environment_up.sh
diff --git a/bin/mousetrap.sh b/old/bin/mousetrap.sh
similarity index 100%
rename from bin/mousetrap.sh
rename to old/bin/mousetrap.sh
diff --git a/bin/pylint.sh b/old/bin/pylint.sh
similarity index 100%
rename from bin/pylint.sh
rename to old/bin/pylint.sh
diff --git a/bin/run_tests.sh b/old/bin/run_tests.sh
similarity index 100%
rename from bin/run_tests.sh
rename to old/bin/run_tests.sh
diff --git a/bin/test_pylint.sh b/old/bin/test_pylint.sh
similarity index 100%
rename from bin/test_pylint.sh
rename to old/bin/test_pylint.sh
diff --git a/old/configure.ac b/old/configure.ac
new file mode 100644
index 0000000..be15795
--- /dev/null
+++ b/old/configure.ac
@@ -0,0 +1,112 @@
+AC_INIT(ChangeLog)
+
+
+CURRENT_DIR=$PWD
+MOUSETRAP_VERSION=0.4
+AM_INIT_AUTOMAKE(mousetrap, $MOUSETRAP_VERSION)
+AC_SUBST(MOUSETRAP_VERSION)
+AC_SUBST(CURRENT_DIR)
+
+# libtool versioning
+LT_CURRENT=0
+LT_REVISION=0
+LT_AGE=0
+LT_VERSION_INFO='-version-info ${LT_CURRENT}:${LT_REVISION}:${LT_AGE}'
+AC_SUBST(LT_VERSION_INFO)
+AC_SUBST(LT_RELEASE)
+AC_SUBST(LT_CURRENT)
+AC_SUBST(LT_REVISION)
+AC_SUBST(LT_AGE)
+
+dnl Specify a header configuration file
+AM_CONFIG_HEADER(config.h)
+
+dnl Initialize maintainer mode
+AM_MAINTAINER_MODE
+
+dnl Gettext stuff
+
+GETTEXT_PACKAGE=mousetrap
+AC_SUBST(GETTEXT_PACKAGE)
+AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package])
+AM_GLIB_GNU_GETTEXT
+
+IT_PROG_INTLTOOL([0.40.0])
+
+dnl Checks for programs
+AC_PROG_CC
+AC_PROG_INSTALL
+AC_ISC_POSIX
+
+dnl Initialize libtool
+AM_DISABLE_STATIC
+AM_PROG_LIBTOOL
+
+# Check for Python
+
+AM_PATH_PYTHON(2.6)
+
+# Find the headers needed to build extensions
+
+AM_CHECK_PYTHON_HEADERS(,[AC_MSG_ERROR(Could not find python headers needed to build Python extensions)])
+
+# Find the modules used by mousetrap
+
+AM_CHECK_PYMOD(gettext,,,[AC_MSG_ERROR(Could not find python module gettext)])
+AM_CHECK_PYMOD(getopt,,,[AC_MSG_ERROR(Could not find python module getopt)])
+AM_CHECK_PYMOD(Xlib,,,[AC_MSG_ERROR(Could not find python module Xlib)])
+AM_CHECK_PYMOD(pyatspi,,,[AC_MSG_ERROR(Could not find python module pyatspi)])
+AM_CHECK_PYMOD(cv,,,[AC_MSG_ERROR(Could not find python module cv)])
+
+AM_CONDITIONAL(WITH_LOUIS, test x$have_liblouis = "xyes")
+
+AC_SUBST(mousetrap_LIBS)
+AC_SUBST(mousetrap_CFLAGS)
+
+PYDOC_CHECK()
+DOXYGEN_CHECK()
+DOCBOOK_CHECK()
+
+#mousetrap.spec
+
+AC_OUTPUT([
+bin/pylint.sh
+Makefile
+mousetrap.desktop
+po/Makefile.in
+docs/Makefile
+docs/man/Makefile
+docs/pydoc/Makefile
+docs/docbook/Makefile
+docs/doxygen/Makefile
+docs/doxygen/Doxyfile
+images/Makefile
+src/Makefile
+src/mousetrap/Makefile
+src/mousetrap/addons/Makefile
+src/mousetrap/app/Makefile
+src/mousetrap/core/Makefile
+src/mousetrap/environment.py
+src/mousetrap/app/lib/Makefile
+src/mousetrap/app/ui/Makefile
+src/mousetrap/app/ui/i18n.py
+src/mousetrap/app/ui/scripts/Makefile
+src/mousetrap/app/addons/Makefile
+src/mousetrap/ocvfw/Makefile
+src/mousetrap/ocvfw/dev/Makefile
+src/mousetrap/ocvfw/idm/Makefile
+src/mousetrap/ocvfw/haars/Makefile
+src/mousetrap/ui/Makefile
+],[chmod +x bin/pylint.sh])
+
+###############################################################################
+# Don't include src/mousetrap/app/mousetrap.in in AC_OUTPUT.  It will be
+# processed by make (see src/mousetrap/app/Makefile.am), not by autoconf or
+# automake. For more information read
+# http://www.gnu.org/software/autoconf/manual/autoconf.html#Installation-Directory-Variables
+#
+# Other files may require this same "fix" (e.g., i18n.py, environment.py,
+# mousetrap.desktop).
+#
+#   - Stoney Jackson, dr stoney gmail com, 10/10/2013
+###############################################################################
diff --git a/old/src/Makefile.am b/old/src/Makefile.am
new file mode 100644
index 0000000..c1e0520
--- /dev/null
+++ b/old/src/Makefile.am
@@ -0,0 +1 @@
+SUBDIRS = mousetrap
diff --git a/old/src/mousetrap/Makefile.am b/old/src/mousetrap/Makefile.am
new file mode 100644
index 0000000..3475db3
--- /dev/null
+++ b/old/src/mousetrap/Makefile.am
@@ -0,0 +1,42 @@
+mousetrap_SCRIPTS = \
+       mousetrap
+
+mousetrapdir=$(bindir)
+
+mousetrap_pathdir=$(pyexecdir)
+
+mousetrap_python_PYTHON = \
+       __init__.py \
+       environment.py \
+       controller.py
+
+SUBDIRS = addons app core ocvfw ui
+
+mousetrap_pythondir=$(pyexecdir)/mousetrap/
+
+install-exec-hook:
+       chmod a+rx $(DESTDIR)$(mousetrap_pythondir) -R
+
+##### START DIRECTORY VARIABLE SUBSTITUTIONS ##################################
+# Substitution of autotool's directory vars (outside of Makefiles) must be done
+# by make. edit defines a sed substitution for all the special variables. The
+# mousetrap rule calls $(edit)
+edit = sed \
+               -e 's|@PYTHON[ ]|$(PYTHON)|g' \
+               -e 's|@pythondir[ ]|$(pythondir)|g' \
+               -e 's|@pyexecdir[ ]|$(pyexecdir)|g' \
+               -e 's|@pkgdatadir[ ]|$(pkgdatadir)|g' \
+               -e 's|@prefix[ ]|$(prefix)|g'
+
+mousetrap: Makefile
+       rm -f $@ $  tmp
+       srcdir=''; \
+               test -f ./$  in || srcdir=$(srcdir)/; \
+               $(edit) $${srcdir}$  in >$  tmp
+
+       chmod +x $  tmp
+       chmod a-w $  tmp
+       mv $  tmp $@
+
+mousetrap: $(srcdir)/mousetrap.in
+##### END DIRECTORY VARIABLE SUBSTITUTIONS ####################################
diff --git a/src/mousetrap/addons/__init__.py b/old/src/mousetrap/__init__.py
similarity index 87%
copy from src/mousetrap/addons/__init__.py
copy to old/src/mousetrap/__init__.py
index 7e8b8d7..7284fed 100644
--- a/src/mousetrap/addons/__init__.py
+++ b/old/src/mousetrap/__init__.py
@@ -18,8 +18,8 @@
 # You should have received a copy of the GNU General Public License
 # along with mouseTrap.  If not, see <http://www.gnu.org/licenses/>.
 
-__id__        = "$Id$"
-__version__   = "$Revision$"
-__date__      = "$Date$"
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
 __copyright__ = "Copyright (c) 2008 Flavio Percoco Premoli"
-__license__   = "GPLv2"
+__license__ = "GPLv2"
diff --git a/src/mousetrap/addons/Makefile.am b/old/src/mousetrap/addons/Makefile.am
similarity index 100%
rename from src/mousetrap/addons/Makefile.am
rename to old/src/mousetrap/addons/Makefile.am
diff --git a/src/mousetrap/addons/__init__.py b/old/src/mousetrap/addons/__init__.py
similarity index 100%
rename from src/mousetrap/addons/__init__.py
rename to old/src/mousetrap/addons/__init__.py
diff --git a/src/mousetrap/app/Makefile.am b/old/src/mousetrap/app/Makefile.am
similarity index 100%
rename from src/mousetrap/app/Makefile.am
rename to old/src/mousetrap/app/Makefile.am
diff --git a/src/mousetrap/app/__init__.py b/old/src/mousetrap/app/__init__.py
similarity index 100%
rename from src/mousetrap/app/__init__.py
rename to old/src/mousetrap/app/__init__.py
diff --git a/src/mousetrap/app/addons/Makefile.am b/old/src/mousetrap/app/addons/Makefile.am
similarity index 100%
rename from src/mousetrap/app/addons/Makefile.am
rename to old/src/mousetrap/app/addons/Makefile.am
diff --git a/src/mousetrap/app/addons/__init__.py b/old/src/mousetrap/app/addons/__init__.py
similarity index 100%
rename from src/mousetrap/app/addons/__init__.py
rename to old/src/mousetrap/app/addons/__init__.py
diff --git a/src/mousetrap/app/addons/cpu.py b/old/src/mousetrap/app/addons/cpu.py
similarity index 100%
rename from src/mousetrap/app/addons/cpu.py
rename to old/src/mousetrap/app/addons/cpu.py
diff --git a/src/mousetrap/app/addons/handler.py b/old/src/mousetrap/app/addons/handler.py
similarity index 100%
rename from src/mousetrap/app/addons/handler.py
rename to old/src/mousetrap/app/addons/handler.py
diff --git a/src/mousetrap/app/addons/recalc.py b/old/src/mousetrap/app/addons/recalc.py
similarity index 100%
rename from src/mousetrap/app/addons/recalc.py
rename to old/src/mousetrap/app/addons/recalc.py
diff --git a/src/mousetrap/app/commons.py b/old/src/mousetrap/app/commons.py
similarity index 100%
rename from src/mousetrap/app/commons.py
rename to old/src/mousetrap/app/commons.py
diff --git a/src/mousetrap/app/debug.py b/old/src/mousetrap/app/debug.py
similarity index 100%
rename from src/mousetrap/app/debug.py
rename to old/src/mousetrap/app/debug.py
diff --git a/src/mousetrap/app/lib/Makefile.am b/old/src/mousetrap/app/lib/Makefile.am
similarity index 100%
rename from src/mousetrap/app/lib/Makefile.am
rename to old/src/mousetrap/app/lib/Makefile.am
diff --git a/src/mousetrap/app/lib/__init__.py b/old/src/mousetrap/app/lib/__init__.py
similarity index 100%
rename from src/mousetrap/app/lib/__init__.py
rename to old/src/mousetrap/app/lib/__init__.py
diff --git a/src/mousetrap/app/lib/dbusd.py b/old/src/mousetrap/app/lib/dbusd.py
similarity index 100%
rename from src/mousetrap/app/lib/dbusd.py
rename to old/src/mousetrap/app/lib/dbusd.py
diff --git a/src/mousetrap/app/lib/httpd.py b/old/src/mousetrap/app/lib/httpd.py
similarity index 100%
rename from src/mousetrap/app/lib/httpd.py
rename to old/src/mousetrap/app/lib/httpd.py
diff --git a/src/mousetrap/app/lib/mouse.py b/old/src/mousetrap/app/lib/mouse.py
similarity index 100%
rename from src/mousetrap/app/lib/mouse.py
rename to old/src/mousetrap/app/lib/mouse.py
diff --git a/src/mousetrap/app/lib/settings.py b/old/src/mousetrap/app/lib/settings.py
similarity index 100%
rename from src/mousetrap/app/lib/settings.py
rename to old/src/mousetrap/app/lib/settings.py
diff --git a/src/mousetrap/app/ui/Makefile.am b/old/src/mousetrap/app/ui/Makefile.am
similarity index 100%
rename from src/mousetrap/app/ui/Makefile.am
rename to old/src/mousetrap/app/ui/Makefile.am
diff --git a/src/mousetrap/app/ui/__init__.py b/old/src/mousetrap/app/ui/__init__.py
similarity index 100%
rename from src/mousetrap/app/ui/__init__.py
rename to old/src/mousetrap/app/ui/__init__.py
diff --git a/src/mousetrap/app/ui/dialogs.py b/old/src/mousetrap/app/ui/dialogs.py
similarity index 100%
rename from src/mousetrap/app/ui/dialogs.py
rename to old/src/mousetrap/app/ui/dialogs.py
diff --git a/src/mousetrap/app/ui/i18n.py.in b/old/src/mousetrap/app/ui/i18n.py.in
similarity index 100%
rename from src/mousetrap/app/ui/i18n.py.in
rename to old/src/mousetrap/app/ui/i18n.py.in
diff --git a/src/mousetrap/app/ui/main.py b/old/src/mousetrap/app/ui/main.py
similarity index 100%
rename from src/mousetrap/app/ui/main.py
rename to old/src/mousetrap/app/ui/main.py
diff --git a/src/mousetrap/app/ui/scripts/Makefile.am b/old/src/mousetrap/app/ui/scripts/Makefile.am
similarity index 100%
rename from src/mousetrap/app/ui/scripts/Makefile.am
rename to old/src/mousetrap/app/ui/scripts/Makefile.am
diff --git a/src/mousetrap/app/ui/scripts/__init__.py b/old/src/mousetrap/app/ui/scripts/__init__.py
similarity index 100%
rename from src/mousetrap/app/ui/scripts/__init__.py
rename to old/src/mousetrap/app/ui/scripts/__init__.py
diff --git a/src/mousetrap/app/ui/scripts/color.py b/old/src/mousetrap/app/ui/scripts/color.py
similarity index 100%
rename from src/mousetrap/app/ui/scripts/color.py
rename to old/src/mousetrap/app/ui/scripts/color.py
diff --git a/src/mousetrap/app/ui/scripts/joystick.py b/old/src/mousetrap/app/ui/scripts/joystick.py
similarity index 100%
rename from src/mousetrap/app/ui/scripts/joystick.py
rename to old/src/mousetrap/app/ui/scripts/joystick.py
diff --git a/src/mousetrap/app/ui/scripts/screen.py b/old/src/mousetrap/app/ui/scripts/screen.py
similarity index 100%
rename from src/mousetrap/app/ui/scripts/screen.py
rename to old/src/mousetrap/app/ui/scripts/screen.py
diff --git a/src/mousetrap/app/ui/settings_gui.py b/old/src/mousetrap/app/ui/settings_gui.py
similarity index 100%
rename from src/mousetrap/app/ui/settings_gui.py
rename to old/src/mousetrap/app/ui/settings_gui.py
diff --git a/src/mousetrap/app/ui/widgets.py b/old/src/mousetrap/app/ui/widgets.py
similarity index 100%
rename from src/mousetrap/app/ui/widgets.py
rename to old/src/mousetrap/app/ui/widgets.py
diff --git a/src/mousetrap/controller.py b/old/src/mousetrap/controller.py
similarity index 100%
rename from src/mousetrap/controller.py
rename to old/src/mousetrap/controller.py
diff --git a/src/mousetrap/core/Makefile.am b/old/src/mousetrap/core/Makefile.am
similarity index 100%
rename from src/mousetrap/core/Makefile.am
rename to old/src/mousetrap/core/Makefile.am
diff --git a/src/mousetrap/core/__init__.py b/old/src/mousetrap/core/__init__.py
similarity index 100%
rename from src/mousetrap/core/__init__.py
rename to old/src/mousetrap/core/__init__.py
diff --git a/src/mousetrap/core/camera.py b/old/src/mousetrap/core/camera.py
similarity index 100%
rename from src/mousetrap/core/camera.py
rename to old/src/mousetrap/core/camera.py
diff --git a/src/mousetrap/core/feature_detector.py b/old/src/mousetrap/core/feature_detector.py
similarity index 100%
rename from src/mousetrap/core/feature_detector.py
rename to old/src/mousetrap/core/feature_detector.py
diff --git a/src/mousetrap/core/heads_up_display.py b/old/src/mousetrap/core/heads_up_display.py
similarity index 100%
rename from src/mousetrap/core/heads_up_display.py
rename to old/src/mousetrap/core/heads_up_display.py
diff --git a/src/mousetrap/core/image_library.py b/old/src/mousetrap/core/image_library.py
similarity index 100%
rename from src/mousetrap/core/image_library.py
rename to old/src/mousetrap/core/image_library.py
diff --git a/src/mousetrap/core/motion_tracker.py b/old/src/mousetrap/core/motion_tracker.py
similarity index 100%
rename from src/mousetrap/core/motion_tracker.py
rename to old/src/mousetrap/core/motion_tracker.py
diff --git a/src/mousetrap/core/pointer.py b/old/src/mousetrap/core/pointer.py
similarity index 100%
rename from src/mousetrap/core/pointer.py
rename to old/src/mousetrap/core/pointer.py
diff --git a/src/mousetrap/core/pointer_manager.py b/old/src/mousetrap/core/pointer_manager.py
similarity index 100%
rename from src/mousetrap/core/pointer_manager.py
rename to old/src/mousetrap/core/pointer_manager.py
diff --git a/src/mousetrap/core/settings.py b/old/src/mousetrap/core/settings.py
similarity index 100%
rename from src/mousetrap/core/settings.py
rename to old/src/mousetrap/core/settings.py
diff --git a/src/mousetrap/core/test_camera.py b/old/src/mousetrap/core/test_camera.py
similarity index 100%
copy from src/mousetrap/core/test_camera.py
copy to old/src/mousetrap/core/test_camera.py
diff --git a/src/mousetrap/core/tracker.py b/old/src/mousetrap/core/tracker.py
similarity index 100%
rename from src/mousetrap/core/tracker.py
rename to old/src/mousetrap/core/tracker.py
diff --git a/src/mousetrap/environment.py.in b/old/src/mousetrap/environment.py.in
similarity index 100%
rename from src/mousetrap/environment.py.in
rename to old/src/mousetrap/environment.py.in
diff --git a/src/mousetrap/inplace_runner.py b/old/src/mousetrap/inplace_runner.py
similarity index 100%
rename from src/mousetrap/inplace_runner.py
rename to old/src/mousetrap/inplace_runner.py
diff --git a/src/mousetrap/mousetrap.in b/old/src/mousetrap/mousetrap.in
similarity index 100%
rename from src/mousetrap/mousetrap.in
rename to old/src/mousetrap/mousetrap.in
diff --git a/src/mousetrap/ocvfw/Makefile.am b/old/src/mousetrap/ocvfw/Makefile.am
similarity index 100%
rename from src/mousetrap/ocvfw/Makefile.am
rename to old/src/mousetrap/ocvfw/Makefile.am
diff --git a/src/mousetrap/ocvfw/__init__.py b/old/src/mousetrap/ocvfw/__init__.py
similarity index 100%
rename from src/mousetrap/ocvfw/__init__.py
rename to old/src/mousetrap/ocvfw/__init__.py
diff --git a/src/mousetrap/ocvfw/_ocv.py b/old/src/mousetrap/ocvfw/_ocv.py
similarity index 100%
rename from src/mousetrap/ocvfw/_ocv.py
rename to old/src/mousetrap/ocvfw/_ocv.py
diff --git a/src/mousetrap/ocvfw/commons.py b/old/src/mousetrap/ocvfw/commons.py
similarity index 100%
rename from src/mousetrap/ocvfw/commons.py
rename to old/src/mousetrap/ocvfw/commons.py
diff --git a/src/mousetrap/ocvfw/debug.py b/old/src/mousetrap/ocvfw/debug.py
similarity index 100%
rename from src/mousetrap/ocvfw/debug.py
rename to old/src/mousetrap/ocvfw/debug.py
diff --git a/src/mousetrap/ocvfw/dev/Makefile.am b/old/src/mousetrap/ocvfw/dev/Makefile.am
similarity index 100%
rename from src/mousetrap/ocvfw/dev/Makefile.am
rename to old/src/mousetrap/ocvfw/dev/Makefile.am
diff --git a/src/mousetrap/ocvfw/dev/__init__.py b/old/src/mousetrap/ocvfw/dev/__init__.py
similarity index 100%
rename from src/mousetrap/ocvfw/dev/__init__.py
rename to old/src/mousetrap/ocvfw/dev/__init__.py
diff --git a/src/mousetrap/ocvfw/dev/camera.py b/old/src/mousetrap/ocvfw/dev/camera.py
similarity index 100%
rename from src/mousetrap/ocvfw/dev/camera.py
rename to old/src/mousetrap/ocvfw/dev/camera.py
diff --git a/src/mousetrap/ocvfw/haars/Makefile.am b/old/src/mousetrap/ocvfw/haars/Makefile.am
similarity index 100%
rename from src/mousetrap/ocvfw/haars/Makefile.am
rename to old/src/mousetrap/ocvfw/haars/Makefile.am
diff --git a/src/mousetrap/ocvfw/haars/Mouth.xml b/old/src/mousetrap/ocvfw/haars/Mouth.xml
similarity index 100%
rename from src/mousetrap/ocvfw/haars/Mouth.xml
rename to old/src/mousetrap/ocvfw/haars/Mouth.xml
diff --git a/src/mousetrap/ocvfw/haars/frontalEyes35x16.xml 
b/old/src/mousetrap/ocvfw/haars/frontalEyes35x16.xml
similarity index 100%
rename from src/mousetrap/ocvfw/haars/frontalEyes35x16.xml
rename to old/src/mousetrap/ocvfw/haars/frontalEyes35x16.xml
diff --git a/src/mousetrap/ocvfw/haars/haarcascade_eye_tree_eyeglasses.xml 
b/old/src/mousetrap/ocvfw/haars/haarcascade_eye_tree_eyeglasses.xml
similarity index 100%
rename from src/mousetrap/ocvfw/haars/haarcascade_eye_tree_eyeglasses.xml
rename to old/src/mousetrap/ocvfw/haars/haarcascade_eye_tree_eyeglasses.xml
diff --git a/src/mousetrap/ocvfw/haars/haarcascade_frontalface_alt.xml 
b/old/src/mousetrap/ocvfw/haars/haarcascade_frontalface_alt.xml
similarity index 100%
rename from src/mousetrap/ocvfw/haars/haarcascade_frontalface_alt.xml
rename to old/src/mousetrap/ocvfw/haars/haarcascade_frontalface_alt.xml
diff --git a/src/mousetrap/ocvfw/haars/haarcascade_frontalface_alt2.xml 
b/old/src/mousetrap/ocvfw/haars/haarcascade_frontalface_alt2.xml
similarity index 100%
rename from src/mousetrap/ocvfw/haars/haarcascade_frontalface_alt2.xml
rename to old/src/mousetrap/ocvfw/haars/haarcascade_frontalface_alt2.xml
diff --git a/src/mousetrap/ocvfw/haars/haarcascade_frontalface_alt_tree.xml 
b/old/src/mousetrap/ocvfw/haars/haarcascade_frontalface_alt_tree.xml
similarity index 100%
rename from src/mousetrap/ocvfw/haars/haarcascade_frontalface_alt_tree.xml
rename to old/src/mousetrap/ocvfw/haars/haarcascade_frontalface_alt_tree.xml
diff --git a/src/mousetrap/ocvfw/haars/haarcascade_frontalface_default.xml 
b/old/src/mousetrap/ocvfw/haars/haarcascade_frontalface_default.xml
similarity index 100%
rename from src/mousetrap/ocvfw/haars/haarcascade_frontalface_default.xml
rename to old/src/mousetrap/ocvfw/haars/haarcascade_frontalface_default.xml
diff --git a/src/mousetrap/ocvfw/idm/Makefile.am b/old/src/mousetrap/ocvfw/idm/Makefile.am
similarity index 100%
rename from src/mousetrap/ocvfw/idm/Makefile.am
rename to old/src/mousetrap/ocvfw/idm/Makefile.am
diff --git a/src/mousetrap/ocvfw/idm/__init__.py b/old/src/mousetrap/ocvfw/idm/__init__.py
similarity index 100%
rename from src/mousetrap/ocvfw/idm/__init__.py
rename to old/src/mousetrap/ocvfw/idm/__init__.py
diff --git a/src/mousetrap/ocvfw/idm/color.py b/old/src/mousetrap/ocvfw/idm/color.py
similarity index 100%
rename from src/mousetrap/ocvfw/idm/color.py
rename to old/src/mousetrap/ocvfw/idm/color.py
diff --git a/src/mousetrap/ocvfw/idm/eyes.py b/old/src/mousetrap/ocvfw/idm/eyes.py
similarity index 100%
rename from src/mousetrap/ocvfw/idm/eyes.py
rename to old/src/mousetrap/ocvfw/idm/eyes.py
diff --git a/src/mousetrap/ocvfw/idm/finger.py b/old/src/mousetrap/ocvfw/idm/finger.py
similarity index 100%
rename from src/mousetrap/ocvfw/idm/finger.py
rename to old/src/mousetrap/ocvfw/idm/finger.py
diff --git a/src/mousetrap/ocvfw/idm/forehead.py b/old/src/mousetrap/ocvfw/idm/forehead.py
similarity index 100%
rename from src/mousetrap/ocvfw/idm/forehead.py
rename to old/src/mousetrap/ocvfw/idm/forehead.py
diff --git a/src/mousetrap/ocvfw/pocv.py b/old/src/mousetrap/ocvfw/pocv.py
similarity index 100%
rename from src/mousetrap/ocvfw/pocv.py
rename to old/src/mousetrap/ocvfw/pocv.py
diff --git a/src/mousetrap/pylintrc b/old/src/mousetrap/pylintrc
similarity index 100%
rename from src/mousetrap/pylintrc
rename to old/src/mousetrap/pylintrc
diff --git a/src/mousetrap/ui/Makefile.am b/old/src/mousetrap/ui/Makefile.am
similarity index 100%
rename from src/mousetrap/ui/Makefile.am
rename to old/src/mousetrap/ui/Makefile.am
diff --git a/src/mousetrap/ui/__init__.py b/old/src/mousetrap/ui/__init__.py
similarity index 100%
rename from src/mousetrap/ui/__init__.py
rename to old/src/mousetrap/ui/__init__.py
diff --git a/src/mousetrap/Makefile.am b/src/mousetrap/Makefile.am
index 3475db3..8079824 100644
--- a/src/mousetrap/Makefile.am
+++ b/src/mousetrap/Makefile.am
@@ -1,5 +1,3 @@
-mousetrap_SCRIPTS = \
-       mousetrap
 
 mousetrapdir=$(bindir)
 
@@ -7,36 +5,12 @@ mousetrap_pathdir=$(pyexecdir)
 
 mousetrap_python_PYTHON = \
        __init__.py \
-       environment.py \
-       controller.py
+       camera.py
 
-SUBDIRS = addons app core ocvfw ui
+#SUBDIRS =
 
 mousetrap_pythondir=$(pyexecdir)/mousetrap/
 
 install-exec-hook:
-       chmod a+rx $(DESTDIR)$(mousetrap_pythondir) -R
+       chmod a+r $(DESTDIR)$(mousetrap_pythondir) -R
 
-##### START DIRECTORY VARIABLE SUBSTITUTIONS ##################################
-# Substitution of autotool's directory vars (outside of Makefiles) must be done
-# by make. edit defines a sed substitution for all the special variables. The
-# mousetrap rule calls $(edit)
-edit = sed \
-               -e 's|@PYTHON[ ]|$(PYTHON)|g' \
-               -e 's|@pythondir[ ]|$(pythondir)|g' \
-               -e 's|@pyexecdir[ ]|$(pyexecdir)|g' \
-               -e 's|@pkgdatadir[ ]|$(pkgdatadir)|g' \
-               -e 's|@prefix[ ]|$(prefix)|g'
-
-mousetrap: Makefile
-       rm -f $@ $  tmp
-       srcdir=''; \
-               test -f ./$  in || srcdir=$(srcdir)/; \
-               $(edit) $${srcdir}$  in >$  tmp
-
-       chmod +x $  tmp
-       chmod a-w $  tmp
-       mv $  tmp $@
-
-mousetrap: $(srcdir)/mousetrap.in
-##### END DIRECTORY VARIABLE SUBSTITUTIONS ####################################
diff --git a/src/mousetrap/__init__.py b/src/mousetrap/__init__.py
index 7284fed..e69de29 100644
--- a/src/mousetrap/__init__.py
+++ b/src/mousetrap/__init__.py
@@ -1,25 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# MouseTrap
-#
-# Copyright 2009 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 v2 as published
-# by the Free Software Foundation.
-#
-# 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/>.
-
-__id__ = "$Id$"
-__version__ = "$Revision$"
-__date__ = "$Date$"
-__copyright__ = "Copyright (c) 2008 Flavio Percoco Premoli"
-__license__ = "GPLv2"
diff --git a/src/mousetrap/camera.py b/src/mousetrap/camera.py
new file mode 100644
index 0000000..9c797db
--- /dev/null
+++ b/src/mousetrap/camera.py
@@ -0,0 +1,32 @@
+import cv2
+
+
+class Camera(object):
+
+    def __init__(self, device_id=0):
+        self._device_id = device_id
+        self._capture = None
+
+    def start_camera(self):
+        self._capture = cv2.VideoCapture(self._device_id)
+
+    def get_image(self):
+        if not self.is_started():
+            raise CameraError("Camera has not been started.")
+        return self._read_image()
+
+    def is_started(self):
+        return self._capture is not None and self._capture.isOpened()
+
+    def _read_image(self):
+        read_was_successful, image = self._capture.read()
+        if not read_was_successful:
+            raise CameraError("Read was not successful.")
+        return image
+
+
+class CameraError(Exception):
+
+    def __init__(self, message):
+        super(CameraError, self).__init__()
+        self.message = message
diff --git a/src/mousetrap/core/test_camera.py b/src/mousetrap/test_camera.py
similarity index 88%
rename from src/mousetrap/core/test_camera.py
rename to src/mousetrap/test_camera.py
index 53736d6..e576ae2 100644
--- a/src/mousetrap/core/test_camera.py
+++ b/src/mousetrap/test_camera.py
@@ -1,7 +1,5 @@
-__author__ = 'foss2serve'
-
 import unittest
-from .camera import Camera, CameraError
+from mousetrap.camera import Camera, CameraError
 
 
 class test_camera(unittest.TestCase):
diff --git a/bin/lib/run_python_tests.py b/src/run_python_tests.py
old mode 100644
new mode 100755
similarity index 83%
rename from bin/lib/run_python_tests.py
rename to src/run_python_tests.py
index 96397ed..db16840
--- a/bin/lib/run_python_tests.py
+++ b/src/run_python_tests.py
@@ -24,11 +24,7 @@ def append_to_path(paths):
 
 
 def get_source_directory():
-    return get_project_directory() + '/src'
-
-
-def get_project_directory():
-    return dirname(dirname(dirname(abspath(__file__))))
+    return abspath(dirname(__file__))
 
 
 def load_tests():



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