Overview
| Comment: | [lo] update: helpers |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | lo | multid |
| Files: | files | file ages | folders |
| SHA3-256: |
12ad3816875b789a445f6b7c2a757bc9 |
| User & Date: | olr on 2018-02-19 12:37:18 |
| Other Links: | branch diff | manifest | tags |
Context
|
2018-02-19
| ||
| 12:38 | [lo] update: text formatter uses helpers check-in: c88678ec25 user: olr tags: lo, multid | |
| 12:37 | [lo] update: helpers check-in: 12ad381687 user: olr tags: lo, multid | |
| 09:44 | merge trunk check-in: 0b7150270a user: olr tags: multid | |
Changes
Modified gc_lang/fr/oxt/helpers.py from [3ebcc78813] to [0c0cec83d0].
|
| | | > > > < < > < > | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# Helpers for LibreOffice extension
import os
import traceback
import uno
from com.sun.star.beans import PropertyValue
from com.sun.star.uno import RuntimeException as _rtex
def xray (myObject):
"XRay - API explorer"
try:
sm = uno.getComponentContext().ServiceManager
mspf = sm.createInstanceWithContext("com.sun.star.script.provider.MasterScriptProviderFactory", uno.getComponentContext())
scriptPro = mspf.createScriptProvider("")
xScript = scriptPro.getScript("vnd.sun.star.script:XrayTool._Main.Xray?language=Basic&location=application")
xScript.invoke((myObject,), (), ())
return
except:
raise _rtex("\nBasic library Xray is not installed", uno.getComponentContext())
def mri (ctx, xTarget):
"MRI - API Explorer"
try:
xMri = ctx.ServiceManager.createInstanceWithContext("mytools.Mri", ctx)
xMri.inspect(xTarget)
except:
raise _rtex("\nPython extension MRI is not installed", uno.getComponentContext())
def getConfigSetting (sNodeConfig, bUpdate):
"get a configuration node"
# example: xNode = getConfigSetting("/org.openoffice.Office.Common/Path/Current", False)
xSvMgr = uno.getComponentContext().ServiceManager
xConfigProvider = xSvMgr.createInstanceWithContext("com.sun.star.configuration.ConfigurationProvider", uno.getComponentContext())
|
| ︙ | ︙ | |||
56 57 58 59 60 61 62 |
xContainerWindow = xDesktop.getCurrentComponent().CurrentController.Frame.ContainerWindow
xWindowSize = xContainerWindow.convertSizeToLogic(xContainerWindow.Size, uno.getConstantByName("com.sun.star.util.MeasureUnit.POINT"))
#print(xContainerWindow.Size.Width, ">", xWindowSize.Width)
#print(xContainerWindow.Size.Height, ">", xWindowSize.Height)
xWindowSize.Width = xWindowSize.Width * 0.666
xWindowSize.Height = xWindowSize.Height * 0.666
return xWindowSize
| > > > > > > > > > > | 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
xContainerWindow = xDesktop.getCurrentComponent().CurrentController.Frame.ContainerWindow
xWindowSize = xContainerWindow.convertSizeToLogic(xContainerWindow.Size, uno.getConstantByName("com.sun.star.util.MeasureUnit.POINT"))
#print(xContainerWindow.Size.Width, ">", xWindowSize.Width)
#print(xContainerWindow.Size.Height, ">", xWindowSize.Height)
xWindowSize.Width = xWindowSize.Width * 0.666
xWindowSize.Height = xWindowSize.Height * 0.666
return xWindowSize
def getAbsolutePathOf (sPath=""):
xDefaultContext = uno.getComponentContext().ServiceManager.DefaultContext
xPackageInfoProvider = xDefaultContext.getValueByName("/singletons/com.sun.star.deployment.PackageInformationProvider")
sFullPath = xPackageInfoProvider.getPackageLocation("French.linguistic.resources.from.Dicollecte.by.OlivierR")
if sPath and not sPath.startswith("/"):
sPath = "/" + sPath
sFullPath = sFullPath[8:] + sPath
return os.path.abspath(sFullPath)
|