コード例 #1
0
ファイル: dash.py プロジェクト: avitebskiy/ajenti
    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)
コード例 #2
0
ファイル: dash.py プロジェクト: avitebskiy/ajenti
    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)
コード例 #3
0
    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)
コード例 #4
0
ファイル: dash.py プロジェクト: avitebskiy/ajenti
 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])
コード例 #5
0
 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])
コード例 #6
0
    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)
コード例 #7
0
ファイル: dash.py プロジェクト: balchjd/ajenti
    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)
コード例 #8
0
ファイル: dash.py プロジェクト: swordsmanli/ajenti
    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)
コード例 #9
0
    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()
コード例 #10
0
ファイル: dash.py プロジェクト: Elvander/ajenti
    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()
コード例 #11
0
ファイル: dash.py プロジェクト: pacNAS/ajenti
    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)