Lines 102-108
Link Here
|
102 |
group = OptionGroup(parser, "General creation options", "Options definig what should be generated") |
102 |
group = OptionGroup(parser, "General creation options", "Options definig what should be generated") |
103 |
# group.add_option('-g', '--generate', action = 'store', choices=['all','menus','panel','topapps'], dest='generate', default='all', metavar='WHAT', |
103 |
# group.add_option('-g', '--generate', action = 'store', choices=['all','menus','panel','topapps'], dest='generate', default='all', metavar='WHAT', |
104 |
# help = "what should be generated. aviable options are: all, menus, panel, topapps. default is all.") |
104 |
# help = "what should be generated. aviable options are: all, menus, panel, topapps. default is all.") |
105 |
group.add_option('--with', action = 'append', type='string', dest='with', metavar='DIRECTORY', |
105 |
group.add_option('--with', action = 'append', type='string', dest='xwith', metavar='DIRECTORY', |
106 |
help = 'generate entries only for defined entries (directories or files)') |
106 |
help = 'generate entries only for defined entries (directories or files)') |
107 |
group.add_option('--without', action = 'append', type='string', dest='without', metavar='DIRECTORY', |
107 |
group.add_option('--without', action = 'append', type='string', dest='without', metavar='DIRECTORY', |
108 |
help = 'do NOT use defined entries (directories or files) for generating output.') |
108 |
help = 'do NOT use defined entries (directories or files) for generating output.') |
Lines 206-217
Link Here
|
206 |
#end of parseArgv |
206 |
#end of parseArgv |
207 |
|
207 |
|
208 |
|
208 |
|
209 |
def getAppsData(databases=[database],checkExecs=False,searchIconsIn='',sortOrder='prio',minLength=3,with=None,without=None,rootName='/Applications',topInSub=True,fileIcon='default.png',dirIcon='directory.png'): |
209 |
def getAppsData(databases=[database],checkExecs=False,searchIconsIn='',sortOrder='prio',minLength=3,xwith=None,without=None,rootName='/Applications',topInSub=True,fileIcon='default.png',dirIcon='directory.png'): |
210 |
"""Read application databases from directories. |
210 |
"""Read application databases from directories. |
211 |
if checkExecs is True then use exec_field from file name to check access before adding it to database |
211 |
if checkExecs is True then use exec_field from file name to check access before adding it to database |
212 |
if searchIconsIn is provided then use this path to check icons existence |
212 |
if searchIconsIn is provided then use this path to check icons existence |
213 |
sortOrder defines sorting order for entries |
213 |
sortOrder defines sorting order for entries |
214 |
with is a list of entries (relative to the database root) that should be read |
214 |
xwith is a list of entries (relative to the database root) that should be read |
215 |
without is a list of entries (relative to the database root or absolute targets for symlinks) that should be left out |
215 |
without is a list of entries (relative to the database root or absolute targets for symlinks) that should be left out |
216 |
""" |
216 |
""" |
217 |
|
217 |
|
Lines 235-241
Link Here
|
235 |
return True |
235 |
return True |
236 |
return False |
236 |
return False |
237 |
|
237 |
|
238 |
def get_entry(root,dir,cat,sort,check,with,without,realcat): |
238 |
def get_entry(root,dir,cat,sort,check,xwith,without,realcat): |
239 |
if not os.path.isdir(os.path.join(root,dir)) or not os.access(os.path.join(root,dir),os.R_OK): |
239 |
if not os.path.isdir(os.path.join(root,dir)) or not os.access(os.path.join(root,dir),os.R_OK): |
240 |
yield None |
240 |
yield None |
241 |
for entry in os.listdir(os.path.join(root,dir)): |
241 |
for entry in os.listdir(os.path.join(root,dir)): |
Lines 268-276
Link Here
|
268 |
if not checkFileAccess(test): |
268 |
if not checkFileAccess(test): |
269 |
continue |
269 |
continue |
270 |
|
270 |
|
271 |
if with and len(with)>0: |
271 |
if xwith and len(xwith)>0: |
272 |
cont=False |
272 |
cont=False |
273 |
for i,v in enumerate(with): |
273 |
for i,v in enumerate(xwith): |
274 |
if not (os.path.join(cat,name).startswith(v) or os.path.join(cat,name.replace('_',' ')).startswith(v)): |
274 |
if not (os.path.join(cat,name).startswith(v) or os.path.join(cat,name.replace('_',' ')).startswith(v)): |
275 |
cont=True |
275 |
cont=True |
276 |
break |
276 |
break |
Lines 305-311
Link Here
|
305 |
x = realcat[:] |
305 |
x = realcat[:] |
306 |
x.extend([prio,name]) |
306 |
x.extend([prio,name]) |
307 |
if access: |
307 |
if access: |
308 |
for sub in get_entry(root,os.path.join(dir,entry),os.path.join(cat,name).replace(' ','_'),sort,check,with,without,x): |
308 |
for sub in get_entry(root,os.path.join(dir,entry),os.path.join(cat,name).replace(' ','_'),sort,check,xwith,without,x): |
309 |
yield sub |
309 |
yield sub |
310 |
elif os.path.isfile(file): |
310 |
elif os.path.isfile(file): |
311 |
if sort=='name' or sort=='rname': |
311 |
if sort=='name' or sort=='rname': |
Lines 327-333
Link Here
|
327 |
db=os.path.abspath(os.path.expanduser(databases[i])) |
327 |
db=os.path.abspath(os.path.expanduser(databases[i])) |
328 |
if not os.path.isdir(db) or not os.access(db,os.R_OK): |
328 |
if not os.path.isdir(db) or not os.access(db,os.R_OK): |
329 |
continue |
329 |
continue |
330 |
for entry in get_entry(db,'',os.path.join('/',rootName),sortOrder,checkExecs,with,without,[0,rootName]): |
330 |
for entry in get_entry(db,'',os.path.join('/',rootName),sortOrder,checkExecs,xwith,without,[0,rootName]): |
331 |
if not entry: |
331 |
if not entry: |
332 |
continue |
332 |
continue |
333 |
if not entry[5]: |
333 |
if not entry[5]: |
Lines 850-856
Link Here
|
850 |
if params[0].database and len(params[0].database)>0: |
850 |
if params[0].database and len(params[0].database)>0: |
851 |
database=params[0].database |
851 |
database=params[0].database |
852 |
|
852 |
|
853 |
apps=getAppsData(database,checkExecs=params[0].checkExecs,searchIconsIn=params[0].iconPath,sortOrder=params[0].sortOrder,minLength=params[0].subLength,with=params[0].with,without=params[0].without,rootName=params[0].rootCat,topInSub=params[0].topInSub,fileIcon=params[0].fileDefault,dirIcon=params[0].dirDefault) |
853 |
apps=getAppsData(database,checkExecs=params[0].checkExecs,searchIconsIn=params[0].iconPath,sortOrder=params[0].sortOrder,minLength=params[0].subLength,xwith=params[0].xwith,without=params[0].without,rootName=params[0].rootCat,topInSub=params[0].topInSub,fileIcon=params[0].fileDefault,dirIcon=params[0].dirDefault) |
854 |
|
854 |
|
855 |
########################## DEBUG ################################ |
855 |
########################## DEBUG ################################ |
856 |
if params[0].verbosity > 1: |
856 |
if params[0].verbosity > 1: |