381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
|
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
|
-
-
-
-
-
-
+
+
|
# create options dictionary
dOpt = {}
for key, lWidget in self.dCheckboxWidgets.items():
w = getattr(self, key)
dOpt[w.Name] = w.State
for w in lWidget:
dOpt[w.Name] = w.State
# get extension path
xDefaultContext = self.ctx.ServiceManager.DefaultContext
xPackageInfoProvider = xDefaultContext.getValueByName("/singletons/com.sun.star.deployment.PackageInformationProvider")
sExtPath = xPackageInfoProvider.getPackageLocation("French.linguistic.resources.from.Dicollecte.by.OlivierR")
sExtPath = sExtPath[8:] + "/pythonpath/tf_options.py" # remove "file:///"
sExtPath = os.path.abspath(sExtPath)
# write file
sExtPath = helpers.getAbsolutePathOf("/pythonpath/tf_options.py")
if os.path.isfile(sExtPath):
print(sExtPath)
hOpt = open(sExtPath, "w")
hOpt.write("dDefaultOpt = " + str(tf_options.dDefaultOpt) + "\n")
hOpt.write("dOpt = " + str(dOpt))
hOpt.close()
except:
traceback.print_exc()
|