uniform plugin layout with code in __init__.py
authorThierry Parmentelat <thierry.parmentelat@inria.fr>
Mon, 23 Sep 2013 12:56:29 +0000 (14:56 +0200)
committerThierry Parmentelat <thierry.parmentelat@inria.fr>
Mon, 23 Sep 2013 12:56:39 +0000 (14:56 +0200)
15 files changed:
plugins/messages/__init__.py
plugins/messages/messages.py [deleted file]
plugins/querycode/__init__.py
plugins/querycode/querycode.py [deleted file]
plugins/quickfilter/__init__.py
plugins/quickfilter/quickfilter.py [deleted file]
plugins/raw/__init__.py
plugins/raw/raw.py [deleted file]
plugins/stack/__init__.py
plugins/stack/stack.py [deleted file]
plugins/tabs/__init__.py
plugins/tabs/tabs.py [deleted file]
portal/sliceview.py
trash/dashboard.py
trash/pluginview.py

index e69de29..65baea1 100644 (file)
@@ -0,0 +1,45 @@
+from unfold.plugin import Plugin
+
+# lists levels and sets them to enabled or not at startup
+default_levels = {'fatal': True, 'error': True, 'warning' : True, 'info' : True, 'debug' : False}
+
+# there are two implementations available here
+# one shows up in the main page like a regular part of the page,
+# while the other one relies on transient popups
+# by default we use the latter, but you can specify 
+# transient=False if you want to use the former
+# xxx
+# also the pieces that go with this transient mode are
+# under views/templates, it would make sense to move them over here
+# however it turns out that views/templates/base.html unconditionnally
+# includes messages-transient-header.html 
+class Messages (Plugin):
+
+    def __init__ (self, transient=True, levels=None, **settings):
+        Plugin.__init__ (self, **settings)
+        if levels is None: levels=default_levels
+        # shortcut: 'ALL' turn everything on
+        elif levels=='ALL': levels=dict( [ (k,True) for k in default_levels ] )
+        elif levels=='NONE': levels=dict( [ (k,False) for k in default_levels ] )
+        self.transient=transient
+        self.levels=levels
+
+    def template_file (self):
+        return "messages.html" if not self.transient else "messages-transient.html"
+
+    def requirements (self):
+        return {
+            'js_files' :  [ "js/messages.js", "js/manifold.js", ],
+            'css_files' : "css/messages.css",
+            }
+
+    # although this has no query, we need a plugin instance to be created in the js output
+    def export_json_settings (self):
+        return True
+    # the js plugin expects a domid
+    def json_settings_list (self):
+        return [ 'plugin_uuid', 'levels' ]
+
+    # and we don't need a spin wheel 
+    def start_with_spin (self):
+        return False
diff --git a/plugins/messages/messages.py b/plugins/messages/messages.py
deleted file mode 100644 (file)
index 65baea1..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-from unfold.plugin import Plugin
-
-# lists levels and sets them to enabled or not at startup
-default_levels = {'fatal': True, 'error': True, 'warning' : True, 'info' : True, 'debug' : False}
-
-# there are two implementations available here
-# one shows up in the main page like a regular part of the page,
-# while the other one relies on transient popups
-# by default we use the latter, but you can specify 
-# transient=False if you want to use the former
-# xxx
-# also the pieces that go with this transient mode are
-# under views/templates, it would make sense to move them over here
-# however it turns out that views/templates/base.html unconditionnally
-# includes messages-transient-header.html 
-class Messages (Plugin):
-
-    def __init__ (self, transient=True, levels=None, **settings):
-        Plugin.__init__ (self, **settings)
-        if levels is None: levels=default_levels
-        # shortcut: 'ALL' turn everything on
-        elif levels=='ALL': levels=dict( [ (k,True) for k in default_levels ] )
-        elif levels=='NONE': levels=dict( [ (k,False) for k in default_levels ] )
-        self.transient=transient
-        self.levels=levels
-
-    def template_file (self):
-        return "messages.html" if not self.transient else "messages-transient.html"
-
-    def requirements (self):
-        return {
-            'js_files' :  [ "js/messages.js", "js/manifold.js", ],
-            'css_files' : "css/messages.css",
-            }
-
-    # although this has no query, we need a plugin instance to be created in the js output
-    def export_json_settings (self):
-        return True
-    # the js plugin expects a domid
-    def json_settings_list (self):
-        return [ 'plugin_uuid', 'levels' ]
-
-    # and we don't need a spin wheel 
-    def start_with_spin (self):
-        return False
index e69de29..55da3e9 100644 (file)
@@ -0,0 +1,30 @@
+from unfold.plugin import Plugin
+
+class QueryCode (Plugin):
+
+    def __init__ (self, query, **settings):
+        Plugin.__init__ (self, **settings)
+        self.query=query
+
+    def template_file (self):
+        return "querycode.html"
+
+    def requirements (self):
+        return { 
+            'js_files' : [ 
+                "js/querycode.js", 
+                "js/manifold.js", "js/manifold-query.js",
+                "js/spin.presets.js", "js/spin.min.js", "js/jquery.spin.js", 
+                "js/shAutoloader.js","js/shCore.js","js/shBrushPython.js","js/shBrushRuby.js",
+                ] ,
+# thierry: see this file for details of why we turn this off for now            
+            'css_files': [
+                "css/querycode.css" ,
+                "css/shCore.css","css/shCoreDefault.css","css/shThemeDefault.css",
+                ],
+            }
+
+    def json_settings_list (self): return ['plugin_uuid','query_uuid']
+        
+    # because we have a link to a query it looks like we need a spin, let's make this right
+    def start_with_spin (self): return False
diff --git a/plugins/querycode/querycode.py b/plugins/querycode/querycode.py
deleted file mode 100644 (file)
index 55da3e9..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-from unfold.plugin import Plugin
-
-class QueryCode (Plugin):
-
-    def __init__ (self, query, **settings):
-        Plugin.__init__ (self, **settings)
-        self.query=query
-
-    def template_file (self):
-        return "querycode.html"
-
-    def requirements (self):
-        return { 
-            'js_files' : [ 
-                "js/querycode.js", 
-                "js/manifold.js", "js/manifold-query.js",
-                "js/spin.presets.js", "js/spin.min.js", "js/jquery.spin.js", 
-                "js/shAutoloader.js","js/shCore.js","js/shBrushPython.js","js/shBrushRuby.js",
-                ] ,
-# thierry: see this file for details of why we turn this off for now            
-            'css_files': [
-                "css/querycode.css" ,
-                "css/shCore.css","css/shCoreDefault.css","css/shThemeDefault.css",
-                ],
-            }
-
-    def json_settings_list (self): return ['plugin_uuid','query_uuid']
-        
-    # because we have a link to a query it looks like we need a spin, let's make this right
-    def start_with_spin (self): return False
index e69de29..9ac95ae 100644 (file)
@@ -0,0 +1,23 @@
+from unfold.plugin import Plugin
+
+class QuickFilter (Plugin) :
+
+    def __init__ (self, criterias, **settings):
+        Plugin.__init__ (self, **settings)
+        self.criterias=criterias
+        self.page.expose_js_metadata()
+
+    def template_file (self): return "quickfilter.html"
+
+    def requirements (self):
+        return { 
+            'js_files' : [ "js/quickfilter.js", "js/metadata.js",
+                           ],
+            'css_files': "css/quickfilter.css",
+            }
+
+    def json_settings_list (self):
+        return ['criterias','plugin_uuid']
+
+    def template_env (self,request):
+        return {'criterias':self.criterias}
diff --git a/plugins/quickfilter/quickfilter.py b/plugins/quickfilter/quickfilter.py
deleted file mode 100644 (file)
index 9ac95ae..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-from unfold.plugin import Plugin
-
-class QuickFilter (Plugin) :
-
-    def __init__ (self, criterias, **settings):
-        Plugin.__init__ (self, **settings)
-        self.criterias=criterias
-        self.page.expose_js_metadata()
-
-    def template_file (self): return "quickfilter.html"
-
-    def requirements (self):
-        return { 
-            'js_files' : [ "js/quickfilter.js", "js/metadata.js",
-                           ],
-            'css_files': "css/quickfilter.css",
-            }
-
-    def json_settings_list (self):
-        return ['criterias','plugin_uuid']
-
-    def template_env (self,request):
-        return {'criterias':self.criterias}
index e69de29..01f59e9 100644 (file)
@@ -0,0 +1,12 @@
+from unfold.plugin import Plugin
+
+# usage Raw (html="some html text")
+
+class Raw (Plugin):
+
+    def __init__ (self, html, **kwds):
+        Plugin.__init__ (self, **kwds)
+        self.html=html
+
+    def render_content (self, request):
+        return self.html
diff --git a/plugins/raw/raw.py b/plugins/raw/raw.py
deleted file mode 100644 (file)
index 01f59e9..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-from unfold.plugin import Plugin
-
-# usage Raw (html="some html text")
-
-class Raw (Plugin):
-
-    def __init__ (self, html, **kwds):
-        Plugin.__init__ (self, **kwds)
-        self.html=html
-
-    def render_content (self, request):
-        return self.html
index e69de29..c8ddbea 100644 (file)
@@ -0,0 +1,11 @@
+from django.template.loader import render_to_string
+
+from unfold.composite import Composite
+
+class Stack (Composite) :
+    
+    def template_file (self):        return "stack.html"
+    def template_env (self, request):
+        env = Composite.template_env (self, request)
+        env['domid'] = self.domid
+        return env
diff --git a/plugins/stack/stack.py b/plugins/stack/stack.py
deleted file mode 100644 (file)
index c8ddbea..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-from django.template.loader import render_to_string
-
-from unfold.composite import Composite
-
-class Stack (Composite) :
-    
-    def template_file (self):        return "stack.html"
-    def template_env (self, request):
-        env = Composite.template_env (self, request)
-        env['domid'] = self.domid
-        return env
index e69de29..6da94da 100644 (file)
@@ -0,0 +1,19 @@
+from unfold.composite import Composite
+
+class Tabs (Composite):
+    
+    def requirements (self):
+        return { 'js_files'     : ['js/tabs.js', 'js/bootstrap.js'],
+                 'css_files'    : ['css/bootstrap.css', 'css/tabs.css', ] 
+                 }
+
+    def template_file (self):
+        return "tabs.html"
+
+    # see Composite.py for the details of template_env, that exposes global
+    # 'sons' as a list of sons with each a set of a few attributes
+    def json_settings_list (self):
+        return []
+
+    def export_json_settings(self):
+        return True
diff --git a/plugins/tabs/tabs.py b/plugins/tabs/tabs.py
deleted file mode 100644 (file)
index 6da94da..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-from unfold.composite import Composite
-
-class Tabs (Composite):
-    
-    def requirements (self):
-        return { 'js_files'     : ['js/tabs.js', 'js/bootstrap.js'],
-                 'css_files'    : ['css/bootstrap.css', 'css/tabs.css', ] 
-                 }
-
-    def template_file (self):
-        return "tabs.html"
-
-    # see Composite.py for the details of template_env, that exposes global
-    # 'sons' as a list of sons with each a set of a few attributes
-    def json_settings_list (self):
-        return []
-
-    def export_json_settings(self):
-        return True
index 762e64a..5e8ddf9 100644 (file)
@@ -8,19 +8,18 @@ from manifold.core.query             import Query, AnalyzedQuery
 
 from myslice.viewutils               import topmenu_items, the_user
 
