[Rapier-commits] r164 - in trunk: debian src

This list send mail when a change occurs on the subversion repository rapier-commits at garage.maemo.org
Sun Dec 2 10:35:02 EET 2007


Author: pamadio
Date: 2007-12-02 10:34:58 +0200 (Sun, 02 Dec 2007)
New Revision: 164

Modified:
   trunk/debian/control
   trunk/src/rapier
   trunk/src/swordutils.py
Log:
get_manager in swordutils + index creation use SWORD_PATH

Modified: trunk/debian/control
===================================================================
--- trunk/debian/control	2007-12-01 16:37:07 UTC (rev 163)
+++ trunk/debian/control	2007-12-02 08:34:58 UTC (rev 164)
@@ -7,6 +7,6 @@
 
 Package: rapier
 Architecture: all
-Depends: ${shlibs:Depends}, ${misc:Depends}, python-sword, python2.5-runtime
+Depends: ${shlibs:Depends}, ${misc:Depends}, pythonsword, python2.5-runtime
 Description: A sword based Bible reader for maemo.
  A sword based Bible reader for maemo.

Modified: trunk/src/rapier
===================================================================
--- trunk/src/rapier	2007-12-01 16:37:07 UTC (rev 163)
+++ trunk/src/rapier	2007-12-02 08:34:58 UTC (rev 164)
@@ -154,19 +154,8 @@
         self.gconf.set_string("/apps/osso/rapier/bookmarks/start",position)
 
     def reload_manager(self):
-        self.mgr = self.get_manager()
+        self.mgr = swordutils.get_manager()
 
-    def get_manager(self, *args):
-        data_path = self.get_data_path()
-        mgr = Sword.SWMgr(*args)
-        if data_path:
-            mgr.prefixPath = data_path
-            mgr.configPath = "%s/mods.d" % data_path
-            mgr.augmentModules(data_path)
-        return mgr
-
-    def get_data_path(self):
-        return self.gconf.get_string("/apps/osso/rapier/data_path")
         
     def get_defaultModule(self):
         return self.gconf.get_string('/apps/osso/rapier/modules/default')
@@ -832,7 +821,7 @@
     def mgModRemoteRefresh_b_clicked(self,widget):
         args={}
         args['osso_context']=self.osso_context
-        args['data_path'] = self.get_data_path()
+        args['data_path'] = swordutils.get_data_path()
         
         newJob=aJob(self.jobCounter,"remote_modules_list",args)
         self.putJob(newJob)
@@ -900,7 +889,7 @@
         args['idx_remove']=idx_to_remove
         args['remote']=self.remoteModules
         args['osso_context']=self.osso_context
-        args['data_path'] = self.get_data_path()
+        args['data_path'] = swordutils.get_data_path()
         newJob=aJob(self.jobCounter,'module_management',args)
         self.putJob(newJob)
         self.waitForModuleManagementFlag=True
@@ -1269,7 +1258,7 @@
        vk=Sword.VerseKey()
        markup=Sword.MarkupFilterMgr(Sword.FMT_PLAIN)
        markup.thisown=False
-       mgr=self.get_manager(markup)
+       mgr=swordutils.get_manager(markup)
        mod=mgr.getModule(self.selected_module)
        if not mod:
           return
@@ -1608,7 +1597,7 @@
         out=[]
         markup=Sword.MarkupFilterMgr(Sword.FMT_PLAIN)
         markup.thisown=False
-        mgr=self.get_manager(markup)
+        mgr=swordutils.get_manager(markup)
         mod=mgr.getModule(args['module'])
         res=mod.doSearch(args['filter'],-4)
         for n in range(res.Count()):

Modified: trunk/src/swordutils.py
===================================================================
--- trunk/src/swordutils.py	2007-12-01 16:37:07 UTC (rev 163)
+++ trunk/src/swordutils.py	2007-12-02 08:34:58 UTC (rev 164)
@@ -49,7 +49,18 @@
     f.close()
     
     
+def get_manager(*args):
+    data_path = get_data_path()
+    mgr = Sword.SWMgr(*args)
+    if data_path:
+        mgr.prefixPath = data_path
+        mgr.configPath = "%s/mods.d" % data_path
+        mgr.augmentModules(data_path)
+    return mgr
 
+def get_data_path():
+    gconf_client=gconf.client_get_default()
+    return gconf_client.get_string("/apps/osso/rapier/data_path")
 
 def get_config():
     sword_mgr=Sword.SWMgr()
@@ -88,7 +99,7 @@
 
     def __init__(self,dataPath,location='ftp://crosswire.org/pub/sword/raw',\
                  osso_context=False):
-        self.mgr=Sword.SWMgr()
+        self.mgr=get_manager()
         self.rep_location=location
         self.data_path = dataPath
         self.tmpDir=dataPath+"/tmp"
@@ -118,7 +129,8 @@
         This segfault
         cmd="/usr/bin/mkfastmod %s"%mod
         '''
-        cmd="cd /home;/usr/bin/mkfastmod %s"%mod
+        cmd="cd /home;SWORD_PATH=%s /usr/bin/mkfastmod %s"%\
+             (get_data_path(),mod)
         
         #cmd="ls /tmp"
         debug("cmd='%s'"%cmd)
@@ -131,7 +143,7 @@
             debug("Oy, creating index failed.")
             return False
         
-        self.mgr=Sword.SWMgr()
+        self.mgr=get_manager()
         debug("data='%s'"%data)
         if error:
             debug("There was an error:'%i'"%error)



More information about the Rapier-commits mailing list