summaryrefslogtreecommitdiff
path: root/wizards/com/sun/star
diff options
context:
space:
mode:
authorXisco Fauli <anistenis@gmail.com>2011-06-10 01:58:54 +0200
committerBjoern Michaelsen <bjoern.michaelsen@canonical.com>2011-08-18 02:13:20 +0200
commit62d753576d5b7cc2326b7d7643cd26f037b94abd (patch)
tree358e291faa68aa6e53ef2d9f4ed91de99570251d /wizards/com/sun/star
parentf7f13da56c6285d012ae0d8aad697696c1d40a20 (diff)
some changes here and there.
- Add listboxes - Create the document preview in a diferent frame - Fix some any.uno errors - Add a listener to some buttons
Diffstat (limited to 'wizards/com/sun/star')
-rw-r--r--wizards/com/sun/star/wizards/common/FileAccess.py16
-rw-r--r--wizards/com/sun/star/wizards/common/Helper.py17
-rw-r--r--wizards/com/sun/star/wizards/common/SystemDialog.py50
-rw-r--r--wizards/com/sun/star/wizards/document/OfficeDocument.py42
-rw-r--r--wizards/com/sun/star/wizards/fax/FaxDocument.py2
-rw-r--r--wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py19
-rw-r--r--wizards/com/sun/star/wizards/text/TextDocument.py32
-rw-r--r--wizards/com/sun/star/wizards/ui/PathSelection.py26
-rw-r--r--wizards/com/sun/star/wizards/ui/UnoDialog.py17
-rw-r--r--wizards/com/sun/star/wizards/ui/UnoDialog2.py31
-rw-r--r--wizards/com/sun/star/wizards/ui/WizardDialog.py151
-rw-r--r--wizards/com/sun/star/wizards/ui/event/CommonListener.py185
-rw-r--r--wizards/com/sun/star/wizards/ui/event/DataAware.py3
-rw-r--r--wizards/com/sun/star/wizards/ui/event/DataAwareFields.py2
-rw-r--r--wizards/com/sun/star/wizards/ui/event/UnoDataAware.py2
15 files changed, 315 insertions, 280 deletions
diff --git a/wizards/com/sun/star/wizards/common/FileAccess.py b/wizards/com/sun/star/wizards/common/FileAccess.py
index c1394bc68d0a..bba7af6da8bd 100644
--- a/wizards/com/sun/star/wizards/common/FileAccess.py
+++ b/wizards/com/sun/star/wizards/common/FileAccess.py
@@ -361,7 +361,7 @@ class FileAccess(object):
xInterface = xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess")
nameList = xInterface.getFolderContents(FolderName, False)
TitleVector = []
- NameVector = [len(nameList)]
+ NameVector = []
if FilterName == None or FilterName == "":
FilterName = None
else:
@@ -376,6 +376,7 @@ class FileAccess(object):
LocLayoutFiles[1] = NameVector
LocLayoutFiles[0] = TitleVector
+
#COMMENTED
#JavaTools.bubblesortList(LocLayoutFiles)
except Exception, exception:
@@ -501,14 +502,13 @@ class FileAccess(object):
#get the file identifier converter
self.filenameConverter = xmsf.createInstance("com.sun.star.ucb.FileContentProvider")
- def getURL(self, parentPath, childPath):
- parent = self.filenameConverter.getSystemPathFromFileURL(parentPath)
- f = File.File_unknown(parent, childPath)
- r = self.filenameConverter.getFileURLFromSystemPath(parentPath, f.getAbsolutePath())
- return r
+ def getURL(self, path, childPath=None):
+ if childPath is not None:
+ path = self.filenameConverter.getSystemPathFromFileURL(path)
+ f = open(path,childPath)
+ else:
+ f = open(path)
- def getURL(self, path):
- f = File.File_unknown(path)
r = self.filenameConverter.getFileURLFromSystemPath(path, f.getAbsolutePath())
return r
diff --git a/wizards/com/sun/star/wizards/common/Helper.py b/wizards/com/sun/star/wizards/common/Helper.py
index 908aa78a1b2b..3514c4ead88c 100644
--- a/wizards/com/sun/star/wizards/common/Helper.py
+++ b/wizards/com/sun/star/wizards/common/Helper.py
@@ -4,9 +4,6 @@ import traceback
from com.sun.star.uno import Exception as UnoException
from com.sun.star.uno import RuntimeException
-#TEMPORAL
-import inspect
-
class Helper(object):
DAY_IN_MILLIS = (24 * 60 * 60 * 1000)
@@ -23,14 +20,13 @@ class Helper(object):
def setUnoPropertyValue(self, xPSet, PropertyName, PropertyValue):
try:
if xPSet.getPropertySetInfo().hasPropertyByName(PropertyName):
- #xPSet.setPropertyValue(PropertyName, PropertyValue)
uno.invoke(xPSet,"setPropertyValue", (PropertyName,PropertyValue))
else:
selementnames = xPSet.getPropertySetInfo().getProperties()
raise ValueError("No Such Property: '" + PropertyName + "'");
except UnoException, exception:
- print type(PropertyValue)
+ print PropertyName
traceback.print_exc()
@classmethod
@@ -126,9 +122,6 @@ class Helper(object):
i += 1
except Exception, e:
- curframe = inspect.currentframe()
- calframe = inspect.getouterframes(curframe, 2)
- #print "caller name:", calframe[1][3]
traceback.print_exc()
'''
@@ -166,13 +159,7 @@ class Helper(object):
class DateUtils(object):
- @classmethod
- def DateUtils_XMultiServiceFactory_Object(self, xmsf, document):
- tmp = DateUtils()
- tmp.DateUtils_body_XMultiServiceFactory_Object(xmsf, document)
- return tmp
-
- def DateUtils_body_XMultiServiceFactory_Object(self, xmsf, docMSF):
+ def __init__(self, xmsf, docMSF):
defaults = docMSF.createInstance("com.sun.star.text.Defaults")
l = Helper.getUnoStructValue(defaults, "CharLocale")
jl = locale.setlocale(l.Language, l.Country, l.Variant)
diff --git a/wizards/com/sun/star/wizards/common/SystemDialog.py b/wizards/com/sun/star/wizards/common/SystemDialog.py
index b88aadfafaa6..c81e9ddaa344 100644
--- a/wizards/com/sun/star/wizards/common/SystemDialog.py
+++ b/wizards/com/sun/star/wizards/common/SystemDialog.py
@@ -3,6 +3,7 @@ import traceback
from Configuration import Configuration
from Resource import Resource
from Desktop import Desktop
+from Helper import Helper
from com.sun.star.ui.dialogs.TemplateDescription import FILESAVE_AUTOEXTENSION, FILEOPEN_SIMPLE
from com.sun.star.ui.dialogs.ExtendedFilePickerElementIds import CHECKBOX_AUTOEXTENSION
@@ -26,22 +27,26 @@ class SystemDialog(object):
self.xMSF = xMSF
self.systemDialog = xMSF.createInstance(ServiceName)
self.xStringSubstitution = self.createStringSubstitution(xMSF)
- listAny = [uno.Any("short",Type)]
if self.systemDialog != None:
- self.systemDialog.initialize(listAny)
+ prova = uno.Any("[]short",(Type,))
+ #uno.invoke(prova, "initialize", (uno.Any("short",(Type,)),))
except UnoException, exception:
traceback.print_exc()
+ @classmethod
def createStoreDialog(self, xmsf):
return SystemDialog(xmsf, "com.sun.star.ui.dialogs.FilePicker", FILESAVE_AUTOEXTENSION)
+ @classmethod
def createOpenDialog(self, xmsf):
return SystemDialog(xmsf, "com.sun.star.ui.dialogs.FilePicker", FILEOPEN_SIMPLE)
+ @classmethod
def createFolderDialog(self, xmsf):
return SystemDialog(xmsf, "com.sun.star.ui.dialogs.FolderPicker", 0)
+ @classmethod
def createOfficeFolderDialog(self, xmsf):
return SystemDialog(xmsf, "com.sun.star.ui.dialogs.OfficeFolderPicker", 0)
@@ -54,34 +59,22 @@ class SystemDialog(object):
return path
'''
- ATTENTION a BUG : TFILESAVE_AUTOEXTENSIONhe extension calculated
- here gives the last 3 chars of the filename - what
- if the extension is of 4 or more chars?
- @param DisplayDirectory
- @param DefaultName
- @param sDocuType
- @return
- '''
-
- def callStoreDialog(self, DisplayDirectory, DefaultName, sDocuType):
- sExtension = DefaultName.substring(DefaultName.length() - 3, DefaultName.length())
- addFilterToDialog(sExtension, sDocuType, True)
- return callStoreDialog(DisplayDirectory, DefaultName)
-
- '''
@param displayDir
@param defaultName
given url to a local path.
@return
'''
- def callStoreDialog(self, displayDir, defaultName):
+ def callStoreDialog(self, displayDir, defaultName, sDocuType=None):
+ if sDocuType is not None:
+ self.addFilterToDialog(defaultName[-3:], sDocuType, True)
+
self.sStorePath = None
try:
self.systemDialog.setValue(CHECKBOX_AUTOEXTENSION, 0, True)
self.systemDialog.setDefaultName(defaultName)
- self.systemDialog.setDisplayDirectory(subst(displayDir))
- if execute(self.systemDialog):
+ self.systemDialog.setDisplayDirectory(self.subst(displayDir))
+ if self.execute(self.systemDialog):
sPathList = self.systemDialog.getFiles()
self.sStorePath = sPathList[0]
@@ -99,7 +92,7 @@ class SystemDialog(object):
self.systemDialog.setTitle(title)
self.systemDialog.setDescription(description)
- if execute(self.systemDialog):
+ if self.execute(self.systemDialog):
return self.systemDialog.getDirectory()
else:
return None
@@ -111,7 +104,7 @@ class SystemDialog(object):
try:
self.systemDialog.setMultiSelectionMode(multiSelect)
self.systemDialog.setDisplayDirectory(subst(displayDirectory))
- if execute(self.systemDialog):
+ if self.execute(self.systemDialog):
return self.systemDialog.getFiles()
except UnoException, exception:
@@ -122,10 +115,10 @@ class SystemDialog(object):
def addFilterToDialog(self, sExtension, filterName, setToDefault):
try:
#get the localized filtername
- uiName = getFilterUIName(filterName)
+ uiName = self.getFilterUIName(filterName)
pattern = "*." + sExtension
#add the filter
- addFilter(uiName, pattern, setToDefault)
+ self.addFilter(uiName, pattern, setToDefault)
except Exception, exception:
traceback.print_exc()
@@ -147,8 +140,8 @@ class SystemDialog(object):
def getFilterUIName(self, filterName):
prodName = Configuration.getProductName(self.xMSF)
- s = [[getFilterUIName_(filterName)]]
- s[0][0] = JavaTools.replaceSubString(s[0][0], prodName, "%productname%")
+ s = [[self.getFilterUIName_(filterName)]]
+ s[0][0] = s[0][0].replace("%productname%", prodName)
return s[0][0]
'''
@@ -162,11 +155,10 @@ class SystemDialog(object):
oFactory = self.xMSF.createInstance("com.sun.star.document.FilterFactory")
oObject = Helper.getUnoObjectbyName(oFactory, filterName)
xPropertyValue = list(oObject)
- MaxCount = xPropertyValue.length
i = 0
- while i < MaxCount:
+ while i < len(xPropertyValue):
aValue = xPropertyValue[i]
- if aValue != None and aValue.Name.equals("UIName"):
+ if aValue != None and aValue.Name == "UIName":
return str(aValue.Value)
i += 1
diff --git a/wizards/com/sun/star/wizards/document/OfficeDocument.py b/wizards/com/sun/star/wizards/document/OfficeDocument.py
index a0d76edb307c..48854e4fb400 100644
--- a/wizards/com/sun/star/wizards/document/OfficeDocument.py
+++ b/wizards/com/sun/star/wizards/document/OfficeDocument.py
@@ -1,6 +1,19 @@
from com.sun.star.awt.WindowClass import TOP
import traceback
import uno
+from common.Desktop import Desktop
+from com.sun.star.awt import WindowDescriptor
+from com.sun.star.awt import Rectangle
+
+#Window Constants
+com_sun_star_awt_WindowAttribute_BORDER \
+ = uno.getConstantByName( "com.sun.star.awt.WindowAttribute.BORDER" )
+com_sun_star_awt_WindowAttribute_SIZEABLE \
+ = uno.getConstantByName( "com.sun.star.awt.WindowAttribute.SIZEABLE" )
+com_sun_star_awt_WindowAttribute_MOVEABLE \
+ = uno.getConstantByName( "com.sun.star.awt.WindowAttribute.MOVEABLE" )
+com_sun_star_awt_VclWindowPeerAttribute_CLIPCHILDREN \
+ = uno.getConstantByName( "com.sun.star.awt.VclWindowPeerAttribute.CLIPCHILDREN" )
class OfficeDocument(object):
'''Creates a new instance of OfficeDocument '''
@@ -70,13 +83,11 @@ class OfficeDocument(object):
return xComponent
- def createNewFrame(self, xMSF, listener):
- return createNewFrame(xMSF, listener, "_blank")
-
- def createNewFrame(self, xMSF, listener, FrameName):
+ @classmethod
+ def createNewFrame(self, xMSF, listener, FrameName="_blank"):
xFrame = None
- if FrameName.equalsIgnoreCase("WIZARD_LIVE_PREVIEW"):
- xFrame = createNewPreviewFrame(xMSF, listener)
+ if FrameName.lower() == "WIZARD_LIVE_PREVIEW".lower():
+ xFrame = self.createNewPreviewFrame(xMSF, listener)
else:
xF = Desktop.getDesktop(xMSF)
xFrame = xF.findFrame(FrameName, 0)
@@ -87,6 +98,7 @@ class OfficeDocument(object):
return xFrame
+ @classmethod
def createNewPreviewFrame(self, xMSF, listener):
xToolkit = None
try:
@@ -96,13 +108,21 @@ class OfficeDocument(object):
traceback.print_exc()
#describe the window and its properties
- aDescriptor = WindowDescriptor.WindowDescriptor()
+ aDescriptor = WindowDescriptor()
aDescriptor.Type = TOP
aDescriptor.WindowServiceName = "window"
aDescriptor.ParentIndex = -1
aDescriptor.Parent = None
- aDescriptor.Bounds = Rectangle.Rectangle_unknown(10, 10, 640, 480)
- aDescriptor.WindowAttributes = WindowAttribute.BORDER | WindowAttribute.MOVEABLE | WindowAttribute.SIZEABLE | VclWindowPeerAttribute.CLIPCHILDREN
+ aDescriptor.Bounds = Rectangle(10, 10, 640, 480)
+
+ #Set Window Attributes
+ gnDefaultWindowAttributes = \
+ com_sun_star_awt_WindowAttribute_BORDER + \
+ com_sun_star_awt_WindowAttribute_MOVEABLE + \
+ com_sun_star_awt_WindowAttribute_SIZEABLE + \
+ com_sun_star_awt_VclWindowPeerAttribute_CLIPCHILDREN
+
+ aDescriptor.WindowAttributes = gnDefaultWindowAttributes
#create a new blank container window
xPeer = None
try:
@@ -127,7 +147,9 @@ class OfficeDocument(object):
#and not part of the desktop tree.
#You are alone with him .-)
if listener != None:
- Desktop.getDesktop(xMSF).addTerminateListener(listener)
+ pass
+ #COMMENTED
+ #Desktop.getDesktop(xMSF).addTerminateListener(listener)
return xFrame
diff --git a/wizards/com/sun/star/wizards/fax/FaxDocument.py b/wizards/com/sun/star/wizards/fax/FaxDocument.py
index 25db248c8b01..691c5effd506 100644
--- a/wizards/com/sun/star/wizards/fax/FaxDocument.py
+++ b/wizards/com/sun/star/wizards/fax/FaxDocument.py
@@ -14,7 +14,7 @@ from com.sun.star.style.NumberingType import ARABIC
class FaxDocument(TextDocument):
def __init__(self, xMSF, listener):
- super(FaxDocument,self).__init__(xMSF, listener, "WIZARD_LIVE_PREVIEW")
+ super(FaxDocument,self).__init__(xMSF, listener, None, "WIZARD_LIVE_PREVIEW")
self.keepLogoFrame = True
self.keepTypeFrame = True
diff --git a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py
index 660018488fe8..dfc21909e8a6 100644
--- a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py
+++ b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py
@@ -49,9 +49,6 @@ class FaxWizardDialogImpl(FaxWizardDialog):
ConnectStr = "uno:socket,host=localhost,port=2002;urp;StarOffice.ComponentContext"
xLocMSF = Desktop.connect(ConnectStr)
lw = FaxWizardDialogImpl(xLocMSF)
- print
- print "lw.startWizard"
- print
lw.startWizard(xLocMSF, None)
except RuntimeException, e:
# TODO Auto-generated catch block
@@ -128,18 +125,19 @@ class FaxWizardDialogImpl(FaxWizardDialog):
return
def cancelWizard(self):
- xDialog.endExecute()
+ self.xUnoDialog.endExecute()
self.running = False
def finishWizard(self):
- switchToStep(getCurrentStep(), getMaxStep())
+ self.switchToStep(self.getCurrentStep(), self.getMaxStep())
self.myFaxDoc.setWizardTemplateDocInfo(self.resources.resFaxWizardDialog_title, self.resources.resTemplateDescription)
try:
- fileAccess = FileAccess(xMSF)
+ fileAccess = FileAccess(self.xMSF)
self.sPath = self.myPathSelection.getSelectedPath()
- if self.sPath.equals(""):
+ if self.sPath == "":
self.myPathSelection.triggerPathPicker()
self.sPath = self.myPathSelection.getSelectedPath()
+ print self.sPath
self.sPath = fileAccess.getURL(self.sPath)
#first, if the filename was not changed, thus
@@ -189,7 +187,7 @@ class FaxWizardDialogImpl(FaxWizardDialog):
except UnoException, e:
traceback.print_exc()
finally:
- xDialog.endExecute()
+ self.xUnoDialog.endExecute()
self.running = False
return True
@@ -246,9 +244,8 @@ class FaxWizardDialogImpl(FaxWizardDialog):
self.sWorkPath = FileAccess.getOfficePath2(xMSF, "Work", "", "")
self.BusinessFiles = FileAccess.getFolderTitles(xMSF, "bus", self.sFaxPath)
self.PrivateFiles = FileAccess.getFolderTitles(xMSF, "pri", self.sFaxPath)
-
- self.setControlProperty("lstBusinessStyle", "StringItemList", self.BusinessFiles[0])
- self.setControlProperty("lstPrivateStyle", "StringItemList", self.PrivateFiles[0])
+ self.setControlProperty("lstBusinessStyle", "StringItemList", tuple(self.BusinessFiles[0]))
+ self.setControlProperty("lstPrivateStyle", "StringItemList", tuple(self.PrivateFiles[0]))
self.setControlProperty("lstBusinessStyle", "SelectedItems", [0])
self.setControlProperty("lstPrivateStyle", "SelectedItems" , [0])
return True
diff --git a/wizards/com/sun/star/wizards/text/TextDocument.py b/wizards/com/sun/star/wizards/text/TextDocument.py
index 1da169d49ea9..93351c6c02f3 100644
--- a/wizards/com/sun/star/wizards/text/TextDocument.py
+++ b/wizards/com/sun/star/wizards/text/TextDocument.py
@@ -7,6 +7,11 @@ from document.OfficeDocument import OfficeDocument
import traceback
from text.ViewHandler import ViewHandler
from text.TextFieldHandler import TextFieldHandler
+from com.sun.star.container import NoSuchElementException
+from com.sun.star.lang import WrappedTargetException
+from common.Configuration import Configuration
+import time
+from com.sun.star.util import DateTime
class TextDocument(object):
@@ -17,19 +22,19 @@ class TextDocument(object):
self.xMSF = xMSF
self.xTextDocument = None
- if listener:
- if FrameName:
+ if listener is not None:
+ if FrameName is not None:
'''creates an instance of TextDocument and creates a named frame.
No document is actually loaded into this frame.'''
self.xFrame = OfficeDocument.createNewFrame(xMSF, listener, FrameName);
return
- elif _sPreviewURL:
+ elif _sPreviewURL is not None:
'''creates an instance of TextDocument by loading a given URL as preview'''
self.xFrame = OfficeDocument.createNewFrame(xMSF, listener)
self.xTextDocument = self.loadAsPreview(_sPreviewURL, True)
- elif xArgs:
+ elif xArgs is not None:
'''creates an instance of TextDocument and creates a frame and loads a document'''
self.xDesktop = Desktop.getDesktop(xMSF);
self.xFrame = OfficeDocument.createNewFrame(xMSF, listener);
@@ -45,7 +50,7 @@ class TextDocument(object):
self.xFrame = self.xDesktop.getActiveFrame()
self.xTextDocument = self.xFrame.getController().getModel()
- elif _moduleIdentifier:
+ elif _moduleIdentifier is not None:
try:
'''create the empty document, and set its module identifier'''
self.xTextDocument = xMSF.createInstance("com.sun.star.text.TextDocument")
@@ -64,7 +69,7 @@ class TextDocument(object):
except Exception, e:
traceback.print_exc()
- elif _textDocument:
+ elif _textDocument is not None:
'''creates an instance of TextDocument from a given XTextDocument'''
self.xFrame = _textDocument.getCurrentController().getFrame()
self.xTextDocument = _textDocument
@@ -180,15 +185,12 @@ class TextDocument(object):
gn = xNA.getByName("givenname")
sn = xNA.getByName("sn")
fullname = str(gn) + " " + str(sn)
- cal = GregorianCalendar.GregorianCalendar()
- year = cal.get(Calendar.YEAR)
- month = cal.get(Calendar.MONTH)
- day = cal.get(Calendar.DAY_OF_MONTH)
- currentDate = DateTime.DateTime()
- currentDate.Day = day
- currentDate.Month = month
- currentDate.Year = year
- du = DateUtils(self.xMSF, self.xTextDocument)
+ currentDate = DateTime()
+ now = time.localtime(time.time())
+ currentDate.Day = time.strftime("%d", now)
+ currentDate.Year = time.strftime("%Y", now)
+ currentDate.Month = time.strftime("%m", now)
+ du = Helper.DateUtils(self.xMSF, self.xTextDocument)
ff = du.getFormat(NumberFormatIndex.DATE_SYS_DDMMYY)
myDate = du.format(ff, currentDate)
xDocProps2 = self.xTextDocument.getDocumentProperties()
diff --git a/wizards/com/sun/star/wizards/ui/PathSelection.py b/wizards/com/sun/star/wizards/ui/PathSelection.py
index a1bdc9511e51..6c897d20e738 100644
--- a/wizards/com/sun/star/wizards/ui/PathSelection.py
+++ b/wizards/com/sun/star/wizards/ui/PathSelection.py
@@ -3,6 +3,7 @@ import uno
from common.PropertyNames import *
from common.FileAccess import *
from com.sun.star.uno import Exception as UnoException
+from common.SystemDialog import SystemDialog
class PathSelection(object):
@@ -27,11 +28,11 @@ class PathSelection(object):
self.TXTSAVEPATH = 1
def insert(self, DialogStep, XPos, YPos, Width, CurTabIndex, LabelText, Enabled, TxtHelpURL, BtnHelpURL):
- self.CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblSaveAs", [PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH], [Enabled, 8, LabelText, XPos, YPos, DialogStep, uno.Any("short",CurTabIndex), Width])
- self.xSaveTextBox = self.CurUnoDialog.insertTextField("txtSavePath", "callXPathSelectionListener", [PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH], [Enabled, 12, TxtHelpURL, XPos, YPos + 10, DialogStep, uno.Any("short",(CurTabIndex + 1)), Width - 26], self)
+ self.CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblSaveAs", (PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH), (Enabled, 8, LabelText, XPos, YPos, DialogStep, uno.Any("short",CurTabIndex), Width))
+ self.xSaveTextBox = self.CurUnoDialog.insertTextField("txtSavePath", "callXPathSelectionListener", (PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH), (Enabled, 12, TxtHelpURL, XPos, YPos + 10, DialogStep, uno.Any("short",(CurTabIndex + 1)), Width - 26), self)
self.CurUnoDialog.setControlProperty("txtSavePath", PropertyNames.PROPERTY_ENABLED, False )
- self.CurUnoDialog.insertButton("cmdSelectPath", "triggerPathPicker", [PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH], [Enabled, 14, BtnHelpURL, "...",XPos + Width - 16, YPos + 9, DialogStep, uno.Any("short",(CurTabIndex + 2)), 16], self)
+ self.CurUnoDialog.insertButton("cmdSelectPath", "triggerPathPicker", (PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH), (Enabled, 14, BtnHelpURL, "...",XPos + Width - 16, YPos + 9, DialogStep, uno.Any("short",(CurTabIndex + 2)), 16), self)
def addSelectionListener(self, xAction):
self.xAction = xAction
@@ -48,20 +49,21 @@ class PathSelection(object):
def triggerPathPicker(self):
try:
- if iTransferMode == TransferMode.SAVE:
- if iDialogType == DialogTypes.FOLDER:
+ if self.iTransferMode == self.TransferMode.SAVE:
+ if self.iDialogType == self.DialogTypes.FOLDER:
#TODO: write code for picking a folder for saving
return
- elif iDialogType == DialogTypes.FILE:
- usedPathPicker = True
- myFilePickerDialog = SystemDialog.createStoreDialog(xMSF)
- myFilePickerDialog.callStoreDialog(sDefaultDirectory, sDefaultName, sDefaultFilter);
+ elif self.iDialogType == self.DialogTypes.FILE:
+ self.usedPathPicker = True
+ myFilePickerDialog = SystemDialog.createStoreDialog(self.xMSF)
+ myFilePickerDialog.callStoreDialog(self.sDefaultDirectory, self.sDefaultName, self.sDefaultFilter);
sStorePath = myFilePickerDialog.sStorePath;
- if sStorePath:
+ if sStorePath is not None:
+ print "hello"
myFA = FileAccess(xMSF);
xSaveTextBox.setText(myFA.getPath(sStorePath, None));
- sDefaultDirectory = FileAccess.getParentDir(sStorePath);
- sDefaultName = myFA.getFilename(sStorePath);
+ self.sDefaultDirectory = FileAccess.getParentDir(sStorePath);
+ self.sDefaultName = myFA.getFilename(sStorePath);
return
elif iTransferMode == TransferMode.LOAD:
if iDialogType == DialogTypes.FOLDER:
diff --git a/wizards/com/sun/star/wizards/ui/UnoDialog.py b/wizards/com/sun/star/wizards/ui/UnoDialog.py
index 87a1a5d24c71..cfc1c043786b 100644
--- a/wizards/com/sun/star/wizards/ui/UnoDialog.py
+++ b/wizards/com/sun/star/wizards/ui/UnoDialog.py
@@ -4,7 +4,6 @@ from common.PropertyNames import PropertyNames
from com.sun.star.awt import Rectangle
from common.Helper import Helper
from PeerConfig import PeerConfig
-from common.Listener import *
from com.sun.star.awt import Rectangle
from com.sun.star.awt.PosSize import POS
@@ -52,14 +51,14 @@ class UnoDialog(object):
if isinstance(PropertyValue,bool):
xPSet.setPropertyValue(PropertyName, PropertyValue)
else:
- if isinstance(PropertyValue,list):
- methodname = "[]short"
- PropertyValue = tuple(PropertyValue)
- elif isinstance(PropertyValue,tuple):
- methodname = "[]string"
- else:
- PropertyValue = (PropertyValue,)
- methodname = "[]string"
+ methodname = "[]string"
+ if not isinstance(PropertyValue,tuple):
+ if isinstance(PropertyValue,list):
+ methodname = "[]short"
+ PropertyValue = tuple(PropertyValue)
+ else:
+ PropertyValue = (PropertyValue,)
+
uno.invoke(xPSet, "setPropertyValue", (PropertyName, uno.Any( \
methodname, PropertyValue)))
diff --git a/wizards/com/sun/star/wizards/ui/UnoDialog2.py b/wizards/com/sun/star/wizards/ui/UnoDialog2.py
index 6088a697c91f..d7aafad6bf11 100644
--- a/wizards/com/sun/star/wizards/ui/UnoDialog2.py
+++ b/wizards/com/sun/star/wizards/ui/UnoDialog2.py
@@ -21,13 +21,11 @@ class UnoDialog2(UnoDialog):
def __init__(self, xmsf):
super(UnoDialog2,self).__init__(xmsf,(), ())
- self.guiEventListener = CommonListener()
def insertButton(self, sName, actionPerformed, sPropNames, oPropValues, eventTarget=None):
xButton = self.insertControlModel2("com.sun.star.awt.UnoControlButtonModel", sName, sPropNames, oPropValues)
- if actionPerformed != None:
- xButton.addActionListener(ActionListenerProcAdapter(self.guiEventListener))
- self.guiEventListener.add(sName, EVENT_ACTION_PERFORMED, actionPerformed, eventTarget)
+ if actionPerformed is not None:
+ xButton.addActionListener(ActionListenerProcAdapter(actionPerformed))
return xButton
@@ -43,8 +41,7 @@ class UnoDialog2(UnoDialog):
if itemChanged != None:
if eventTarget is None:
eventTarget = self
- xCheckBox.addItemListener(ItemListenerProcAdapter(self.guiEventListener))
- self.guiEventListener.add(sName, EVENT_ITEM_CHANGED, itemChanged, eventTarget)
+ xCheckBox.addItemListener(ItemListenerProcAdapter(None))
return xCheckBox
@@ -53,16 +50,13 @@ class UnoDialog2(UnoDialog):
if eventTarget is None:
eventTarget = self
if actionPerformed != None:
- xComboBox.addActionListener(self.guiEventListener)
- self.guiEventListener.add(sName, EVENT_ACTION_PERFORMED, actionPerformed, eventTarget)
+ xComboBox.addActionListener(None)
if itemChanged != None:
- xComboBox.addItemListener(ItemListenerProcAdapter(self.guiEventListener))
- self.guiEventListener.add(sName, EVENT_ITEM_CHANGED, itemChanged, eventTarget)
+ xComboBox.addItemListener(ItemListenerProcAdapter(None))
if textChanged != None:
- xComboBox.addTextListener(TextListenerProcAdapter(self.guiEventListener))
- self.guiEventListener.add(sName, EVENT_TEXT_CHANGED, textChanged, eventTarget)
+ xComboBox.addTextListener(TextListenerProcAdapter(None))
return xComboBox
@@ -74,12 +68,10 @@ class UnoDialog2(UnoDialog):
eventTarget = self
if actionPerformed != None:
- xListBox.addActionListener(self.guiEventListener)
- self.guiEventListener.add(sName, EVENT_ACTION_PERFORMED, actionPerformed, eventTarget)
+ xListBox.addActionListener(None)
if itemChanged != None:
- xListBox.addItemListener(ItemListenerProcAdapter(self.guiEventListener))
- self.guiEventListener.add(sName, EVENT_ITEM_CHANGED, itemChanged, eventTarget)
+ xListBox.addItemListener(ItemListenerProcAdapter(None))
return xListBox
@@ -89,8 +81,8 @@ class UnoDialog2(UnoDialog):
if itemChanged != None:
if eventTarget is None:
eventTarget = self
- xRadioButton.addItemListener(ItemListenerProcAdapter(self.guiEventListener))
- self.guiEventListener.add(sName, EVENT_ITEM_CHANGED, itemChanged, eventTarget)
+ xRadioButton.addItemListener(ItemListenerProcAdapter(None))
+
return xRadioButton
@@ -120,8 +112,7 @@ class UnoDialog2(UnoDialog):
if sTextChanged != None:
if eventTarget is None:
eventTarget = self
- xField.addTextListener(TextListenerProcAdapter(self.guiEventListener))
- self.guiEventListener.add(sName, EVENT_TEXT_CHANGED, sTextChanged, eventTarget)
+ xField.addTextListener(TextListenerProcAdapter(None))
return xField
diff --git a/wizards/com/sun/star/wizards/ui/WizardDialog.py b/wizards/com/sun/star/wizards/ui/WizardDialog.py
index 6dbdf53cea5e..e22f2d662d75 100644
--- a/wizards/com/sun/star/wizards/ui/WizardDialog.py
+++ b/wizards/com/sun/star/wizards/ui/WizardDialog.py
@@ -13,11 +13,7 @@ from event.EventNames import EVENT_ITEM_CHANGED
class WizardDialog(UnoDialog2):
__metaclass__ = ABCMeta
- __NEXT_ACTION_PERFORMED = "gotoNextAvailableStep"
- __BACK_ACTION_PERFORMED = "gotoPreviousAvailableStep"
- __FINISH_ACTION_PERFORMED = "finishWizard_1"
- __CANCEL_ACTION_PERFORMED = "cancelWizard_1"
- __HELP_ACTION_PERFORMED = "callHelp"
+
'''
Creates a new instance of WizardDialog
the hid is used as following :
@@ -41,6 +37,7 @@ class WizardDialog(UnoDialog2):
self.__bTerminateListenermustberemoved = True
self.__oWizardResource = Resource(xMSF, "dbw")
self.sMsgEndAutopilot = self.__oWizardResource.getResText(UIConsts.RID_DB_COMMON + 33)
+ self.oRoadmap = None
#self.vetos = VetoableChangeSupport.VetoableChangeSupport_unknown(this)
def getResource(self):
@@ -121,13 +118,12 @@ class WizardDialog(UnoDialog2):
# the roadmap control has got no real TabIndex ever
# that is not correct, but changing this would need time, so it is used
# without TabIndex as before
- self.oRoadmap = self.insertControlModel("com.sun.star.awt.UnoControlRoadmapModel", "rdmNavi", (PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, "Tabstop", PropertyNames.PROPERTY_WIDTH),((iDialogHeight - 26), 0, 0, 0, 0, True, uno.Any("short",85)))
+ self.oRoadmap = self.insertControlModel("com.sun.star.awt.UnoControlRoadmapModel", "rdmNavi", (PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, "Tabstop", PropertyNames.PROPERTY_WIDTH),((iDialogHeight - 26), 0, 0, 0, uno.Any("short",0), True, uno.Any("short",85)))
self.oRoadmap.setPropertyValue(PropertyNames.PROPERTY_NAME, "rdmNavi")
mi = MethodInvocation("itemStateChanged", self)
- self.guiEventListener.add("rdmNavi", EVENT_ITEM_CHANGED, mi)
self.xRoadmapControl = self.xUnoDialog.getControl("rdmNavi")
- self.xRoadmapControl.addItemListener(ItemListenerProcAdapter(self.guiEventListener))
+ self.xRoadmapControl.addItemListener(ItemListenerProcAdapter(None))
Helper.setUnoPropertyValue(self.oRoadmap, "Text", self.__oWizardResource.getResText(UIConsts.RID_COMMON + 16))
except NoSuchMethodException, ex:
@@ -176,21 +172,21 @@ class WizardDialog(UnoDialog2):
return None
def switchToStep(self,_nOldStep=None, _nNewStep=None):
- if _nOldStep and _nNewStep:
+ if _nOldStep is not None and _nNewStep is not None:
self.__nOldStep = _nOldStep
self.__nNewStep = _nNewStep
- leaveStep(self.__nOldStep, self.__nNewStep)
+ self.leaveStep(self.__nOldStep, self.__nNewStep)
if self.__nNewStep != self.__nOldStep:
if self.__nNewStep == self.__nMaxStep:
- setControlProperty("btnWizardNext", "DefaultButton", False)
- setControlProperty("btnWizardFinish", "DefaultButton", True)
+ self.setControlProperty("btnWizardNext", "DefaultButton", False)
+ self.setControlProperty("btnWizardFinish", "DefaultButton", True)
else:
- setControlProperty("btnWizardNext", "DefaultButton", True)
- setControlProperty("btnWizardFinish", "DefaultButton", False)
+ self.setControlProperty("btnWizardNext", "DefaultButton", True)
+ self.setControlProperty("btnWizardFinish", "DefaultButton", False)
- changeToStep(self.__nNewStep)
- enterStep(self.__nOldStep, self.__nNewStep)
+ self.changeToStep(self.__nNewStep)
+ self.enterStep(self.__nOldStep, self.__nNewStep)
return True
return False
@@ -205,15 +201,13 @@ class WizardDialog(UnoDialog2):
def changeToStep(self, nNewStep):
Helper.setUnoPropertyValue(self.xDialogModel, PropertyNames.PROPERTY_STEP, nNewStep)
- setCurrentRoadmapItemID((short)(nNewStep))
- enableNextButton(getNextAvailableStep() > 0)
- enableBackButton(nNewStep != 1)
-
+ self.setCurrentRoadmapItemID(nNewStep)
+ self.enableNextButton(self.getNextAvailableStep() > 0)
+ self.enableBackButton(nNewStep != 1)
def iscompleted(self, _ndialogpage):
return False
-
def ismodified(self, _ndialogpage):
return False
@@ -235,19 +229,18 @@ class WizardDialog(UnoDialog2):
self.insertControlModel("com.sun.star.awt.UnoControlFixedLineModel", "lnRoadSep",(PropertyNames.PROPERTY_HEIGHT, "Orientation", PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_WIDTH),(iBtnPosY - 6, 1, 85, 0, iCurStep, 1))
propNames = (PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "PushButtonType", PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH)
Helper.setUnoPropertyValue(self.xDialogModel, PropertyNames.PROPERTY_HELPURL, HelpIds.getHelpIdString(self.__hid))
- self.insertButton("btnWizardHelp", WizardDialog.__HELP_ACTION_PERFORMED,(PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "PushButtonType", PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH),(True, iButtonHeight, self.__oWizardResource.getResText(UIConsts.RID_COMMON + 15), iHelpPosX, iBtnPosY, uno.Any("short",HELP), iCurStep, uno.Any("short",(curtabindex + 1)), iButtonWidth))
- self.insertButton("btnWizardBack", WizardDialog.__BACK_ACTION_PERFORMED, propNames,(False, iButtonHeight, HelpIds.getHelpIdString(self.__hid + 2), self.__oWizardResource.getResText(UIConsts.RID_COMMON + 13), iBackPosX, iBtnPosY, uno.Any("short",STANDARD), iCurStep, uno.Any("short",(curtabindex + 1)), iButtonWidth))
- self.insertButton("btnWizardNext", WizardDialog.__NEXT_ACTION_PERFORMED, propNames,(True, iButtonHeight, HelpIds.getHelpIdString(self.__hid + 3), self.__oWizardResource.getResText(UIConsts.RID_COMMON + 14), iNextPosX, iBtnPosY, uno.Any("short",STANDARD), iCurStep, uno.Any("short",(curtabindex + 1)), iButtonWidth))
- self.insertButton("btnWizardFinish", WizardDialog.__FINISH_ACTION_PERFORMED, propNames,(True, iButtonHeight, HelpIds.getHelpIdString(self.__hid + 4), self.__oWizardResource.getResText(UIConsts.RID_COMMON + 12), iFinishPosX, iBtnPosY, uno.Any("short",STANDARD), iCurStep, uno.Any("short",(curtabindex + 1)), iButtonWidth))
- self.insertButton("btnWizardCancel", WizardDialog.__CANCEL_ACTION_PERFORMED, propNames,(True, iButtonHeight, HelpIds.getHelpIdString(self.__hid + 5), self.__oWizardResource.getResText(UIConsts.RID_COMMON + 11), iCancelPosX, iBtnPosY, uno.Any("short",STANDARD), iCurStep, uno.Any("short",(curtabindex + 1)), iButtonWidth))
+ self.insertButton("btnWizardHelp", "",(PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "PushButtonType", PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH),(True, iButtonHeight, self.__oWizardResource.getResText(UIConsts.RID_COMMON + 15), iHelpPosX, iBtnPosY, uno.Any("short",HELP), iCurStep, uno.Any("short",(curtabindex + 1)), iButtonWidth))
+ self.insertButton("btnWizardBack", self.gotoPreviousAvailableStep, propNames,(False, iButtonHeight, HelpIds.getHelpIdString(self.__hid + 2), self.__oWizardResource.getResText(UIConsts.RID_COMMON + 13), iBackPosX, iBtnPosY, uno.Any("short",STANDARD), iCurStep, uno.Any("short",(curtabindex + 1)), iButtonWidth))
+ self.insertButton("btnWizardNext", self.gotoNextAvailableStep, propNames,(True, iButtonHeight, HelpIds.getHelpIdString(self.__hid + 3), self.__oWizardResource.getResText(UIConsts.RID_COMMON + 14), iNextPosX, iBtnPosY, uno.Any("short",STANDARD), iCurStep, uno.Any("short",(curtabindex + 1)), iButtonWidth))
+ self.insertButton("btnWizardFinish", self.finishWizard_1, propNames,(True, iButtonHeight, HelpIds.getHelpIdString(self.__hid + 4), self.__oWizardResource.getResText(UIConsts.RID_COMMON + 12), iFinishPosX, iBtnPosY, uno.Any("short",STANDARD), iCurStep, uno.Any("short",(curtabindex + 1)), iButtonWidth))
+ self.insertButton("btnWizardCancel", self.cancelWizard_1, propNames,(True, iButtonHeight, HelpIds.getHelpIdString(self.__hid + 5), self.__oWizardResource.getResText(UIConsts.RID_COMMON + 11), iCancelPosX, iBtnPosY, uno.Any("short",STANDARD), iCurStep, uno.Any("short",(curtabindex + 1)), iButtonWidth))
self.setControlProperty("btnWizardNext", "DefaultButton", True)
# add a window listener, to know
# if the user used "escape" key to
# close the dialog.
windowHidden = MethodInvocation("windowHidden", self)
- self.xUnoDialog.addWindowListener(WindowListenerProcAdapter(self.guiEventListener))
+ self.xUnoDialog.addWindowListener(WindowListenerProcAdapter(None))
dialogName = Helper.getUnoPropertyValue(self.xDialogModel, PropertyNames.PROPERTY_NAME)
- self.guiEventListener.add(dialogName, EVENT_ACTION_PERFORMED, windowHidden)
except Exception, exception:
traceback.print_exc()
@@ -259,22 +252,22 @@ class WizardDialog(UnoDialog2):
def setStepEnabled(self, _nStep, bEnabled, enableNextButton):
setStepEnabled(_nStep, bEnabled)
- if getNextAvailableStep() > 0:
- enableNextButton(bEnabled)
+ if self.getNextAvailableStep() > 0:
+ self.enableNextButton(bEnabled)
def enableNavigationButtons(self, _bEnableBack, _bEnableNext, _bEnableFinish):
- enableBackButton(_bEnableBack)
- enableNextButton(_bEnableNext)
- enableFinishButton(_bEnableFinish)
+ self.enableBackButton(_bEnableBack)
+ self.enableNextButton(_bEnableNext)
+ self.enableFinishButton(_bEnableFinish)
def enableBackButton(self, enabled):
- setControlProperty("btnWizardBack", PropertyNames.PROPERTY_ENABLED, enabled)
+ self.setControlProperty("btnWizardBack", PropertyNames.PROPERTY_ENABLED, enabled)
def enableNextButton(self, enabled):
- setControlProperty("btnWizardNext", PropertyNames.PROPERTY_ENABLED, enabled)
+ self.setControlProperty("btnWizardNext", PropertyNames.PROPERTY_ENABLED, enabled)
def enableFinishButton(self, enabled):
- setControlProperty("btnWizardFinish", PropertyNames.PROPERTY_ENABLED, enabled)
+ self.setControlProperty("btnWizardFinish", PropertyNames.PROPERTY_ENABLED, enabled)
def setStepEnabled(self, _nStep, bEnabled):
xRoadmapItem = getRoadmapItemByID(_nStep)
@@ -295,75 +288,81 @@ class WizardDialog(UnoDialog2):
def isStepEnabled(self, _nStep):
try:
- xRoadmapItem = getRoadmapItemByID(_nStep)
+ xRoadmapItem = self.getRoadmapItemByID(_nStep)
# Todo: In this case an exception should be thrown
if (xRoadmapItem == None):
return False
-
bIsEnabled = bool(Helper.getUnoPropertyValue(xRoadmapItem, PropertyNames.PROPERTY_ENABLED))
return bIsEnabled
except UnoException, exception:
traceback.print_exc()
return False
- def gotoPreviousAvailableStep(self):
- if self.__nNewStep > 1:
- self.__nOldStep = self.__nNewStep
- self.__nNewStep -= 1
- while self.__nNewStep > 0:
- bIsEnabled = isStepEnabled(self.__nNewStep)
- if bIsEnabled:
- break;
-
+ def gotoPreviousAvailableStep(self, oActionEvent):
+ try:
+ if self.__nNewStep > 1:
+ self.__nOldStep = self.__nNewStep
self.__nNewStep -= 1
- # Exception???
- if (self.__nNewStep == 0):
- self.__nNewStep = self.__nOldStep
- switchToStep()
+ while self.__nNewStep > 0:
+ bIsEnabled = self.isStepEnabled(self.__nNewStep)
+ if bIsEnabled:
+ break;
+
+ self.__nNewStep -= 1
+ if (self.__nNewStep == 0):
+ self.__nNewStep = self.__nOldStep
+ self.switchToStep()
+ except Exception, e:
+ traceback.print_exc()
#TODO discuss with rp
def getNextAvailableStep(self):
- if isRoadmapComplete():
+ if self.isRoadmapComplete():
i = self.__nNewStep + 1
while i <= self.__nMaxStep:
- if isStepEnabled(i):
+ if self.isStepEnabled(i):
return i
i += 1
return -1
- def gotoNextAvailableStep(self):
- self.__nOldStep = self.__nNewStep
- self.__nNewStep = getNextAvailableStep()
- if self.__nNewStep > -1:
- switchToStep()
+ def gotoNextAvailableStep(self, oActionEvent):
+ try:
+ self.__nOldStep = self.__nNewStep
+ self.__nNewStep = self.getNextAvailableStep()
+ if self.__nNewStep > -1:
+ self.switchToStep()
+ except Exception, e:
+ traceback.print_exc()
@abstractmethod
def finishWizard(self):
pass
- #This function will call if the finish button is pressed on the UI.
-
- def finishWizard_1(self):
- enableFinishButton(False)
- success = False
+ def finishWizard_1(self, oActionEvent):
+ '''This function will call if the finish button is pressed on the UI'''
try:
- success = finishWizard()
- finally:
- if not success:
- enableFinishButton(True)
-
- if success:
- removeTerminateListener()
+ self.enableFinishButton(False)
+ success = False
+ try:
+ success = self.finishWizard()
+ finally:
+ if not success:
+ self.enableFinishButton(True)
+
+ if success:
+ removeTerminateListener()
+ except Exception, e:
+ traceback.print_exc()
def getMaximalStep(self):
return self.__nMaxStep
def getCurrentStep(self):
try:
- return int(Helper.getUnoPropertyValue(self.MSFDialogModel, PropertyNames.PROPERTY_STEP))
+ return int(Helper.getUnoPropertyValue(self.xDialogModel, PropertyNames.PROPERTY_STEP))
except UnoException, exception:
traceback.print_exc()
return -1
@@ -404,9 +403,13 @@ class WizardDialog(UnoDialog2):
perform a cancel.
'''
- def cancelWizard_1(self):
- cancelWizard()
- removeTerminateListener()
+ def cancelWizard_1(self, oActionEvent):
+ try:
+ self.cancelWizard()
+ self.removeTerminateListener()
+ except Exception,e:
+ traceback.print_exc()
+
def windowHidden(self):
cancelWizard_1()
diff --git a/wizards/com/sun/star/wizards/ui/event/CommonListener.py b/wizards/com/sun/star/wizards/ui/event/CommonListener.py
index 9806dd7c0ea8..1ab91eb51323 100644
--- a/wizards/com/sun/star/wizards/ui/event/CommonListener.py
+++ b/wizards/com/sun/star/wizards/ui/event/CommonListener.py
@@ -1,72 +1,113 @@
-'''
-import com.sun.star.awt.*;
-
-import com.sun.star.lang.EventObject;
-'''
-from AbstractListener import AbstractListener
-from EventNames import *
-
-class CommonListener(AbstractListener):
-
- def __init__(self):
- pass
-
- '''Implementation of com.sun.star.awt.XActionListener'''
- def actionPerformed(self, actionEvent):
- self.invoke(self.getEventSourceName(actionEvent), EVENT_ACTION_PERFORMED, actionEvent)
-
- '''Implementation of com.sun.star.awt.XItemListener'''
- def itemStateChanged(self, itemEvent):
- self.invoke(self.getEventSourceName(itemEvent), EVENT_ITEM_CHANGED, itemEvent)
-
- '''Implementation of com.sun.star.awt.XTextListener'''
- def textChanged(self, textEvent):
- self.invoke(self.getEventSourceName(textEvent), EVENT_TEXT_CHANGED, textEvent)
-
- '''@see com.sun.star.awt.XWindowListener#windowResized(com.sun.star.awt.WindowEvent)'''
- def windowResized(self, event):
- self.invoke(self.getEventSourceName(event), EVENT_WINDOW_RESIZED, event)
-
- '''@see com.sun.star.awt.XWindowListener#windowMoved(com.sun.star.awt.WindowEvent)'''
- def windowMoved(self, event):
- self.invoke(self.getEventSourceName(event), EVENT_WINDOW_MOVED, event)
-
- '''@see com.sun.star.awt.XWindowListener#windowShown(com.sun.star.lang.EventObject)'''
- def windowShown(self, event):
- self.invoke(self.getEventSourceName(event), EVENT_WINDOW_SHOWN, event)
-
- '''@see com.sun.star.awt.XWindowListener#windowHidden(com.sun.star.lang.EventObject)'''
- def windowHidden(self, event):
- self.invoke(self.getEventSourceName(event), EVENT_WINDOW_HIDDEN, event)
-
- '''@see com.sun.star.awt.XMouseListener#mousePressed(com.sun.star.awt.MouseEvent)'''
- def mousePressed(self, event):
- self.invoke(self.getEventSourceName(event), EVENT_MOUSE_PRESSED, event)
-
- '''@see com.sun.star.awt.XMouseListener#mouseReleased(com.sun.star.awt.MouseEvent)'''
- def mouseReleased(self, event):
- self.invoke(self.getEventSourceName(event), EVENT_KEY_RELEASED, event)
-
- '''@see com.sun.star.awt.XMouseListener#mouseEntered(com.sun.star.awt.MouseEvent)'''
- def mouseEntered(self, event):
- self.invoke(self.getEventSourceName(event), EVENT_MOUSE_ENTERED, event)
-
- '''@see com.sun.star.awt.XMouseListener#mouseExited(com.sun.star.awt.MouseEvent)'''
- def mouseExited(self, event):
- self.invoke(self.getEventSourceName(event), EVENT_MOUSE_EXITED, event)
-
- '''@see com.sun.star.awt.XFocusListener#focusGained(com.sun.star.awt.FocusEvent)'''
- def focusGained(self, event):
- self.invoke(self.getEventSourceName(event), EVENT_FOCUS_GAINED, event)
-
- '''@see com.sun.star.awt.XFocusListener#focusLost(com.sun.star.awt.FocusEvent)'''
- def focusLost(self, event):
- self.invoke(self.getEventSourceName(event), EVENT_FOCUS_LOST, event)
-
- '''@see com.sun.star.awt.XKeyListener#keyPressed(com.sun.star.awt.KeyEvent)'''
- def keyPressed(self, event):
- self.invoke(c(event), EVENT_KEY_PRESSED, event)
-
- '''@see com.sun.star.awt.XKeyListener#keyReleased(com.sun.star.awt.KeyEvent)'''
- def keyReleased(self, event):
- self.invoke(self.getEventSourceName(event), EVENT_KEY_RELEASED, event)
+#**********************************************************************
+#
+# Danny.OOo.Listeners.ListenerProcAdapters.py
+#
+# A module to easily work with OpenOffice.org.
+#
+#**********************************************************************
+# Copyright (c) 2003-2004 Danny Brewer
+# d29583@groovegarden.com
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See: http://www.gnu.org/licenses/lgpl.html
+#
+#**********************************************************************
+# If you make changes, please append to the change log below.
+#
+# Change Log
+# Danny Brewer Revised 2004-06-05-01
+#
+#**********************************************************************
+
+# OOo's libraries
+import uno
+import unohelper
+import inspect
+
+#--------------------------------------------------
+# An ActionListener adapter.
+# This object implements com.sun.star.awt.XActionListener.
+# When actionPerformed is called, this will call an arbitrary
+# python procedure, passing it...
+# 1. the oActionEvent
+# 2. any other parameters you specified to this object's constructor (as a tuple).
+from com.sun.star.awt import XActionListener
+class ActionListenerProcAdapter( unohelper.Base, XActionListener ):
+ def __init__( self, oProcToCall, tParams=() ):
+ self.oProcToCall = oProcToCall # a python procedure
+ self.tParams = tParams # a tuple
+
+
+ # oActionEvent is a com.sun.star.awt.ActionEvent struct.
+ def actionPerformed( self, oActionEvent ):
+ if callable( self.oProcToCall ):
+ apply( self.oProcToCall, (oActionEvent,) + self.tParams )
+
+
+#--------------------------------------------------
+# An ItemListener adapter.
+# This object implements com.sun.star.awt.XItemListener.
+# When itemStateChanged is called, this will call an arbitrary
+# python procedure, passing it...
+# 1. the oItemEvent
+# 2. any other parameters you specified to this object's constructor (as a tuple).
+from com.sun.star.awt import XItemListener
+class ItemListenerProcAdapter( unohelper.Base, XItemListener ):
+ def __init__( self, oProcToCall, tParams=() ):
+ self.oProcToCall = oProcToCall # a python procedure
+ self.tParams = tParams # a tuple
+
+ # oItemEvent is a com.sun.star.awt.ItemEvent struct.
+ def itemStateChanged( self, oItemEvent ):
+ if callable( self.oProcToCall ):
+ apply( self.oProcToCall, (oActionEvent,) + self.tParams )
+
+
+#--------------------------------------------------
+# An TextListener adapter.
+# This object implements com.sun.star.awt.XTextistener.
+# When textChanged is called, this will call an arbitrary
+# python procedure, passing it...
+# 1. the oTextEvent
+# 2. any other parameters you specified to this object's constructor (as a tuple).
+from com.sun.star.awt import XTextListener
+class TextListenerProcAdapter( unohelper.Base, XTextListener ):
+ def __init__( self, oProcToCall, tParams=() ):
+ self.oProcToCall = oProcToCall # a python procedure
+ self.tParams = tParams # a tuple
+
+ # oTextEvent is a com.sun.star.awt.TextEvent struct.
+ def textChanged( self, oTextEvent ):
+ if callable( self.oProcToCall ):
+ apply( self.oProcToCall, (oTextEvent,) + self.tParams )
+
+#--------------------------------------------------
+# An Window adapter.
+# This object implements com.sun.star.awt.XWindowListener.
+# When textChanged is called, this will call an arbitrary
+# python procedure, passing it...
+# 1. the oTextEvent
+# 2. any other parameters you specified to this object's constructor (as a tuple).
+from com.sun.star.awt import XWindowListener
+class WindowListenerProcAdapter( unohelper.Base, XWindowListener ):
+ def __init__( self, oProcToCall, tParams=() ):
+ self.oProcToCall = oProcToCall # a python procedure
+ self.tParams = tParams # a tuple
+
+ # oTextEvent is a com.sun.star.awt.TextEvent struct.
+ def windowResized(self, actionEvent):
+ if callable( self.oProcToCall ):
+ apply( self.oProcToCall, (actionEvent,) + self.tParams )
diff --git a/wizards/com/sun/star/wizards/ui/event/DataAware.py b/wizards/com/sun/star/wizards/ui/event/DataAware.py
index 24172f1665e6..e3dd9f8fc1bd 100644
--- a/wizards/com/sun/star/wizards/ui/event/DataAware.py
+++ b/wizards/com/sun/star/wizards/ui/event/DataAware.py
@@ -2,9 +2,6 @@ from common.PropertyNames import *
from abc import ABCMeta, abstractmethod
import traceback
-#TEMPORAL
-import inspect
-
'''
@author rpiterman
DataAware objects are used to live-synchronize UI and DataModel/DataObject.
diff --git a/wizards/com/sun/star/wizards/ui/event/DataAwareFields.py b/wizards/com/sun/star/wizards/ui/event/DataAwareFields.py
index efa017f55755..b23cce2eef01 100644
--- a/wizards/com/sun/star/wizards/ui/event/DataAwareFields.py
+++ b/wizards/com/sun/star/wizards/ui/event/DataAwareFields.py
@@ -106,6 +106,8 @@ class DataAwareFields(object):
return int(i)
elif isinstance(self.convertTo,str):
return str(i)
+ elif self.convertTo.type == uno.Any("short",0).type:
+ return uno.Any("[]short",(i,))
else:
raise AttributeError("Cannot convert int value to given type (" + str(type(self.convertTo)) + ").");
diff --git a/wizards/com/sun/star/wizards/ui/event/UnoDataAware.py b/wizards/com/sun/star/wizards/ui/event/UnoDataAware.py
index 65d22bf6181e..5654eb7d54f7 100644
--- a/wizards/com/sun/star/wizards/ui/event/UnoDataAware.py
+++ b/wizards/com/sun/star/wizards/ui/event/UnoDataAware.py
@@ -167,7 +167,7 @@ class UnoDataAware(DataAware):
@classmethod
def attachListBox(self, data, prop, listBox, listener, field):
if field:
- aux = DataAwareFields.getFieldValueFor(data, prop, 0)
+ aux = DataAwareFields.getFieldValueFor(data, prop, uno.Any("short",0))
else:
aux = DataAware.PropertyValue (prop, data)
uda = UnoDataAware(data, aux, listBox, "SelectedItems")