Updated to only create the dialog library when the script library is also missing.
This commit is contained in:
parent
1c031e2d57
commit
0720c3c704
17
oobsync.py
17
oobsync.py
@ -99,8 +99,7 @@ def sync_macros(oo):
|
|||||||
print >> sys.stderr, \
|
print >> sys.stderr, \
|
||||||
"ERROR: Found no source macros in " + args.projdir
|
"ERROR: Found no source macros in " + args.projdir
|
||||||
return
|
return
|
||||||
update_basic_modules(libraries, args.library, modules)
|
update_basic_modules(libraries, args.library, modules, oo)
|
||||||
check_dialog_library(oo, args.library)
|
|
||||||
if args.run is not None:
|
if args.run is not None:
|
||||||
factory = oo.service_manager.DefaultContext.getByName(
|
factory = oo.service_manager.DefaultContext.getByName(
|
||||||
"/singletons/com.sun.star.script.provider."
|
"/singletons/com.sun.star.script.provider."
|
||||||
@ -171,11 +170,12 @@ def read_basic_modules(libraries, libname):
|
|||||||
return modules
|
return modules
|
||||||
|
|
||||||
|
|
||||||
def update_basic_modules(libraries, libname, modules):
|
def update_basic_modules(libraries, libname, modules, oo):
|
||||||
""" Updates the OpenOffice Basic macros storage. """
|
""" Updates the OpenOffice Basic macros storage. """
|
||||||
if not libraries.hasByName(libname):
|
if not libraries.hasByName(libname):
|
||||||
libraries.createLibrary(libname)
|
libraries.createLibrary(libname)
|
||||||
print >> sys.stderr, "Script library " + libname + " created."
|
print >> sys.stderr, "Script library " + libname + " created."
|
||||||
|
create_dialog_library(oo, libname)
|
||||||
library = libraries.getByName(libname)
|
library = libraries.getByName(libname)
|
||||||
for modname in sorted(modules.keys()):
|
for modname in sorted(modules.keys()):
|
||||||
library.insertByName(modname, modules[modname])
|
library.insertByName(modname, modules[modname])
|
||||||
@ -200,14 +200,13 @@ def update_basic_modules(libraries, libname, modules):
|
|||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
def check_dialog_library(oo, libname):
|
def create_dialog_library(oo, libname):
|
||||||
""" Checks and adds the dialog library when missing. """
|
""" Creates the dialog library. """
|
||||||
libraries = oo.service_manager.createInstance(
|
libraries = oo.service_manager.createInstance(
|
||||||
"com.sun.star.script.ApplicationDialogLibraryContainer")
|
"com.sun.star.script.ApplicationDialogLibraryContainer")
|
||||||
if not libraries.hasByName(libname):
|
libraries.createLibrary(libname)
|
||||||
libraries.createLibrary(libname)
|
print >> sys.stderr, "Dialog library " + libname + " created."
|
||||||
print >> sys.stderr, "Dialog library " + libname + " created."
|
libraries.storeLibraries()
|
||||||
libraries.storeLibraries()
|
|
||||||
|
|
||||||
|
|
||||||
class OpenOffice:
|
class OpenOffice:
|
||||||
|
Loading…
Reference in New Issue
Block a user