json, icon, and misc fixes and improvements made to ejpi/gonvert
authorEd Page <eopage@byu.net>
Sat, 13 Aug 2011 21:44:56 +0000 (16:44 -0500)
committerEd Page <eopage@byu.net>
Sun, 14 Aug 2011 02:36:39 +0000 (21:36 -0500)
Makefile
data/template.desktop
dialcentral/backends/gvoice/gvoice.py
dialcentral/util/linux.py
dialcentral/util/qt_compat.py
dialcentral/util/qtpieboard.py
setup.py
support/obs_upload.sh [new file with mode: 0755]

index 24cb868..c53ccfe 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -5,7 +5,7 @@ SOURCE_PATH=$(PACKAGE_NAME)
 SOURCE=$(shell find $(SOURCE_PATH) -iname "*.py")
 
 PROGRAM=DialCentral
-ICON_SIZES=26 32 48 80
+ICON_SIZES=26 32 48 64 80
 ICONS=$(foreach size, $(ICON_SIZES), data/icons/$(size)/$(PROJECT_NAME).png)
 PACKAGE_VARIANTS=fremantle harmattan ubuntu
 DESKTOP_FILES=$(foreach variant, $(PACKAGE_VARIANTS), data/$(variant)/$(PROJECT_NAME).desktop)
@@ -46,28 +46,44 @@ debug: $(OBJ)
 test: $(OBJ)
        $(UNIT_TEST)
 
