X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=engine%2Fplugin.py;h=8f817a5b6666ded6b2425985fe11b915dcd8b394;hb=433a5d301336bc9d402af49b2aceb257f57514bb;hp=2088c2702254086043f239543c281e7450268edd;hpb=6c8063e1fcffee77e26340ec6c5143d434c2306a;p=unfold.git diff --git a/engine/plugin.py b/engine/plugin.py index 2088c270..8f817a5b 100644 --- a/engine/plugin.py +++ b/engine/plugin.py @@ -16,7 +16,7 @@ from engine.prelude import Prelude # . True : to debug all plugin DEBUG= False -#DEBUG= [ 'SliceList' ] +DEBUG= [ 'QuickFilter' ] # decorator to deflect calls on Plugin to its Prelude through self.page.prelude def to_prelude (method): @@ -118,10 +118,14 @@ class Plugin: return result # as a first approximation, only plugins that are associated with a query - # need to be prepared for js - others just get displayed and that's it - def is_asynchroneous (self): + # need to be prepared for js - meaning their json settings get exposed to js + # others just get displayed and that's it + def export_json_settings (self): return 'query' in self.__dict__ + def start_with_spin (self): + return self.export_json_settings() + # returns the html code for that plugin # in essence, wraps the results of self.render_content () def render (self, request): @@ -130,11 +134,13 @@ class Plugin: # shove this into plugin.html env = {} env ['plugin_content']= plugin_content + # need_spin is used in plugin.html + self.need_spin=self.start_with_spin() env.update(self.__dict__) result = render_to_string ('plugin.html',env) # export this only for relevant plugins - if self.is_asynchroneous(): + if self.export_json_settings(): env ['settings_json' ] = self.settings_json() # compute plugin-specific initialization js_init = render_to_string ( 'plugin-setenv.js', env ) @@ -232,5 +238,13 @@ class Plugin: # also 'query_uuid' gets replaced with query.uuid def json_settings_list (self): return ['json_settings_list-must-be-redefined'] - # might also define this one; see e.g. slicelist.py that piggybacks simplelist js code - # def plugin_classname (self): + # might also define these ones: + # + # see e.g. slicelist.py that piggybacks simplelist js code + # def plugin_classname (self) + # + # whether we export the json settings to js + # def export_json_settings (self) + # + # whether we show an initial spinner + # def start_with_spin (self)