-from plugins.raw.raw                 import Raw
-from plugins.stack.stack             import Stack
-from plugins.tabs.tabs               import Tabs
+from plugins.raw                     import Raw
+from plugins.stack                   import Stack
+from plugins.tabs                    import Tabs
 from plugins.hazelnut                import Hazelnut 
 from plugins.resources_selected      import ResourcesSelected
 from plugins.googlemap               import GoogleMap
 from plugins.senslabmap.senslabmap   import SensLabMap
-from plugins.querycode.querycode     import QueryCode
+from plugins.querycode               import QueryCode
 from plugins.query_editor            import QueryEditor
 from plugins.active_filters          import ActiveFilters
-from plugins.quickfilter.quickfilter import QuickFilter
-from plugins.messages.messages       import Messages
-#from plugins.updater                 import Updater
+from plugins.quickfilter             import QuickFilter
+from plugins.messages                import Messages
 
 tmp_default_slice='ple.upmc.myslicedemo'
 
index e996477..20bc15f 100644 (file)
@@ -11,10 +11,10 @@ from unfold.page import Page
 from manifold.core.query import Query
 #from manifold.manifoldquery import ManifoldQuery
 
-from plugins.stack.stack import Stack
+from plugins.stack import Stack
 from plugins.lists.slicelist import SliceList
-from plugins.querycode.querycode import QueryCode
-from plugins.quickfilter.quickfilter import QuickFilter
+from plugins.querycode import QueryCode
+from plugins.quickfilter import QuickFilter
 
 from trash.trashutils  import quickfilter_criterias
 
index 5440a14..f6198df 100644 (file)
@@ -10,13 +10,13 @@ from django.contrib.auth.decorators     import login_required
 from unfold.page                        import Page
 from manifold.core.query                import Query
 
-from plugins.stack.stack                import Stack
-from plugins.tabs.tabs                  import Tabs
+from plugins.stack                      import Stack
+from plugins.tabs                       import Tabs
 from plugins.lists.staticlist           import StaticList
-from plugins.quickfilter.quickfilter    import QuickFilter
-from plugins.querycode.querycode        import QueryCode
-from plugins.raw.raw                    import Raw
-from plugins.messages.messages          import Messages
+from plugins.quickfilter                import QuickFilter
+from plugins.querycode                  import QueryCode
+from plugins.raw                        import Raw
+from plugins.messages                   import Messages
 from plugins.hazelnut                   import Hazelnut
 from plugins.updater                    import Updater