[brainoviz] Add brainoviz dependence and add a "view" tab for scan
authorVincent Michel <vincent.michel@logilab.fr>
Wed, 17 Jul 2013 17:43:02 +0200
changeset 321 62024074d85d
parent 320 cffea84a301b
child 322 92e49364eee4
[brainoviz] Add brainoviz dependence and add a "view" tab for scan
__pkginfo__.py
views/tabs.py
--- a/__pkginfo__.py	Wed Jul 17 17:38:50 2013 +0200
+++ b/__pkginfo__.py	Wed Jul 17 17:43:02 2013 +0200
@@ -23,6 +23,7 @@
                 'cubicweb-comment': None,
                 'cubicweb-registration': None,
                 'cubicweb-jqplot': None,
+                'cubicweb-brainoviz': None,
                 }
 __recommends__ = {}
 
--- a/views/tabs.py	Wed Jul 17 17:38:50 2013 +0200
+++ b/views/tabs.py	Wed Jul 17 17:43:02 2013 +0200
@@ -195,3 +195,21 @@
             $('#jqplot-info').html(htmlstr);
             }""" % (self._cw.base_url(), self.get_rql())
         return jsbind
+
+
+###############################################################################
+### TABBLABLE COMPONENTS - SCANVIEWER #########################################
+###############################################################################
+class BrainomicsTabblableSCanViewerQuestion(AbstractBrainomicsTabblable):
+    __select__ = AbstractBrainomicsTabblable.__select__ & is_instance('Scan')
+    __regid__ = 'entity-scan-tab'
+
+    def get_title(self):
+        return self._cw._('View')
+
+    def render_content(self, w, **kwargs):
+        entity = self.cw_rset.get_entity(0, 0)
+        if 'slices-view' in self._cw.vreg['views']:
+            w(entity.view('slices-view'))
+        else:
+            w(u'<h4>%s</h4>' % self._cw._('The brainoviz cube is required'))