# we just need this to be unique in a page
domid=0
- @staticmethod
- def newdomid():
+ # when a domid is not set by the caller, we name plugins after their respective class as well,
+ # so as to limit name clashes between different views
+ # this has to see with the UI storing the last-seen status of plugins based on their id
+ # put it more bluntly it is recommended that a domid should be set
+ # and maybe xxx we should just enforce that...
+ def newdomid(self):
Plugin.domid += 1
- return "plugin-%d"%Plugin.domid
+ return "plugin-%s-%d"%(self.__class__.__name__.lower(),Plugin.domid)
##########
# Constructor
def __init__ (self, page, title=None, domid=None,
visible=True, togglable=None, toggled=None, **settings):
self.page = page
- self.title=title
# callers can provide their domid for css'ing
- if not domid: domid=Plugin.newdomid()
+ if not domid: domid=self.newdomid()
self.domid=domid
+ # title is shown when togglable
if not title: title="Plugin title for %s"%domid
+ self.title=title
self.classname=self._py_classname()
self.plugin_classname=self._js_classname()
self.visible=visible
self.need_spin=self.start_with_spin()
env.update(self.__dict__)
# translate high-level 'toggled' into 4 different booleans
+ self.need_toggle = False
if self.toggled=='persistent':
# start with everything turned off and let the js callback do its job
env.update({'persistent_toggle':True,'display_hide_button':False,'display_show_button':False,'display_body':False})