[Libreoffice-commits] help.git: source/text
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Sat Jan 26 11:09:52 UTC 2019
source/text/sbasic/python/python_programming.xhp | 37 ++++++++++++++---------
1 file changed, 24 insertions(+), 13 deletions(-)
New commits:
commit 9d3ac186501c299a627c1338b5e27e0b18f1ea01
Author: LibreOfficiant <OpenOfficiant at sfr.fr>
AuthorDate: Sat Jan 26 10:19:29 2019 +0100
Commit: Olivier Hallot <olivier.hallot at libreoffice.org>
CommitDate: Sat Jan 26 12:09:31 2019 +0100
Improper Python code requiring update
Change-Id: Ia59f0e5d67718771152cca49704173701bf1f0f8
Reviewed-on: https://gerrit.libreoffice.org/66957
Tested-by: Jenkins
Reviewed-by: Olivier Hallot <olivier.hallot at libreoffice.org>
diff --git a/source/text/sbasic/python/python_programming.xhp b/source/text/sbasic/python/python_programming.xhp
index 46d9d90c1..a513c684c 100644
--- a/source/text/sbasic/python/python_programming.xhp
+++ b/source/text/sbasic/python/python_programming.xhp
@@ -192,7 +192,7 @@
</tablerow>
<tablerow>
<tablecell>
- <paragraph role="tablecontent" localize="false" id="N0277">ctx = ..getComponentContext()</paragraph>
+ <paragraph role="tablecontent" localize="false" id="N0277">ctx = uno.getComponentContext()</paragraph>
<paragraph role="tablecontent" localize="false" id="N0278">smgr = ctx.getServiceManager()</paragraph>
<paragraph role="tablecontent" localize="false" id="N0279">obj = smgr.createInstanceWithContext( .. , ctx)</paragraph>
</tablecell>
@@ -202,15 +202,6 @@
</tablerow>
<tablerow>
<tablecell>
- <paragraph role="tablecontent" localize="false" id="N0281">ctx = ..getComponentContext()</paragraph>
- <paragraph role="tablecontent" localize="false" id="N0282">smgr = ctx.getServiceManager()</paragraph>
- </tablecell>
- <tablecell>
- <paragraph role="tablecontent" localize="false" id="N0283">GetProcessServiceManager()</paragraph>
- </tablecell>
- </tablerow>
- <tablerow>
- <tablecell>
<paragraph role="tablecontent" id="N0284">See Creating a Dialog</paragraph>
</tablecell>
<tablecell>
@@ -243,6 +234,15 @@
</tablerow>
<tablerow>
<tablecell>
+ <paragraph role="tablecontent" localize="false" id="N0281">ctx = uno.getComponentContext()</paragraph>
+ <paragraph role="tablecontent" localize="false" id="N0282">smgr = ctx.getServiceManager()</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph role="tablecontent" localize="false" id="N0283">GetProcessServiceManager()</paragraph>
+ </tablecell>
+ </tablerow>
+ <tablerow>
+ <tablecell>
</tablecell>
<tablecell>
<paragraph role="tablecontent" localize="false" id="N0294">HasUnoInterfaces()</paragraph>
@@ -255,6 +255,17 @@
<paragraph role="tablecontent" localize="false" id="N0296">IsUnoStruct()</paragraph>
</tablecell>
</tablerow>
+ <tablerow>
+ <tablecell>
+ <paragraph role="tablecontent" localize="false" id="N0297">ctx = uno.getComponentContext()</paragraph>
+ <paragraph role="tablecontent" localize="false" id="N0298">smgr = ctx.getServiceManager()</paragraph>
+ <paragraph role="tablecontent" localize="false" id="N0299">DESK = 'com.sun.star.frame.Desktop'</paragraph>
+ <paragraph role="tablecontent" localize="false" id="N0300">obj = smgr.createInstanceWithContext(DESK , ctx)</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph role="tablecontent" localize="false" id="N0301">StarDesktop</paragraph>
+ </tablecell>
+ </tablerow>
</table>
<h2 id="N0297">Importing an embedded Module</h2>
<section id="PythonEmbeddedImport" >
@@ -269,10 +280,10 @@
<paragraph role="pycode" id="N0305"> Adapted from 'Bibliothèque de fonctions' by Hubert Lambert</paragraph>
<paragraph role="pycode" id="N0306"> at https://forum.openoffice.org/fr/forum/viewtopic.php?p=286213"""</paragraph>
<paragraph role="pycode" id="N0307"> doc = XSCRIPTCONTEXT.getDocument() # current document</paragraph>
- <paragraph role="pycode" localize="false" id="N0308"> url = uno.fileUrlToSystemPath('{}/{}/{}', \</paragraph>
- <paragraph role="pycode" localize="false" id="N0309"> format(doc.URL, 'Scripts/python', library_name) # ConvertToURL()</paragraph>
+ <paragraph role="pycode" localize="false" id="N0308"> url = uno.fileUrlToSystemPath( \</paragraph>
+ <paragraph role="pycode" localize="false" id="N0309"> '{}/{}'.format(doc.URL, 'Scripts/python'+library_name)) # ConvertToURL()</paragraph>
<paragraph role="pycode" id="N0310"> if not url in sys.path: # add path if necessary</paragraph>
- <paragraph role="pycode" id="N0311"> sys.path.insert(0, url) # doc takes precedence</paragraph>
+ <paragraph role="pycode" id="N0311"> sys.path.insert(0, url) # doclib takes precedence</paragraph>
<paragraph role="pycode" id="N0312"> if module_name: # import if requested</paragraph>
<paragraph role="pycode" localize="false" id="N0313"> return zipimport.zipimporter(url).load_module(module_name)</paragraph>
<paragraph role="pycode" localize="false" id="N0314"></paragraph>
More information about the Libreoffice-commits
mailing list