From 4d74613382a61c29c10eeb40cc9d595eaf29ca76 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Fri, 17 Jun 2011 18:28:23 +0200 Subject: Let's delete it for now and see if we need it in the future --- wizards/com/sun/star/wizards/common/FileAccess.py | 4 +- .../sun/star/wizards/document/OfficeDocument.py | 12 +- .../com/sun/star/wizards/fax/FaxWizardDialog.py | 2 +- wizards/com/sun/star/wizards/ui/PeerConfig.py | 159 --------------------- wizards/com/sun/star/wizards/ui/UIConsts.py | 107 ++++++-------- wizards/com/sun/star/wizards/ui/UnoDialog.py | 1 - wizards/com/sun/star/wizards/ui/UnoDialog2.py | 8 +- wizards/com/sun/star/wizards/ui/WizardDialog.py | 31 +--- .../sun/star/wizards/ui/event/CommonListener.py | 41 +----- 9 files changed, 68 insertions(+), 297 deletions(-) delete mode 100644 wizards/com/sun/star/wizards/ui/PeerConfig.py (limited to 'wizards') diff --git a/wizards/com/sun/star/wizards/common/FileAccess.py b/wizards/com/sun/star/wizards/common/FileAccess.py index 83a447257959..5af66d826f3b 100644 --- a/wizards/com/sun/star/wizards/common/FileAccess.py +++ b/wizards/com/sun/star/wizards/common/FileAccess.py @@ -404,13 +404,13 @@ class FileAccess(object): FilterName = FilterName + "-" fileName = "" NameVectorAppend = NameVector.append - TitleVectoAppend = TitleVector.append + TitleVectorAppend = TitleVector.append for i in nameList: fileName = self.getFilename(i) if FilterName is None or fileName.startswith(FilterName): xDocInterface.loadFromMedium(i, tuple()) NameVectorAppend(i) - TitleVectoAppend(xDocInterface.Title) + TitleVectorAppend(xDocInterface.Title) LocLayoutFiles[1] = NameVector LocLayoutFiles[0] = TitleVector diff --git a/wizards/com/sun/star/wizards/document/OfficeDocument.py b/wizards/com/sun/star/wizards/document/OfficeDocument.py index 69a537d3a952..0647d328a76a 100644 --- a/wizards/com/sun/star/wizards/document/OfficeDocument.py +++ b/wizards/com/sun/star/wizards/document/OfficeDocument.py @@ -1,6 +1,7 @@ from com.sun.star.awt.WindowClass import TOP import traceback import uno +from ui.event.CommonListener import TerminateListenerProcAdapter from common.Desktop import Desktop from com.sun.star.awt import WindowDescriptor from com.sun.star.awt import Rectangle @@ -98,10 +99,10 @@ class OfficeDocument(object): else: xF = Desktop.getDesktop(xMSF) xFrame = xF.findFrame(FrameName, 0) - if listener != None: + if listener is not None: xFF = xF.getFrames() xFF.remove(xFrame) - xF.addTerminateListener(listener) + xF.addTerminateListener(TerminateListenerProcAdapter(listener)) return xFrame @@ -153,10 +154,9 @@ class OfficeDocument(object): #from now this frame is useable ... #and not part of the desktop tree. #You are alone with him .-) - if listener != None: - pass - #COMMENTED - #Desktop.getDesktop(xMSF).addTerminateListener(listener) + if listener is not None: + Desktop.getDesktop(xMSF).addTerminateListener( + TerminateListenerProcAdapter(listener)) return xFrame diff --git a/wizards/com/sun/star/wizards/fax/FaxWizardDialog.py b/wizards/com/sun/star/wizards/fax/FaxWizardDialog.py index 5b178cb75949..c3c2bd7d8038 100644 --- a/wizards/com/sun/star/wizards/fax/FaxWizardDialog.py +++ b/wizards/com/sun/star/wizards/fax/FaxWizardDialog.py @@ -630,7 +630,7 @@ class FaxWizardDialog(WizardDialog): PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH), - (uno.Any("short",0), 10, "private:resource/dbu/image/19205", 92, 145, + (uno.Any("short",0), 10, UIConsts.INFOIMAGEURL, 92, 145, False, 5, uno.Any("short",47), 10)) self.lblTemplateName = self.insertLabel("lblTemplateName", (PropertyNames.PROPERTY_HEIGHT, diff --git a/wizards/com/sun/star/wizards/ui/PeerConfig.py b/wizards/com/sun/star/wizards/ui/PeerConfig.py deleted file mode 100644 index 4647ad172f2a..000000000000 --- a/wizards/com/sun/star/wizards/ui/PeerConfig.py +++ /dev/null @@ -1,159 +0,0 @@ -import traceback -from common.Helper import * - -''' -To change the template for this generated type comment go to -Window>Preferences>Java>Code Generation>Code and Comments -''' - -class PeerConfig(object): - - def __init__(self, _oUnoDialog): - self.oUnoDialog = _oUnoDialog - #self.oUnoDialog.xUnoDialog.addWindowListener(self) - self.m_aPeerTasks = [] - self.aControlTasks = [] - self.aImageUrlTasks = [] - self.oUnoDialog = None - - class PeerTask(object): - - def __init__(self,_xControl, propNames_, propValues_): - self.propnames = propNames_ - self.propvalues = propValues_ - self.xControl = _xControl - - class ControlTask(object): - - def __init__(self, _oModel, _propName, _propValue): - self.propname = _propName - self.propvalue = _propValue - self.oModel = _oModel - - class ImageUrlTask(object): - - def __init__(self, _oModel , _oResource, _oHCResource): - self.oResource = _oResource - self.oHCResource = _oHCResource - self.oModel = _oModel - - def windowShown(self, arg0): - try: - i = 0 - while i < self.m_aPeerTasks.size(): - aPeerTask = self.m_aPeerTasks.elementAt(i) - xVclWindowPeer = aPeerTask.xControl.Peer - n = 0 - while n < aPeerTask.propnames.length: - xVclWindowPeer.setProperty(aPeerTask.propnames[n], - aPeerTask.propvalues[n]) - n += 1 - i += 1 - i = 0 - while i < self.aControlTasks.size(): - aControlTask = self.aControlTasks.elementAt(i) - Helper.setUnoPropertyValue(aControlTask.oModel, - aControlTask.propname, aControlTask.propvalue) - i += 1 - i = 0 - while i < self.aImageUrlTasks.size(): - aImageUrlTask = self.aImageUrlTasks.elementAt(i) - sImageUrl = "" - if isinstance(aImageUrlTask.oResource,int): - sImageUrl = self.oUnoDialog.getWizardImageUrl( - (aImageUrlTask.oResource).intValue(), - (aImageUrlTask.oHCResource).intValue()) - elif isinstance(aImageUrlTask.oResource,str): - sImageUrl = self.oUnoDialog.getImageUrl( - (aImageUrlTask.oResource), - (aImageUrlTask.oHCResource)) - - if not sImageUrl.equals(""): - Helper.setUnoPropertyValue( - aImageUrlTask.oModel, - PropertyNames.PROPERTY_IMAGEURL, sImageUrl) - - i += 1 - except RuntimeException, re: - traceback.print_exc - raise re; - - ''' - @param oAPIControl an API control that the interface XControl - can be derived from - @param _saccessname - ''' - - def setAccessibleName(self, oAPIControl, _saccessname): - setPeerProperties(oAPIControl, ("AccessibleName"), (_saccessname)) - - def setAccessibleName(self, _xControl, _saccessname): - setPeerProperties(_xControl, ("AccessibleName"), (_saccessname)) - - ''' - @param oAPIControl an API control that the interface XControl - can be derived from - @param _propnames - @param _propvalues - ''' - - def setPeerProperties(self, oAPIControl, _propnames, _propvalues): - setPeerProperties(oAPIControl, _propnames, _propvalues) - - def setPeerProperties(self, _xControl, propnames, propvalues): - oPeerTask = PeerTask(_xControl, propnames, propvalues) - self.m_aPeerTasks.append(oPeerTask) - - ''' - assigns an arbitrary property to a control as soon as the peer is created - Note: The property 'ImageUrl' should better be assigned with - 'setImageurl(...)', to consider the High Contrast Mode - @param _ocontrolmodel - @param _spropname - @param _propvalue - ''' - - def setControlProperty(self, _ocontrolmodel, _spropname, _propvalue): - oControlTask = self.ControlTask(_ocontrolmodel, _spropname, _propvalue) - self.aControlTasks.append(oControlTask) - - ''' - Assigns an image to the property 'ImageUrl' of a dialog control. - The image id must be assigned in a resource file within the wizards - project wizards project - @param _ocontrolmodel - @param _nResId - @param _nhcResId - ''' - - def setImageUrl(self, _ocontrolmodel, _nResId, _nhcResId): - oImageUrlTask = ImageUrlTask(_ocontrolmodel,_nResId, _nhcResId) - self.aImageUrlTasks.append(oImageUrlTask) - - ''' - Assigns an image to the property 'ImageUrl' of a dialog control. - The image ids that the Resource urls point to - may be assigned in a Resource file outside the wizards project - @param _ocontrolmodel - @param _sResourceUrl - @param _sHCResourceUrl - ''' - - def setImageUrl(self, _ocontrolmodel, _sResourceUrl, _sHCResourceUrl): - oImageUrlTask = ImageUrlTask( - _ocontrolmodel, _sResourceUrl, _sHCResourceUrl) - self.aImageUrlTasks.append(oImageUrlTask) - - ''' - Assigns an image to the property 'ImageUrl' of a dialog control. - The image id must be assigned in a resource file within the wizards - project wizards project - @param _ocontrolmodel - @param _oResource - @param _oHCResource - ''' - - def setImageUrl(self, _ocontrolmodel, _oResource, _oHCResource): - oImageUrlTask = self.ImageUrlTask( - _ocontrolmodel, _oResource, _oHCResource) - self.aImageUrlTasks.append(oImageUrlTask) diff --git a/wizards/com/sun/star/wizards/ui/UIConsts.py b/wizards/com/sun/star/wizards/ui/UIConsts.py index f64ddedaf492..a975ff4904d5 100644 --- a/wizards/com/sun/star/wizards/ui/UIConsts.py +++ b/wizards/com/sun/star/wizards/ui/UIConsts.py @@ -1,66 +1,53 @@ +RID_COMMON = 500 +RID_DB_COMMON = 1000 +RID_FORM = 2200 +RID_QUERY = 2300 +RID_REPORT = 2400 +RID_TABLE = 2500 +RID_IMG_REPORT = 1000 +RID_IMG_FORM = 1100 +RID_IMG_WEB = 1200 +INVISIBLESTEP = 99 +INFOIMAGEURL = "private:resource/dbu/image/19205" + ''' -To change the template for this generated type comment go to -Window>Preferences>Java>Code Generation>Code and Comments +The tabindex of the navigation buttons in a wizard must be assigned a very +high tabindex because on every step their taborder must appear at the end ''' -class UIConsts(): - - RID_COMMON = 500 - RID_DB_COMMON = 1000 - RID_FORM = 2200 - RID_QUERY = 2300 - RID_REPORT = 2400 - RID_TABLE = 2500 - RID_IMG_REPORT = 1000 - RID_IMG_FORM = 1100 - RID_IMG_WEB = 1200 - INVISIBLESTEP = 99 - INFOIMAGEURL = "private:resource/dbu/image/19205" - INFOIMAGEURL_HC = "private:resource/dbu/image/19230" - ''' - The tabindex of the navigation buttons in a wizard must be assigned a very - high tabindex because on every step their taborder must appear at the end - ''' - SOFIRSTWIZARDNAVITABINDEX = 30000 - INTEGER_8 = 8 - INTEGER_12 = 12 - INTEGER_14 = 14 - INTEGER_16 = 16 - INTEGER_40 = 40 - INTEGER_50 = 50 +SOFIRSTWIZARDNAVITABINDEX = 30000 - #Steps of the QueryWizard +#Steps of the QueryWizard - SOFIELDSELECTIONPAGE = 1 - SOSORTINGPAGE = 2 - SOFILTERPAGE = 3 - SOAGGREGATEPAGE = 4 - SOGROUPSELECTIONPAGE = 5 - SOGROUPFILTERPAGE = 6 - SOTITLESPAGE = 7 - SOSUMMARYPAGE = 8 - INTEGERS = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] +SOFIELDSELECTIONPAGE = 1 +SOSORTINGPAGE = 2 +SOFILTERPAGE = 3 +SOAGGREGATEPAGE = 4 +SOGROUPSELECTIONPAGE = 5 +SOGROUPFILTERPAGE = 6 +SOTITLESPAGE = 7 +SOSUMMARYPAGE = 8 - class CONTROLTYPE(): +class CONTROLTYPE(): - BUTTON = 1 - IMAGECONTROL = 2 - LISTBOX = 3 - COMBOBOX = 4 - CHECKBOX = 5 - RADIOBUTTON = 6 - DATEFIELD = 7 - EDITCONTROL = 8 - FILECONTROL = 9 - FIXEDLINE = 10 - FIXEDTEXT = 11 - FORMATTEDFIELD = 12 - GROUPBOX = 13 - HYPERTEXT = 14 - NUMERICFIELD = 15 - PATTERNFIELD = 16 - PROGRESSBAR = 17 - ROADMAP = 18 - SCROLLBAR = 19 - TIMEFIELD = 20 - CURRENCYFIELD = 21 - UNKNOWN = -1 + BUTTON = 1 + IMAGECONTROL = 2 + LISTBOX = 3 + COMBOBOX = 4 + CHECKBOX = 5 + RADIOBUTTON = 6 + DATEFIELD = 7 + EDITCONTROL = 8 + FILECONTROL = 9 + FIXEDLINE = 10 + FIXEDTEXT = 11 + FORMATTEDFIELD = 12 + GROUPBOX = 13 + HYPERTEXT = 14 + NUMERICFIELD = 15 + PATTERNFIELD = 16 + PROGRESSBAR = 17 + ROADMAP = 18 + SCROLLBAR = 19 + TIMEFIELD = 20 + CURRENCYFIELD = 21 + UNKNOWN = -1 diff --git a/wizards/com/sun/star/wizards/ui/UnoDialog.py b/wizards/com/sun/star/wizards/ui/UnoDialog.py index 551d0e39ed1e..baacd58c5c84 100644 --- a/wizards/com/sun/star/wizards/ui/UnoDialog.py +++ b/wizards/com/sun/star/wizards/ui/UnoDialog.py @@ -3,7 +3,6 @@ import traceback from common.PropertyNames import PropertyNames from com.sun.star.awt import Rectangle from common.Helper import Helper -from PeerConfig import PeerConfig from com.sun.star.awt import Rectangle from com.sun.star.awt.PosSize import POS diff --git a/wizards/com/sun/star/wizards/ui/UnoDialog2.py b/wizards/com/sun/star/wizards/ui/UnoDialog2.py index cc9ec652f223..4fcdadb6bed6 100644 --- a/wizards/com/sun/star/wizards/ui/UnoDialog2.py +++ b/wizards/com/sun/star/wizards/ui/UnoDialog2.py @@ -1,7 +1,7 @@ from UnoDialog import * from ui.event.CommonListener import * from common.Desktop import Desktop -from UIConsts import * +import UIConsts ''' This class contains convenience methods for inserting components to a dialog. @@ -10,7 +10,7 @@ description files to a Java class which builds the same dialog through the UNO API.
It uses an Event-Listener method, which calls a method through reflection wenn an event on a component is trigered. -see the classes AbstractListener, CommonListener, MethodInvocation for details +see the classes CommonListener for details ''' class UnoDialog2(UnoDialog): @@ -138,10 +138,6 @@ class UnoDialog2(UnoDialog): PropertyNames.PROPERTY_WIDTH), (uno.Any("short",0), 10, UIConsts.INFOIMAGEURL, _posx, _posy, False, _iStep, 10)) - self.getPeerConfiguration().setImageUrl( - self.getModel(xImgControl), - UIConsts.INFOIMAGEURL, - UIConsts.INFOIMAGEURL_HC) return xImgControl ''' diff --git a/wizards/com/sun/star/wizards/ui/WizardDialog.py b/wizards/com/sun/star/wizards/ui/WizardDialog.py index ad46e2dbc5f3..b8f1236427db 100644 --- a/wizards/com/sun/star/wizards/ui/WizardDialog.py +++ b/wizards/com/sun/star/wizards/ui/WizardDialog.py @@ -7,7 +7,6 @@ from com.sun.star.lang import IllegalArgumentException from com.sun.star.frame import TerminationVetoException from common.HelpIds import * from com.sun.star.awt.PushButtonType import HELP, STANDARD -from event.MethodInvocation import * from event.EventNames import EVENT_ITEM_CHANGED class WizardDialog(UnoDialog2): @@ -52,7 +51,7 @@ class WizardDialog(UnoDialog2): def activate(self): try: - if self.xUnoDialog != None: + if self.xUnoDialog is not None: self.xUnoDialog.toFront() except UnoException, ex: @@ -313,13 +312,6 @@ class WizardDialog(UnoDialog2): uno.Any("short",(curtabindex + 1)), iButtonWidth), self) 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(None)) - dialogName = Helper.getUnoPropertyValue(self.xDialogModel, - PropertyNames.PROPERTY_NAME) except Exception, exception: traceback.print_exc() @@ -488,9 +480,8 @@ class WizardDialog(UnoDialog2): def removeTerminateListener(self): if self.__bTerminateListenermustberemoved: - #COMMENTED - #Desktop.getDesktop(self.xMSF).removeTerminateListener( \ - # ActionListenerProcAdapter(self)) + Desktop.getDesktop(self.xMSF).removeTerminateListener( \ + TerminateListenerProcAdapter(self)) self.__bTerminateListenermustberemoved = False ''' @@ -507,16 +498,6 @@ class WizardDialog(UnoDialog2): except Exception,e: traceback.print_exc() - - def windowHidden(self): - cancelWizard_1() - - def notifyTermination(self, arg0): - cancelWizard_1() - - def queryTermination(self, arg0): - activate() - raise TerminationVetoException (); - - def disposing(self, arg0): - cancelWizard_1() + def queryTermination(self): + self.activate() + raise TerminationVetoException() diff --git a/wizards/com/sun/star/wizards/ui/event/CommonListener.py b/wizards/com/sun/star/wizards/ui/event/CommonListener.py index 73a52c961397..1ab35e395854 100644 --- a/wizards/com/sun/star/wizards/ui/event/CommonListener.py +++ b/wizards/com/sun/star/wizards/ui/event/CommonListener.py @@ -37,14 +37,6 @@ 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=() ): @@ -57,15 +49,6 @@ class ActionListenerProcAdapter( unohelper.Base, XActionListener ): if callable( self.oProcToCall ): apply( self.oProcToCall ) - -#-------------------------------------------------- -# 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=() ): @@ -80,15 +63,6 @@ class ItemListenerProcAdapter( unohelper.Base, XItemListener ): except: apply( self.oProcToCall, (oItemEvent,) + 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=() ): @@ -100,21 +74,14 @@ class TextListenerProcAdapter( unohelper.Base, XTextListener ): if callable( self.oProcToCall ): apply( self.oProcToCall ) -#-------------------------------------------------- -# 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 ): +from com.sun.star.frame import XTerminateListener +class TerminateListenerProcAdapter( unohelper.Base, XTerminateListener ): 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): + def queryTermination(self, TerminateEvent): + self.oProcToCall = getattr(self.oProcToCall,"queryTermination") if callable( self.oProcToCall ): apply( self.oProcToCall ) -- cgit