davemds pushed a commit to branch master. http://git.enlightenment.org/apps/espionage.git/commit/?id=dda3a3564f5b2973231e2928310e65b4a3e54582
commit dda3a3564f5b2973231e2928310e65b4a3e54582 Author: Dave Andreoli <d...@gurumeditation.it> Date: Mon Apr 26 07:46:50 2021 +0200 Small optimizations --- espionage/espionage.py | 48 ++++++++++++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/espionage/espionage.py b/espionage/espionage.py index 4504091..f42b050 100644 --- a/espionage/espionage.py +++ b/espionage/espionage.py @@ -280,7 +280,7 @@ def recursive_introspect(bus, named_service, object_path, ret_data=None): if child.tag == 'property': typ = child.attrib['type'] access = child.attrib['access'] - prop = DBusProperty(child.attrib['name'], iface, typ, access) + DBusProperty(child.attrib['name'], iface, typ, access) if child.tag == 'method': meth = DBusMethod(child.attrib['name'], iface) @@ -317,7 +317,8 @@ class NamesListGroupItemClass(GenlistItemClass): def __init__(self): GenlistItemClass.__init__(self, item_style='group_index') - def text_get(self, gl, part, name): + @staticmethod + def text_get(gl, part, name): return name @@ -325,7 +326,8 @@ class NamesListItemClass(GenlistItemClass): def __init__(self): GenlistItemClass.__init__(self, item_style='default') - def text_get(self, gl, part, name): + @staticmethod + def text_get(gl, part, name): return name @@ -409,7 +411,8 @@ class NamesList(Genlist): else: self.win.detail_list.populate(name) - def sort_cb(self, it1, it2): + @staticmethod + def sort_cb(it1, it2): return 1 if it1.data.lower() < it2.data.lower() else -1 def service_activatable_add(self, name): @@ -451,10 +454,12 @@ class ObjectItemClass(GenlistItemClass): def __init__(self): GenlistItemClass.__init__(self, item_style='group_index') - def text_get(self, gl, part, obj): + @staticmethod + def text_get(gl, part, obj): return obj.name - def content_get(self, gl, part, obj): + @staticmethod + def content_get(gl, part, obj): if part == 'elm.swallow.icon': return Icon(gl, size_hint_min=(22, 22), file=theme_resource_get(obj.icon)) @@ -464,7 +469,8 @@ class NodeItemClass(GenlistItemClass): def __init__(self): GenlistItemClass.__init__(self, item_style='default_style') - def text_get(self, gl, part, obj): + @staticmethod + def text_get(gl, part, obj): if isinstance(obj, DBusInterface): return '<font %s>%s</>' % (options.stl_iface, obj.name) if isinstance(obj, DBusProperty): @@ -488,7 +494,8 @@ class NodeItemClass(GenlistItemClass): params = colored_params(obj.params) return '<font %s>%s</> %s' % (options.stl_name, obj.name, params) - def content_get(self, gl, part, obj): + @staticmethod + def content_get(gl, part, obj): if part == 'elm.swallow.icon': return Icon(gl, file=theme_resource_get(obj.icon)) @@ -521,11 +528,11 @@ class DetailList(Genlist): if not options.show_introspect_stuff and \ iface.name.startswith('org.freedesktop.DBus'): continue - iface_item = self.item_append(self.itc, iface, - parent_item=obj_item, - flags=ELM_GENLIST_ITEM_TREE) + self.item_append(self.itc, iface, parent_item=obj_item, + flags=ELM_GENLIST_ITEM_TREE) - def sort_cb(self, it1, it2): + @staticmethod + def sort_cb(it1, it2): pri1 = pri2 = 0 if isinstance(it1.data, DBusProperty): pri1 = 3 @@ -545,7 +552,8 @@ class DetailList(Genlist): return -1 return 1 if it1.data.name.lower() < it2.data.name.lower() else -1 - def expand_request_cb(self, genlist, item): + @staticmethod + def expand_request_cb(genlist, item): item.expanded = True def expanded_cb(self, genlist, item): @@ -553,10 +561,12 @@ class DetailList(Genlist): for obj in iface.properties + iface.methods + iface.signals: self.item_sorted_insert(self.itc, obj, self.sort_cb, parent_item=item) - def contract_request_cb(self, genlist, item): + @staticmethod + def contract_request_cb(genlist, item): item.expanded = False - def contracted_cb(self, genlist, item): + @staticmethod + def contracted_cb(genlist, item): item.subitems_clear() def double_click_cb(self, genlist, item): @@ -726,12 +736,14 @@ class SignalItemClass(GenlistItemClass): def __init__(self): GenlistItemClass.__init__(self, item_style='default_style') - def text_get(self, gl, part, data): + @staticmethod + def text_get(gl, part, data): return '<font %s>%s</> <font %s>iface: %s</> <font %s>path: %s</> <font %s>sender: %s</>' % \ (options.stl_name, data['signal'], options.stl_ptype, data['iface'], options.stl_pname, data['path'], options.stl_value, data['sender']) - def content_get(self, gl, part, data): + @staticmethod + def content_get(gl, part, data): if part == 'elm.swallow.icon': return Icon(gl, file=theme_resource_get('signal.png')) @@ -926,7 +938,7 @@ class EspionageWin(StandardWindow): def main(): elm.init() - win = EspionageWin() + EspionageWin() elm.run() elm.shutdown() return 0 --