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
789c4825
Kaydet (Commit)
789c4825
authored
Eki 03, 2012
tarafından
Xisco Fauli
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
pyfax: cleanup ugly code
Change-Id: I6141e544391c6723e7d2949771be1bd5a1768163
üst
ee70864a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
49 deletions
+13
-49
FileAccess.py
wizards/com/sun/star/wizards/common/FileAccess.py
+8
-44
FaxWizardDialogImpl.py
wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py
+5
-5
No files found.
wizards/com/sun/star/wizards/common/FileAccess.py
Dosyayı görüntüle @
789c4825
...
...
@@ -17,6 +17,7 @@
#
import
traceback
import
types
from
collections
import
OrderedDict
from
os
import
path
as
osPath
from
.NoValidPathException
import
NoValidPathException
...
...
@@ -36,11 +37,6 @@ These Convenince methods include mainly Exception-handling.
'''
class
FileAccess
(
object
):
'''
@param xMSF
@param sPath
@param sAddPath
'''
@classmethod
def
addOfficePath
(
self
,
xMSF
,
sPath
,
sAddPath
):
...
...
@@ -312,62 +308,30 @@ class FileAccess(object):
@classmethod
def
getFolderTitles
(
self
,
xMSF
,
FilterName
,
FolderName
):
LocLayoutFiles
=
[[
2
],[]]
#Returns and ordered dict containing the template's name and path
LocLayoutFiles
=
{}
try
:
xDocInterface
=
xMSF
.
createInstance
(
"com.sun.star.document.DocumentProperties"
)
xInterface
=
xMSF
.
createInstance
(
"com.sun.star.ucb.SimpleFileAccess"
)
nameList
=
xInterface
.
getFolderContents
(
FolderName
,
False
)
TitleVector
=
[]
NameVector
=
[]
if
FilterName
is
None
or
FilterName
==
""
:
FilterName
=
None
else
:
FilterName
=
FilterName
+
"-"
fileName
=
""
NameVectorAppend
=
NameVector
.
append
TitleVectorAppend
=
TitleVector
.
append
FilterName
+=
"-"
for
i
in
nameList
:
fileName
=
self
.
getFilename
(
i
)
if
FilterName
is
None
or
fileName
.
startswith
(
FilterName
):
xDocInterface
.
loadFromMedium
(
i
,
tuple
())
NameVectorAppend
(
i
)
TitleVectorAppend
(
xDocInterface
.
Title
)
LocLayoutFiles
[
1
]
=
NameVector
LocLayoutFiles
[
0
]
=
TitleVector
LocLayoutFiles
[
xDocInterface
.
Title
]
=
i
except
Exception
,
exception
:
traceback
.
print_exc
()
return
self
.
__bubblesortList
(
LocLayoutFiles
)
'''
This function bubble sorts an array of with 2 dimensions.
The default sorting order is the first dimension
Only if sort2ndValue is True the second dimension is
the relevant for the sorting order
'''
@classmethod
def
__bubblesortList
(
self
,
SortList
):
SortCount
=
len
(
SortList
[
0
])
DimCount
=
len
(
SortList
)
for
i
in
xrange
(
SortCount
):
for
t
in
xrange
(
SortCount
-
i
-
1
):
if
SortList
[
0
][
t
]
>
SortList
[
0
][
t
+
1
]:
for
k
in
xrange
(
DimCount
):
DisplayDummy
=
SortList
[
k
][
t
];
SortList
[
k
][
t
]
=
SortList
[
k
][
t
+
1
];
SortList
[
k
][
t
+
1
]
=
DisplayDummy
return
SortList
'''
We search in all given path for a given file
@param _sPath
@param _sPath2
@return
'''
return
OrderedDict
(
sorted
(
LocLayoutFiles
.
items
(),
key
=
lambda
t
:
t
[
0
]))
@classmethod
def
addPath
(
self
,
_sPath
,
_sPath2
):
...
...
wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py
Dosyayı görüntüle @
789c4825
...
...
@@ -302,15 +302,15 @@ class FaxWizardDialogImpl(FaxWizardDialog):
self
.
sFaxPath
)
self
.
PrivateFiles
=
FileAccess
.
getFolderTitles
(
xMSF
,
"pri"
,
self
.
sFaxPath
)
self
.
setControlProperty
(
"lstBusinessStyle"
,
"StringItemList"
,
tuple
(
self
.
BusinessFiles
[
0
]
))
tuple
(
self
.
BusinessFiles
.
keys
()
))
self
.
setControlProperty
(
"lstPrivateStyle"
,
"StringItemList"
,
tuple
(
self
.
PrivateFiles
[
0
]
))
tuple
(
self
.
PrivateFiles
.
keys
()
))
self
.
setControlProperty
(
"lstBusinessStyle"
,
"SelectedItems"
,
(
0
,))
self
.
setControlProperty
(
"lstPrivateStyle"
,
"SelectedItems"
,
(
0
,))
return
True
except
NoValidPathException
,
e
:
# TODO Auto-generated catch block
traceback
.
print_exc
()
return
False
...
...
@@ -457,7 +457,7 @@ class FaxWizardDialogImpl(FaxWizardDialog):
if
FaxWizardDialogImpl
.
lstBusinessStylePos
is
not
selectedItemPos
:
FaxWizardDialogImpl
.
lstBusinessStylePos
=
selectedItemPos
TextDocument
.
xTextDocument
=
self
.
myFaxDoc
.
loadAsPreview
(
self
.
BusinessFiles
[
1
]
[
selectedItemPos
],
False
)
self
.
BusinessFiles
.
values
()
[
selectedItemPos
],
False
)
self
.
initializeElements
()
self
.
setElements
()
self
.
drawConstants
()
...
...
@@ -482,7 +482,7 @@ class FaxWizardDialogImpl(FaxWizardDialog):
if
FaxWizardDialogImpl
.
lstPrivateStylePos
is
not
selectedItemPos
:
FaxWizardDialogImpl
.
lstPrivateStylePos
=
selectedItemPos
TextDocument
.
xTextDocument
=
self
.
myFaxDoc
.
loadAsPreview
(
self
.
PrivateFiles
[
1
]
[
selectedItemPos
],
False
)
self
.
PrivateFiles
.
values
()
[
selectedItemPos
],
False
)
self
.
initializeElements
()
self
.
setElements
()
...
...
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