Ejemplo n.º 1
0
 def on_click(self, event, params, vars=None):
     if params[0] == 'updaction':
         if self._updstat[0] == False:
             UpdateCheck.get().check_updates()
         else:
             self._update = True
     if params[0] == 'editconfig':
         self._config = params[1]
     if params[0] == 'restart':
         self.app.restart()
     if params[0] == 'shutdown':
         shell('shutdown -P now')
     if params[0] == 'reboot':
         shell('reboot')
Ejemplo n.º 2
0
 def on_click(self, event, params, vars=None):
     if params[0] == 'updaction':
         if self._updstat[0] == False:
             UpdateCheck.get().check_updates(refresh=True)
         else:
             self._update = True
     if params[0] == 'editconfig':
         self._config = params[1]
     if params[0] == 'restart':
         self.app.restart()
     if params[0] == 'shutdown':
         shell('shutdown -P now')
     if params[0] == 'reboot':
         shell('reboot')
Ejemplo n.º 3
0
    def get_ui(self):
        ui = self.app.inflate('home:home')
        cats = self.app.grab_plugins(api.ICategoryProvider)
        webs = self.app.grab_plugins(apis.webapps.IWebapp)
        btnlist = []

        for x in cats:
            if x.folder in self.folder_ids:
                btnlist.append({'id': x.plugin_id, 
                    'type': 'plugin',
                    'icon': x.plugin_info.icon if hasattr(x.plugin_info, 'icon') else x.iconfont,
                    'name': x.text})
        for x in webs:
            btnlist.append({'id': x.plugin_info.id,
                'type': 'webapp',
                'icon': x.plugin_info.icon,
                'name': x.plugin_info.name})
        
        for x in sorted(btnlist, key=lambda y: y['name']):
            ui.append('main', 
                UI.HomeButton(
                    id=x['id'],
                    type=x['type'],
                    iconfont=x['icon'],
                    name=x['name']
                    )
                )

        if UpdateCheck.get().get_status()[0] == True:
            self.put_message('info', 'An update for Genesis is available. See the Settings pane for details.')

        return ui
Ejemplo n.º 4
0
    def get_ui(self):
        ui = self.app.inflate("sysmon:main")
        self._mgr.refresh()

        self.fill("l", self._mgr.list_left(), ui, "cleft")
        self.fill("r", self._mgr.list_right(), ui, "cright")

        ui.insertText("host", platform.node())
        ui.insertText("distro", detect_distro())
        ui.find("icon").set("src", "/dl/sysmon/distributor-logo-%s.png" % detect_platform(mapping=False))

        if self._adding_widget == True:
            dlg = self.app.inflate("sysmon:add-widget")
            idx = 0
            for prov in sorted(self.app.grab_plugins(apis.dashboard.IWidget)):
                if hasattr(prov, "hidden"):
                    continue
                dlg.append(
                    "list",
                    UI.ListItem(
                        UI.HContainer(UI.IconFont(iconfont=prov.iconfont), UI.Label(text=prov.name)), id=prov.plugin_id
                    ),
                )
                idx += 1
            ui.append("main", dlg)

        elif self._adding_widget != None:
            ui.append("main", self._mgr.get_by_name(self._adding_widget).get_config_dialog())

        if UpdateCheck.get().get_status()[0] == True:
            self.put_message("info", "An update for Genesis is available. See the Settings pane for details.")

        return ui
