Taking in DialCentral changes
authorepage <eopage@byu.net>
Thu, 28 May 2009 01:00:48 +0000 (01:00 +0000)
committerepage <eopage@byu.net>
Thu, 28 May 2009 01:00:48 +0000 (01:00 +0000)
git-svn-id: file:///svnroot/ejpi/trunk@43 df6cc7de-23d0-4ae0-bb86-c17aa67b2a9d

Makefile
src/ejpi_glade.py
src/gtk_toolbox.py
support/builddeb.py
support/pylint.rc

index 0423046..bafdbc7 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -40,6 +40,7 @@ test: $(OBJ)
 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)) ; )
index afb2175..3350af1 100755 (executable)
@@ -43,6 +43,7 @@ import plugin_utils
 import history
 import gtkhistory
 import gtk_toolbox
+import constants
 
 
 PLUGIN_SEARCH_PATHS = [
@@ -97,11 +98,6 @@ class ValueEntry(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"),
@@ -113,7 +109,7 @@ class Calculator(object):
                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
 
@@ -147,6 +143,7 @@ class Calculator(object):
                else:
                        self.display_error_message("Cannot find ejpi.glade")
                        gtk.main_quit()
+                       return
                try:
                        os.makedirs(self._user_data)
                except OSError, e:
@@ -154,28 +151,27 @@ class Calculator(object):
                                raise
 
                self._clipboard = gtk.clipboard_get()
-               self.__window = self._widgetTree.get_widget("mainWindow")
+               self._window = self._widgetTree.get_widget("mainWindow")
 
-               global hildon
                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)
-                       self.__window.set_menu(menu)
+                       self._window.set_menu(menu)
                        gtkMenu.destroy()
 
-                       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)
 
@@ -217,20 +213,18 @@ class Calculator(object):
                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
-
                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:
@@ -338,9 +332,9 @@ class Calculator(object):
                """
                if event.keyval == gtk.keysyms.F6:
                        if self._isFullScreen:
-                               self.__window.unfullscreen()
+                               self._window.unfullscreen()
                        else:
-                               self.__window.fullscreen()
+                               self._window.fullscreen()
 
        def _on_push(self, *args):
                self.__history.push_entry()
@@ -364,17 +358,15 @@ class Calculator(object):
 
        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.
 
-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"])
@@ -398,7 +390,7 @@ def run_calculator():
 
        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()
 
index 52dcd5d..1f14788 100644 (file)
@@ -1,5 +1,7 @@
 #!/usr/bin/python
 
+from __future__ import with_statement
+
 import sys
 import traceback
 import functools
@@ -19,6 +21,14 @@ def gtk_lock():
                gtk.gdk.threads_leave()
 
 
+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
@@ -46,7 +56,9 @@ def asynchronous_gtk_message(original_func):
 
        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):
@@ -83,11 +95,8 @@ class ErrorDisplay(object):
                self.__parentBox.remove(self.__errorBox)
 
        def push_message_with_lock(self, message):
-               gtk.gdk.threads_enter()
-               try:
+               with gtk_lock():
                        self.push_message(message)
-               finally:
-                       gtk.gdk.threads_leave()
 
        def push_message(self, message):
                if 0 < len(self.__messages):
@@ -95,6 +104,10 @@ class ErrorDisplay(object):
                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)
index 63b16e0..09da773 100755 (executable)
@@ -1,13 +1,14 @@
 #!/usr/bin/python2.5
 
 from py2deb import *
+import constants
 
 
-__appname__ = "ejpi"
+__appname__ = constants.__app_name__
 __description__ = "A Touch Screen Optimized RPN Calculator using Pie Menus"
 __author__ = "Ed Page"
 __email__ = "eopage@byu.net"
-__version__ = "0.9.4"
+__version__ = constants.__version__
 __build__ = 0
 __changelog__ = '''
 0.9.4
@@ -81,7 +82,7 @@ if __name__ == "__main__":
        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"
index 37b9725..2a371a1 100644 (file)
@@ -53,7 +53,7 @@ load-plugins=
 #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
 
 [REPORTS]