diff options
author | Xisco Fauli <anistenis@gmail.com> | 2012-11-28 22:24:18 +0100 |
---|---|---|
committer | Xisco Fauli <anistenis@gmail.com> | 2012-11-28 22:45:38 +0100 |
commit | acea3cd3aaa511718bdc60320753f38d28cbdf8f (patch) | |
tree | f208d7dde514395fc46b37119420adab13e5e5a4 /wizards | |
parent | 700e75f09dce3336751fa66eb2aa04f4a4b69f6a (diff) |
pywizards: remove set/get controlproperty
Change-Id: Ib8fb5ee973e9f555d85cb08d2945199deb4ba9aa
Diffstat (limited to 'wizards')
-rw-r--r-- | wizards/com/sun/star/wizards/common/Configuration.py | 1 | ||||
-rw-r--r-- | wizards/com/sun/star/wizards/fax/FaxDocument.py | 3 | ||||
-rw-r--r-- | wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py | 152 | ||||
-rw-r--r-- | wizards/com/sun/star/wizards/letter/LetterDocument.py | 76 | ||||
-rw-r--r-- | wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py | 336 | ||||
-rw-r--r-- | wizards/com/sun/star/wizards/ui/PathSelection.py | 3 | ||||
-rw-r--r-- | wizards/com/sun/star/wizards/ui/UnoDialog.py | 23 | ||||
-rw-r--r-- | wizards/com/sun/star/wizards/ui/WizardDialog.py | 23 |
8 files changed, 194 insertions, 423 deletions
diff --git a/wizards/com/sun/star/wizards/common/Configuration.py b/wizards/com/sun/star/wizards/common/Configuration.py index f467c224d30f..5e42356efede 100644 --- a/wizards/com/sun/star/wizards/common/Configuration.py +++ b/wizards/com/sun/star/wizards/common/Configuration.py @@ -17,7 +17,6 @@ # import uno import traceback -from .PropertyNames import PropertyNames class Configuration(object): '''This class gives access to the OO configuration api.''' diff --git a/wizards/com/sun/star/wizards/fax/FaxDocument.py b/wizards/com/sun/star/wizards/fax/FaxDocument.py index ee33cc6ee528..b695ffe55c1a 100644 --- a/wizards/com/sun/star/wizards/fax/FaxDocument.py +++ b/wizards/com/sun/star/wizards/fax/FaxDocument.py @@ -18,7 +18,6 @@ from ..text.TextDocument import TextDocument, traceback, \ TextFieldHandler, Configuration from ..text.TextSectionHandler import TextSectionHandler -from ..common.PropertyNames import PropertyNames from com.sun.star.text.ControlCharacter import PARAGRAPH_BREAK from com.sun.star.style.ParagraphAdjust import CENTER @@ -112,7 +111,7 @@ class FaxDocument(TextDocument): myFieldHandler.changeUserFieldContent( "PostCode", oUserDataAccess.getByName("postalcode")) myFieldHandler.changeUserFieldContent( - PropertyNames.PROPERTY_STATE, oUserDataAccess.getByName("st")) + "State", oUserDataAccess.getByName("st")) myFieldHandler.changeUserFieldContent( "City", oUserDataAccess.getByName("l")) myFieldHandler.changeUserFieldContent( diff --git a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py index 1074f14b47ee..8bfc6c47eb84 100644 --- a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py +++ b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py @@ -17,7 +17,7 @@ # import traceback import os.path -from .FaxWizardDialog import FaxWizardDialog, PropertyNames, uno, HID +from .FaxWizardDialog import FaxWizardDialog, uno, HID from .CGFaxWizard import CGFaxWizard from .FaxDocument import FaxDocument from ..ui.PathSelection import PathSelection @@ -277,44 +277,41 @@ class FaxWizardDialogImpl(FaxWizardDialog): self.sFaxPath, self.resources.dictBusinessTemplate) self.PrivateFiles = FileAccess.getFolderTitles(xMSF, "pri", self.sFaxPath, self.resources.dictPrivateTemplate) - - 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,)) + + self.xDialogModel.lstBusinessStyle.StringItemList = \ + tuple(self.BusinessFiles[0]) + self.xDialogModel.lstPrivateStyle.StringItemList = \ + tuple(self.PrivateFiles[0]) + self.xDialogModel.lstBusinessStyle.SelectedItems = (0,) + self.xDialogModel.lstPrivateStyle.SelectedItems = (0,) return True except NoValidPathException: traceback.print_exc() return False def initializeElements(self): - self.setControlProperty("chkUseLogo", - PropertyNames.PROPERTY_ENABLED, - self.myFaxDoc.hasElement("Company Logo")) - self.setControlProperty("chkUseSubject", - PropertyNames.PROPERTY_ENABLED, - self.myFaxDoc.hasElement("Subject Line")) - self.setControlProperty("chkUseDate", - PropertyNames.PROPERTY_ENABLED, - self.myFaxDoc.hasElement("Date")) + self.xDialogModel.chkUseLogo.Enabled = \ + self.myFaxDoc.hasElement("Company Logo") + self.xDialogModel.chkUseSubject.Enabled = \ + self.myFaxDoc.hasElement("Subject Line") + self.xDialogModel.chkUseDate.Enabled = \ + self.myFaxDoc.hasElement("Date") self.myFaxDoc.updateDateFields() def initializeSalutation(self): #'Saludation' listbox - self.setControlProperty("lstSalutation", "StringItemList", - tuple(self.resources.SalutationLabels)) + self.xDialogModel.lstSalutation.StringItemList = \ + tuple(self.resources.SalutationLabels) def initializeGreeting(self): #'Complimentary Close' listbox - self.setControlProperty("lstGreeting", "StringItemList", - tuple(self.resources.GreetingLabels)) + self.xDialogModel.lstGreeting.StringItemList = \ + tuple(self.resources.GreetingLabels) def initializeCommunication(self): #'Type of message' listbox - self.setControlProperty("lstCommunicationType", "StringItemList", - tuple(self.resources.CommunicationLabels)) + self.xDialogModel.lstCommunicationType.StringItemList = \ + tuple(self.resources.CommunicationLabels) def __setDefaultForGreetingAndSalutationAndCommunication(self): if not self.lstSalutation.Text: @@ -414,14 +411,11 @@ class FaxWizardDialogImpl(FaxWizardDialog): def optBusinessFaxItemChanged(self): self.lstPrivateStylePos = None - self.setControlProperty("lblBusinessStyle", - PropertyNames.PROPERTY_ENABLED, True) - self.setControlProperty("lstBusinessStyle", - PropertyNames.PROPERTY_ENABLED, True) - self.setControlProperty("lblPrivateStyle", - PropertyNames.PROPERTY_ENABLED, False) - self.setControlProperty("lstPrivateStyle", - PropertyNames.PROPERTY_ENABLED, False) + self.xDialogModel.lblBusinessStyle.Enabled = True + self.xDialogModel.lstBusinessStyle.Enabled = True + self.xDialogModel.lblPrivateStyle.Enabled = False + self.xDialogModel.lstPrivateStyle.Enabled = False + self.lstBusinessStyleItemChanged() self.__enableSenderReceiver() self.__setPossibleFooter(True) @@ -439,14 +433,11 @@ class FaxWizardDialogImpl(FaxWizardDialog): def optPrivateFaxItemChanged(self): self.lstBusinessStylePos = None - self.setControlProperty("lblBusinessStyle", - PropertyNames.PROPERTY_ENABLED, False) - self.setControlProperty("lstBusinessStyle", - PropertyNames.PROPERTY_ENABLED, False) - self.setControlProperty("lblPrivateStyle", - PropertyNames.PROPERTY_ENABLED, True) - self.setControlProperty("lstPrivateStyle", - PropertyNames.PROPERTY_ENABLED, True) + self.xDialogModel.lblBusinessStyle.Enabled = False + self.xDialogModel.lstBusinessStyle.Enabled = False + self.xDialogModel.lblPrivateStyle.Enabled = True + self.xDialogModel.lstPrivateStyle.Enabled = True + self.lstPrivateStyleItemChanged() self.__disableSenderReceiver() self.__setPossibleFooter(False) @@ -467,49 +458,29 @@ class FaxWizardDialogImpl(FaxWizardDialog): xDocProps.Title = self.txtTemplateName.Text def optSenderPlaceholderItemChanged(self): - self.setControlProperty("lblSenderName", - PropertyNames.PROPERTY_ENABLED, False) - self.setControlProperty("lblSenderStreet", - PropertyNames.PROPERTY_ENABLED, False) - self.setControlProperty("lblPostCodeCity", - PropertyNames.PROPERTY_ENABLED, False) - self.setControlProperty("lblSenderFax", - PropertyNames.PROPERTY_ENABLED, False) - self.setControlProperty("txtSenderName", - PropertyNames.PROPERTY_ENABLED, False) - self.setControlProperty("txtSenderStreet", - PropertyNames.PROPERTY_ENABLED, False) - self.setControlProperty("txtSenderPostCode", - PropertyNames.PROPERTY_ENABLED, False) - self.setControlProperty("txtSenderState", - PropertyNames.PROPERTY_ENABLED, False) - self.setControlProperty("txtSenderCity", - PropertyNames.PROPERTY_ENABLED, False) - self.setControlProperty("txtSenderFax", - PropertyNames.PROPERTY_ENABLED, False) + self.xDialogModel.lblSenderName.Enabled = False + self.xDialogModel.lblSenderStreet.Enabled = False + self.xDialogModel.lblPostCodeCity.Enabled = False + self.xDialogModel.lblSenderFax.Enabled = False + self.xDialogModel.txtSenderName.Enabled = False + self.xDialogModel.txtSenderStreet.Enabled = False + self.xDialogModel.txtSenderPostCode.Enabled = False + self.xDialogModel.txtSenderState.Enabled = False + self.xDialogModel.txtSenderCity.Enabled = False + self.xDialogModel.txtSenderFax.Enabled = False self.myFaxDoc.fillSenderWithUserData() def optSenderDefineItemChanged(self): - self.setControlProperty("lblSenderName", - PropertyNames.PROPERTY_ENABLED, True) - self.setControlProperty("lblSenderStreet", - PropertyNames.PROPERTY_ENABLED, True) - self.setControlProperty("lblPostCodeCity", - PropertyNames.PROPERTY_ENABLED, True) - self.setControlProperty("lblSenderFax", - PropertyNames.PROPERTY_ENABLED, True) - self.setControlProperty("txtSenderName", - PropertyNames.PROPERTY_ENABLED, True) - self.setControlProperty("txtSenderStreet", - PropertyNames.PROPERTY_ENABLED, True) - self.setControlProperty("txtSenderPostCode", - PropertyNames.PROPERTY_ENABLED, True) - self.setControlProperty("txtSenderState", - PropertyNames.PROPERTY_ENABLED, True) - self.setControlProperty("txtSenderCity", - PropertyNames.PROPERTY_ENABLED, True) - self.setControlProperty("txtSenderFax", - PropertyNames.PROPERTY_ENABLED, True) + self.xDialogModel.lblSenderName.Enabled = True + self.xDialogModel.lblSenderStreet.Enabled = True + self.xDialogModel.lblPostCodeCity.Enabled = True + self.xDialogModel.lblSenderFax.Enabled = True + self.xDialogModel.txtSenderName.Enabled = True + self.xDialogModel.txtSenderStreet.Enabled = True + self.xDialogModel.txtSenderPostCode.Enabled = True + self.xDialogModel.txtSenderState.Enabled = True + self.xDialogModel.txtSenderCity.Enabled = True + self.xDialogModel.txtSenderFax.Enabled = True self.myFieldHandler = TextFieldHandler(self.myFaxDoc.xMSF, self.myFaxDoc.xTextDocument) @@ -538,7 +509,7 @@ class FaxWizardDialogImpl(FaxWizardDialog): def txtSenderStateTextChanged(self): self.myFieldHandler.changeUserFieldContent( - PropertyNames.PROPERTY_STATE, self.txtSenderState.Text) + "State", self.txtSenderState.Text) def txtSenderFaxTextChanged(self): self.myFieldHandler.changeUserFieldContent( @@ -593,8 +564,7 @@ class FaxWizardDialogImpl(FaxWizardDialog): def chkUseFooterItemChanged(self): try: bFooterPossible = bool(self.chkUseFooter.State) \ - and bool(self.getControlProperty("chkUseFooter", - PropertyNames.PROPERTY_ENABLED)) + and bool(self.xDialogModel.chkUseFooter.Enabled) if bool(self.chkFooterNextPages.State): self.myFaxDoc.switchFooter("First Page", False, bool(self.chkFooterPageNumbers.State), @@ -631,9 +601,8 @@ class FaxWizardDialogImpl(FaxWizardDialog): def chkUseSalutationItemChanged(self): self.myFaxDoc.switchUserField("Salutation", self.lstSalutation.Text, bool(self.chkUseSalutation.State)) - self.setControlProperty("lstSalutation", - PropertyNames.PROPERTY_ENABLED, - bool(self.chkUseSalutation.State)) + self.xDialogModel.lstSalutation.Enabled = \ + bool(self.chkUseSalutation.State) def lstSalutationItemChanged(self): self.myFaxDoc.switchUserField("Salutation", @@ -643,9 +612,8 @@ class FaxWizardDialogImpl(FaxWizardDialog): self.myFaxDoc.switchUserField("CommunicationType", self.lstCommunicationType.Text, bool(self.chkUseCommunicationType.State)) - self.setControlProperty("lstCommunicationType", - PropertyNames.PROPERTY_ENABLED, - bool(self.chkUseCommunicationType.State)) + self.xDialogModel.lstCommunicationType.Enabled = \ + bool(self.chkUseCommunicationType.State) def lstCommunicationItemChanged(self): self.myFaxDoc.switchUserField("CommunicationType", @@ -655,17 +623,15 @@ class FaxWizardDialogImpl(FaxWizardDialog): def chkUseGreetingItemChanged(self): self.myFaxDoc.switchUserField("Greeting", self.lstGreeting.Text, bool(self.chkUseGreeting.State)) - self.setControlProperty("lstGreeting", - PropertyNames.PROPERTY_ENABLED, - bool(self.chkUseGreeting.State)) + self.xDialogModel.lstGreeting.Enabled = \ + bool(self.chkUseGreeting.State) def lstGreetingItemChanged(self): self.myFaxDoc.switchUserField("Greeting", self.lstGreeting.Text, bool(self.chkUseGreeting.State)) def __setPossibleFooter(self, bState): - self.setControlProperty("chkUseFooter", - PropertyNames.PROPERTY_ENABLED, bState) + self.xDialogModel.chkUseFooter.Enabled = bState if not bState: self.chkUseFooter.State = 0 diff --git a/wizards/com/sun/star/wizards/letter/LetterDocument.py b/wizards/com/sun/star/wizards/letter/LetterDocument.py index 4ef902374586..75025a2c6c64 100644 --- a/wizards/com/sun/star/wizards/letter/LetterDocument.py +++ b/wizards/com/sun/star/wizards/letter/LetterDocument.py @@ -18,7 +18,6 @@ from ..text.TextDocument import TextDocument, traceback, \ TextFieldHandler, Configuration from ..text.TextSectionHandler import TextSectionHandler -from ..common.PropertyNames import PropertyNames from com.sun.star.table import BorderLine from com.sun.star.text.ControlCharacter import PARAGRAPH_BREAK @@ -124,8 +123,7 @@ class LetterDocument(TextDocument): myFieldHandler.changeUserFieldContent( "City", oUserDataAccess.getByName("l")) myFieldHandler.changeUserFieldContent( - PropertyNames.PROPERTY_STATE, - oUserDataAccess.getByName("st")) + "State", oUserDataAccess.getByName("st")) except Exception: traceback.print_exc() @@ -183,40 +181,20 @@ class BusinessPaperObject(object): self.xTextDocument.createInstance( "com.sun.star.text.TextFrame") self.setFramePosition() - Helper.setUnoPropertyValue( - self.xFrame, - "AnchorType", AT_PAGE) - Helper.setUnoPropertyValue( - self.xFrame, - "SizeType", FIX) + self.xFrame.AnchorType = AT_PAGE + self.xFrame.SizeType = FIX - Helper.setUnoPropertyValue( - self.xFrame, - "TextWrap", THROUGHT) - Helper.setUnoPropertyValue( - self.xFrame, - "Opaque", True); - Helper.setUnoPropertyValue( - self.xFrame, - "BackColor", 15790320) + self.xFrame.TextWrap = THROUGHT + self.xFrame.Opaque = True + self.xFrame.BackColor = 15790320 myBorder = BorderLine() myBorder.OuterLineWidth = 0 - Helper.setUnoPropertyValue( - self.xFrame, - "LeftBorder", myBorder) - Helper.setUnoPropertyValue( - self.xFrame, - "RightBorder", myBorder) - Helper.setUnoPropertyValue( - self.xFrame, - "TopBorder", myBorder) - Helper.setUnoPropertyValue( - self.xFrame, - "BottomBorder", myBorder) - Helper.setUnoPropertyValue( - self.xFrame, - "Print", False) + self.xFrame.LeftBorder = myBorder + self.xFrame.RightBorder = myBorder + self.xFrame.TopBorder = myBorder + self.xFrame.BottomBorder = myBorder + self.xFrame.Print = False xTextCursor = \ self.xTextDocument.Text.createTextCursor() xTextCursor.gotoEnd(True) @@ -238,30 +216,14 @@ class BusinessPaperObject(object): def setFramePosition(self): try: - Helper.setUnoPropertyValue( - self.xFrame, - "HoriOrient", NONEHORI) - Helper.setUnoPropertyValue( - self.xFrame, - "VertOrient", NONEVERT) - Helper.setUnoPropertyValue( - self.xFrame, - PropertyNames.PROPERTY_HEIGHT, self.iHeight) - Helper.setUnoPropertyValue( - self.xFrame, - PropertyNames.PROPERTY_WIDTH, self.iWidth) - Helper.setUnoPropertyValue( - self.xFrame, - "HoriOrientPosition", self.iXPos) - Helper.setUnoPropertyValue( - self.xFrame, - "VertOrientPosition", self.iYPos) - Helper.setUnoPropertyValue( - self.xFrame, - "HoriOrientRelation", PAGE_FRAME) - Helper.setUnoPropertyValue( - self.xFrame, - "VertOrientRelation", PAGE_FRAME) + self.xFrame.HoriOrient = NONEHORI + self.xFrame.VertOrient = NONEVERT + self.xFrame.Height = self.iHeight + self.xFrame.Width = self.iWidth + self.xFrame.HoriOrientPosition = self.iXPos + self.xFrame.VertOrientPosition = self.iYPos + self.xFrame.HoriOrientRelation = PAGE_FRAME + self.xFrame.VertOrientRelation = PAGE_FRAME except Exception: traceback.print_exc() diff --git a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py index 2c451335c25c..29b802fcd601 100644 --- a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py +++ b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py @@ -17,8 +17,7 @@ # import traceback import os.path -from .LetterWizardDialog import LetterWizardDialog, PropertyNames, uno, \ - HelpIds, HID +from .LetterWizardDialog import LetterWizardDialog, uno, HelpIds, HID from .LetterDocument import LetterDocument, BusinessPaperObject from .CGLetterWizard import CGLetterWizard from ..common.NoValidPathException import NoValidPathException @@ -266,20 +265,13 @@ class LetterWizardDialogImpl(LetterWizardDialog): def optBusinessLetterItemChanged(self): self.lstPrivateStylePos = None self.lstPrivOfficialStylePos = None - self.setControlProperty( - "lblBusinessStyle", PropertyNames.PROPERTY_ENABLED, True) - self.setControlProperty( - "lstBusinessStyle", PropertyNames.PROPERTY_ENABLED, True) - self.setControlProperty( - "chkBusinessPaper", PropertyNames.PROPERTY_ENABLED, True) - self.setControlProperty( - "lblPrivOfficialStyle", PropertyNames.PROPERTY_ENABLED, False) - self.setControlProperty( - "lstPrivOfficialStyle", PropertyNames.PROPERTY_ENABLED, False) - self.setControlProperty( - "lblPrivateStyle", PropertyNames.PROPERTY_ENABLED, False) - self.setControlProperty( - "lstPrivateStyle", PropertyNames.PROPERTY_ENABLED, False) + self.xDialogModel.lblBusinessStyle.Enabled = True + self.xDialogModel.lstBusinessStyle.Enabled = True + self.xDialogModel.chkBusinessPaper.Enabled = True + self.xDialogModel.lblPrivOfficialStyle.Enabled = False + self.xDialogModel.lstPrivOfficialStyle.Enabled = False + self.xDialogModel.lblPrivateStyle.Enabled = False + self.xDialogModel.lstPrivateStyle.Enabled = False self.lstBusinessStyleItemChanged() self.enableSenderReceiver() self.setPossibleFooter(True) @@ -289,20 +281,13 @@ class LetterWizardDialogImpl(LetterWizardDialog): def optPrivOfficialLetterItemChanged(self): self.lstBusinessStylePos = None self.lstPrivateStylePos = None - self.setControlProperty( - "lblBusinessStyle", PropertyNames.PROPERTY_ENABLED, False) - self.setControlProperty( - "lstBusinessStyle", PropertyNames.PROPERTY_ENABLED, False) - self.setControlProperty( - "chkBusinessPaper", PropertyNames.PROPERTY_ENABLED, False) - self.setControlProperty( - "lblPrivOfficialStyle", PropertyNames.PROPERTY_ENABLED, True) - self.setControlProperty( - "lstPrivOfficialStyle", PropertyNames.PROPERTY_ENABLED, True) - self.setControlProperty( - "lblPrivateStyle", PropertyNames.PROPERTY_ENABLED, False) - self.setControlProperty( - "lstPrivateStyle", PropertyNames.PROPERTY_ENABLED, False) + self.xDialogModel.lblBusinessStyle.Enabled = False + self.xDialogModel.lstBusinessStyle.Enabled = False + self.xDialogModel.chkBusinessPaper.Enabled = False + self.xDialogModel.lblPrivOfficialStyle.Enabled = True + self.xDialogModel.lstPrivOfficialStyle.Enabled = True + self.xDialogModel.lblPrivateStyle.Enabled = False + self.xDialogModel.lstPrivateStyle.Enabled = False self.lstPrivOfficialStyleItemChanged() self.disableBusinessPaper() self.enableSenderReceiver() @@ -313,20 +298,13 @@ class LetterWizardDialogImpl(LetterWizardDialog): def optPrivateLetterItemChanged(self): self.lstBusinessStylePos = None self.lstPrivOfficialStylePos = None - self.setControlProperty( - "lblBusinessStyle", PropertyNames.PROPERTY_ENABLED, False) - self.setControlProperty( - "lstBusinessStyle", PropertyNames.PROPERTY_ENABLED, False) - self.setControlProperty( - "chkBusinessPaper", PropertyNames.PROPERTY_ENABLED, False) - self.setControlProperty( - "lblPrivOfficialStyle", PropertyNames.PROPERTY_ENABLED, False) - self.setControlProperty( - "lstPrivOfficialStyle", PropertyNames.PROPERTY_ENABLED, False) - self.setControlProperty( - "lblPrivateStyle", PropertyNames.PROPERTY_ENABLED, True) - self.setControlProperty( - "lstPrivateStyle", PropertyNames.PROPERTY_ENABLED, True) + self.xDialogModel.lblBusinessStyle.Enabled = False + self.xDialogModel.lstBusinessStyle.Enabled = False + self.xDialogModel.chkBusinessPaper.Enabled = False + self.xDialogModel.lblPrivOfficialStyle.Enabled = False + self.xDialogModel.lstPrivOfficialStyle.Enabled = False + self.xDialogModel.lblPrivateStyle.Enabled = True + self.xDialogModel.lstPrivateStyle.Enabled = True self.lstPrivateStyleItemChanged() self.disableBusinessPaper() self.disableSenderReceiver() @@ -335,41 +313,25 @@ class LetterWizardDialogImpl(LetterWizardDialog): self.myPathSelection.initializePath() def optSenderPlaceholderItemChanged(self): - self.setControlProperty( - "lblSenderName", PropertyNames.PROPERTY_ENABLED, False) - self.setControlProperty( - "lblSenderStreet", PropertyNames.PROPERTY_ENABLED, False) - self.setControlProperty( - "lblPostCodeCity", PropertyNames.PROPERTY_ENABLED, False) - self.setControlProperty( - "txtSenderName", PropertyNames.PROPERTY_ENABLED, False) - self.setControlProperty( - "txtSenderStreet", PropertyNames.PROPERTY_ENABLED, False) - self.setControlProperty( - "txtSenderPostCode", PropertyNames.PROPERTY_ENABLED, False) - self.setControlProperty( - "txtSenderState", PropertyNames.PROPERTY_ENABLED, False) - self.setControlProperty( - "txtSenderCity", PropertyNames.PROPERTY_ENABLED, False) + self.xDialogModel.lblSenderName.Enabled = False + self.xDialogModel.lblSenderStreet.Enabled = False + self.xDialogModel.lblPostCodeCity.Enabled = False + self.xDialogModel.txtSenderName.Enabled = False + self.xDialogModel.txtSenderStreet.Enabled = False + self.xDialogModel.txtSenderPostCode.Enabled = False + self.xDialogModel.txtSenderState.Enabled = False + self.xDialogModel.txtSenderCity.Enabled = False self.myLetterDoc.fillSenderWithUserData() def optSenderDefineItemChanged(self): - self.setControlProperty( - "lblSenderName", PropertyNames.PROPERTY_ENABLED, True) - self.setControlProperty( - "lblSenderStreet", PropertyNames.PROPERTY_ENABLED, True) - self.setControlProperty( - "lblPostCodeCity", PropertyNames.PROPERTY_ENABLED, True) - self.setControlProperty( - "txtSenderName", PropertyNames.PROPERTY_ENABLED, True) - self.setControlProperty( - "txtSenderStreet", PropertyNames.PROPERTY_ENABLED, True) - self.setControlProperty( - "txtSenderPostCode", PropertyNames.PROPERTY_ENABLED, True) - self.setControlProperty( - "txtSenderState", PropertyNames.PROPERTY_ENABLED, True) - self.setControlProperty( - "txtSenderCity", PropertyNames.PROPERTY_ENABLED, True) + self.xDialogModel.lblSenderName.Enabled = True + self.xDialogModel.lblSenderStreet.Enabled = True + self.xDialogModel.lblPostCodeCity.Enabled = True + self.xDialogModel.txtSenderName.Enabled = True + self.xDialogModel.txtSenderStreet.Enabled = True + self.xDialogModel.txtSenderPostCode.Enabled = True + self.xDialogModel.txtSenderState.Enabled = True + self.xDialogModel.txtSenderCity.Enabled = True self.txtSenderNameTextChanged() self.txtSenderStreetTextChanged() self.txtSenderPostCodeTextChanged() @@ -459,43 +421,19 @@ class LetterWizardDialogImpl(LetterWizardDialog): int(self.numLogoHeight.Value * 1000), int(self.numLogoX.Value * 1000), self.numLogoY.Value * 1000) - self.setControlProperty( - "numLogoHeight", PropertyNames.PROPERTY_ENABLED, True) - self.setControlProperty( - "lblCompanyLogoHeight", PropertyNames.PROPERTY_ENABLED, True) - self.setControlProperty( - "numLogoWidth", PropertyNames.PROPERTY_ENABLED, True) - self.setControlProperty( - "lblCompanyLogoWidth", PropertyNames.PROPERTY_ENABLED, True) - self.setControlProperty( - "numLogoX", PropertyNames.PROPERTY_ENABLED, True) - self.setControlProperty( - "lblCompanyLogoX", PropertyNames.PROPERTY_ENABLED, True) - self.setControlProperty( - "numLogoY", PropertyNames.PROPERTY_ENABLED, True) - self.setControlProperty( - "lblCompanyLogoY", PropertyNames.PROPERTY_ENABLED, True) + self.xDialogModel.numLogoHeight.Enabled = True + self.xDialogModel.numLogoWidth.Enabled = True + self.xDialogModel.numLogoX.Enabled = True + self.xDialogModel.numLogoY.Enabled = True self.setPossibleLogo(False) else: if self.BusCompanyLogo != None: self.BusCompanyLogo.removeFrame() - self.setControlProperty( - "numLogoHeight", PropertyNames.PROPERTY_ENABLED, False) - self.setControlProperty( - "lblCompanyLogoHeight", PropertyNames.PROPERTY_ENABLED, False) - self.setControlProperty( - "numLogoWidth", PropertyNames.PROPERTY_ENABLED, False) - self.setControlProperty( - "lblCompanyLogoWidth", PropertyNames.PROPERTY_ENABLED, False) - self.setControlProperty( - "numLogoX", PropertyNames.PROPERTY_ENABLED, False) - self.setControlProperty( - "lblCompanyLogoX", PropertyNames.PROPERTY_ENABLED, False) - self.setControlProperty( - "numLogoY", PropertyNames.PROPERTY_ENABLED, False) - self.setControlProperty( - "lblCompanyLogoY", PropertyNames.PROPERTY_ENABLED, False) + self.xDialogModel.numLogoHeight.Enabled = False + self.xDialogModel.numLogoWidth.Enabled = False + self.xDialogModel.numLogoX.Enabled = False + self.xDialogModel.numLogoY.Enabled = False self.setPossibleLogo(True) def chkPaperCompanyAddressItemChanged(self): @@ -512,22 +450,10 @@ class LetterWizardDialogImpl(LetterWizardDialog): int(self.numAddressHeight.Value * 1000), int(self.numAddressX.Value * 1000), int(self.numAddressY.Value * 1000)) - self.setControlProperty( - "numAddressHeight", PropertyNames.PROPERTY_ENABLED, True) - self.setControlProperty( - "lblCompanyAddressHeight", PropertyNames.PROPERTY_ENABLED, True) - self.setControlProperty( - "numAddressWidth", PropertyNames.PROPERTY_ENABLED, True) - self.setControlProperty( - "lblCompanyAddressWidth", PropertyNames.PROPERTY_ENABLED, True) - self.setControlProperty( - "numAddressX", PropertyNames.PROPERTY_ENABLED, True) - self.setControlProperty( - "lblCompanyAddressX", PropertyNames.PROPERTY_ENABLED, True) - self.setControlProperty( - "numAddressY", PropertyNames.PROPERTY_ENABLED, True) - self.setControlProperty( - "lblCompanyAddressY", PropertyNames.PROPERTY_ENABLED, True) + self.xDialogModel.numAddressHeight.Enabled = True + self.xDialogModel.numAddressWidth.Enabled = True + self.xDialogModel.numAddressX.Enabled = True + self.xDialogModel.numAddressY.Enabled = True if self.myLetterDoc.hasElement("Sender Address"): self.myLetterDoc.switchElement( "Sender Address", False) @@ -538,22 +464,10 @@ class LetterWizardDialogImpl(LetterWizardDialog): else: if self.BusCompanyAddress is not None: self.BusCompanyAddress.removeFrame() - self.setControlProperty( - "numAddressHeight", PropertyNames.PROPERTY_ENABLED, False) - self.setControlProperty( - "lblCompanyAddressHeight", PropertyNames.PROPERTY_ENABLED, False) - self.setControlProperty( - "numAddressWidth", PropertyNames.PROPERTY_ENABLED, False) - self.setControlProperty( - "lblCompanyAddressWidth", PropertyNames.PROPERTY_ENABLED, False) - self.setControlProperty( - "numAddressX", PropertyNames.PROPERTY_ENABLED, False) - self.setControlProperty( - "lblCompanyAddressX", PropertyNames.PROPERTY_ENABLED, False) - self.setControlProperty( - "numAddressY", PropertyNames.PROPERTY_ENABLED, False) - self.setControlProperty( - "lblCompanyAddressY", PropertyNames.PROPERTY_ENABLED, False) + self.xDialogModel.numAddressHeight.Enabled = False + self.xDialogModel.numAddressWidth.Enabled = False + self.xDialogModel.numAddressX.Enabled = False + self.xDialogModel.numAddressY.Enabled = False if self.myLetterDoc.hasElement("Sender Address"): self.myLetterDoc.switchElement("Sender Address", True) @@ -609,45 +523,38 @@ class LetterWizardDialogImpl(LetterWizardDialog): int(self.numFooterHeight.Value * 1000), 0, int(self.myLetterDoc.DocSize.Height - \ (self.numFooterHeight.Value * 1000))) - self.setControlProperty( - "numFooterHeight", PropertyNames.PROPERTY_ENABLED, True) - self.setControlProperty( - "lblFooterHeight", PropertyNames.PROPERTY_ENABLED, True) + self.xDialogModel.numFooterHeight.Enabled = True + self.xDialogModel.lblFooterHeight.Enabled = True self.setPossibleFooter(False) else: if self.BusFooter != None: self.BusFooter.removeFrame() - self.setControlProperty( - "numFooterHeight", PropertyNames.PROPERTY_ENABLED, False) - self.setControlProperty( - "lblFooterHeight", PropertyNames.PROPERTY_ENABLED, False) + self.xDialogModel.numFooterHeight.Enabled = False + self.xDialogModel.lblFooterHeight.Enabled = False self.setPossibleFooter(True) def chkUseLogoItemChanged(self): try: if self.myLetterDoc.hasElement("Company Logo"): logostatus = \ - bool(self.getControlProperty( - "chkUseLogo", PropertyNames.PROPERTY_ENABLED)) \ + bool(self.xDialogModel.chkUseLogo.Enabled) \ and (self.chkUseLogo.State != 0) self.myLetterDoc.switchElement( "Company Logo", logostatus) - except IllegalArgumentException: + except Exception: traceback.print_exc() def chkUseAddressReceiverItemChanged(self): try: if self.myLetterDoc.hasElement("Sender Address Repeated"): rstatus = \ - bool(self.getControlProperty( - "chkUseAddressReceiver", - PropertyNames.PROPERTY_ENABLED)) \ + bool(self.xDialogModel.chkUseAddressReceiver.Enabled) \ and (self.chkUseAddressReceiver.State != 0) self.myLetterDoc.switchElement( "Sender Address Repeated", rstatus) - except IllegalArgumentException: + except Exception: traceback.print_exc() def chkUseSignsItemChanged(self): @@ -668,8 +575,7 @@ class LetterWizardDialogImpl(LetterWizardDialog): def chkUseFooterItemChanged(self): try: bFooterPossible = (self.chkUseFooter.State != 0) \ - and bool(self.getControlProperty( - "chkUseFooter", PropertyNames.PROPERTY_ENABLED)) + and bool(self.xDialogModel.chkUseFooter.Enabled) if self.chkFooterNextPages.State != 0: self.myLetterDoc.switchFooter( "First Page", False, self.chkFooterPageNumbers.State != 0, @@ -697,20 +603,17 @@ class LetterWizardDialogImpl(LetterWizardDialog): self.chkUseFooterItemChanged() def setPossibleFooter(self, bState): - self.setControlProperty( - "chkUseFooter", PropertyNames.PROPERTY_ENABLED, bState) + self.xDialogModel.chkUseFooter.Enabled = bState self.chkUseFooterItemChanged() def setPossibleAddressReceiver(self, bState): if self.myLetterDoc.hasElement("Sender Address Repeated"): - self.setControlProperty( - "chkUseAddressReceiver", PropertyNames.PROPERTY_ENABLED, bState) + self.xDialogModel.chkUseAddressReceiver.Enabled = bState self.chkUseAddressReceiverItemChanged() def setPossibleLogo(self, bState): if self.myLetterDoc.hasElement("Company Logo"): - self.setControlProperty( - "chkUseLogo", PropertyNames.PROPERTY_ENABLED, bState) + self.xDialogModel.chkUseLogo.Enabled = bState self.chkUseLogoItemChanged() def txtFooterTextChanged(self): @@ -744,7 +647,7 @@ class LetterWizardDialogImpl(LetterWizardDialog): myFieldHandler = TextFieldHandler( self.myLetterDoc.xMSF, self.myLetterDoc.xTextDocument) myFieldHandler.changeUserFieldContent( - PropertyNames.PROPERTY_STATE, self.txtSenderState.Text) + "State", self.txtSenderState.Text) def txtTemplateNameTextChanged(self): xDocProps = self.myLetterDoc.xTextDocument.DocumentProperties @@ -755,9 +658,8 @@ class LetterWizardDialogImpl(LetterWizardDialog): self.myLetterDoc.switchUserField( "Salutation", self.lstSalutation.Text, self.chkUseSalutation.State != 0) - self.setControlProperty( - "lstSalutation", PropertyNames.PROPERTY_ENABLED, - self.chkUseSalutation.State != 0) + self.xDialogModel.lstSalutation.Enabled = \ + self.chkUseSalutation.State != 0 def lstSalutationItemChanged(self): self.myLetterDoc.switchUserField( @@ -767,9 +669,8 @@ class LetterWizardDialogImpl(LetterWizardDialog): def chkUseGreetingItemChanged(self): self.myLetterDoc.switchUserField( "Greeting", self.lstGreeting.Text, self.chkUseGreeting.State != 0) - self.setControlProperty( - "lstGreeting", PropertyNames.PROPERTY_ENABLED, - self.chkUseGreeting.State != 0) + self.xDialogModel.lstGreeting.Enabled = \ + self.chkUseGreeting.State != 0 def setDefaultForGreetingAndSalutation(self): if self.lstSalutation.Text: @@ -790,31 +691,19 @@ class LetterWizardDialogImpl(LetterWizardDialog): self.setPossibleSenderData(True) def setPossibleSenderData(self, bState): - self.setControlProperty( - "optSenderDefine", PropertyNames.PROPERTY_ENABLED, bState) - self.setControlProperty( - "optSenderPlaceholder", PropertyNames.PROPERTY_ENABLED, bState) - self.setControlProperty( - "lblSenderAddress", PropertyNames.PROPERTY_ENABLED, bState) + self.xDialogModel.optSenderDefine.Enabled = bState + self.xDialogModel.optSenderPlaceholder.Enabled = bState + self.xDialogModel.lblSenderAddress.Enabled = bState if not bState: - self.setControlProperty( - "txtSenderCity", PropertyNames.PROPERTY_ENABLED, bState) - self.setControlProperty( - "txtSenderName", PropertyNames.PROPERTY_ENABLED, bState) - self.setControlProperty( - "txtSenderPostCode", PropertyNames.PROPERTY_ENABLED, bState) - self.setControlProperty( - "txtSenderStreet", PropertyNames.PROPERTY_ENABLED, bState) - self.setControlProperty( - "txtSenderCity", PropertyNames.PROPERTY_ENABLED, bState) - self.setControlProperty( - "txtSenderState", PropertyNames.PROPERTY_ENABLED, bState) - self.setControlProperty( - "lblSenderName", PropertyNames.PROPERTY_ENABLED, bState) - self.setControlProperty( - "lblSenderStreet", PropertyNames.PROPERTY_ENABLED, bState) - self.setControlProperty( - "lblPostCodeCity", PropertyNames.PROPERTY_ENABLED, bState) + self.xDialogModel.txtSenderCity.Enabled = bState + self.xDialogModel.txtSenderName.Enabled = bState + self.xDialogModel.txtSenderPostCode.Enabled = bState + self.xDialogModel.txtSenderStreet.Enabled = bState + self.xDialogModel.txtSenderCity.Enabled = bState + self.xDialogModel.txtSenderState.Enabled = bState + self.xDialogModel.lblSenderName.Enabled = bState + self.xDialogModel.lblSenderStreet.Enabled = bState + self.xDialogModel.lblPostCodeCity.Enabled = bState def enableSenderReceiver(self): BPaperItem = self.getRoadmapItemByID( @@ -865,14 +754,12 @@ class LetterWizardDialogImpl(LetterWizardDialog): traceback.print_exc() def initializeSalutation(self): - self.setControlProperty( - "lstSalutation", "StringItemList", - tuple(self.resources.SalutationLabels)) + self.xDialogModel.lstSalutation.StringItemList = \ + tuple(self.resources.SalutationLabels) def initializeGreeting(self): - self.setControlProperty( - "lstGreeting", "StringItemList", - tuple(self.resources.GreetingLabels)) + self.xDialogModel.lstGreeting.StringItemList = \ + tuple(self.resources.GreetingLabels) def getCurrentLetter(self): if self.myConfig.cp_LetterType == 0: @@ -906,39 +793,28 @@ class LetterWizardDialogImpl(LetterWizardDialog): self.PrivateFiles = \ FileAccess.getFolderTitles( xMSF, "pri", sLetterPath, self.resources.dictPrivateTemplate) - self.setControlProperty( - "lstBusinessStyle", "StringItemList", - tuple(self.BusinessFiles[0])) - self.setControlProperty( - "lstPrivOfficialStyle", "StringItemList", - tuple(self.OfficialFiles[0])) - self.setControlProperty( - "lstPrivateStyle", "StringItemList", - tuple(self.PrivateFiles[0])) - self.setControlProperty( - "lstBusinessStyle", "SelectedItems", (0,)) - self.setControlProperty( - "lstPrivOfficialStyle", "SelectedItems", (0,)) - self.setControlProperty( - "lstPrivateStyle", "SelectedItems", (0,)) + self.xDialogModel.lstBusinessStyle.StringItemList = \ + tuple(self.BusinessFiles[0]) + self.xDialogModel.lstPrivOfficialStyle.StringItemList = \ + tuple(self.OfficialFiles[0]) + self.xDialogModel.lstPrivateStyle.StringItemList = \ + tuple(self.PrivateFiles[0]) + self.xDialogModel.lstBusinessStyle.SelectedItems = (0,) + self.xDialogModel.lstPrivOfficialStyle.SelectedItems = (0,) + self.xDialogModel.lstPrivateStyle.SelectedItems = (0,) return True def initializeElements(self): - self.setControlProperty( - "chkUseLogo", PropertyNames.PROPERTY_ENABLED, - self.myLetterDoc.hasElement("Company Logo")) - self.setControlProperty( - "chkUseBendMarks", PropertyNames.PROPERTY_ENABLED, - self.myLetterDoc.hasElement("Bend Marks")) - self.setControlProperty( - "chkUseAddressReceiver", PropertyNames.PROPERTY_ENABLED, - self.myLetterDoc.hasElement("Sender Address Repeated")) - self.setControlProperty( - "chkUseSubject", PropertyNames.PROPERTY_ENABLED, - self.myLetterDoc.hasElement("Subject Line")) - self.setControlProperty( - "chkUseSigns", PropertyNames.PROPERTY_ENABLED, - self.myLetterDoc.hasElement("Letter Signs")) + self.xDialogModel.chkUseLogo.Enabled = \ + self.myLetterDoc.hasElement("Company Logo") + self.xDialogModel.chkUseBendMarks.Enabled = \ + self.myLetterDoc.hasElement("Bend Marks") + self.xDialogModel.chkUseAddressReceiver.Enabled = \ + self.myLetterDoc.hasElement("Sender Address Repeated") + self.xDialogModel.chkUseSubject.Enabled = \ + self.myLetterDoc.hasElement("Subject Line") + self.xDialogModel.chkUseSigns.Enabled = \ + self.myLetterDoc.hasElement("Letter Signs") self.myLetterDoc.updateDateFields() def setConfiguration(self): diff --git a/wizards/com/sun/star/wizards/ui/PathSelection.py b/wizards/com/sun/star/wizards/ui/PathSelection.py index 47159a59fccc..bd9ba6adbdd5 100644 --- a/wizards/com/sun/star/wizards/ui/PathSelection.py +++ b/wizards/com/sun/star/wizards/ui/PathSelection.py @@ -71,8 +71,7 @@ class PathSelection(object): (Enabled, 12, TxtHelpURL, XPos, YPos + 10, DialogStep, (CurTabIndex + 1), Width - 26), self) - self.CurUnoDialog.setControlProperty("txtSavePath", - PropertyNames.PROPERTY_ENABLED, False ) + self.CurUnoDialog.xDialogModel.txtSavePath.Enabled = False self.CurUnoDialog.insertButton("cmdSelectPath", "triggerPathPicker", (PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, diff --git a/wizards/com/sun/star/wizards/ui/UnoDialog.py b/wizards/com/sun/star/wizards/ui/UnoDialog.py index e20c1ff7672c..967136713e62 100644 --- a/wizards/com/sun/star/wizards/ui/UnoDialog.py +++ b/wizards/com/sun/star/wizards/ui/UnoDialog.py @@ -49,29 +49,6 @@ class UnoDialog(object): self.m_oPeerConfig = PeerConfig(self) return self.m_oPeerConfig - def setControlProperty(self, ControlName, PropertyName, PropertyValue): - try: - if PropertyValue is not None: - if not self.xDialogModel.hasByName(ControlName): - return - xPSet = self.xDialogModel.getByName(ControlName) - setattr(xPSet,PropertyName, PropertyValue) - - except Exception: - traceback.print_exc() - - def setControlProperties( - self, ControlName, PropertyNames, PropertyValues): - self.setControlProperty(ControlName, PropertyNames, PropertyValues) - - def getControlProperty(self, ControlName, PropertyName): - try: - xPSet = self.xDialogModel.getByName(ControlName) - return xPSet.getPropertyValue(PropertyName) - except Exception: - traceback.print_exc() - return None - def getMAPConversionFactor(self, ControlName): xControl2 = self.xUnoDialog.getControl(ControlName) aSize = xControl2.Size diff --git a/wizards/com/sun/star/wizards/ui/WizardDialog.py b/wizards/com/sun/star/wizards/ui/WizardDialog.py index eef56271372f..52597a15d5d9 100644 --- a/wizards/com/sun/star/wizards/ui/WizardDialog.py +++ b/wizards/com/sun/star/wizards/ui/WizardDialog.py @@ -170,15 +170,11 @@ class WizardDialog(UnoDialog2): self.leaveStep(self.nOldStep, self.nNewStep) if self.nNewStep != self.nOldStep: if self.nNewStep == self.nMaxStep: - self.setControlProperty( - "btnWizardNext", "DefaultButton", False) - self.setControlProperty( - "btnWizardFinish", "DefaultButton", True) + self.xDialogModel.btnWizardNext.DefaultButton = False + self.xDialogModel.btnWizardFinish.DefaultButton = True else: - self.setControlProperty( - "btnWizardNext", "DefaultButton", True) - self.setControlProperty( - "btnWizardFinish", "DefaultButton", False) + self.xDialogModel.btnWizardNext.DefaultButton = True + self.xDialogModel.btnWizardFinish.DefaultButton = False self.changeToStep(self.nNewStep) self.enterStep(self.nOldStep, self.nNewStep) @@ -287,7 +283,7 @@ class WizardDialog(UnoDialog2): iCancelPosX, iBtnPosY, uno.Any("short",STANDARD), iCurStep, uno.Any("short",(curtabindex + 1)), iButtonWidth), self) - self.setControlProperty("btnWizardNext", "DefaultButton", True) + self.xDialogModel.btnWizardNext.DefaultButton = True except Exception: traceback.print_exc() @@ -310,16 +306,13 @@ class WizardDialog(UnoDialog2): self.enableFinishButton(_bEnableFinish) def enableBackButton(self, enabled): - self.setControlProperty("btnWizardBack", - PropertyNames.PROPERTY_ENABLED, enabled) + self.xDialogModel.btnWizardBack.Enabled = enabled def enableNextButton(self, enabled): - self.setControlProperty("btnWizardNext", - PropertyNames.PROPERTY_ENABLED, enabled) + self.xDialogModel.btnWizardNext.Enabled = enabled def enableFinishButton(self, enabled): - self.setControlProperty("btnWizardFinish", - PropertyNames.PROPERTY_ENABLED, enabled) + self.xDialogModel.btnWizardFinish.Enabled = enabled def enablefromStep(self, _iStep, _bDoEnable): if _iStep <= self.nMaxStep: |