Ejemplo n.º 5
0
    def get_ui(self):
        ui = self.app.inflate('config:main')

        # General
        ui.find('bind_host').set('value', self.app.gconfig.get('genesis', 'bind_host', ''))
        ui.find('bind_port').set('value', self.app.gconfig.get('genesis', 'bind_port', ''))
        ui.find('dformat').set('value', self.app.gconfig.get('genesis', 'dformat', '%d %b %Y'))
        ui.find('tformat').set('value', self.app.gconfig.get('genesis', 'tformat', '%H:%M'))
        ui.find('ssl').set('text', ('Enabled' if self.app.gconfig.get('genesis', 'ssl', '')=='1' else 'Disabled'))
        ui.find('nofx').set('checked', self.app.gconfig.get('genesis', 'nofx', '')=='1')
        ui.find('updcheck').set('checked', self.app.gconfig.get('genesis', 'updcheck', '')=='1')
        ui.find('purge').set('checked', self.app.gconfig.get('genesis', 'purge', '')=='1')

        # Security
        ui.find('httpauth').set('checked', self.app.gconfig.get('genesis','auth_enabled')=='1')

        # Configs
        cfgs = self.app.grab_plugins(IModuleConfig)
        cfgs = sorted(cfgs, key=lambda config: config.target.__name__ if not hasattr(config.target, 'text') else config.target.text)
        t = ui.find('configs')
        for c in cfgs:
            if c.target:
                t.append(UI.DTR(
                UI.IconFont(iconfont=(None if not hasattr(c.target, 'iconfont') else c.target.iconfont)),
                UI.Label(text=(c.target.__name__ if not hasattr(c.target, 'text') else c.target.text)),
                UI.TipIcon(text='Edit', iconfont="gen-pencil-2", id='editconfig/'+c.target.__name__),
            ))

        # Updates
        self._updstat = UpdateCheck.get().get_status()
        if self._updstat[0] == True:
            ui.find('updstatus').set('text', 'An update for Genesis is available.')
            ui.find('updstatus').set('size', '3')
            ui.find('updaction').set('text', 'Update Now')
            ui.find('updaction').set('iconfont', 'gen-arrow-down-3')
            ui.find('updaction').set('design', 'primary')

        if self._config:
            ui.append('main',
                self.app.get_config_by_classname(self._config).get_ui_edit()
            )

        if self._update is not None:
            pass
        else:
            ui.remove('dlgUpdate')

        if self._changed:
            self.put_message('warn', 'A restart is required for this setting change to take effect.')

        return ui
Ejemplo n.º 6
0
Archivo: main.py Proyecto: tewe/genesis
    def get_ui(self):
        ui = self.app.inflate('sysmon:main')
        self._mgr = apis.dashboard.WidgetManager(self.app)
        self._mgr.refresh()
        self._failed = []

        self.fill('l', self._mgr.list_left(), ui, 'cleft')
        self.fill('r', self._mgr.list_right(), ui, 'cright')

        if self._failed != []:
            ui.find('ui-dashboard-buttons').append(
                UI.Button(id='btnCleanUp',
                          text='Clean Up',
                          iconfont='gen-remove'))

        ui.insertText('host', platform.node())
        ui.insertText('distro', detect_distro())
        ui.find('icon').set(
            'src', '/dl/sysmon/distributor-logo-%s.png' %
            detect_platform(mapping=False))

        if self._adding_widget == True:
            dlg = self.app.inflate('sysmon:add-widget')
            idx = 0
            for prov in sorted(self.app.grab_plugins(apis.dashboard.IWidget)):
                if hasattr(prov, 'hidden'):
                    continue
                dlg.append(
                    'list',
                    UI.ListItem(
                        UI.HContainer(
                            UI.IconFont(iconfont=prov.iconfont),
                            UI.Label(text=' ' + prov.name),
                        ),
                        id=prov.plugin_id,
                    ))
                idx += 1
            ui.append('main', dlg)

        elif self._adding_widget != None:
            ui.append(
                'main',
                self._mgr.get_by_name(self._adding_widget).get_config_dialog())

        if UpdateCheck.get().get_status()[0] == True:
            self.put_message(
                'info',
                'An update for Genesis is available. See the Settings pane for details.'
            )

        return ui
