PROJECT_NAME=ejpi
SOURCE_PATH=src
SOURCE=$(shell find $(SOURCE_PATH) -iname *.py)
+PROGRAM=$(SOURCE_PATH)/$(PROJECT_NAME).py
DATA_TYPES=*.ini *.map *.glade *.png
DATA=$(foreach type, $(DATA_TYPES), $(shell find $(SOURCE_PATH) -iname $(type)))
OBJ=$(SOURCE:.py=.pyc)
-TAG_FILE=~/.ctags/$(PROJECT_NAME).tags
BUILD_PATH=./build/
BUILD_SOURCE=$(foreach file, $(SOURCE), $(BUILD_PATH)/$(subst /,-,$(file)))
+TAG_FILE=~/.ctags/$(PROJECT_NAME).tags
TODO_FILE=./TODO
DEBUGGER=winpdb
-UNIT_TEST=nosetests -w $(TEST_PATH)
-STYLE_TEST=../../Python/tools/pep8.py --ignore=W191
+UNIT_TEST=nosetests --with-doctest -w $(TEST_PATH)
+STYLE_TEST=../../Python/tools/pep8.py --ignore=W191,E501
LINT_RC=./support/pylint.rc
LINT=pylint --rcfile=$(LINT_RC)
-COVERAGE_TEST=figleaf
-PROFILER=pyprofiler
-CTAGS=ctags-exuberant
TODO_FINDER=support/todo.py
+PROFILE_GEN=python -m cProfile -o .profile
+PROFILE_VIEW=python -m pstats .profile
+CTAGS=ctags-exuberant
-.PHONY: all run debug test lint tags todo package clean distclean
+.PHONY: all run profile debug test lint tags todo package clean distclean
all: test package
run: $(SOURCE)
$(SOURCE_PATH)/ejpi_glade.py
+profile: $(SOURCE)
+ $(PROFILE_GEN) $(PROGRAM)
+ $(PROFILE_VIEW)
+
debug: $(SOURCE)
- $(DEBUGGER) $(SOURCE_PATH)/ejpi_glade.py
+ $(DEBUGGER) $(PROGRAM)
test: $(SOURCE)
- $(SOURCE_PATH)/ejpi_glade.py -t
+ $(UNIT_TEST)
package:
rm -Rf $(BUILD_PATH)
cp support/$(PROJECT_NAME).desktop $(BUILD_PATH)
cp support/builddeb.py $(BUILD_PATH)
-lint:
+lint: $(SOURCE)
$(foreach file, $(SOURCE), $(LINT) $(file) ; )
tags: $(TAG_FILE)
rm -Rf $(OBJ)
rm -Rf $(BUILD_PATH)
rm -Rf $(TAG_FILE)
+ find $(SOURCE_PATH) -name "*.*~" | xargs rm -f
+ find $(SOURCE_PATH) -name "*.swp" | xargs rm -f
+ find $(SOURCE_PATH) -name "*.bak" | xargs rm -f
+ find $(SOURCE_PATH) -name ".*.swp" | xargs rm -f
$(TAG_FILE): $(SOURCE)
mkdir -p $(dir $(TAG_FILE))
self.__clickPosition = 0, 0
self.__popupTimeDelay = None
- self.__popupWindow = gtk.Window(type = gtk.WINDOW_POPUP)
- self.__popupWindow.set_title("")
-
self.__pie = None
self.__pie = PieMenu(self.sliceStyle)
- self.__popupWindow.add(self.__pie)
self.__pie.connect("button_release_event", self._on_button_release)
+ self.__pie.show()
+
+ self.__popupWindow = gtk.Window(type = gtk.WINDOW_POPUP)
+ self.__popupWindow.set_title("")
+ self.__popupWindow.add(self.__pie)
for direction in PieSlice.SLICE_DIRECTIONS:
self.add_slice(NullPieSlice(), direction)
def _on_motion_notify(self, widget, event):
self.__update_state(event.get_coords())
- if self.__pie is None:
+ if not self.__popped:
return
mousePosition = event.get_root_coords()
self.__pie._on_button_press(self.__pie, pieClick)
self.__pie.grab_focus()
- self.__popupWindow.show_all()
+ self.__popupWindow.show()
def __unpop(self):
assert self.__popped
self.__popped = False
+
piePosition = self.__popupWindow.get_position()
self.grab_focus()
+
self.__popupWindow.hide()
from __future__ import with_statement
+import threading
import contextlib
import functools
-import math
import gobject
import gtk
if not a:
a.append(func(*args, **kwds))
try:
- a[0].next()
+ shouldBeNone = a[0].next()
+ assert shouldBeNone is None, "The idle only task yield a value, %r" % shouldBeNone
return True
except StopIteration:
del a[:]
def gtk_critical_section():
#The API changed and I hope these are the right calls
gtk.gdk.threads_enter()
- yield
- gtk.gdk.threads_leave()
+ try:
+ yield
+ finally:
+ gtk.gdk.threads_leave()
if __name__ == "__main__":
return wrapper
-class expected(object):
+@contextlib.contextmanager
+def expected(exception):
"""
- >>> with expected(ZeroDivisionError):
+ >>> with expected2(ZeroDivisionError):
... 1 / 0
- >>> with expected(AssertionError("expected ZeroDivisionError to have been thrown")):
+ >>> with expected2(AssertionError("expected ZeroDivisionError to have been thrown")):
... with expected(ZeroDivisionError):
... 1 / 2
Traceback (most recent call last):
File "/media/data/Personal/Development/bzr/Recollection-trunk/src/libraries/recipes/context.py", line 139, in __exit__
assert t is not None, ("expected {0:%s} to have been thrown" % (self._t.__name__))
AssertionError: expected {0:ZeroDivisionError} to have been thrown
- >>> with expected(Exception("foo")):
+ >>> with expected2(Exception("foo")):
... raise Exception("foo")
- >>> with expected(Exception("bar")):
+ >>> with expected2(Exception("bar")):
... with expected(Exception("foo")): # this won't catch it
... raise Exception("bar")
... assert False, "should not see me"
- >>> with expected(Exception("can specify")):
+ >>> with expected2(Exception("can specify")):
... raise Exception("can specify prefixes")
- >>> with expected(Exception("Base class fun")):
- ... raise IndexError("Base class fun")
+ >>> with expected2(Exception("Base class fun")):
+ True
+ >>> True
+ False
"""
-
- def __init__(self, e):
- if isinstance(e, Exception):
- self._t, self._v = type(e), str(e)
- elif isinstance(e, type):
- self._t, self._v = e, ""
- else:
- raise Exception("usage: with expected(Exception): ... or "
- "with expected(Exception(\"text\")): ...")
-
- def __enter__(self):
- try:
- pass
- except:
- pass # this is a Python 3000 way of saying sys.exc_clear()
-
- def __exit__(self, t, v, tb):
- assert t is not None, ("expected {0:%s} to have been thrown" % (self._t.__name__))
- return self._t in inspect.getmro(t) and str(v).startswith(self._v)
+ if isinstance(exception, Exception):
+ excType, excValue = type(exception), str(exception)
+ elif isinstance(e, type):
+ excType, excValue = e, ""
+
+ try:
+ yield
+ except Exception, e:
+ if not (excType in inspect.getmro(type(e)) and str(e).startswith(excValue)):
+ raise
+ else:
+ raise AssertionError("expected {0:%s} to have been thrown" % excType.__name__)
+
+
+if __name__ == "__main__":
+ import doctest
+ doctest.testmod()
\ No newline at end of file
__description__ = "RPN Calculator"
__author__ = "Ed Page"
__email__ = "eopage@byu.net"
-__version__ = "0.9.0"
-__build__ = 4
+__version__ = "0.9.1"
+__build__ = 0
__changelog__ = '''\
+0.9.1 - "Laziness doesn't always pay off"
+* Modified the pie menus a bit to try and optimize popup time
+
0.9.0 - "Feed is for horses, so what about feedback?"
* Initial public release
* Pie menus for keys
# lint Python modules using external checkers.
-#
+#
# This is the main checker controling the other ones and the reports
# generation. It is itself both a raw checker and an astng checker in order
# to:
# * handle message activation / deactivation at the module level
# * handle some basic but necessary stats'data (number of classes, methods...)
-#
+#
[MASTER]
# Specify a configuration file.
#enable-msg=
# Disable the message(s) with the given id(s).
-disable-msg=W0403,W0612,W0613,C0103,C0111,C0301
+disable-msg=W0403,W0612,W0613,C0103,C0111,C0301,R0903,W0142,W0603,R0904
[REPORTS]
# set the output format. Available formats are text, parseable, colorized, msvs
# (visual studio) and html
-output-format=text
+output-format=colorized
# Include message's id in output
-include-ids=no
+include-ids=yes
# Put messages in a separate file for each module / package specified on the
# command line instead of printing them on stdout. Reports (if any) will be
files-output=no
# Tells wether to display a full report or only the messages
-reports=yes
+reports=no
# Python expression which should return a note less than 10 (10 is the highest
# note).You have access to the variables errors warning, statement which
# * undefined variables
# * redefinition of variable from builtins or from an outer scope
# * use of variable before assigment
-#
+#
[VARIABLES]
# Tells wether we should check for unused import in __init__ files.
# * dangerous default values as arguments
# * redefinition of function / method / class
# * uses of the global statement
-#
+#
[BASIC]
# Required attributes for module, separated by a comma
# checks for sign of poor/misdesign:
# * number of methods, attributes, local variables...
# * size, complexity of functions, methods
-#
+#
[DESIGN]
# Maximum number of arguments for function / method
# * attributes not defined in the __init__ method
# * supported interfaces implementation
# * unreachable code
-#
+#
[CLASSES]
# List of interface methods to ignore, separated by a comma. This is used for
# * relative / wildcard imports
# * cyclic imports
# * uses of deprecated modules
-#
+#
[IMPORTS]
# Deprecated modules which should not be used, separated by a comma
# checks for similarities and duplicated code. This computation may be
# memory / CPU intensive, so you should disable it if you experiments some
# problems.
-#
+#
[SIMILARITIES]
# Minimum lines number of a similarity.
# checks for:
# * warning notes in the code like FIXME, XXX
# * PEP 263: source code with non ascii character but no encoding declaration
-#
+#
[MISCELLANEOUS]
# List of note tags to take in consideration, separated by a comma.
# * strict indentation
# * line length
# * use of <> instead of !=
-#
+#
[FORMAT]
# Maximum number of characters on a single line.