Hi,
I have submitted a patch for review:
https://gerrit.libreoffice.org/3013
To pull it, you can do:
git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/13/3013/1
Init: Pythonize the BackgroundsDialog class.
Change-Id: I50e153a07372aee447ce8a32186cc3fbf9fc9d9a
---
M wizards/com/sun/star/wizards/web/BackgroundsDialog.py
1 file changed, 28 insertions(+), 22 deletions(-)
diff --git a/wizards/com/sun/star/wizards/web/BackgroundsDialog.py
b/wizards/com/sun/star/wizards/web/BackgroundsDialog.py
index 640daee..936aa16 100644
--- a/wizards/com/sun/star/wizards/web/BackgroundsDialog.py
+++ b/wizards/com/sun/star/wizards/web/BackgroundsDialog.py
@@ -15,11 +15,17 @@
# except in compliance with the License. You may obtain a copy of
# the License at http://www.apache.org/licenses/LICENSE-2.0 .
#
-from ImageListDialog import *
-from ImageListDialog import *
-from WWHID import HID_BG
-from common.SystemDialog import SystemDialog
-from common.FileAccess import FileAccess
+import uno
+import traceback
+
+from .ImageListDialog import ImageListDialog
+from .WWHID import HID_BG
+from .WebWizardConst import *
+from ..common.SystemDialog import SystemDialog
+from ..common.FileAccess import FileAccess
+from ..common.Configuration import Configuration
+
+from com.sun.star.awt import Size
class BackgroundsDialog(ImageListDialog):
@@ -59,7 +65,7 @@
if filename is not None and filename.length > 0 and filename[0] is not None:
self.settings.cp_DefaultSession.cp_InDirectory = \
FileAccess.getParentDir(filename[0])
- i = add(filename[0])
+ i = self.add(filename[0])
il.setSelected(i)
il.display(i)
@@ -74,7 +80,7 @@
#first i check the item does not already exists in the list...
i = 0
while i < il.getListModel().getSize():
- if il.getListModel().getElementAt(i).equals(s):
+ if il.getListModel().getElementAt(i) == s:
return i
i += 1
@@ -82,13 +88,13 @@
try:
configView = Configuration.getConfigurationRoot(
self.xMSF, FileAccess.connectURLs(
- WebWizardConst.CONFIG_PATH, "BackgroundImages"), True)
+ CONFIG_PATH, "BackgroundImages"), True)
i = Configuration.getChildrenNames(configView).length + 1
o = Configuration.addConfigNode(configView, "" + i)
Configuration.set(s, "Href", o)
Configuration.commit(configView)
- except Exception, ex:
- ex.printStackTrace()
+ except Exception:
+ traceback.print_exc()
return il.getListModel().getSize() - 1
@@ -107,9 +113,9 @@
self.cut = cut_
def getImageUrls(self, listItem):
- if listItem is not None:
- sRetUrls = range(1)
- sRetUrls[0] = listItem
+ sRetUrls = []
+ if (listItem is not None):
+ sRetUrls.append(listItem)
return sRetUrls
return None
@@ -153,8 +159,8 @@
remove(model.getKey(image))
i += 1
- except Exception, ex:
- ex.printStackTrace()
+ except Exception:
+ traceback.print_exc()
'''
when instanciating the model, it checks if each image
@@ -170,8 +176,8 @@
self.xMSF, WebWizardConst.CONFIG_PATH + "/BackgroundImages",
True)
Configuration.removeNode(conf, imageName)
- except Exception, ex:
- ex.printStackTrace()
+ except Exception:
+ traceback.print_exc()
'''
if the given url is a directory
@@ -182,9 +188,9 @@
def addDir(self, url):
if self.fileAccess.isDirectory(url):
- add(self.fileAccess.listFiles(url, False))
+ self.add(self.fileAccess.listFiles(url, False))
else:
- add(url)
+ self.add(url)
'''
adds the given filenames (urls) to
@@ -194,8 +200,8 @@
def add(self, filenames):
i = 0
- while i < filenames.length:
- add(filenames[i])
+ while i < len(filenames):
+ self.add1(filenames[i])
i += 1
'''
@@ -205,7 +211,7 @@
@param filename image url.
'''
- def add(self, filename):
+ def add1(self, filename):
lcase = filename.toLowerCase()
if lcase.endsWith("jpg") or lcase.endsWith("jpeg") or \
lcase.endsWith("gif"):
--
To view, visit https://gerrit.libreoffice.org/3013
To unsubscribe, visit https://gerrit.libreoffice.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I50e153a07372aee447ce8a32186cc3fbf9fc9d9a
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Javier Fernandez <javier.fgb@gmail.com>
Context
- [PATCH] Init: Pythonize the BackgroundsDialog class. · Javier Fernandez (via Code Review)
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.