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
09f2d543
Kaydet (Commit)
09f2d543
authored
Eki 16, 2012
tarafından
Xisco Fauli
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
pywizards: cleanup common code
Change-Id: I6e64ec407326b5759664ace286eb67b2c6cd3b04
üst
0d8e34f6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
234 deletions
+7
-234
Configuration.py
wizards/com/sun/star/wizards/common/Configuration.py
+1
-174
Desktop.py
wizards/com/sun/star/wizards/common/Desktop.py
+0
-37
Resource.py
wizards/com/sun/star/wizards/common/Resource.py
+2
-5
SystemDialog.py
wizards/com/sun/star/wizards/common/SystemDialog.py
+4
-18
No files found.
wizards/com/sun/star/wizards/common/Configuration.py
Dosyayı görüntüle @
09f2d543
...
...
@@ -20,21 +20,8 @@ import traceback
from
.PropertyNames
import
PropertyNames
from
.Helper
import
Helper
'''
This class gives access to the OO configuration api.
It contains 4 get and 4 set convenience methods for getting and settings
properties in the configuration. <br/>
For the get methods, two parameters must be given: name and parent, where
name is the name of the property, parent is a HierarchyElement
(::com::sun::star::configuration::HierarchyElement)<br/>
The get and set methods support hieryrchical property names like
"options/gridX". <br/>
NOTE: not yet supported, but sometime later,
If you will ommit the "parent" parameter, then the "name" parameter must be
in hierarchy form from the root of the registry.
'''
class
Configuration
(
object
):
'''This class gives access to the OO configuration api.'''
@classmethod
def
getConfigurationRoot
(
self
,
xmsf
,
sPath
,
updateable
):
...
...
@@ -59,163 +46,3 @@ class Configuration(object):
sView
=
"com.sun.star.configuration.ConfigurationAccess"
return
oConfigProvider
.
createInstanceWithArguments
(
sView
,
tuple
(
args
))
@classmethod
def
getProductName
(
self
,
xMSF
):
try
:
oProdNameAccess
=
self
.
getConfigurationRoot
(
xMSF
,
"org.openoffice.Setup/Product"
,
False
)
ProductName
=
Helper
.
getUnoObjectbyName
(
oProdNameAccess
,
"ooName"
)
return
ProductName
except
Exception
:
traceback
.
print_exc
()
return
None
@classmethod
def
getOfficeLocaleString
(
self
,
xMSF
):
sLocale
=
""
try
:
aLocLocale
=
Locale
.
Locale
()
oMasterKey
=
self
.
getConfigurationRoot
(
xMSF
,
"org.openoffice.Setup/L10N/"
,
False
)
sLocale
=
(
String
)
Helper
.
getUnoObjectbyName
(
oMasterKey
,
"ooLocale"
)
except
Exception
,
exception
:
traceback
.
print_exc
()
return
sLocale
@classmethod
def
getOfficeLocale
(
self
,
xMSF
):
aLocLocale
=
Locale
.
Locale
()
sLocale
=
getOfficeLocaleString
(
xMSF
)
sLocaleList
=
JavaTools
.
ArrayoutofString
(
sLocale
,
"-"
)
aLocLocale
.
Language
=
sLocaleList
[
0
]
if
sLocaleList
.
length
>
1
:
aLocLocale
.
Country
=
sLocaleList
[
1
]
return
aLocLocale
@classmethod
def
removeNode
(
self
,
configView
,
name
,
xmsf
=
None
):
commitChanges
=
False
if
xmsf
is
not
None
:
configView
=
self
.
getConfigurationRoot
(
xmsf
,
path
,
True
)
commit
=
True
if
configView
.
hasByName
(
name
):
configView
.
removeByName
(
name
)
if
commitChanges
:
configView
.
commitChanges
()
@classmethod
def
updateConfiguration
(
self
,
xmsf
,
path
,
name
,
node
,
param
):
view
=
self
.
getConfigurationRoot
(
xmsf
,
path
,
True
)
addConfigNode
(
path
,
name
)
node
.
writeConfiguration
(
view
,
param
)
view
.
commitChanges
()
@classmethod
def
getNodeDisplayNames
(
self
,
_xNameAccessNode
):
snames
=
None
return
getNodeChildNames
(
_xNameAccessNode
,
PropertyNames
.
PROPERTY_NAME
)
@classmethod
def
getNodeChildNames
(
self
,
xNameAccessNode
,
_schildname
):
snames
=
None
try
:
snames
=
xNameAccessNode
.
getElementNames
()
sdisplaynames
=
range
(
snames
.
length
)
i
=
0
while
i
<
snames
.
length
:
oContent
=
Helper
.
getUnoPropertyValue
(
xNameAccessNode
.
getByName
(
snames
[
i
]),
_schildname
)
if
not
AnyConverter
.
isVoid
(
oContent
):
sdisplaynames
[
i
]
=
(
String
)
Helper
.
getUnoPropertyValue
(
xNameAccessNode
.
getByName
(
snames
[
i
]),
_schildname
)
else
:
sdisplaynames
[
i
]
=
snames
[
i
]
i
+=
1
return
sdisplaynames
except
Exception
,
e
:
traceback
.
print_exc
()
return
snames
@classmethod
def
getChildNodebyIndex
(
self
,
_xNameAccess
,
_index
):
try
:
snames
=
_xNameAccess
.
getElementNames
()
oNode
=
_xNameAccess
.
getByName
(
snames
[
_index
])
return
oNode
except
Exception
,
e
:
traceback
.
print_exc
()
return
None
@classmethod
def
getChildNodebyName
(
self
,
_xNameAccessNode
,
_SubNodeName
):
try
:
if
_xNameAccessNode
.
hasByName
(
_SubNodeName
):
return
_xNameAccessNode
.
getByName
(
_SubNodeName
)
except
Exception
,
e
:
traceback
.
print_exc
()
return
None
@classmethod
def
getChildNodebyDisplayName
(
self
,
_xNameAccessNode
,
_displayname
):
snames
=
None
return
getChildNodebyDisplayName
(
_xNameAccessNode
,
_displayname
,
PropertyNames
.
PROPERTY_NAME
)
@classmethod
def
getChildNodebyDisplayName
(
self
,
_xNameAccessNode
,
_displayname
,
_nodename
):
snames
=
None
try
:
snames
=
_xNameAccessNode
.
getElementNames
()
sdisplaynames
=
range
(
snames
.
length
)
i
=
0
while
i
<
snames
.
length
:
curdisplayname
=
Helper
.
getUnoPropertyValue
(
_xNameAccessNode
.
getByName
(
snames
[
i
]),
_nodename
)
if
curdisplayname
.
equals
(
_displayname
):
return
_xNameAccessNode
.
getByName
(
snames
[
i
])
i
+=
1
except
Exception
,
e
:
traceback
.
print_exc
()
return
None
@classmethod
def
getChildNodebyDisplayName
(
self
,
_xMSF
,
_aLocale
,
_xNameAccessNode
,
_displayname
,
_nodename
,
_nmaxcharcount
):
snames
=
None
try
:
snames
=
_xNameAccessNode
.
getElementNames
()
sdisplaynames
=
range
(
snames
.
length
)
i
=
0
while
i
<
snames
.
length
:
curdisplayname
=
Helper
.
getUnoPropertyValue
(
_xNameAccessNode
.
getByName
(
snames
[
i
]),
_nodename
)
if
(
_nmaxcharcount
>
0
)
and
(
_nmaxcharcount
<
\
curdisplayname
.
length
()):
curdisplayname
=
curdisplayname
.
substring
(
0
,
_nmaxcharcount
)
curdisplayname
=
Desktop
.
removeSpecialCharacters
(
_xMSF
,
_aLocale
,
curdisplayname
)
if
curdisplayname
.
equals
(
_displayname
):
return
_xNameAccessNode
.
getByName
(
snames
[
i
])
i
+=
1
except
Exception
,
e
:
traceback
.
print_exc
()
return
None
wizards/com/sun/star/wizards/common/Desktop.py
Dosyayı görüntüle @
09f2d543
...
...
@@ -17,7 +17,6 @@
#
import
uno
import
traceback
from
.NoValidPathException
import
NoValidPathException
from
com.sun.star.frame.FrameSearchFlag
import
ALL
,
PARENT
from
com.sun.star.util
import
URL
...
...
@@ -130,39 +129,3 @@ class Desktop(object):
def
getUniqueName
(
self
,
xElementContainer
,
sElementName
):
sIncSuffix
=
self
.
getIncrementSuffix
(
xElementContainer
,
sElementName
)
return
sElementName
+
sIncSuffix
class
OfficePathRetriever
:
def
OfficePathRetriever
(
self
,
xMSF
):
try
:
TemplatePath
=
FileAccess
.
getOfficePath
(
xMSF
,
"Template"
,
"share"
,
"/wizard"
)
UserTemplatePath
=
FileAccess
.
getOfficePath
(
xMSF
,
"Template"
,
"user"
,
""
)
BitmapPath
=
FileAccess
.
combinePaths
(
xMSF
,
TemplatePath
,
"/../wizard/bitmap"
)
WorkPath
=
FileAccess
.
getOfficePath
(
xMSF
,
"Work"
,
""
,
""
)
except
NoValidPathException
,
nopathexception
:
pass
@classmethod
def
getTemplatePath
(
self
,
_xMSF
):
sTemplatePath
=
""
try
:
sTemplatePath
=
FileAccess
.
getOfficePath
(
_xMSF
,
"Template"
,
"share"
,
"/wizard"
)
except
NoValidPathException
,
nopathexception
:
pass
return
sTemplatePath
@classmethod
def
getBitmapPath
(
self
,
_xMSF
):
sBitmapPath
=
""
try
:
sBitmapPath
=
FileAccess
.
combinePaths
(
_xMSF
,
getTemplatePath
(
_xMSF
),
"/../wizard/bitmap"
)
except
NoValidPathException
,
nopathexception
:
pass
return
sBitmapPath
wizards/com/sun/star/wizards/common/Resource.py
Dosyayı görüntüle @
09f2d543
...
...
@@ -17,7 +17,6 @@
#
import
traceback
from
.Configuration
import
Configuration
from
.SystemDialog
import
SystemDialog
from
com.sun.star.awt.VclWindowPeerAttribute
import
OK
...
...
@@ -63,9 +62,7 @@ class Resource(object):
@classmethod
def
showCommonResourceError
(
self
,
xMSF
):
ProductName
=
Configuration
.
getProductName
(
xMSF
)
from
.SystemDialog
import
SystemDialog
sError
=
"The files required could not be found.
\n
"
+
\
"Please start the
%
PRODUCTNAME Setup and choose 'Repair'."
sError
=
sError
.
replace
(
"
%
PRODUCTNAME"
,
ProductName
)
"Please start the LibreOffice Setup and choose 'Repair'."
SystemDialog
.
showMessageBox
(
xMSF
,
"ErrorBox"
,
OK
,
sError
)
wizards/com/sun/star/wizards/common/SystemDialog.py
Dosyayı görüntüle @
09f2d543
...
...
@@ -16,7 +16,6 @@
# the License at http://www.apache.org/licenses/LICENSE-2.0 .
#
import
traceback
from
.Configuration
import
Configuration
from
.Desktop
import
Desktop
from
.Helper
import
Helper
...
...
@@ -140,26 +139,13 @@ class SystemDialog(object):
except
Exception
,
ex
:
traceback
.
print_exc
()
'''
converts the name returned from getFilterUIName_(...) so the
product name is correct.
@param filterName
@return
'''
def
getFilterUIName
(
self
,
filterName
):
prodName
=
Configuration
.
getProductName
(
self
.
xMSF
)
s
=
[[
self
.
getFilterUIName_
(
filterName
)]]
s
[
0
][
0
]
=
s
[
0
][
0
]
.
replace
(
"
%
productname
%
"
,
prodName
)
return
s
[
0
][
0
]
'''
note the result should go through conversion of the product name.
@param filterName
@return the UI localized name of the given filter name.
'''
def
getFilterUIName
_
(
self
,
filterName
):
def
getFilterUIName
(
self
,
filterName
):
try
:
oFactory
=
self
.
xMSF
.
createInstance
(
"com.sun.star.document.FilterFactory"
)
...
...
@@ -167,7 +153,7 @@ class SystemDialog(object):
xPropertyValue
=
list
(
oObject
)
for
i
in
xPropertyValue
:
if
i
is
not
None
and
i
.
Name
==
"UIName"
:
return
str
(
i
.
Value
)
return
str
(
i
.
Value
)
.
replace
(
"
%
productname
%
"
,
"LibreOffice"
)
raise
NullPointerException
(
"UIName property not found for Filter "
+
filterName
);
...
...
@@ -178,10 +164,10 @@ class SystemDialog(object):
@classmethod
def
showErrorBox
(
self
,
xMSF
,
ResName
,
ResPrefix
,
ResID
,
AddTag
=
None
,
AddString
=
None
):
ProductName
=
Configuration
.
getProductName
(
xMSF
)
from
.Resource
import
Resource
oResource
=
Resource
(
xMSF
,
ResPrefix
)
sErrorMessage
=
oResource
.
getResText
(
ResID
)
sErrorMessage
=
sErrorMessage
.
replace
(
ProductName
,
"
%
PRODUCTNAME"
)
sErrorMessage
=
sErrorMessage
.
replace
(
"
%
PRODUCTNAME"
,
"LibreOffice"
)
sErrorMessage
=
sErrorMessage
.
replace
(
str
(
13
),
"<BR>"
)
if
AddTag
and
AddString
:
sErrorMessage
=
sErrorMessage
.
replace
(
AddString
,
AddTag
)
...
...
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