Ejemplo n.º 7
0
    def get_ui(self):
        ui = self.app.inflate('config:main')

        # General
        ui.find('bind_host').set('value', self.app.gconfig.get('genesis', 'bind_host', ''))
        ui.find('bind_port').set('value', self.app.gconfig.get('genesis', 'bind_port', ''))
        ui.find('timedalert').set('value', self.app.gconfig.get('genesis', 'timedalert', ''))
        ui.find('dformat').set('value', self.app.gconfig.get('genesis', 'dformat', '%d %b %Y'))
        ui.find('tformat').set('value', self.app.gconfig.get('genesis', 'tformat', '%H:%M'))
        ui.find('ssl').set('text', ('Enabled' if self.app.gconfig.get('genesis', 'ssl', '')=='1' else 'Disabled'))
        ui.find('nofx').set('checked', self.app.gconfig.get('genesis', 'nofx', '')=='1')
        ui.find('updcheck').set('checked', self.app.gconfig.get('genesis', 'updcheck', '')=='1')
        ui.find('purge').set('checked', self.app.gconfig.get('genesis', 'purge', '')=='1')

        # Security
        ui.find('httpauth').set('checked', self.app.gconfig.get('genesis','auth_enabled')=='1')

        # Configs
        cfgs = self.app.grab_plugins(IModuleConfig)
        cfgs = sorted(cfgs, key=lambda config: config.target.__name__ if not hasattr(config.target, 'text') else config.target.text)
        t = ui.find('configs')
        for c in cfgs:
            if c.target:
                t.append(UI.DTR(
                UI.IconFont(iconfont=(None if not hasattr(c.target, 'iconfont') else c.target.iconfont)),
                UI.Label(text=(c.target.__name__ if not hasattr(c.target, 'text') else c.target.text)),
                UI.TipIcon(text='Edit', iconfont="gen-pencil-2", id='editconfig/'+c.target.__name__),
            ))

        # Updates
        self._updstat = UpdateCheck.get().get_status()
        if self._updstat[0] == True:
            ui.find('updstatus').set('text', 'An update for Genesis is available.')
            ui.find('updstatus').set('size', '3')
            ui.find('updaction').set('text', 'Update Now')
            ui.find('updaction').set('iconfont', 'gen-arrow-down-3')
            ui.find('updaction').set('design', 'primary')

        if self._config:
            ui.append('main',
                self.app.get_config_by_classname(self._config).get_ui_edit()
            )

        if not self._update:
            ui.remove('dlgUpdate')

        if self._changed:
            self.put_message('warn', 'A restart is required for this setting change to take effect.')

        return ui
Ejemplo n.º 8
0
    def get_ui(self):
        ui = self.app.inflate('home:home')
        cats = self.app.grab_plugins(api.ICategoryProvider)
        webs = self.app.grab_plugins(apis.webapps.IWebapp)
        btnlist = []

        for x in cats:
            if x.folder in self.folder_ids:
                btnlist.append({
                    'id':
                    x.plugin_id,
                    'type':
                    'plugin',
                    'icon':
                    x.plugin_info.icon
                    if hasattr(x.plugin_info, 'icon') else x.iconfont,
                    'name':
                    x.text
                })
        for x in webs:
            btnlist.append({
                'id': x.plugin_info.id,
                'type': 'webapp',
                'icon': x.plugin_info.icon,
                'name': x.plugin_info.name
            })

        for x in sorted(btnlist, key=lambda y: y['name']):
            ui.append(
                'main',
                UI.HomeButton(id=x['id'],
                              type=x['type'],
                              iconfont=x['icon'],
                              name=x['name']))

        if UpdateCheck.get().get_status()[0] == True:
            self.put_message(
                'info',
                'An update for Genesis is available. See the Settings pane for details.'
            )

        return ui
Ejemplo n.º 9
0
    def get_ui(self):
        ui = self.app.inflate('sysmon:main')
        self._mgr = apis.dashboard.WidgetManager(self.app)
        self._mgr.refresh()
        self._failed = []

        self.fill('l', self._mgr.list_left(), ui, 'cleft')
        self.fill('r', self._mgr.list_right(), ui, 'cright')

        if self._failed != []:
            ui.find('ui-dashboard-buttons').append(UI.Button(id='btnCleanUp', text='Clean Up', iconfont='gen-remove'))

        ui.insertText('host', platform.node())
        ui.insertText('distro', detect_distro())
        ui.find('icon').set('src', '/dl/sysmon/distributor-logo-%s.png'%detect_platform(mapping=False))

        if self._adding_widget == True:
            dlg = self.app.inflate('sysmon:add-widget')
            idx = 0
            for prov in sorted(self.app.grab_plugins(apis.dashboard.IWidget)):
                if hasattr(prov, 'hidden'):
                    continue
                dlg.append('list', UI.ListItem(
                    UI.HContainer(
                        UI.IconFont(iconfont=prov.iconfont),
                        UI.Label(text=' '+prov.name),
                    ),
                    id=prov.plugin_id,
                ))
                idx += 1
            ui.append('main', dlg)

        elif self._adding_widget != None:
            ui.append('main', self._mgr.get_by_name(self._adding_widget).get_config_dialog())

        if UpdateCheck.get().get_status()[0] == True:
            self.put_message('info', 'An update for Genesis is available. See the Settings pane for details.')

        return ui