def _saveConfig (self):
try:
# 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
if os.path.isfile(sExtPath):
hOpt = open(sExtPath, "w")
hOpt.write("dDefaultOpt = " + str(tf_options.dDefaultOpt) + "\n")
hOpt.write("dOpt = " + str(dOpt))
hOpt.close()
except:
traceback.print_exc()
评论列表
文章目录