Changeset 162

Show
Ignore:
Timestamp:
Sat Apr 21 08:36:27 2007
Author:
manatlan
Message:

- plugins : no more current path changing for executing plugins

Files:

Legend:

Unmodified
Added
Removed
Modified
  • trunk/plugins/comment/__init__.py

    r145 r162  
    1   # -*- coding: cp1252 -*-  
      1 # -*- coding: UTF-8 -*-  
    1 1 ##  
    2 2 ##    Copyright (C) 2005 manatlan manatlan[at]gmail(dot)com  
     
    13 13 ##  
    14 14  
    15    
    16 15 from __main__ import JPlugin  
    17 16  
  • trunk/plugins/comment/comment.py

    r145 r162  
    16 16 from common import PictureSelector  
    17 17  
    18   # phil miossec --------------------------------  
    19   import gettext  
    20   gettext.install("plugin", "po")  
    21   # ---------------------------------------------  
      18 from libs.gladeapp import GladeApp  
    22 19  
    23   from __main__ import GladeApp  
    24   GladeApp.bindtextdomain("plugin","po")  
    25 20  
    26 21 class Wincomment(GladeApp):  
     
    43 38  
    44 39         self.nodes = nodes  
    45            
      40  
    45 40         self.selector = PictureSelector(self.nodes)  
    46 41         self.hbox1.pack_start(self.selector)  
    47 42         self.selector.connect("value_changed", self.on_selector_value_changed)  
    48 43         self.selector.show()  
    49            
      44  
    49 44         self.list=[]  
    50 45         for i in self.nodes:  
  • trunk/plugins/redate/redate.py

    r138 r162  
    17 17 from datetime import datetime,timedelta  
    18 18  
    19   # phil miossec --------------------------------  
    20   import gettext  
    21   gettext.install("plugin", "po")  
    22   # ---------------------------------------------  
    23    
    24    
    25   from __main__ import GladeApp  
    26   GladeApp.bindtextdomain("plugin","po")  
    27    
    28    
      19 from libs.gladeapp import GladeApp  
    29 20  
    30 21 class Winredate(GladeApp):  
  • trunk/plugins/multiexport/__init__.py

    r145 r162  
    162 162         ec=ExportConf(self.conf)  
    163 163  
    164           XSL = ["xsl/"+i for i in os.listdir("xsl") if i[0]!="."]  
      164         pathXsl=os.path.join(os.path.dirname(__file__),"xsl")  
      165         XSL = [i for i in os.listdir(pathXsl) if i[0]!="."]  
    165 166  
    166 167         window_export = Windowexport(ec,"%d photos" % len(list),list,XSL)  
     
    324 325  
    325 326                         # applys the xslt transformation  
    326                           xslt_doc = parse( XSL[ ec["HG.template"] ] )  
      327                         xslt_doc = parse( os.path.join(pathXsl, XSL[ ec["HG.template"] ]) )  
    326 327                         nodeParams = xslt_doc.xpath("//xsl:param",{"xsl":"http://www.w3.org/1999/XSL/Transform"})  
    327 328  
  • trunk/plugins/multiexport/winexport.py

    r145 r162  
    17 17 from common import PictureSelector  
    18 18  
    19   from __main__ import GladeApp  
    20   #~ from gladeapp import GladeApp  
    21   #~ def _(a): return a  
    22   GladeApp.bindtextdomain("plugin","po")  
      19 from __main__ import GladeApp # no "libs.gladeapp", because there is a libs dir here ;-(  
    23 20  
    24 21 def chooseFolder(t):  
     
    228 225  
    229 226     # Stuff to make the privacy selections work  
    230        
      227  
    230 227     def on_psThumbSelectFR_value_changed(self, widget, *args):  
    231 228         # This method is called when the value of the Flickr slider changes  
     
    246 243         else:  
    247 244             self.psThumbSelectFR.set_sensitive(True)  
    248                
      245  
    248 245     def on_rbPrivateFR_toggled(self, widget, *args):  
    249 246         # (De)activates the friends and family checkbuttons in the Flickr tab when "public" is (de)selected  
     
    260 257         # The checkbuttons for privacy can't call setPrivacy directly,because they give extra arguments which setPrivacy can't use  
    261 258         self.setPrivacyFR()  
    262            
      259  
    262 259     def setPrivacyFR(self, apply_to_all = None):  
    263 260         # Set the Flickr privacy as indicated in the window to the photos indicated in te window  
    264 261         # If apply_to_all is given, it overrides the checkbutton (used for initialization)  
    265            
      262  
    265 262         if (apply_to_all == None):  
    266 263             apply_to_all = self.cbSelectAllFR.get_active()  
    267            
      264  
    267 264         photo = self.photoList[int(self.psThumbSelectFR.getValue())]  
    268 265         is_public = self.rbPublicFR.get_active()  
     
    273 270         is_family = self.cbFamilyFR.get_active()  
    274 271         privacy = [is_public, is_friends, is_family]  
    275                
      272  
    275 272         if not (apply_to_all):  
    276 273             self.privacyFR[photo] = privacy  
     
    279 276             for photo in self.photoList:  
    280 277                 self.privacyFR[photo] = privacy  
    281                    
      278  
    281 278     def getPrivacyFR(self, photo):  
    282 279         return self.privacyFR[photo]  
    283            
      280  
  • trunk/plugins/instantWeb/instantweb.py

    r138 r162  
    405 405 #~ sys.path.append("../../libs")  
    406 406 #~ from gladeapp import GladeApp  
    407   from __main__ import GladeApp  
    408   GladeApp.bindtextdomain("plugin","po")  
      407  
      408 from libs.gladeapp import GladeApp  
    409 409  
    410 410 class Winweb(GladeApp):  
  • trunk/jplugins.py

    r138 r162  
    54 54                     module=__import__(namespace,[],[],["Plugin"])  
    55 55  
    56                       # create the _() function specific to this plugin  
      56                     # create the _() for __init__ plugins  
    56 56                     module.__dict__["_"] = createGetText("plugin",os.path.join(fullpath,path,"po"))  
    57 57  
    58 58                     # create an instance  
    59 59                     instance = module.Plugin(id,path)  
      60                     instance.module = module  
    60 61  
    61 62                     #add to the list  
     
    81 82             if hasattr(instance,"showEntry"):  
    82 83                 find=True  
    83                   precPath = os.getcwdu()  
    84                   os.chdir(instance.path)  
      84                 #~ precPath = os.getcwdu()  
      85                 #~ os.chdir(instance.path)  
    85 86                 try:  
    86 87                     instance.showEntry(ln,idx)  
    87 88                 except:  
    88 89                     self.__plugError("%s.showEntry() is bugged "%instance.id)  
    89                   os.chdir(precPath)  
      90                 #~ os.chdir(precPath)  
    89 90  
    90 91         if not find:  
     
    101 102         a=[]  
    102 103         for instance in self.__plugins:  
    103               precPath = os.getcwdu()  
    104               os.chdir(instance.path)  
      104             #~ precPath = os.getcwdu()  
      105             #~ os.chdir(instance.path)  
    105 106             try:  
    106 107                 menus = instance.menuEntries(l)  
     
    108 109                 self.__plugError("%s.menuEntries() is bugged "%instance.id)  
    109 110                 menus=[]  
    110               os.chdir(precPath)  
      111             #~ os.chdir(precPath)  
    110 111  
    111 112             for ordre,label,alter,callback,img in menus:  
    112                   a.append( (ordre,label,alter,callback,img,instance.path) )  
      113                 a.append( (ordre,label,alter,callback,img,instance) )  
    112 113  
    113 114  
     
    119 120         # remakes the order (from 0), and place callback of callback, from a --> b  
    120 121         b=[]  
    121           for ord,nom,alter,callback,img,path in a:  
    122               pathImg = img and os.path.join(path,img) or None  
    123               b.append( (len(b),nom,alter,self.__callMenuEntry(callback,path),pathImg ))  
      122         for ord,nom,alter,callback,img,instance in a:  
      123             pathImg = img and os.path.join(instance.path,img) or None  
      124             b.append( (len(b),nom,alter,self.__callMenuEntry(callback,instance),pathImg ))  
    124 125         return b  
    125 126  
    126       def __callMenuEntry(self,callback,path):  
      127     def __callMenuEntry(self,callback,instance):  
    126 127         """ callBack of callback .. to be able to control what appends while  
    127 128             the call of the original callback  
     
    130 131         def myCallBack(*a,**k):  
    131 132  
    132               precPath = os.getcwdu()  
    133               os.chdir(path)  
      133             #~ precPath = os.getcwdu()  
      134             #~ os.chdir(path)  
      135             #~ old = _  
      136             old=__builtins__["_"]  
    134 137             try:  
      138                 # for the .glade files  
      139                 from libs.gladeapp import GladeApp  
      140                 GladeApp.bindtextdomain("plugin",os.path.join(instance.path, 'po'))  
      141  
      142                 # for the "_()" in "window gladeapp" code  
      143                 __builtins__["_"] = createGetText("plugin",os.path.join(instance.path,"po"))  
      144  
    135 145                 ret=callback(*a,**k)  
    136 146             finally:  
    137                   os.chdir(precPath)  
      147                 #~ os.chdir(precPath)  
      148                 __builtins__["_"] = old  
      149                 pass  
    138 150             return ret  
    139 151         return myCallBack  
  • trunk/jbrout.py

    r154 r162  
    43 43  
    44 44 # make translation available in the gui/gtk  
    45   GladeApp.bindtextdomain("jbrout","po")  
      45 GladeApp.bindtextdomain("jbrout",os.path.join(os.path.dirname(__file__), 'po'))  
    45 45  
    46 46 # make translation available in the code  
    47   __builtins__.__dict__["_"] = createGetText("jbrout","po")  
      47 __builtins__.__dict__["_"] = createGetText("jbrout",os.path.join(os.path.dirname(__file__), 'po'))  
    47 47  
    48 48