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
33776d14
Kaydet (Commit)
33776d14
authored
Tem 01, 2015
tarafından
Matthew J. Francis
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
PyUNO: Allow import of constant group by name
Change-Id: I0ea809a888187624261182552cf7fa0a9c96c648
üst
3a6ec53e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
1 deletion
+30
-1
uno.py
pyuno/source/module/uno.py
+30
-1
No files found.
pyuno/source/module/uno.py
Dosyayı görüntüle @
33776d14
...
...
@@ -303,7 +303,11 @@ def _uno_import( name, *optargs, **kwargs ):
try
:
d
[
x
]
=
getConstantByName
(
name
+
"."
+
x
)
except
RuntimeException
:
failed
=
True
# check for constant group
try
:
d
[
x
]
=
_impl_getConstantGroupByName
(
name
,
x
)
except
ValueError
:
failed
=
True
if
failed
:
# We have an import failure, but cannot distinguish between
...
...
@@ -336,6 +340,31 @@ def _uno_import( name, *optargs, **kwargs ):
return
mod
# private
class
_ConstantGroup
(
object
):
__slots__
=
[
'_constants'
]
def
__init__
(
self
,
constants
):
self
.
_constants
=
constants
def
__dir__
(
self
):
return
self
.
_constants
.
keys
()
def
__getattr__
(
self
,
name
):
if
name
in
self
.
_constants
:
return
self
.
_constants
[
name
]
raise
AttributeError
# private
def
_impl_getConstantGroupByName
(
module
,
group
):
CONSTANTS
=
Enum
(
'com.sun.star.uno.TypeClass'
,
'CONSTANTS'
)
ONE
=
Enum
(
'com.sun.star.reflection.TypeDescriptionSearchDepth'
,
'ONE'
)
tdm
=
_g_ctx
.
getValueByName
(
'/singletons/com.sun.star.reflection.theTypeDescriptionManager'
)
tde
=
tdm
.
createTypeDescriptionEnumeration
(
module
,(
CONSTANTS
,),
ONE
)
qualifiedName
=
module
+
'.'
+
group
for
td
in
tde
:
if
td
.
Name
==
qualifiedName
:
return
_ConstantGroup
({
c
.
Name
.
split
(
'.'
)[
-
1
]:
c
.
ConstantValue
for
c
in
td
.
Constants
})
else
:
raise
ValueError
# private function, don't use
def
_impl_extractName
(
name
):
r
=
list
(
range
(
len
(
name
)
-
1
,
0
,
-
1
))
...
...
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