Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
bbdf01a4
Kaydet (Commit)
bbdf01a4
authored
May 24, 2003
tarafından
Jörg Budischewski
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
added inspect function, modified addComponentsToContext because of the new component naming scheme
üst
e9c652ed
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
94 additions
and
3 deletions
+94
-3
unohelper.py
pyuno/source/module/unohelper.py
+94
-3
No files found.
pyuno/source/module/unohelper.py
Dosyayı görüntüle @
bbdf01a4
...
@@ -2,9 +2,9 @@
...
@@ -2,9 +2,9 @@
#
#
# $RCSfile: unohelper.py,v $
# $RCSfile: unohelper.py,v $
#
#
# $Revision: 1.
1
$
# $Revision: 1.
2
$
#
#
# last change: $Author: jbu $ $Date: 2003-0
3-23 12:12:59
$
# last change: $Author: jbu $ $Date: 2003-0
5-24 23:23:38
$
#
#
# The Contents of this file are made available subject to the terms of
# The Contents of this file are made available subject to the terms of
# either of the following licenses
# either of the following licenses
...
@@ -59,9 +59,97 @@
...
@@ -59,9 +59,97 @@
#*************************************************************************
#*************************************************************************
import
uno
import
uno
import
pyuno
import
pyuno
import
os
from
com.sun.star.lang
import
XTypeProvider
,
XSingleComponentFactory
,
XServiceInfo
from
com.sun.star.lang
import
XTypeProvider
,
XSingleComponentFactory
,
XServiceInfo
from
com.sun.star.uno
import
RuntimeException
from
com.sun.star.uno
import
RuntimeException
from
com.sun.star.beans.MethodConcept
import
ALL
as
METHOD_CONCEPT_ALL
from
com.sun.star.beans.PropertyConcept
import
ALL
as
PROPERTY_CONCEPT_ALL
from
com.sun.star.reflection.ParamMode
import
\
IN
as
PARAM_MODE_IN
,
\
OUT
as
PARAM_MODE_OUT
,
\
INOUT
as
PARAM_MODE_INOUT
from
com.sun.star.beans.PropertyAttribute
import
\
MAYBEVOID
as
PROP_ATTR_MAYBEVOID
,
\
BOUND
as
PROP_ATTR_BOUND
,
\
CONSTRAINED
as
PROP_ATTR_CONSTRAINED
,
\
TRANSIENT
as
PROP_ATTR_TRANSIENT
,
\
READONLY
as
PROP_ATTR_READONLY
,
\
MAYBEAMBIGUOUS
as
PROP_ATTR_MAYBEAMBIGUOUS
,
\
MAYBEDEFAULT
as
PROP_ATTR_MAYBEDEFAULT
,
\
REMOVEABLE
as
PROP_ATTR_REMOVEABLE
def
_mode_to_str
(
mode
):
ret
=
"[]"
if
mode
==
PARAM_MODE_INOUT
:
ret
=
"[inout]"
elif
mode
==
PARAM_MODE_OUT
:
ret
=
"[out]"
elif
mode
==
PARAM_MODE_IN
:
ret
=
"[in]"
return
ret
def
_propertymode_to_str
(
mode
):
ret
=
""
if
PROP_ATTR_REMOVEABLE
&
mode
:
ret
=
ret
+
"removeable "
if
PROP_ATTR_MAYBEDEFAULT
&
mode
:
ret
=
ret
+
"maybedefault "
if
PROP_ATTR_MAYBEAMBIGUOUS
&
mode
:
ret
=
ret
+
"maybeambigous "
if
PROP_ATTR_READONLY
&
mode
:
ret
=
ret
+
"readonly "
if
PROP_ATTR_TRANSIENT
&
mode
:
ret
=
ret
+
"tranient "
if
PROP_ATTR_CONSTRAINED
&
mode
:
ret
=
ret
+
"constrained "
if
PROP_ATTR_BOUND
&
mode
:
ret
=
ret
+
"bound "
if
PROP_ATTR_MAYBEVOID
&
mode
:
ret
=
ret
+
"maybevoid "
return
ret
.
rstrip
()
def
inspect
(
obj
,
out
):
ctx
=
uno
.
getComponentContext
()
introspection
=
\
ctx
.
ServiceManager
.
createInstanceWithContext
(
"com.sun.star.beans.Introspection"
,
ctx
)
out
.
write
(
"Supported services:
\n
"
)
if
hasattr
(
obj
,
"getSupportedServiceNames"
):
names
=
obj
.
getSupportedServiceNames
()
for
ii
in
names
:
out
.
write
(
" "
+
ii
+
"
\n
"
)
else
:
out
.
write
(
" unknown
\n
"
)
out
.
write
(
"Interfaces:
\n
"
)
if
hasattr
(
obj
,
"getTypes"
):
interfaces
=
obj
.
getTypes
()
for
ii
in
interfaces
:
out
.
write
(
" "
+
ii
.
typeName
+
"
\n
"
)
else
:
out
.
write
(
" unknown
\n
"
)
access
=
introspection
.
inspect
(
obj
)
methods
=
access
.
getMethods
(
METHOD_CONCEPT_ALL
)
out
.
write
(
"Methods:
\n
"
)
for
ii
in
methods
:
out
.
write
(
" "
+
ii
.
ReturnType
.
Name
+
" "
+
ii
.
Name
)
args
=
ii
.
ParameterTypes
infos
=
ii
.
ParameterInfos
out
.
write
(
"( "
)
for
i
in
range
(
0
,
len
(
args
)
):
if
i
>
0
:
out
.
write
(
", "
)
out
.
write
(
_mode_to_str
(
infos
[
i
]
.
aMode
)
+
" "
+
args
[
i
]
.
Name
+
" "
+
infos
[
i
]
.
aName
)
out
.
write
(
" )
\n
"
)
props
=
access
.
getProperties
(
PROPERTY_CONCEPT_ALL
)
out
.
write
(
"Properties:
\n
"
)
for
ii
in
props
:
out
.
write
(
" ("
+
_propertymode_to_str
(
ii
.
Attributes
)
+
") "
+
ii
.
Type
.
typeName
+
" "
+
ii
.
Name
+
"
\n
"
)
def
createSingleServiceFactory
(
clazz
,
implementationName
,
serviceNames
):
def
createSingleServiceFactory
(
clazz
,
implementationName
,
serviceNames
):
return
_FactoryHelper_
(
clazz
,
implementationName
,
serviceNames
)
return
_FactoryHelper_
(
clazz
,
implementationName
,
serviceNames
)
...
@@ -139,11 +227,14 @@ def addComponentsToContext( toBeExtendedContext, contextRuntime, componentUrls,
...
@@ -139,11 +227,14 @@ def addComponentsToContext( toBeExtendedContext, contextRuntime, componentUrls,
smgr
=
contextRuntime
.
ServiceManager
smgr
=
contextRuntime
.
ServiceManager
loader
=
smgr
.
createInstanceWithContext
(
loaderName
,
contextRuntime
)
loader
=
smgr
.
createInstanceWithContext
(
loaderName
,
contextRuntime
)
implReg
=
smgr
.
createInstanceWithContext
(
"com.sun.star.registry.ImplementationRegistration"
,
contextRuntime
)
implReg
=
smgr
.
createInstanceWithContext
(
"com.sun.star.registry.ImplementationRegistration"
,
contextRuntime
)
isWin
=
os
.
name
==
'nt'
or
os
.
name
==
'dos'
# create a temporary registry
# create a temporary registry
for
componentUrl
in
componentUrls
:
for
componentUrl
in
componentUrls
:
reg
=
smgr
.
createInstanceWithContext
(
"com.sun.star.registry.SimpleRegistry"
,
contextRuntime
)
reg
=
smgr
.
createInstanceWithContext
(
"com.sun.star.registry.SimpleRegistry"
,
contextRuntime
)
reg
.
open
(
""
,
0
,
1
)
reg
.
open
(
""
,
0
,
1
)
if
not
isWin
and
componentUrl
.
endswith
(
".uno"
):
# still allow platform independent naming
componentUrl
=
componentUrl
+
".so"
implReg
.
registerImplementation
(
loaderName
,
componentUrl
,
reg
)
implReg
.
registerImplementation
(
loaderName
,
componentUrl
,
reg
)
rootKey
=
reg
.
getRootKey
()
rootKey
=
reg
.
getRootKey
()
implementationKey
=
rootKey
.
openKey
(
"IMPLEMENTATIONS"
)
implementationKey
=
rootKey
.
openKey
(
"IMPLEMENTATIONS"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment