diff options
author | Xisco Fauli <anistenis@gmail.com> | 2013-02-02 22:46:11 +0100 |
---|---|---|
committer | Xisco Fauli <anistenis@gmail.com> | 2013-02-03 00:43:36 +0100 |
commit | 57f01781c62d741e603d90010ea74c121131c9fd (patch) | |
tree | 8a6b8ebff882a73c25da9f90f4443f539c233d23 | |
parent | 98185094cf975dcc3fe4e6c234bea9b46b4e9482 (diff) |
pyagenda: some duck typing here
Change-Id: I6761962178473828039317a6826beaa242954c69
-rw-r--r-- | wizards/com/sun/star/wizards/common/ConfigGroup.py | 7 | ||||
-rw-r--r-- | wizards/com/sun/star/wizards/common/ConfigNode.py | 27 | ||||
-rw-r--r-- | wizards/com/sun/star/wizards/common/ConfigSet.py | 4 |
3 files changed, 5 insertions, 33 deletions
diff --git a/wizards/com/sun/star/wizards/common/ConfigGroup.py b/wizards/com/sun/star/wizards/common/ConfigGroup.py index 225b2fcb7bb7..bda4f96443c8 100644 --- a/wizards/com/sun/star/wizards/common/ConfigGroup.py +++ b/wizards/com/sun/star/wizards/common/ConfigGroup.py @@ -16,10 +16,9 @@ # the License at http://www.apache.org/licenses/LICENSE-2.0 . # import inspect -from .ConfigNode import ConfigNode from .Configuration import Configuration -class ConfigGroup(ConfigNode): +class ConfigGroup(object): def writeConfiguration(self, configurationView, param): for name,data in inspect.getmembers(self): @@ -29,7 +28,7 @@ class ConfigGroup(ConfigNode): def writeField(self, field, configView, prefix): propertyName = field[len(prefix):] child = getattr(self, field) - if isinstance(child, ConfigNode): + if isinstance(child, ConfigGroup): child.writeConfiguration(configView.getByName(propertyName), prefix) else: @@ -43,7 +42,7 @@ class ConfigGroup(ConfigNode): def readField(self, field, configView, prefix): propertyName = field[len(prefix):] child = getattr(self, field) - if isinstance(child, ConfigNode): + if isinstance(child, ConfigGroup): child.readConfiguration(configView.getByName(propertyName), prefix) else: diff --git a/wizards/com/sun/star/wizards/common/ConfigNode.py b/wizards/com/sun/star/wizards/common/ConfigNode.py deleted file mode 100644 index efaeedbacf76..000000000000 --- a/wizards/com/sun/star/wizards/common/ConfigNode.py +++ /dev/null @@ -1,27 +0,0 @@ -# -# This file is part of the LibreOffice project. -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# This file incorporates work covered by the following license notice: -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed -# with this work for additional information regarding copyright -# ownership. The ASF licenses this file to you under the Apache -# License, Version 2.0 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.apache.org/licenses/LICENSE-2.0 . -# -from abc import ABCMeta, abstractmethod - -class ConfigNode(object): - @abstractmethod - def readConfiguration(self, configurationView, param): - pass - - @abstractmethod - def writeConfiguration(self, configurationView, param): - pass diff --git a/wizards/com/sun/star/wizards/common/ConfigSet.py b/wizards/com/sun/star/wizards/common/ConfigSet.py index 0675e8dca21a..aa02c6a80127 100644 --- a/wizards/com/sun/star/wizards/common/ConfigSet.py +++ b/wizards/com/sun/star/wizards/common/ConfigSet.py @@ -17,10 +17,10 @@ # import traceback import inspect -from .ConfigNode import ConfigNode +from .ConfigGroup import ConfigGroup from .Configuration import Configuration -class ConfigSet(ConfigNode): +class ConfigSet(ConfigGroup): ''' After reading the configuration set items, the ConfigSet checks this field. |