Пример #1
0
    def run(self):
        rm = RepositoryManager(self.app.config)
        feed_url = feedparser.parse('http://arkos.io/feed')

        while True:
            try:
                self.feed = []
                rm.update_list()
                for e in feed_url.entries:
                    self.feed.append({
                        'title': e.title,
                        'link': e.link,
                        'time': e.published_parsed
                    })
            except:
                pass
            time.sleep(60 * 60 * 12)  # check once every 12 hours
Пример #2
0
    def get_ui(self):
        ui = self.app.inflate('firstrun:main')
        step = self.app.inflate('firstrun:step%i' % self._step)
        ui.append('content', step)

        if self._step == 4:
            if self.arch[1] != 'Raspberry Pi':
                ui.remove('rpi-sdc')
                ui.remove('rpi-ogm')
            tz_sel = [
                UI.SelectOption(text=x, value=x, selected=False)
                for x in zonelist.zones
            ]
            ui.appendAll('zoneselect', *tz_sel)

        if self._step == 5:
            self._mgr = RepositoryManager(self.app.log, self.app.config)
            try:
                self._mgr.update_list(crit=True)
            except Exception, e:
                self.put_message('err', str(e))
                self.app.log.error(str(e))

            lst = self._mgr.available

            for k in sorted(lst, key=lambda x: x.name):
                row = self.app.inflate('firstrun:item')
                row.find('name').set('text', k.name)
                row.find('desc').set('text', k.description)
                row.find('icon').set('class', k.icon)
                row.find('version').set('text', k.version)
                row.find('author').set('text', k.author)
                row.find('author').set('url', k.homepage)

                req = k.str_req()

                row.find('check').set('name', 'install-' + k.id)
                if req != '':
                    row.append('reqs', UI.HelpIcon(text=req))

                ui.append('list', row)
Пример #3
0
    def get_ui(self):
        ui = self.app.inflate('firstrun:main')
        step = self.app.inflate('firstrun:step%i' % self._step)
        ui.append('content', step)

        if self._step == 3:
            tz_sel = [
                UI.SelectOption(text=x, value=x, selected=False)
                for x in zonelist.zones
            ]
            ui.appendAll('zoneselect', *tz_sel)

        if self._step == 4:
            self._mgr = RepositoryManager(self.app.config)
            self._mgr.update_list()

            lst = self._mgr.available

            for k in sorted(lst, key=lambda x: x.name):
                row = self.app.inflate('firstrun:item')
                row.find('name').set('text', k.name)
                row.find('desc').set('text', k.description)
                row.find('icon').set('class', k.icon)
                row.find('version').set('text', k.version)
                row.find('author').set('text', k.author)
                row.find('author').set('url', k.homepage)

                req = k.str_req()

                row.find('check').set('name', 'install-' + k.id)
                if req != '':
                    row.append('reqs', UI.HelpIcon(text=req))

                ui.append('list', row)

        return ui
Пример #4
0
 def on_session_start(self):
     self._mgr = RepositoryManager(self.app.log, self.app.config)
     self._nc = apis.networkcontrol(self.app)
     self._reloadfw = False
Пример #5
0
 def on_session_start(self):
     self._mgr = RepositoryManager(self.app.log, self.app.config)
     self._nc = apis.networkcontrol(self.app)
     self._wa = apis.webapps(self.app)
     self._info = None
     self._metoo = []
Пример #6
0
 def on_session_start(self):
     self._mgr = RepositoryManager(self.app.config)
Пример #7
0
    def get_ui(self):
        ui = self.app.inflate('firstrun:main')
        step = self.app.inflate('firstrun:step%i'%self._step)
        ui.append('content', step)

        if self.app.platform == 'arkos':
            ui.find('welcomemsg').text = 'Welcome to arkOS'

        for x in self._veriferr:
            ui.append('veriferr', UI.SystemMessage(cls="danger", iconfont="gen-close", text=x))
        self._veriferr = []

        if self._step == 2:
            ui.find('login').set('value', self._opts['username'] if self._opts.has_key('username') else '')
            ui.find('passwd').set('value', self._opts['userpasswd'] if self._opts.has_key('userpasswd') else '')

        if self._step == 3:
            ui.find('rootpasswd').set('value', self._opts['rootpasswd'] if self._opts.has_key('rootpasswd') else '')

        if self._step == 4:
            ui.find('hostname').set('value', self._opts['hostname'] if self._opts.has_key('hostname') else 'arkos')
            ui.find('ssh_as_root').set('checked', 'True' if self._opts.has_key('ssh_as_root') and self._opts['ssh_as_root'] == '1' else 'False')

            if self.app.board == 'Raspberry Pi':
                ui.find('resize').set('checked', 'True' if self._opts.has_key('resize') and self._opts['resize'] == '1' else 'False')
                ui.find('gpumem').set('checked', 'True' if self._opts.has_key('gpumem') and self._opts['gpumem'] == '1' else 'False')
            else:
                ui.remove('rpi-ogm')
            if self.app.board in ['Unknown', 'General']:
                ui.remove('sdc')
            if self.app.board not in ['Cubieboard2', 'Cubietruck']:
                ui.remove('cbb-mac')
            else:
                mac = ':'.join(map(lambda x: "%02x" % x, 
                    [0x54, 0xb3, 0xeb, random.randint(0x00, 0x7f), 
                    random.randint(0x00, 0xff), 
                    random.randint(0x00, 0xff)]))
                ui.find('macaddr').set('value', mac)
            tz = self._opts['zone'] if self._opts.has_key('zone') else 'UTC'
            tz_sel = [UI.SelectOption(text = x, value = x,
                selected=(x==tz))
                for x in zonelist.zones]
            ui.appendAll('zoneselect', *tz_sel)

        if self._step == 5:
            self._mgr = RepositoryManager(self.app.log, self.app.config)
            try:
                self._mgr.update_list(crit=True)
            except Exception, e:
                self.put_message('err', str(e))
                self.app.log.error(str(e))

            lst = self._mgr.available

            for k in sorted(lst, key=lambda x:x.name):
                ui.append('ui-firstrun-appselectfield',
                    UI.AppSelect(
                        id=k.id,
                        name=k.name,
                        desc=k.description,
                        iconfont=k.icon,
                        version=k.version
                    ))