[d-feet] Remove duplicate if-clause



commit 36511f1cba0b0af14ca615bfb0b962fc51ec1a19
Author: Thomas Bechtold <thomasbechtold jpberlin de>
Date:   Thu Jul 18 12:16:45 2013 +0200

    Remove duplicate if-clause

 src/dfeet/introspection.py |   87 ++++++++++++++++++++++----------------------
 1 files changed, 43 insertions(+), 44 deletions(-)
---
diff --git a/src/dfeet/introspection.py b/src/dfeet/introspection.py
index 493da07..43c62ec 100644
--- a/src/dfeet/introspection.py
+++ b/src/dfeet/introspection.py
@@ -183,50 +183,49 @@ class AddressInfo():
                 #tree_iter = self.__treemodel.append(tree_iter, ["Hallo", None])
 
                 #append interfaces to tree model
-                if len(node_info.interfaces) > 0:
-                    name_iter = self.__treemodel.append(tree_iter,
-                                                        ["<b>Interfaces</b>", None])
-                    for iface in node_info.interfaces:
-                        iface_obj = DBusInterface(node_obj, iface)
-                        iface_iter = self.__treemodel.append(
-                            name_iter,
-                            ["%s" % iface.name, iface_obj])
-                        #interface methods
-                        if len(iface.methods) > 0:
-                            iface_methods_iter = self.__treemodel.append(
-                                iface_iter, ["<b>Methods</b>", None])
-                            for iface_method in iface.methods:
-                                method_obj = DBusMethod(iface_obj, iface_method)
-                                self.__treemodel.append(
-                                    iface_methods_iter,
-                                    ["%s" % method_obj.markup_str, method_obj])
-                        #interface signals
-                        if len(iface.signals) > 0:
-                            iface_signals_iter = self.__treemodel.append(
-                                iface_iter, ["<b>Signals</b>", None])
-                            for iface_signal in iface.signals:
-                                signal_obj = DBusSignal(iface_obj, iface_signal)
-                                self.__treemodel.append(
-                                    iface_signals_iter,
-                                    ["%s" % signal_obj.markup_str, signal_obj])
-                        #interface properties
-                        if len(iface.properties) > 0:
-                            iface_properties_iter = self.__treemodel.append(
-                                iface_iter, ["<b>Properties</b>", None])
-                            for iface_property in iface.properties:
-                                property_obj = DBusProperty(iface_obj, iface_property)
-                                self.__treemodel.append(
-                                    iface_properties_iter,
-                                    ["%s" % property_obj.markup_str, property_obj])
-                        #interface annotations
-                        if len(iface.annotations) > 0:
-                            iface_annotations_iter = self.__treemodel.append(
-                                iface_iter, ["<b>Annotations</b>", None])
-                            for iface_annotation in iface.annotations:
-                                annotation_obj = DBusAnnotation(iface_obj, iface_annotation)
-                                self.__treemodel.append(
-                                    iface_annotations_iter,
-                                    ["%s" % (annotation_obj.markup_str), annotation_obj])
+                name_iter = self.__treemodel.append(tree_iter,
+                                                    ["<b>Interfaces</b>", None])
+                for iface in node_info.interfaces:
+                    iface_obj = DBusInterface(node_obj, iface)
+                    iface_iter = self.__treemodel.append(
+                        name_iter,
+                        ["%s" % iface.name, iface_obj])
+                    #interface methods
+                    if len(iface.methods) > 0:
+                        iface_methods_iter = self.__treemodel.append(
+                            iface_iter, ["<b>Methods</b>", None])
+                        for iface_method in iface.methods:
+                            method_obj = DBusMethod(iface_obj, iface_method)
+                            self.__treemodel.append(
+                                iface_methods_iter,
+                                ["%s" % method_obj.markup_str, method_obj])
+                    #interface signals
+                    if len(iface.signals) > 0:
+                        iface_signals_iter = self.__treemodel.append(
+                            iface_iter, ["<b>Signals</b>", None])
+                        for iface_signal in iface.signals:
+                            signal_obj = DBusSignal(iface_obj, iface_signal)
+                            self.__treemodel.append(
+                                iface_signals_iter,
+                                ["%s" % signal_obj.markup_str, signal_obj])
+                    #interface properties
+                    if len(iface.properties) > 0:
+                        iface_properties_iter = self.__treemodel.append(
+                            iface_iter, ["<b>Properties</b>", None])
+                        for iface_property in iface.properties:
+                            property_obj = DBusProperty(iface_obj, iface_property)
+                            self.__treemodel.append(
+                                iface_properties_iter,
+                                ["%s" % property_obj.markup_str, property_obj])
+                    #interface annotations
+                    if len(iface.annotations) > 0:
+                        iface_annotations_iter = self.__treemodel.append(
+                            iface_iter, ["<b>Annotations</b>", None])
+                        for iface_annotation in iface.annotations:
+                            annotation_obj = DBusAnnotation(iface_obj, iface_annotation)
+                            self.__treemodel.append(
+                                iface_annotations_iter,
+                                ["%s" % (annotation_obj.markup_str), annotation_obj])
 
             #are more nodes left?
             if len(node_info.nodes) > 0:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]