diff options
author | Xisco Fauli <anistenis@gmail.com> | 2013-11-23 17:23:19 +0100 |
---|---|---|
committer | Xisco Fauli <anistenis@gmail.com> | 2013-11-23 17:27:16 +0100 |
commit | f86769904747a89bcd7e81ad0d859f38175822c3 (patch) | |
tree | 694f1d5e319ab4f1e9fa3617598af7f19730b514 | |
parent | 2d5695bab3d62f0284669373e472c82e5e45ec2b (diff) |
pyweb: Cleanup publisher options
Change-Id: I4308a831a505b0a5d0ac04b943cd9d6efa89298d
7 files changed, 33 insertions, 55 deletions
diff --git a/wizards/com/sun/star/wizards/ui/event/DataAware.py b/wizards/com/sun/star/wizards/ui/event/DataAware.py index 0fae91a559f6..70e52df47dac 100644 --- a/wizards/com/sun/star/wizards/ui/event/DataAware.py +++ b/wizards/com/sun/star/wizards/ui/event/DataAware.py @@ -53,9 +53,6 @@ class DataAware(object): self._dataObject = dataObject_ self._field = field_ - def enableControls(self, value): - pass - ''' sets the given value to the UI control @param newValue the value to set to the ui control. @@ -89,7 +86,6 @@ class DataAware(object): self.setToUI(data) except Exception: traceback.print_exc() - self.enableControls(data) ''' sets a new data object. Optionally @@ -135,7 +131,6 @@ class DataAware(object): #Listbox Element ui = ui[0] setattr(self._dataObject, self._field, ui) - self.enableControls(ui) except Exception: traceback.print_exc() diff --git a/wizards/com/sun/star/wizards/ui/event/UnoDataAware.py b/wizards/com/sun/star/wizards/ui/event/UnoDataAware.py index 1ed80a10dbc6..1254e981313c 100644 --- a/wizards/com/sun/star/wizards/ui/event/UnoDataAware.py +++ b/wizards/com/sun/star/wizards/ui/event/UnoDataAware.py @@ -34,8 +34,6 @@ For those controls, static convenience methods are offered, to simplify use. class UnoDataAware(DataAware): - disableObjects = [] - def __init__(self, dataObject, field, unoObject_, unoPropName_, isShort=False): super(UnoDataAware,self).__init__(dataObject, field) self.unoControl = unoObject_ @@ -43,10 +41,6 @@ class UnoDataAware(DataAware): self.unoPropName = unoPropName_ self.isShort = isShort - def enableControls(self, value): - for i in self.disableObjects: - i.Model.Enabled = self.getBoolean(value) - def setToUI(self, value): if (isinstance(value, list)): value = tuple(value) @@ -65,28 +59,6 @@ class UnoDataAware(DataAware): else: uno.invoke(self.unoModel, "set" + self.unoPropName, (value,)) - # Try to get from an arbitrary object a boolean value. - # Null returns Boolean.FALSE; - # A Boolean object returns itself. - # An Array returns true if it not empty. - # An Empty String returns Boolean.FALSE. - # everything else returns a Boolean.TRUE. - # @param value - # @return - def getBoolean(self, value): - if (value is None): - return False - elif (isinstance(value, bool)): - return bool(value) - elif (isinstance(value, list)): - return True if (len(value) is not 0) else False - elif (value is ""): - return False - elif (isinstance(value, int)): - return True if (value == 0) else False - else: - return True - def getFromUI(self): return getattr(self.unoModel, self.unoPropName) diff --git a/wizards/com/sun/star/wizards/web/WWD_Events.py b/wizards/com/sun/star/wizards/web/WWD_Events.py index af88c00160db..50d5bc793f29 100644 --- a/wizards/com/sun/star/wizards/web/WWD_Events.py +++ b/wizards/com/sun/star/wizards/web/WWD_Events.py @@ -425,8 +425,8 @@ class WWD_Events(WWD_Startup): ''' def updatePublishUI(self, number): - (self.pubAware[number]).updateUI() - (self.pubAware[number + 1]).updateUI() + self.pubAware[number].updateUI() + self.pubAware[number + 1].updateUI() self.checkPublish() ''' diff --git a/wizards/com/sun/star/wizards/web/WWD_General.py b/wizards/com/sun/star/wizards/web/WWD_General.py index 4a06ce67e80d..cecd51e66365 100644 --- a/wizards/com/sun/star/wizards/web/WWD_General.py +++ b/wizards/com/sun/star/wizards/web/WWD_General.py @@ -30,10 +30,7 @@ from ..common.HelpIds import HelpIds from ..common.PropertyNames import PropertyNames from ..ui.event.ListModelBinder import ListModelBinder -from com.sun.star.lang import IllegalArgumentException - ''' -@author rpiterman This class implements general methods, used by different sub-classes (either WWD_Sturtup, or WWD_Events) or both. ''' @@ -172,6 +169,8 @@ class WWD_General(WebWizardDialog): If it is empty, then step3 and on are disabled. ''' if self.checkDocList(): + self.changeLocalDirState(self.chkLocalDir.Model.State) + self.changeZipState(self.chkZip.Model.State) self.checkPublish() ''' @@ -232,7 +231,7 @@ class WWD_General(WebWizardDialog): if p.cp_Publish: url = getattr(text.Model, _property) if url is None or url == "": - raise IllegalArgumentException () + return False else: return True else: @@ -248,15 +247,12 @@ class WWD_General(WebWizardDialog): ''' def checkPublish_(self): - try: - return \ - self.checkPublish2(LOCAL_PUBLISHER, self.txtLocalDir, "Text") \ - or (not self.proxies and self.checkPublish2( - FTP_PUBLISHER, self.lblFTP, PropertyNames.PROPERTY_LABEL) \ - or self.checkPublish2(ZIP_PUBLISHER, self.txtZip, "Text")) \ - and self.checkSaveSession() - except IllegalArgumentException as ex: - return False + return \ + self.checkPublish2(LOCAL_PUBLISHER, self.txtLocalDir, "Text") \ + or (not self.proxies and self.checkPublish2( + FTP_PUBLISHER, self.lblFTP, PropertyNames.PROPERTY_LABEL) \ + or self.checkPublish2(ZIP_PUBLISHER, self.txtZip, "Text")) \ + and self.checkSaveSession() ''' This method checks if the publishing @@ -269,6 +265,20 @@ class WWD_General(WebWizardDialog): def checkPublish(self): self.enableFinishButton(self.checkPublish_()) + def chkLocalDirItemChanged(self): + self.changeLocalDirState(self.chkLocalDir.Model.State) + self.checkPublish() + + def chkZipItemChanged(self): + self.changeZipState(self.chkZip.Model.State) + self.checkPublish() + + def changeLocalDirState(self, enable): + self.btnLocalDir.Model.Enabled = enable + + def changeZipState(self, enable): + self.btnZip.Model.Enabled = enable + ''' shows a message box "Unexpected Error... " :-) @param ex diff --git a/wizards/com/sun/star/wizards/web/WWD_Startup.py b/wizards/com/sun/star/wizards/web/WWD_Startup.py index f76ffc4f327d..b2dfecda0460 100644 --- a/wizards/com/sun/star/wizards/web/WWD_Startup.py +++ b/wizards/com/sun/star/wizards/web/WWD_Startup.py @@ -127,6 +127,8 @@ class WWD_Startup(WWD_General): self.buildStep5() self.buildStep6() self.buildStep7(self.proxies, exclamationURL) + self.txtLocalDir.Model.Enabled = False + self.txtZip.Model.Enabled = False self.buildStepX() self.xMSF = xmsf xDesktop = Desktop.getDesktop(xmsf) @@ -223,7 +225,6 @@ class WWD_Startup(WWD_General): DataAware.updateUIs(self.genAware) DataAware.updateUIs(self.pubAware) self.sessionNameDA.updateUI() - self.checkPublish() ''' create the peer, add roadmap, @@ -448,9 +449,9 @@ class WWD_Startup(WWD_General): self.pubAware_( LOCAL_PUBLISHER, self.chkLocalDir, self.txtLocalDir, False) self.pubAware_( - FTP_PUBLISHER, self.chkFTP, self.lblFTP, True) - self.pubAware_( ZIP_PUBLISHER, self.chkZip, self.txtZip, False) + self.pubAware_( + FTP_PUBLISHER, self.chkFTP, self.lblFTP, True) self.sessionNameDA = UnoDataAware.attachEditControl( self.settings.cp_DefaultSession, "cp_Name", self.cbSaveSettings, True) @@ -466,8 +467,6 @@ class WWD_Startup(WWD_General): def pubAware_(self, publish, checkbox, textbox, isLabel): p = self.settings.cp_DefaultSession.cp_Publishing.getElement(publish) uda = UnoDataAware.attachCheckBox(p, "cp_Publish", checkbox, True) - uda.Inverse = True - uda.disableObjects = [textbox] self.pubAware.append(uda) if isLabel: aux = UnoDataAware.attachLabel(p, "cp_URL", textbox, False) diff --git a/wizards/com/sun/star/wizards/web/WebWizardConst.py b/wizards/com/sun/star/wizards/web/WebWizardConst.py index 7af2518441f0..f6a2282dc9f7 100644 --- a/wizards/com/sun/star/wizards/web/WebWizardConst.py +++ b/wizards/com/sun/star/wizards/web/WebWizardConst.py @@ -29,7 +29,8 @@ BTNICONSETS_ACTION_PERFORMED = "chooseIconset" # "btnIconSetsActionPerformed" BTNFAVICON_ACTION_PERFORMED = "chooseFavIcon" # "btnFavIconActionPerformed" BTNPREVIEW_ACTION_PERFORMED = "documentPreview" # "btnPreviewActionPerformed" BTNFTP_ACTION_PERFORMED = "setFTPPublish" # "btnFTPActionPerformed" -CHKLOCALDIR_ITEM_CHANGED = "checkPublish" # "chkLocalDirItemChanged" +CHKLOCALDIR_ITEM_CHANGED = "chkLocalDirItemChanged" # "chkLocalDirItemChanged" +CHKZIP_ITEM_CHANGED = "chkZipItemChanged" CHKSAVESETTINGS_ITEM_CHANGED = "checkPublish" # "chkSaveSettingsItemChanged" TXTSAVESETTINGS_TEXT_CHANGED = "checkPublish" # "txtSaveSettingsTextChanged" BTNLOCALDIR_ACTION_PERFORMED = "setPublishLocalDir" # "btnLocalDirActionPerformed" diff --git a/wizards/com/sun/star/wizards/web/WebWizardDialog.py b/wizards/com/sun/star/wizards/web/WebWizardDialog.py index 47a788079f3a..80b221c96310 100644 --- a/wizards/com/sun/star/wizards/web/WebWizardDialog.py +++ b/wizards/com/sun/star/wizards/web/WebWizardDialog.py @@ -599,7 +599,8 @@ class WebWizardDialog(WizardDialog): self.resources.resbtnLocalDir_value, "btnLocalDir", 308, 77, 7, tabIndex + 1, 16), self) self.chkZip = self.insertCheckBox( - "chkZip", None, WebWizardDialog.PROPNAMES_CHKBOX, + "chkZip", CHKZIP_ITEM_CHANGED, + WebWizardDialog.PROPNAMES_CHKBOX, (9, HelpIds.getHelpIdString(HID7_CHK_PUBLISH_ZIP), self.resources.reschkZip_value, "chkZip", 103, 96, 0, 7, tabIndex + 1, 215), self) |