build: $(OBJ)
rm -Rf $(BUILD_PATH)
mkdir $(BUILD_PATH)
build: $(OBJ)
rm -Rf $(BUILD_PATH)
mkdir $(BUILD_PATH)
+ cp $(SOURCE_PATH)/constants.py $(BUILD_PATH)
cp $(SOURCE_PATH)/$(PROJECT_NAME).py $(BUILD_PATH)
$(foreach file, $(DATA), cp $(file) $(BUILD_PATH)/$(subst /,-,$(file)) ; )
$(foreach file, $(SOURCE), cp $(file) $(BUILD_PATH)/$(subst /,-,$(file)) ; )
cp $(SOURCE_PATH)/$(PROJECT_NAME).py $(BUILD_PATH)
$(foreach file, $(DATA), cp $(file) $(BUILD_PATH)/$(subst /,-,$(file)) ; )
$(foreach file, $(SOURCE), cp $(file) $(BUILD_PATH)/$(subst /,-,$(file)) ; )
import history
import gtkhistory
import gtk_toolbox
import history
import gtkhistory
import gtk_toolbox
class Calculator(object):
class Calculator(object):
- __pretty_app_name__ = "e**(j pi) + 1 = 0"
- __app_name__ = "ejpi"
- __version__ = "0.9.4"
- __app_magic__ = 0xdeadbeef
-
_glade_files = [
'/usr/lib/ejpi/ejpi.glade',
os.path.join(os.path.dirname(__file__), "ejpi.glade"),
_glade_files = [
'/usr/lib/ejpi/ejpi.glade',
os.path.join(os.path.dirname(__file__), "ejpi.glade"),
os.path.join(os.path.dirname(__file__), "plugins/"),
]
os.path.join(os.path.dirname(__file__), "plugins/"),
]
- _user_data = os.path.expanduser("~/.%s/" % __app_name__)
+ _user_data = os.path.expanduser("~/.%s/" % constants.__app_name__)
_user_settings = "%s/settings.ini" % _user_data
_user_history = "%s/history.stack" % _user_data
_user_settings = "%s/settings.ini" % _user_data
_user_history = "%s/history.stack" % _user_data
else:
self.display_error_message("Cannot find ejpi.glade")
gtk.main_quit()
else:
self.display_error_message("Cannot find ejpi.glade")
gtk.main_quit()
try:
os.makedirs(self._user_data)
except OSError, e:
try:
os.makedirs(self._user_data)
except OSError, e:
raise
self._clipboard = gtk.clipboard_get()
raise
self._clipboard = gtk.clipboard_get()
- self.__window = self._widgetTree.get_widget("mainWindow")
+ self._window = self._widgetTree.get_widget("mainWindow")
self._app = None
self._isFullScreen = False
if hildon is not None:
self._app = hildon.Program()
oldWindow = self._window
self._app = None
self._isFullScreen = False
if hildon is not None:
self._app = hildon.Program()
oldWindow = self._window
- self.__window = hildon.Window()
- oldWindow.get_child().reparent(self.__window)
- self._app.add_window(self.__window)
+ self._window = hildon.Window()
+ oldWindow.get_child().reparent(self._window)
+ self._app.add_window(self._window)
hildon.hildon_helper_set_thumb_scrollbar(self._widgetTree.get_widget('scrollingHistory'), True)
gtkMenu = self._widgetTree.get_widget("mainMenubar")
menu = gtk.Menu()
for child in gtkMenu.get_children():
child.reparent(menu)
hildon.hildon_helper_set_thumb_scrollbar(self._widgetTree.get_widget('scrollingHistory'), True)
gtkMenu = self._widgetTree.get_widget("mainMenubar")
menu = gtk.Menu()
for child in gtkMenu.get_children():
child.reparent(menu)
- self.__window.set_menu(menu)
+ self._window.set_menu(menu)
- self.__window.connect("key-press-event", self._on_key_press)
- self.__window.connect("window-state-event", self._on_window_state_change)
+ self._window.connect("key-press-event", self._on_key_press)
+ self._window.connect("window-state-event", self._on_window_state_change)
else:
pass # warnings.warn("No Hildon", UserWarning, 2)
else:
pass # warnings.warn("No Hildon", UserWarning, 2)
self._widgetTree.get_widget("copyMenuItem").connect("activate", self._on_copy)
self._widgetTree.get_widget("copyEquationMenuItem").connect("activate", self._on_copy_equation)
self._widgetTree.get_widget("copyMenuItem").connect("activate", self._on_copy)
self._widgetTree.get_widget("copyEquationMenuItem").connect("activate", self._on_copy_equation)
- if self.__window:
- if hildon is None:
- self.__window.set_title("%s" % self.__pretty_app_name__)
- self.__window.connect("destroy", self._on_close)
- self.__window.show_all()
+ if hildon is None:
+ self._window.set_title("%s" % constants.__pretty_app_name__)
+ self._window.connect("destroy", self._on_close)
+ self._window.show_all()
try:
import osso
except ImportError:
osso = None
try:
import osso
except ImportError:
osso = None
self._osso = None
if osso is not None:
self._osso = None
if osso is not None:
- self._osso = osso.Context(Calculator.__app_name__, Calculator.__version__, False)
+ self._osso = osso.Context(constants.__app_name__, constants.__version__, False)
device = osso.DeviceState(self._osso)
device.set_device_state_callback(self._on_device_state_change, 0)
else:
device = osso.DeviceState(self._osso)
device.set_device_state_callback(self._on_device_state_change, 0)
else:
"""
if event.keyval == gtk.keysyms.F6:
if self._isFullScreen:
"""
if event.keyval == gtk.keysyms.F6:
if self._isFullScreen:
- self.__window.unfullscreen()
+ self._window.unfullscreen()
- self.__window.fullscreen()
+ self._window.fullscreen()
def _on_push(self, *args):
self.__history.push_entry()
def _on_push(self, *args):
self.__history.push_entry()
def _on_about_activate(self, *args):
dlg = gtk.AboutDialog()
def _on_about_activate(self, *args):
dlg = gtk.AboutDialog()
- dlg.set_name(self.__pretty_app_name__)
- dlg.set_version(self.__version__)
+ dlg.set_name(constants.__pretty_app_name__)
+ dlg.set_version(constants.__version__)
dlg.set_copyright("Copyright 2008 - LGPL")
dlg.set_comments("""
ejpi A Touch Screen Optimized RPN Calculator for Maemo and Linux.
dlg.set_copyright("Copyright 2008 - LGPL")
dlg.set_comments("""
ejpi A Touch Screen Optimized RPN Calculator for Maemo and Linux.
-How do I use this?
-The buttons are all pie-menus. Clicking on them will give you the default (center) behavior. If you click and hold, the menu gets displayed showing what other actions you can then perform. While still holding, just drag in the direction of one of these actions.
-
-This is RPN, where are the swap, roll, etc operations?
-This also uses a touch screen, go ahead and feel adventerous by dragging the stack items around.
+RPN: Stack based math, its fun
+Buttons: Try both pressing and hold/drag
+History: Try dragging things around, deleting them, etc
""")
dlg.set_website("http://ejpi.garage.maemo.org")
dlg.set_authors(["Ed Page"])
""")
dlg.set_website("http://ejpi.garage.maemo.org")
dlg.set_authors(["Ed Page"])
gtkpie.IMAGES.add_path(os.path.join(os.path.dirname(__file__), "libraries/images"), )
if hildon is not None:
gtkpie.IMAGES.add_path(os.path.join(os.path.dirname(__file__), "libraries/images"), )
if hildon is not None:
- gtk.set_application_name(Calculator.__pretty_app_name__)
+ gtk.set_application_name(constants.__pretty_app_name__)
handle = Calculator()
gtk.main()
handle = Calculator()
gtk.main()
+from __future__ import with_statement
+
import sys
import traceback
import functools
import sys
import traceback
import functools
+def find_parent_window(widget):
+ while True:
+ parent = widget.get_parent()
+ if isinstance(parent, gtk.Window):
+ return parent
+ widget = parent
+
+
def make_idler(func):
"""
Decorator that makes a generator-function into a function that will continue execution on next call
def make_idler(func):
"""
Decorator that makes a generator-function into a function that will continue execution on next call
def execute(allArgs):
args, kwargs = allArgs
def execute(allArgs):
args, kwargs = allArgs
- original_func(*args, **kwargs)
+ with gtk_lock():
+ original_func(*args, **kwargs)
+ return False
@functools.wraps(original_func)
def delayed_func(*args, **kwargs):
@functools.wraps(original_func)
def delayed_func(*args, **kwargs):
self.__parentBox.remove(self.__errorBox)
def push_message_with_lock(self, message):
self.__parentBox.remove(self.__errorBox)
def push_message_with_lock(self, message):
- gtk.gdk.threads_enter()
- try:
self.push_message(message)
self.push_message(message)
- finally:
- gtk.gdk.threads_leave()
def push_message(self, message):
if 0 < len(self.__messages):
def push_message(self, message):
if 0 < len(self.__messages):
else:
self.__show_message(message)
else:
self.__show_message(message)
+ def push_exception_with_lock(self, exception = None):
+ with gtk_lock():
+ self.push_exception(exception)
+
def push_exception(self, exception = None):
if exception is None:
userMessage = str(sys.exc_value)
def push_exception(self, exception = None):
if exception is None:
userMessage = str(sys.exc_value)
#!/usr/bin/python2.5
from py2deb import *
#!/usr/bin/python2.5
from py2deb import *
+__appname__ = constants.__app_name__
__description__ = "A Touch Screen Optimized RPN Calculator using Pie Menus"
__author__ = "Ed Page"
__email__ = "eopage@byu.net"
__description__ = "A Touch Screen Optimized RPN Calculator using Pie Menus"
__author__ = "Ed Page"
__email__ = "eopage@byu.net"
+__version__ = constants.__version__
__build__ = 0
__changelog__ = '''
0.9.4
__build__ = 0
__changelog__ = '''
0.9.4
p.arch = "all"
p.urgency = "low"
p.distribution = "chinook diablo"
p.arch = "all"
p.urgency = "low"
p.distribution = "chinook diablo"
- p.repository = "extras-devel"
+ p.repository = "extras"
p.changelog = __changelog__
p.postinstall = __postinstall__
p.icon="26x26-ejpi.png"
p.changelog = __changelog__
p.postinstall = __postinstall__
p.icon="26x26-ejpi.png"
#enable-msg=
# Disable the message(s) with the given id(s).
#enable-msg=
# Disable the message(s) with the given id(s).
-disable-msg=W0403,W0612,W0613,C0103,C0111,C0301,R0903,W0142,W0603,R0904
+disable-msg=W0403,W0612,W0613,C0103,C0111,C0301,R0903,W0142,W0603,R0904,R0921,R0201