summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2011-06-21 00:10:41 +0200
committerFlorent Le Coz <louiz@louiz.org>2011-06-21 00:10:41 +0200
commit511ecf6195597ceda94730bf66017645d368ea5f (patch)
treefd7fb8413ee72b97740359cf28963efa398e8cab
parentca0b4af3647b935adbe8b6c0dcb30764507ed083 (diff)
downloadpoezio-511ecf6195597ceda94730bf66017645d368ea5f.tar.gz
poezio-511ecf6195597ceda94730bf66017645d368ea5f.tar.bz2
poezio-511ecf6195597ceda94730bf66017645d368ea5f.tar.xz
poezio-511ecf6195597ceda94730bf66017645d368ea5f.zip
Meta + up and down scrolls the nodes, up and down scrolls the items
-rw-r--r--src/pubsub.py19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/pubsub.py b/src/pubsub.py
index 73c03bcc..1b4a8e1e 100644
--- a/src/pubsub.py
+++ b/src/pubsub.py
@@ -26,21 +26,22 @@ from sleekxmpp.xmlstream import ElementBase, ET
class PubsubNode(object):
node_type = None # unknown yet
- def __init__(self, name):
+ def __init__(self, name, parent=None):
self.items = []
self.name = name
+ self.parent = parent
class LeafNode(PubsubNode):
node_type = "leaf"
- def __init__(self, name):
- PubsubNode.__init__(self, name)
+ def __init__(self, name, parent=None):
+ PubsubNode.__init__(self, name, parent)
class CollectionNode(PubsubNode):
node_type = "collection"
- def __init__(self, name):
- PubsubNode.__init__(self, name)
+ def __init__(self, name, parent=None):
+ PubsubNode.__init__(self, name, parent)
self.subnodes = []
@@ -84,8 +85,10 @@ class PubsubBrowserTab(tabs.Tab):
self.input = self.default_help_message
self.key_func['c'] = self.command_create_node
- self.key_func["KEY_DOWN"] = self.node_listview.move_cursor_down
- self.key_func["KEY_UP"] = self.node_listview.move_cursor_up
+ self.key_func["M-KEY_DOWN"] = self.node_listview.move_cursor_down
+ self.key_func["M-KEY_UP"] = self.node_listview.move_cursor_up
+ self.key_func["KEY_DOWN"] = self.item_listview.move_cursor_down
+ self.key_func["KEY_UP"] = self.item_listview.move_cursor_up
self.resize()
self.get_nodes()
@@ -139,7 +142,7 @@ class PubsubBrowserTab(tabs.Tab):
item_list = []
if items:
for it in items:
- item_list.append(PubsubItem(it.attrib['id'], ET.tostring(it)))
+ item_list.append(PubsubItem(it.attrib['id'], it))
node.items = item_list
log.debug('Item on node %s: %s' % (node.name, item_list))