conduit r1395 - in trunk: . conduit conduit/dataproviders conduit/gtkui conduit/modules conduit/modules/BackpackModule conduit/modules/EvolutionModule conduit/modules/FacebookModule conduit/modules/FlickrModule conduit/modules/GoogleModule conduit/utils test/python-tests
- From: jstowers svn gnome org
- To: svn-commits-list gnome org
- Subject: conduit r1395 - in trunk: . conduit conduit/dataproviders conduit/gtkui conduit/modules conduit/modules/BackpackModule conduit/modules/EvolutionModule conduit/modules/FacebookModule conduit/modules/FlickrModule conduit/modules/GoogleModule conduit/utils test/python-tests
- Date: Wed, 26 Mar 2008 11:50:01 +0000 (GMT)
Author: jstowers
Date: Wed Mar 26 11:50:01 2008
New Revision: 1395
URL: http://svn.gnome.org/viewvc/conduit?rev=1395&view=rev
Log:
2008-03-27 John Stowers <john stowers gmail com>
* conduit/Conduit.py:
* conduit/DBus.py:
* conduit/Main.py:
* conduit/Module.py:
* conduit/TypeConverter.py:
* conduit/dataproviders/DataProvider.py:
* conduit/gtkui/Canvas.py:
* conduit/gtkui/Tree.py:
* conduit/gtkui/UI.py:
* conduit/modules/BackpackModule/BackpackModule.py:
* conduit/modules/EvolutionModule/EvolutionModule.py:
* conduit/modules/FacebookModule/FacebookModule.py:
* conduit/modules/FlickrModule/FlickrModule.py:
* conduit/modules/GoogleModule/GoogleModule.py:
* conduit/modules/iPodModule.py:
* conduit/utils/__init__.py:
* test/python-tests/TestCoreUtil.py: Remove some of the useless debug print
at application startup. Add utils.get_module_information which prints the
version and location of a loaded module. Use this new function to print
version information about gdata, pyfacebook, etc
Removed:
trunk/conduit/Utils.py
Modified:
trunk/ChangeLog
trunk/conduit/Conduit.py
trunk/conduit/DBus.py
trunk/conduit/Main.py
trunk/conduit/Module.py
trunk/conduit/TypeConverter.py
trunk/conduit/dataproviders/DataProvider.py
trunk/conduit/gtkui/Canvas.py
trunk/conduit/gtkui/Tree.py
trunk/conduit/gtkui/UI.py
trunk/conduit/modules/BackpackModule/BackpackModule.py
trunk/conduit/modules/EvolutionModule/EvolutionModule.py
trunk/conduit/modules/FacebookModule/FacebookModule.py
trunk/conduit/modules/FlickrModule/FlickrModule.py
trunk/conduit/modules/GoogleModule/GoogleModule.py
trunk/conduit/modules/iPodModule.py
trunk/conduit/utils/__init__.py
trunk/test/python-tests/TestCoreUtil.py
Modified: trunk/conduit/Conduit.py
==============================================================================
--- trunk/conduit/Conduit.py (original)
+++ trunk/conduit/Conduit.py Wed Mar 26 11:50:01 2008
@@ -275,7 +275,6 @@
return self.deletedPolicy
def set_policy(self, policy, value):
- log.debug("Setting %s policy: %s" % (policy,value))
if policy not in CONFLICT_POLICY_NAMES:
raise Exception("Unknown policy: %s" % policy)
if value not in CONFLICT_POLICY_VALUES:
Modified: trunk/conduit/DBus.py
==============================================================================
--- trunk/conduit/DBus.py (original)
+++ trunk/conduit/DBus.py Wed Mar 26 11:50:01 2008
@@ -20,6 +20,8 @@
ERROR = -1
SUCCESS = 0
+DEBUG_ALL_CALLS = False
+
APPLICATION_DBUS_IFACE="org.conduit.Application"
SYNCSET_DBUS_IFACE="org.conduit.SyncSet"
CONDUIT_DBUS_IFACE="org.conduit.Conduit"
@@ -129,7 +131,8 @@
return self.__dbus_object_path__
def _print(self, message):
- log.debug("DBus Message from %s: %s" % (self.get_path(), message))
+ if DEBUG_ALL_CALLS:
+ log.debug("DBus Message from %s: %s" % (self.get_path(), message))
class ConduitDBusItem(DBusItem):
def __init__(self, sync_manager, conduit, uuid):
Modified: trunk/conduit/Main.py
==============================================================================
--- trunk/conduit/Main.py (original)
+++ trunk/conduit/Main.py Wed Mar 26 11:50:01 2008
@@ -78,7 +78,7 @@
sys.exit(1)
log.info("Conduit v%s Installed: %s" % (conduit.VERSION, conduit.IS_INSTALLED))
- log.info("Using UI: %s" % self.ui)
+ log.info("Python: %s" % sys.version)
#Make conduit single instance. If conduit is already running then
#make the original process build or show the gui
@@ -106,6 +106,7 @@
#Throw up a splash screen ASAP. Dont show anything if launched via --console.
if buildGUI:
+ log.info("Using UI: %s" % self.ui)
self.ImportGUI()
if not iconify:
self.ShowSplash()
Modified: trunk/conduit/Module.py
==============================================================================
--- trunk/conduit/Module.py (original)
+++ trunk/conduit/Module.py Wed Mar 26 11:50:01 2008
@@ -95,7 +95,6 @@
while len(directories) > 0:
d = directories.pop(0)
- log.debug("Reading directory %s" % d)
try:
if not os.path.exists(d):
continue
Modified: trunk/conduit/TypeConverter.py
==============================================================================
--- trunk/conduit/TypeConverter.py (original)
+++ trunk/conduit/TypeConverter.py Wed Mar 26 11:50:01 2008
@@ -149,7 +149,6 @@
else:
conversions.append( (fromType, toType, args) )
- log.debug(conversions)
return conversions
def _conversion_exists(self, from_type, to_type):
Modified: trunk/conduit/dataproviders/DataProvider.py
==============================================================================
--- trunk/conduit/dataproviders/DataProvider.py (original)
+++ trunk/conduit/dataproviders/DataProvider.py Wed Mar 26 11:50:01 2008
@@ -211,7 +211,7 @@
Show a configuration box for configuring the dataprovider instance.
@param window: The parent gtk.Window (to show a modal dialog)
"""
- log.debug("configure() not overridden by derived class %s" % self._name_)
+ pass
def is_configured(self, isSource, isTwoWay):
"""
@@ -229,7 +229,6 @@
@returns: Dictionary of strings containing application settings
@rtype: C{dict(string)}
"""
- log.debug("get_configuration() not overridden by derived class %s" % self._name_)
return {}
def get_configuration_xml(self):
@@ -262,12 +261,10 @@
Restores applications settings
@param config: dictionary of dataprovider settings to restore
"""
- log.debug("set_configuration() not overridden by derived class %s" % self._name_)
for c in config:
#Perform these checks to stop malformed xml from stomping on
#unintended variables or posing a security risk by overwriting methods
if getattr(self, c, None) != None and callable(getattr(self, c, None)) == False:
- log.debug("Setting %s to %s" % (c, config[c]))
setattr(self,c,config[c])
else:
log.warn("Not restoring %s setting: Exists=%s Callable=%s" % (
@@ -300,7 +297,6 @@
#fallback to string type
log.warn("Cannot convert string (%s) to native type %s\n" % (raw, vtype, traceback.format_exc()))
data = str(raw)
- log.debug("Read Setting: Name=%s Value=%s Type=%s" % (s.localName, data, type(data)))
settings[s.localName] = data
try:
Modified: trunk/conduit/gtkui/Canvas.py
==============================================================================
--- trunk/conduit/gtkui/Canvas.py (original)
+++ trunk/conduit/gtkui/Canvas.py Wed Mar 26 11:50:01 2008
@@ -102,6 +102,8 @@
#model is a SyncSet, not set till later because it is loaded from xml
self.model = None
+
+ log.info("Goocanvas version: %s" % str(goocanvas.pygoocanvas_version))
def _show_welcome_message(self):
"""
@@ -320,7 +322,6 @@
for i in xrange(0, len(items)):
try:
overlap = items[i].get_bottom() - items[i+1].get_top()
- log.debug("Overlap: %s %s ----> %s" % (overlap,i,i+1))
if overlap != 0.0:
#translate all those below
for item in items[i+1:]:
Modified: trunk/conduit/gtkui/Tree.py
==============================================================================
--- trunk/conduit/gtkui/Tree.py (original)
+++ trunk/conduit/gtkui/Tree.py Wed Mar 26 11:50:01 2008
@@ -127,11 +127,9 @@
built (in the constructor)
@type signal: C{bool}
"""
- log.debug("Adding DataProvider %s to TreeModel" % dpw)
#Do we need to create a category first?
i = self._get_category_index_by_name(dpw.category)
if i == None:
- log.debug("Creating Category: %s" % dpw.category.name)
new_cat = CategoryWrapper(dpw.category)
self.cats.append(new_cat)
i = self.cats.index(new_cat)
Modified: trunk/conduit/gtkui/UI.py
==============================================================================
--- trunk/conduit/gtkui/UI.py (original)
+++ trunk/conduit/gtkui/UI.py Wed Mar 26 11:50:01 2008
@@ -62,7 +62,6 @@
]
for i in icon_dirs:
gtk.icon_theme_get_default().prepend_search_path(i)
- log.debug("Adding %s to icon theme search path" % (i))
self.gladeFile = os.path.join(conduit.SHARED_DATA_DIR, "conduit.glade")
self.widgets = gtk.glade.XML(self.gladeFile, "MainWindow")
Modified: trunk/conduit/modules/BackpackModule/BackpackModule.py
==============================================================================
--- trunk/conduit/modules/BackpackModule/BackpackModule.py (original)
+++ trunk/conduit/modules/BackpackModule/BackpackModule.py Wed Mar 26 11:50:01 2008
@@ -19,6 +19,7 @@
MODULES = {
"BackpackNoteSink" : { "type": "dataprovider" }
}
+log.info("Module Information: %s" % Utils.get_module_information(backpack, None))
class BackpackBase(DataProvider.DataProviderBase):
def __init__(self, *args):
Modified: trunk/conduit/modules/EvolutionModule/EvolutionModule.py
==============================================================================
--- trunk/conduit/modules/EvolutionModule/EvolutionModule.py (original)
+++ trunk/conduit/modules/EvolutionModule/EvolutionModule.py Wed Mar 26 11:50:01 2008
@@ -1,20 +1,6 @@
-from gettext import gettext as _
-
-MODULES = {}
-try:
- import evolution
- if evolution.__version__ >= (0,0,4):
- MODULES = {
- "EvoContactTwoWay" : { "type": "dataprovider" },
- "EvoCalendarTwoWay" : { "type": "dataprovider" },
- "EvoTasksTwoWay" : { "type": "dataprovider" },
- "EvoMemoTwoWay" : { "type": "dataprovider" },
- }
-except:
- pass
-
import datetime
import gobject
+from gettext import gettext as _
import logging
log = logging.getLogger("modules.Evolution")
@@ -22,11 +8,24 @@
import conduit.dataproviders.DataProvider as DataProvider
import conduit.utils as Utils
import conduit.Exceptions as Exceptions
-from conduit.datatypes import Rid
import conduit.datatypes.Contact as Contact
import conduit.datatypes.Event as Event
import conduit.datatypes.Note as Note
+MODULES = {}
+try:
+ import evolution
+ if evolution.__version__ >= (0,0,4):
+ MODULES = {
+ "EvoContactTwoWay" : { "type": "dataprovider" },
+ "EvoCalendarTwoWay" : { "type": "dataprovider" },
+ "EvoTasksTwoWay" : { "type": "dataprovider" },
+ "EvoMemoTwoWay" : { "type": "dataprovider" },
+ }
+ log.info("Module Information: %s" % Utils.get_module_information(evolution, '__version__'))
+except ImportError:
+ log.info("Evolution support disabled")
+
class EvoBase(DataProvider.TwoWay):
def __init__(self, sourceURI, *args):
DataProvider.TwoWay.__init__(self)
@@ -171,7 +170,7 @@
obj = evolution.ebook.EContact(vcard=contact.get_vcard_string())
if self.book.add_contact(obj):
mtime = datetime.datetime.fromtimestamp(obj.get_modified())
- return Rid(uid=obj.get_uid(), mtime=mtime, hash=mtime)
+ return conduit.datatypes.Rid(uid=obj.get_uid(), mtime=mtime, hash=mtime)
else:
raise Exceptions.SyncronizeError("Error creating contact")
@@ -227,7 +226,7 @@
obj = evolution.ecal.ECalComponent(evolution.ecal.CAL_COMPONENT_EVENT, event.get_ical_string())
if self.calendar.add_object(obj):
mtime = datetime.datetime.fromtimestamp(obj.get_modified())
- return Rid(uid=obj.get_uid(), mtime=mtime, hash=mtime)
+ return conduit.datatypes.Rid(uid=obj.get_uid(), mtime=mtime, hash=mtime)
else:
raise Exceptions.SyncronizeError("Error creating event")
@@ -285,7 +284,7 @@
)
if self.tasks.add_object(obj):
mtime = datetime.datetime.fromtimestamp(obj.get_modified())
- return Rid(uid=obj.get_uid(), mtime=mtime, hash=mtime)
+ return conduit.datatypes.Rid(uid=obj.get_uid(), mtime=mtime, hash=mtime)
else:
raise Exceptions.SyncronizeError("Error creating event")
@@ -353,7 +352,7 @@
if uid != None:
mtime = datetime.datetime.fromtimestamp(obj.get_modified())
- return Rid(uid=uid, mtime=mtime, hash=mtime)
+ return conduit.datatypes.Rid(uid=uid, mtime=mtime, hash=mtime)
else:
raise Exceptions.SyncronizeError("Error creating memo")
Modified: trunk/conduit/modules/FacebookModule/FacebookModule.py
==============================================================================
--- trunk/conduit/modules/FacebookModule/FacebookModule.py (original)
+++ trunk/conduit/modules/FacebookModule/FacebookModule.py Wed Mar 26 11:50:01 2008
@@ -18,17 +18,19 @@
from gettext import gettext as _
try:
- from pyfacebook import Facebook, FacebookError, VERSION
+ import pyfacebook
except ImportError:
Utils.dataprovider_add_dir_to_path(__file__)
- from pyfacebook import Facebook, FacebookError, VERSION
+ import pyfacebook
-if VERSION < '0.1':
- raise Exceptions.NotSupportedError("Incorrect pyfacebook version")
-
-MODULES = {
- "FacebookSink" : { "type": "dataprovider" }
-}
+if pyfacebook.VERSION < '0.1':
+ log.info("Facebook support disabled")
+ MODULES = {}
+else:
+ log.info("Module Information: %s" % Utils.get_module_information(pyfacebook, 'VERSION'))
+ MODULES = {
+ "FacebookSink" : { "type": "dataprovider" }
+ }
class FacebookSink(Image.ImageSink):
@@ -42,7 +44,7 @@
def __init__(self, *args):
Image.ImageSink.__init__(self)
- self.fapi = Facebook(FacebookSink.API_KEY, FacebookSink.SECRET)
+ self.fapi = pyfacebook.Facebook(FacebookSink.API_KEY, FacebookSink.SECRET)
self.browser = "gtkmozembed"
def _upload_photo (self, uploadInfo):
@@ -52,7 +54,7 @@
try:
rsp = self.fapi.photos.upload(uploadInfo.url)
return Rid(uid=rsp["pid"])
- except FacebookError, f:
+ except pyfacebook.FacebookError, f:
raise Exceptions.SyncronizeError("Facebook Upload Error %s" % f)
def _login(self):
Modified: trunk/conduit/modules/FlickrModule/FlickrModule.py
==============================================================================
--- trunk/conduit/modules/FlickrModule/FlickrModule.py (original)
+++ trunk/conduit/modules/FlickrModule/FlickrModule.py Wed Mar 26 11:50:01 2008
@@ -21,13 +21,16 @@
#http://sourceforge.net/tracker/index.php?func=detail&aid=1874067&group_id=203043&atid=984009
Utils.dataprovider_add_dir_to_path(__file__)
import flickrapi
-if not flickrapi.__version__.endswith("CONDUIT"):
- raise Exceptions.NotSupportedError("Incorrect Flickrapi version")
-
-MODULES = {
- "FlickrTwoWay" : { "type": "dataprovider" }
-}
+if flickrapi.__version__.endswith("CONDUIT"):
+ MODULES = {
+ "FlickrTwoWay" : { "type": "dataprovider" }
+ }
+ log.info("Module Information: %s" % Utils.get_module_information(flickrapi, "__version__"))
+else:
+ MODULES = {}
+ log.info("Flickr support disabled")
+
class MyFlickrAPI(flickrapi.FlickrAPI):
def __init__(self, apiKey, secret, username):
flickrapi.FlickrAPI.__init__(self,
Modified: trunk/conduit/modules/GoogleModule/GoogleModule.py
==============================================================================
--- trunk/conduit/modules/GoogleModule/GoogleModule.py (original)
+++ trunk/conduit/modules/GoogleModule/GoogleModule.py Wed Mar 26 11:50:01 2008
@@ -1,8 +1,10 @@
+import re
import gobject
import datetime
import dateutil.parser
import vobject
from dateutil.tz import tzutc, tzlocal
+from gettext import gettext as _
import logging
log = logging.getLogger("modules.Google")
@@ -16,36 +18,37 @@
import conduit.datatypes.Photo as Photo
import conduit.datatypes.Video as Video
-from gettext import gettext as _
-
-import re
-
#Distributors, if you ship python gdata >= 1.0.10 then remove this line
#and the appropriate directories
Utils.dataprovider_add_dir_to_path(__file__)
-import atom
-import gdata
-import gdata.service
-import gdata.photos
-import gdata.photos.service
-import gdata.calendar
-import gdata.calendar.service
+try:
+ import atom
+ import gdata
+ import gdata.service
+ import gdata.photos
+ import gdata.photos.service
+ import gdata.calendar
+ import gdata.calendar.service
+
+ MODULES = {
+ "GoogleCalendarTwoWay" : { "type": "dataprovider" },
+ "PicasaTwoWay" : { "type": "dataprovider" },
+ "YouTubeSource" : { "type": "dataprovider" },
+ }
+ log.info("Module Information: %s" % Utils.get_module_information(gdata, None))
+except (ImportError, AttributeError):
+ MODULES = {}
+ log.info("Google support disabled")
# time format
FORMAT_STRING = "%Y-%m-%dT%H:%M:%S"
-MODULES = {
- "GoogleCalendarTwoWay" : { "type": "dataprovider" },
- "PicasaTwoWay" : { "type": "dataprovider" },
- "YouTubeSource" : { "type": "dataprovider" },
-}
-
class GoogleBase(object):
def __init__(self):
self.username = ""
self.password = ""
self.loggedIn = False
-
+
def _do_login(self):
raise NotImplementedError
Modified: trunk/conduit/modules/iPodModule.py
==============================================================================
--- trunk/conduit/modules/iPodModule.py (original)
+++ trunk/conduit/modules/iPodModule.py Wed Mar 26 11:50:01 2008
@@ -32,8 +32,10 @@
try:
import gpod
LIBGPOD_PHOTOS = gpod.version_info >= (0,6,0)
-except:
+ log.info("Module Information: %s" % Utils.get_module_information(gpod, 'version_info'))
+except ImportError:
LIBGPOD_PHOTOS = False
+ log.info("iPod photo support disabled")
def _string_to_unqiue_file(txt, base_uri, prefix, postfix=''):
for i in range(1, 10000):
Modified: trunk/conduit/utils/__init__.py
==============================================================================
--- trunk/conduit/utils/__init__.py (original)
+++ trunk/conduit/utils/__init__.py Wed Mar 26 11:50:01 2008
@@ -111,7 +111,6 @@
"""
path = os.path.join(dataproviderfile, "..", directory)
path = os.path.abspath(path)
- log.debug("Adding %s to python path" % path)
sys.path.insert(0,path)
def dataprovider_glade_get_widget(dataproviderfile, gladefilename, widget):
@@ -281,5 +280,21 @@
return ans[0]
else:
return None
-
+
+def get_module_information(module, versionAttributeName):
+ """
+ Prints the name, location and version of the supplied module
+ """
+ version = ""
+ if versionAttributeName:
+ try:
+ version = " v%s" % str(getattr(module, versionAttributeName))
+ except: pass
+
+ path = ""
+ try:
+ path = " (%s)" % module.__file__
+ except: pass
+
+ return "%s%s%s" % (module.__name__, version, path)
Modified: trunk/test/python-tests/TestCoreUtil.py
==============================================================================
--- trunk/test/python-tests/TestCoreUtil.py (original)
+++ trunk/test/python-tests/TestCoreUtil.py Wed Mar 26 11:50:01 2008
@@ -6,6 +6,7 @@
import datetime
import os.path
+import sys
#Test resizing an image 200wx100h
w,h = Utils.get_proportional_resize(100,None,200,100)
@@ -60,5 +61,10 @@
ok("Simple xml tag extractor",
Utils.xml_extract_value_from_tag("tag", "<nottag>tag</nottag>") == None)
+info = Utils.get_module_information(os, None)
+ok("Library Information: %s" % info, len(info) > 0)
+
+info = Utils.get_module_information(sys, 'version_info')
+ok("System Information: %s" % info, len(info) > 0)
finished()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]