@todo Expanded copy/paste (Unusure how far to go)
@li Copy formula, value, serialized, mathml, latex?
@li Paste serialized, value?
+@bug Has the same Maemo tab color bug as DialCentral
Some useful things on Maemo
@li http://maemo.org/api_refs/4.1/libosso-2.16-1/group__Statesave.html
import plugin_utils
import history
import gtkhistory
+import gtk_toolbox
PLUGIN_SEARCH_PATHS = [
value = property(get_value, set_value, clear)
-class ErrorDisplay(history.ErrorReporting):
-
- def __init__(self, widgetTree):
- super(ErrorDisplay, self).__init__()
- self.__errorBox = widgetTree.get_widget("errorEventBox")
- self.__errorDescription = widgetTree.get_widget("errorDescription")
- self.__errorClose = widgetTree.get_widget("errorClose")
- self.__parentBox = self.__errorBox.get_parent()
-
- self.__errorBox.connect("button_release_event", self._on_close)
-
- self.__messages = []
- self.__parentBox.remove(self.__errorBox)
-
- def push_message(self, message):
- if 0 < len(self.__messages):
- self.__messages.append(message)
- else:
- self.__show_message(message)
-
- def pop_message(self):
- if 0 < len(self.__messages):
- self.__show_message(self.__messages[0])
- del self.__messages[0]
- else:
- self.__hide_message()
-
- def _on_close(self, *args):
- self.pop_message()
-
- def __show_message(self, message):
- self.__errorDescription.set_text(message)
- self.__parentBox.pack_start(self.__errorBox, False, False)
- self.__parentBox.reorder_child(self.__errorBox, 1)
-
- def __hide_message(self):
- self.__errorDescription.set_text("")
- self.__parentBox.remove(self.__errorBox)
-
-
class Calculator(object):
__pretty_app_name__ = "e**(j pi) + 1 = 0"
__app_name__ = "ejpi"
- __version__ = "0.9.0"
+ __version__ = "0.9.4"
__app_magic__ = 0xdeadbeef
_glade_files = [
self._isFullScreen = False
if hildon is not None:
self._app = hildon.Program()
+ oldWindow = self._window
self.__window = hildon.Window()
- self._widgetTree.get_widget("mainLayout").reparent(self.__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)
else:
pass # warnings.warn("No Hildon", UserWarning, 2)
- self.__errorDisplay = ErrorDisplay(self._widgetTree)
+ self.__errorDisplay = gtk_toolbox.ErrorDisplay(self._widgetTree)
self.__userEntry = ValueEntry(self._widgetTree.get_widget("entryView"))
self.__stackView = self._widgetTree.get_widget("historyView")
self.__builtinPlugin = self.__keyboardPlugins.keyboards["Builtin"].construct_keyboard()
self.__builtinKeyboard = self.__builtinPlugin.setup(self.__history, self.__sliceStyle, self.__handler)
self._widgetTree.get_widget("functionLayout").pack_start(self.__builtinKeyboard)
- self._widgetTree.get_widget("functionLayout").reorder_child(self.__builtinKeyboard, 0)
self.enable_plugin(self.__keyboardPlugins.lookup_plugin("Trigonometry"))
self.enable_plugin(self.__keyboardPlugins.lookup_plugin("Computer"))
self.enable_plugin(self.__keyboardPlugins.lookup_plugin("Alphabet"))
"on_about": self._on_about_activate,
}
self._widgetTree.signal_autoconnect(callbackMapping)
+ 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._isFullScreen = False
def _on_close(self, *args, **kwds):
+ if self._osso is not None:
+ self._osso.close()
+
try:
self.__save_history()
finally:
gtk.main_quit()
+ def _on_copy(self, *args):
+ try:
+ equationNode = self.__history.history.peek()
+ result = str(equationNode.evaluate())
+ self._clipboard.set_text(result)
+ except StandardError, e:
+ self.__errorDisplay.push_exception()
+
+ def _on_copy_equation(self, *args):
+ try:
+ equationNode = self.__history.history.peek()
+ equation = str(equationNode)
+ self._clipboard.set_text(equation)
+ except StandardError, e:
+ self.__errorDisplay.push_exception()
+
def _on_paste(self, *args):
contents = self._clipboard.wait_for_text()
self.__userEntry.append(contents)
dlg.set_name(self.__pretty_app_name__)
dlg.set_version(self.__version__)
dlg.set_copyright("Copyright 2008 - LGPL")
- dlg.set_comments("")
- dlg.set_website("")
- dlg.set_authors([""])
+ 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.
+""")
+ dlg.set_website("http://ejpi.garage.maemo.org")
+ dlg.set_authors(["Ed Page"])
dlg.run()
dlg.destroy()