From c6b937f953622ed18aac2e9940eb33a526e20449 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Fri, 1 Jul 2011 15:52:37 +0200 Subject: save RadioButtons too --- wizards/com/sun/star/wizards/common/ConfigGroup.py | 5 +- .../com/sun/star/wizards/common/Configuration.py | 54 ---------------------- .../sun/star/wizards/fax/FaxWizardDialogImpl.py | 6 ++- .../sun/star/wizards/ui/event/RadioDataAware.py | 4 +- 4 files changed, 7 insertions(+), 62 deletions(-) diff --git a/wizards/com/sun/star/wizards/common/ConfigGroup.py b/wizards/com/sun/star/wizards/common/ConfigGroup.py index 9019ffe63..ca1b60a4d 100644 --- a/wizards/com/sun/star/wizards/common/ConfigGroup.py +++ b/wizards/com/sun/star/wizards/common/ConfigGroup.py @@ -20,10 +20,7 @@ class ConfigGroup(ConfigNode): child.writeConfiguration(configView.getByName(propertyName), prefix) else: - try: - setattr(configView,propertyName,getattr(self,field)) - except Exception: - pass + setattr(configView,propertyName,getattr(self,field)) def readConfiguration(self, configurationView, param): for name,data in inspect.getmembers(self): diff --git a/wizards/com/sun/star/wizards/common/Configuration.py b/wizards/com/sun/star/wizards/common/Configuration.py index 20f4bd374..0e3abe128 100644 --- a/wizards/com/sun/star/wizards/common/Configuration.py +++ b/wizards/com/sun/star/wizards/common/Configuration.py @@ -18,25 +18,6 @@ in hierarchy form from the root of the registry. class Configuration(object): - @classmethod - def getNode(self, name, parent): - return parent.getByName(name) - - @classmethod - def Set(self, value, name, parent): - setattr(parent, name, value) - - ''' - @param name - @param parent - @return - @throws Exception - ''' - - @classmethod - def getConfigurationNode(self, name, parent): - return parent.getByName(name) - @classmethod def getConfigurationRoot(self, xmsf, sPath, updateable): oConfigProvider = xmsf.createInstance( @@ -61,10 +42,6 @@ class Configuration(object): return oConfigProvider.createInstanceWithArguments(sView, tuple(args)) - @classmethod - def getChildrenNames(self, configView): - return configView.getElementNames() - @classmethod def getProductName(self, xMSF): try: @@ -112,41 +89,12 @@ class Configuration(object): traceback.print_exc() return None - ''' - This method creates a new configuration node and adds it - to the given view. Note that if a node with the given name - already exists it will be completely removed from - the configuration. - @param configView - @param name - @return the new created configuration node. - @throws com.sun.star.lang.WrappedTargetException - @throws ElementExistException - @throws NoSuchElementException - @throws com.sun.star.uno.Exception - ''' - - @classmethod - def addConfigNode(self, configView, name): - if configView is None: - return configView.getByName(name) - else: - # the new element is the result ! - newNode = configView.createInstance() - # insert it - this also names the element - configView.insertByName(name, newNode) - return newNode - @classmethod def removeNode(self, configView, name): if configView.hasByName(name): configView.removeByName(name) - @classmethod - def commit(self, configView): - configView.commitChanges() - @classmethod def updateConfiguration(self, xmsf, path, name, node, param): view = self.getConfigurationRoot(xmsf, path, True) @@ -262,6 +210,4 @@ class Configuration(object): i += 1 except Exception, e: traceback.print_exc() - return None - diff --git a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py index 72933af51..5564283d7 100644 --- a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py +++ b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py @@ -414,7 +414,7 @@ class FaxWizardDialogImpl(FaxWizardDialog): root = Configuration.getConfigurationRoot(self.xMSF, "/org.openoffice.Office.Writer/Wizards/Fax", True) self.myConfig.writeConfiguration(root, "cp_") - Configuration.commit(root) + root.commitChanges() except Exception, e: traceback.print_exc() @@ -645,7 +645,9 @@ class FaxWizardDialogImpl(FaxWizardDialog): self.chkUseFooterItemChanged() def txtFooterTextChanged(self): - self.chkUseFooterItemChanged() + self.myFaxDoc.switchFooter("First Page", True, + (self.chkFooterPageNumbers.State is not 0), + self.txtFooter.Text) def chkUseSalutationItemChanged(self): self.myFaxDoc.switchUserField("Salutation", diff --git a/wizards/com/sun/star/wizards/ui/event/RadioDataAware.py b/wizards/com/sun/star/wizards/ui/event/RadioDataAware.py index 457f7580b..41ce307a0 100644 --- a/wizards/com/sun/star/wizards/ui/event/RadioDataAware.py +++ b/wizards/com/sun/star/wizards/ui/event/RadioDataAware.py @@ -24,8 +24,8 @@ class RadioDataAware(DataAware): self.radioButtons[selected].State = True def getFromUI(self): - for i in self.radioButtons: - if i.State: + for i in xrange(len(self.radioButtons)): + if self.radioButtons[i].State: return i return -1 -- cgit v1.2.3