Changeset 7985


Ignore:
Timestamp:
Aug 24, 2018, 12:18:19 PM (14 months ago)
Author:
mabarracus
Message:

New desktop, plank, file plugins

Location:
syncer/trunk/fuentes
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • syncer/trunk/fuentes/debian/changelog

    r4451 r7985  
     1syncer (1.4) unreleased; urgency=medium
     2
     3  * New desktop, plank, file plugins
     4
     5 -- M.Angel Juan <m.angel.juan@gmail.com>  Fri, 24 Aug 2018 12:13:13 +0200
     6
    17syncer (1.3) xenial; urgency=medium
    28
  • syncer/trunk/fuentes/syncer.install/usr/lib/syncer/plugins/dconf.py

    r4039 r7985  
    99
    1010    def process(self,*args,**kwargs):
    11         params = self.get_params(*args, **kwargs)
    12         exit_code=check_call(['dconf','write',params['key'],'\''+params['value']+'\''])
     11        #params = self.get_params(*args, **kwargs)
     12        params = kwargs['params']
     13        #exit_code=subprocess.call(['dconf','write',params['key'],"\"'"+params['value']+"'\""])
     14        exit_code = check_call(['dconf','write',params['key'],"'"+params['value']+"'"])
    1315        if (exit_code == 0):
    1416            status=True
    1517        else:
    1618            status=False
    17         output="Executed dconf write {} '{}'".format(params['key'],params['value'])
     19        output="Executed dconf {} {}".format(params['key'],params['value'])
    1820        return status,output
  • syncer/trunk/fuentes/syncer.install/usr/lib/syncer/plugins/files.py

    r4039 r7985  
    11from lib.SyncerTypes import *
     2import os
    23import base64
     4import tempfile
    35
    46class handler_file(IPlugin):
     
    68    def init_plugin(self):
    79        self.typeplug = 'file'
    8         self.params = ['orig_path', 'dest_path']
    9     #def process(self):
     10        self.params = ['action', 'filename', 'content']
     11    def process(self,*args,**kwargs):
     12        dir=tempfile.mkdtemp()
     13        filename=dir+'/'+os.path.basename(kwargs['params']['filename'])
     14        with open(filename,'wb') as fp:
     15            fp.write(base64.b64decode(kwargs['params']['content']))
     16        return True, filename
  • syncer/trunk/fuentes/syncer.install/usr/lib/syncer/plugins/plank.py

    r4451 r7985  
    44import os
    55import re
     6import shutil
    67from shutil import copyfile
    78
     
    4142                        else:
    4243                            filelist.append(os.path.join(root,file))
    43             if filelist == []:
    44                 return None
    45             else:
    4644                return filelist
    4745
     
    6462    def process(self,*args,**kwargs):
    6563        params = kwargs['params']
    66         if params['action']== 'add':
     64        if params['action'] == 'addcontent':
     65            item = params['option']
     66            basename_item = os.path.basename(item)
     67            if not os.path.exists(item):
     68                return False,str(item)
     69            folder = os.path.expanduser('~')+'/.config/syncer-plank'
     70            if not os.path.exists(folder):
     71                os.mkdir(folder)
     72            newitem = folder+'/'+basename_item+'.desktop'
     73            shutil.move(item,newitem)
     74            os.chmod(newitem,0o0755)
     75            # create element
     76            entry=['[PlankDockItemPreferences]','Launcher=file://'+newitem]
     77            entry=map(lambda x: x+'\n',entry)
     78            with open(os.path.expanduser('~')+'/.config/plank/dock1/launchers/'+basename_item+'.dockitem','w') as f:
     79                f.writelines(entry)
     80            return True,'Added {}'.format(item)
     81
     82        elif params['action']== 'add':
    6783            try:
    6884                where='applications'
Note: See TracChangeset for help on using the changeset viewer.