def init(self): self.title = _('Dashboard') self.category = '' self.icon = 'dashboard' self.order = 0 self.append(self.ui.inflate('dashboard:dash')) self.dash = self.find('dash') self.dash.on('reorder', self.on_reorder) self.autorefresh = False self.find('header').platform = ajenti.platform_unmapped self.find('header').distro = ajenti.platform_string def post_widget_bind(o, c, i, u): u.find('listitem').on('click', self.on_add_widget_click, i) self.find('add-widgets').post_item_bind = post_widget_bind classes = [ x for x in DashboardWidget.get_classes() if not x.hidden and UserManager.get().has_permission(self.context, WidgetPermissions.name_for(x)) ] CollectionAutoBinding( sorted(classes, key=lambda x: x.name), None, self.find('add-widgets')).populate() self.context.session.spawn(self.worker)
def refresh(self): self.find('header').hostname = Sensor.find('hostname').value() self.dash.empty() for widget in self.classconfig['widgets']: for cls in DashboardWidget.get_classes(): if cls.classname == widget['class']: if not UserManager.get().has_permission(self.context, WidgetPermissions.name_for(cls)): continue try: instance = cls.new( self.ui, container=widget['container'], index=widget['index'], config=widget['config'], ) except Exception, e: traceback.print_exc() instance = CrashedWidget.new( self.ui, container=widget['container'], index=widget['index'], config=widget['config'], ) instance.classname = cls.classname instance.set(e) instance.on('save-config', self.on_widget_config, widget, instance) self.dash.append(instance)
def init(self): self.title = _('Dashboard') self.category = '' self.icon = 'dashboard' self.order = 0 self.append(self.ui.inflate('dashboard:dash')) self.dash = self.find('dash') self.dash.on('reorder', self.on_reorder) self.autorefresh = False self.find('header').platform = ajenti.platform_unmapped self.find('header').distro = ajenti.platform_string def post_widget_bind(o, c, i, u): u.find('listitem').on('click', self.on_add_widget_click, i) self.find('add-widgets').post_item_bind = post_widget_bind classes = [ x for x in DashboardWidget.get_classes() if not x.hidden and UserManager.get().has_permission( self.context, WidgetPermissions.name_for(x)) ] CollectionAutoBinding(sorted(classes, key=lambda x: x.name), None, self.find('add-widgets')).populate() self.context.session.spawn(self.worker) AjentiUpdater.get().check_for_updates(self.update_check_callback)
def get_permissions(self): # Generate permission set on-the-fly return sorted([ (WidgetPermissions.name_for(x), _(x.name)) for x in DashboardWidget.get_classes() if not x.hidden ], key=lambda x: x[1])
def refresh(self): self.find('header').hostname = Sensor.find('hostname').value() self.dash.empty() for widget in self.classconfig['widgets']: for cls in DashboardWidget.get_classes(): if cls.classname == widget['class']: if not UserManager.get().has_permission( self.context, WidgetPermissions.name_for(cls)): continue try: instance = cls.new( self.ui, container=widget['container'], index=widget['index'], config=widget['config'], ) except Exception, e: traceback.print_exc() instance = CrashedWidget.new( self.ui, container=widget['container'], index=widget['index'], config=widget['config'], ) instance.classname = cls.classname instance.set(e) instance.on('save-config', self.on_widget_config, widget, instance) self.dash.append(instance)
def refresh(self): self.find('header').hostname = Sensor.find('hostname').value() self.dash.empty() for widget in self.classconfig['widgets']: for cls in DashboardWidget.get_classes(): if cls.classname == widget['class']: instance = cls.new( self.ui, container=widget['container'], index=widget['index'], config=widget['config'], ) instance.on('save-config', self.on_widget_config, widget, instance) self.dash.append(instance)
def init(self): self.title = 'Dashboard' self.category = '' self.icon = 'dashboard' self.order = 0 self.append(self.ui.inflate('dashboard:dash')) self.dash = self.find('dash') self.dash.on('reorder', self.on_reorder) self.find('header').platform = ajenti.platform_unmapped self.find('header').distro = ajenti.platform_string def post_widget_bind(o, c, i, u): u.find('listitem').on('click', self.on_add_widget_click, i) self.find('add-widgets').post_item_bind = post_widget_bind classes = [x for x in DashboardWidget.get_classes() if not x.hidden] CollectionAutoBinding(sorted(classes, key=lambda x: x.name), None, self.find('add-widgets')).populate()
def init(self): self.title = _('Dashboard') self.category = '' self.icon = 'dashboard' self.order = 0 self.append(self.ui.inflate('dashboard:dash')) self.dash = self.find('dash') self.dash.on('reorder', self.on_reorder) self.find('header').platform = ajenti.platform_unmapped self.find('header').distro = ajenti.platform_string def post_widget_bind(o, c, i, u): u.find('listitem').on('click', self.on_add_widget_click, i) self.find('add-widgets').post_item_bind = post_widget_bind classes = [x for x in DashboardWidget.get_classes() if not x.hidden] CollectionAutoBinding( sorted(classes, key=lambda x: x.name), None, self.find('add-widgets')).populate()
def refresh(self): self.find("header").hostname = Sensor.find("hostname").value() self.dash.empty() for widget in self.classconfig["widgets"]: for cls in DashboardWidget.get_classes(): if cls.classname == widget["class"]: if not UserManager.get().has_permission(WidgetPermissions.name_for(cls)): continue try: instance = cls.new( self.ui, container=widget["container"], index=widget["index"], config=widget["config"] ) except Exception, e: traceback.print_exc() instance = CrashedWidget.new( self.ui, container=widget["container"], index=widget["index"], config=widget["config"] ) instance.classname = cls.classname instance.set(e) instance.on("save-config", self.on_widget_config, widget, instance) self.dash.append(instance)