git://git.onelab.eu
/
sfa-gui.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Tweaks for first demo of GUI
[sfa-gui.git]
/
SfaBrowser.py
diff --git
a/SfaBrowser.py
b/SfaBrowser.py
index
14e8fc0
..
fe3f4ac
100644
(file)
--- a/
SfaBrowser.py
+++ b/
SfaBrowser.py
@@
-13,14
+13,22
@@
class PopupRecord(PopupPanel):
self.setStyleName("ks-popups-Popup")
class SfaItem(TreeItem):
self.setStyleName("ks-popups-Popup")
class SfaItem(TreeItem):
- def __init__(self, hrn,
authority = False
):
- self.
isAuthority = authority
+ def __init__(self, hrn,
kind
):
+ self.
kind = kind
self.hrn = hrn
last = hrn.split('.')[-1]
self.hrn = hrn
last = hrn.split('.')[-1]
- self.label = last
+ if self.kind == "(authority)":
+ self.label = "<b>%s</b>" % last
+ elif self.kind == "(slice)":
+ self.label = "<u><i>%s</i></u>" % last
+ elif self.kind == "(user)":
+ self.label = "%s" % last
+ else:
+ self.label = "<b>%s</b>" % last
+
TreeItem.__init__(self, self.label)
TreeItem.__init__(self, self.label)
- if self.
isAuthority
:
+ if self.
kind == "(authority)"
:
self.addItem(PendingItem())
class PendingItem(TreeItem):
self.addItem(PendingItem())
class PendingItem(TreeItem):
@@
-39,10
+47,10
@@
class SfaBrowser(Sink):
self.tree = Tree()
self.tree = Tree()
- item = SfaItem("plc",
True
)
+ item = SfaItem("plc",
"(authority)"
)
self.tree.addItem(item)
self.tree.addItem(item)
- item = SfaItem("ple",
True
)
+ item = SfaItem("ple",
"(authority)"
)
self.tree.addItem(item)
self.tree.addTreeListener(self)
self.tree.addItem(item)
self.tree.addTreeListener(self)
@@
-59,12
+67,14
@@
class SfaBrowser(Sink):
p.show()
def onTreeItemStateChanged(self, item):
p.show()
def onTreeItemStateChanged(self, item):
+ self.tree.moveFocus(item)
child = item.getChild(0)
if hasattr(child, "isPendingItem"):
item.removeItem(child)
child = item.getChild(0)
if hasattr(child, "isPendingItem"):
item.removeItem(child)
- hrns = self.data.listChildren(item.hrn)
+ hrns = sorted(self.data.listChildren(item.hrn),
+ key=lambda hrn: hrn[0])
for (hrn, kind) in hrns:
for (hrn, kind) in hrns:
- item.addItem(SfaItem(hrn,
(kind=="(authority)")
))
+ item.addItem(SfaItem(hrn,
kind
))
def onShow(self):
pass
def onShow(self):
pass