-package: $(OBJ) $(ICONS) $(SETUP_FILES) $(DESKTOP_FILES)
-       rm -Rf $(DIST_BASE_PATH)_*/*
+_package_prep: $(OBJ) $(ICONS) $(SETUP_FILES) $(DESKTOP_FILES)
+
+package_diablo: _package_prep
+       rm -Rf $(DIST_BASE_PATH)_diablo/*
        ./setup.fremantle.py sdist_diablo \
                -d $(DIST_BASE_PATH)_diablo \
                --install-purelib=/usr/lib/python2.5/site-packages
+package_fremantle: _package_prep
+       rm -Rf $(DIST_BASE_PATH)_fremantle/*
        ./setup.fremantle.py sdist_fremantle \
                -d $(DIST_BASE_PATH)_fremantle \
                --install-purelib=/usr/lib/python2.5/site-packages
+package_harmattan: _package_prep
+       rm -Rf $(DIST_BASE_PATH)_harmattan/*
        ./setup.harmattan.py sdist_harmattan \
-               -d $(DIST_BASE_PATH)_harmattan
+               -d $(DIST_BASE_PATH)_harmattan \
                --install-purelib=/usr/lib/python2.6/dist-packages
+package_ubuntu: _package_prep
+       rm -Rf $(DIST_BASE_PATH)_ubuntu/*
        ./setup.ubuntu.py sdist_ubuntu \
                -d $(DIST_BASE_PATH)_ubuntu
        mkdir $(DIST_BASE_PATH)_ubuntu/build
        cd $(DIST_BASE_PATH)_ubuntu/build ; tar -zxvf ../*.tar.gz
        cd $(DIST_BASE_PATH)_ubuntu/build ; dpkg-buildpackage -tc -rfakeroot -us -uc
 
-upload:
+package: package_diablo package_fremantle package_harmattan package_ubuntu
+
+upload_diablo:
        dput diablo-extras-builder $(DIST_BASE_PATH)_diablo/$(PROJECT_NAME)*.changes
+upload_fremantle:
        dput fremantle-extras-builder $(DIST_BASE_PATH)_fremantle/$(PROJECT_NAME)*.changes
+upload_harmattan:
+       ./support/obs_upload.sh $(PROJECT_NAME) harmattan dist_harmattan
+upload_ubuntu:
        cp $(DIST_BASE_PATH)_ubuntu/*.deb www/$(PROJECT_NAME).deb
 
+upload: upload_diablo upload_fremantle upload_harmattan upload_ubuntu
+
 lint: $(OBJ)
        $(foreach file, $(SOURCE), $(LINT) $(file) ; )
 
@@ -79,7 +95,7 @@ clean:
        rm -Rf $(OBJ)
        rm -Rf $(TODO_FILE)
        rm -f $(ICONS) $(SETUP_FILES) $(DESKTOP_FILES)
-       rm -Rf $(DIST_PATHS)
+       rm -Rf $(DIST_PATHS) ./build
 
 distclean: clean
        find $(SOURCE_PATH) -name "*.*~" | xargs rm -f
@@ -103,8 +119,8 @@ setup.harmattan.py: setup.py src/constants.py
        cog.py -c \
                -D DESKTOP_FILE_PATH=/usr/share/applications \
                -D INPUT_DESKTOP_FILE=data/$(VARIANT)/$(PROJECT_NAME).desktop \
-               -D ICON_CATEGORY=hildon \
-               -D ICON_SIZES=32,80 \
+               -D ICON_CATEGORY=apps \
+               -D ICON_SIZES=64,80 \
                -o $@ $<
        chmod +x $@
 
@@ -128,6 +144,7 @@ $(DESKTOP_FILES): data/template.desktop
        cog.py -d \
                -D VARIANT=$(VARIANT) \
                -D PROGRAM=$(PROGRAM) \
+               -D ICON_NAME=$(PROJECT_NAME) \
                -o $@ $<
 
 
index 8a72f1e..3b3e995 100644 (file)
@@ -11,10 +11,15 @@ Comment=Google Voice Client
 #              cog.outl("Exec=/usr/local/bin/%s" % PROGRAM)
 #      else:
 #              raise RuntimeError("Unsupported desktop file flavor %r" % PROGRAM)
+#
+#      if VARIANT == "harmattan":
+#              cog.outl("Icon=/usr/share/icons/hicolor/80x80/apps/%s.png" % ICON_NAME)
+#      else:
+#              cog.outl("Icon=%s" % ICON_NAME)
 #]]]
 Exec=/usr/local/bin/DialCentral
-#[[[end]]]
 Icon=dialcentral
+#[[[end]]]
 Categories=Network;InstantMessaging;Qt;
 Type=Application
 Encoding=UTF-8
index b0825ef..5ea83d5 100755 (executable)
@@ -41,10 +41,14 @@ from xml.sax import saxutils
 from xml.etree import ElementTree
 
 try:
-       import simplejson as _simplejson
-       simplejson = _simplejson
+       import json as _json
+       simplejson = _json
 except ImportError:
-       simplejson = None
+       try:
+               import simplejson as _simplejson
+               simplejson = _simplejson
+       except ImportError:
+               simplejson = None
 
 import browser_emu
 
index 4e77445..21bf959 100644 (file)
@@ -28,13 +28,13 @@ def set_process_name(name):
                _moduleLogger.warning('Unable to set processName: %s" % e')
 
 
-def get_new_resource(resourceType, resource, name):
+def _get_xdg_path(resourceType):
        if BaseDirectory is not None:
                if resourceType == "data":
                        base = BaseDirectory.xdg_data_home
                        if base == "/usr/share/mime":
                                # Ugly hack because somehow Maemo 4.1 seems to be set to this
-                               base = os.path.join(os.path.expanduser("~"), ".%s" % resource)
+                               base = None
                elif resourceType == "config":
                        base = BaseDirectory.xdg_config_home
                elif resourceType == "cache":
@@ -42,10 +42,26 @@ def get_new_resource(resourceType, resource, name):
                else:
                        raise RuntimeError("Unknown type: "+resourceType)
        else:
+               base = None
+
+       return base
+
+
+def get_resource_path(resourceType, resource, name = None):
+       base = _get_xdg_path(resourceType)
+       if base is not None:
+               dirPath = os.path.join(base, resource)
+       else:
                base = os.path.join(os.path.expanduser("~"), ".%s" % resource)
+               dirPath = base
+       if name is not None:
+               dirPath = os.path.join(dirPath, name)
+       return dirPath
+
 
-       filePath = os.path.join(base, resource, name)
-       dirPath = os.path.dirname(filePath)
+def get_new_resource(resourceType, resource, name):
+       dirPath = get_resource_path(resourceType, resource)
+       filePath = os.path.join(dirPath, name)
        if not os.path.exists(dirPath):
                # Looking before I leap to not mask errors
                os.makedirs(dirPath)
@@ -54,17 +70,7 @@ def get_new_resource(resourceType, resource, name):
 
 
 def get_existing_resource(resourceType, resource, name):
-       if BaseDirectory is not None:
-               if resourceType == "data":
-                       base = BaseDirectory.xdg_data_home
-               elif resourceType == "config":
-                       base = BaseDirectory.xdg_config_home
-               elif resourceType == "cache":
-                       base = BaseDirectory.xdg_cache_home
-               else:
-                       raise RuntimeError("Unknown type: "+resourceType)
-       else:
-               base = None
+       base = _get_xdg_path(resourceType)
 
        if base is not None:
                finalPath = os.path.join(base, name)
index 409c00d..e4081c8 100644 (file)
@@ -3,7 +3,7 @@
 from __future__ import with_statement
 from __future__ import division
 
-_TRY_PYSIDE = False
+_TRY_PYSIDE = True
 
 try:
        if not _TRY_PYSIDE:
index 50ae9ae..8c227bc 100755 (executable)
@@ -171,11 +171,11 @@ class KeyboardHandler(object):
                del self.__modifiers["<%s>" % modifierName]
 
        def map_slice_action(self, slice, action):
-               callback = lambda direction: self(direction, action)
+               callback = lambda: self(action)
                slice.action().triggered.connect(callback)
                self.__sliceActions[slice] = (action, callback)
 
-       def __call__(self, direction, action):
+       def __call__(self, action):
                activeModifiers = [
                        mod.name
                        for mod in self.__modifiers.itervalues()
index 8eb7735..40830e7 100755 (executable)
--- a/setup.py
+++ b/setup.py
@@ -88,6 +88,7 @@ setup(
        },
        data_files=[
                (DESKTOP_FILE_PATH, [INPUT_DESKTOP_FILE]),
+               ("/usr/share/icons/hicolor/scalable/apps", ["data/%s.svg" % APP_NAME]),
        ] +
        [
                (
@@ -98,7 +99,6 @@ setup(
        ],
        requires=[
                "PySide",
-               "simplejson",
                "xml",
        ],
        cmdclass={
@@ -114,7 +114,7 @@ setup(
                        "copyright": "lgpl",
                        "changelog": CHANGES,
                        "buildversion": str(BUILD),
-                       "depends": "python, python-pyside.qtcore, python-pyside.qtgui, python-simplejson, python-xml, python-dbus, python-gst0.10",
+                       "depends": "python, python-pyside.qtcore, python-pyside.qtgui, python-xdg, python-dbus, python-gst0.10",
                        "architecture": "any",
                },
                "sdist_diablo": {
@@ -127,7 +127,7 @@ setup(
                        "copyright": "lgpl",
                        "changelog": CHANGES,
                        "buildversion": str(BUILD),
-                       "depends": "python2.5, python2.5-qt4-core, python2.5-qt4-gui, python-simplejson, python-xml | python2.5-xml, python-dbus | python2.5-dbus",
+                       "depends": "python2.5, python2.5-qt4-core, python2.5-qt4-gui, python-xdg, python-simplejson, python-xml | python2.5-xml, python-dbus | python2.5-dbus",
                        "architecture": "any",
                },
                "sdist_fremantle": {
@@ -140,7 +140,7 @@ setup(
                        "copyright": "lgpl",
                        "changelog": CHANGES,
                        "buildversion": str(BUILD),
-                       "depends": "python, python-pyside.qtcore, python-pyside.qtgui, python-pyside.qtmaemo5, python-simplejson, python-gst0.10, python-xml | python2.5-xml, python-dbus | python2.5-dbus",
+                       "depends": "python, python-pyside.qtcore, python-pyside.qtgui, python-pyside.qtmaemo5, python-xdg, python-simplejson, python-gst0.10, python-xml | python2.5-xml, python-dbus | python2.5-dbus",
                        "architecture": "any",
                },
                "sdist_harmattan": {
@@ -155,7 +155,7 @@ setup(
                        "copyright": "lgpl",
                        "changelog": CHANGES,
                        "buildversion": str(BUILD),
-                       "depends": "python, python-pyside.qtcore, python-pyside.qtgui, python-simplejson, python-xml",
+                       "depends": "python, python-pyside.qtcore, python-pyside.qtgui, python-xdg",
                        "architecture": "any",
                },
                "bdist_rpm": {
diff --git a/support/obs_upload.sh b/support/obs_upload.sh
new file mode 100755 (executable)
index 0000000..d2b8095
--- /dev/null
@@ -0,0 +1,13 @@
+#!/usr/bin/env bash
+
+# Doing the pushd as a test of directory movement to try to be safer with the "rm"
+pushd ../../osc/home:epage:$2/$1 && rm $1_*.dsc $1_*.tar.gz
+popd
+
+cp $3/$1_*.dsc $3/$1_*.tar.gz  ../../osc/home:epage:$2/$1
+
+pushd ../../osc/home:epage:$2/$1
+
+osc addremove && osc commit
+
+popd