예제 #1
0
파일: main.py 프로젝트: skyboyhjj/genesis
    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
예제 #2
0
파일: main.py 프로젝트: heinzK1X/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('c', self._mgr.list_center(), ui, 'cmiddle')
        self.fill('r', self._mgr.list_right(), ui, 'cright')

        if self._failed != []:
            ui.find('ui-dashboard-buttons').append(UI.Btn(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.Label(text=prov.name),
                    iconfont=prov.iconfont,
                    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())

        return ui
예제 #3
0
파일: main.py 프로젝트: Bugsbane/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("c", self._mgr.list_center(), ui, "cmiddle")
        self.fill("r", self._mgr.list_right(), ui, "cright")

        if self._failed != []:
            ui.find("ui-dashboard-buttons").append(UI.Btn(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.Label(text=prov.name), iconfont=prov.iconfont, 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())

        return ui
예제 #4
0
파일: main.py 프로젝트: bneg/genesis
    def get_ui(self):
        ui = self.app.inflate('dashboard: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/dashboard/distributor-logo-%s.png'%detect_platform(mapping=False))

        if self._adding_widget == True:
            dlg = self.app.inflate('dashboard: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.Image(file=prov.icon),
                        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())

        return ui
예제 #5
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('c', self._mgr.list_center(), ui, 'cmiddle')
        self.fill('r', self._mgr.list_right(), ui, 'cright')

        if self._failed != []:
            ui.find('ui-dashboard-buttons').append(UI.Btn(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.Label(text=prov.name),
                    iconfont=prov.iconfont,
                    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())

        return ui
예제 #6
0
class DiskUsageMeter(LinearMeter):
    name = 'Disk usage'
    category = 'System'
    transform = 'percent'

    _platform = detect_platform()
    _partstatformat = re.compile('(/dev/)?(?P<dev>\w+)\s+\d+\s+\d+\s+\d+\s+' +
                                 '(?P<usage>\d+)%\s+(?P<mountpoint>\S+)$')
    if 'arkos' in _platform or 'arch' in _platform:
        _totalformat = re.compile(
            '(?P<dev>total)\s+\d+\s+\d+\s+\d+\s+(?P<usage>\d+)%+\s+\-$')
    else:
        _totalformat = re.compile(
            '(?P<dev>total)\s+\d+\s+\d+\s+\d+\s+(?P<usage>\d+)%$')

    def init(self):
        if self.variant == 'total':
            self.text = 'total'
        else:
            mountpoints = self.get_mountpoints()
            self.text = '%s (%s)' % (self.variant, ', '.join(mountpoints))

    def _get_stats(self, predicate=(lambda m: True)):
        if hasattr(self, 'variant') and self.variant == 'total':
            matcher = DiskUsageMeter._totalformat
        else:
            matcher = DiskUsageMeter._partstatformat

        stats = shell('df --total')
        matches = []
        for stat in stats.splitlines():
            match = matcher.match(stat)
            if match and predicate(match):
                matches.append(match)
        return matches

    def _get_stats_for_this_device(self):
        return self._get_stats(lambda m: m.group('dev').endswith(self.variant))

    def get_variants(self):
        if 'arkos' in self._platform or 'arch' in self._platform:
            return sorted(set([m.group('dev') for m in self._get_stats()]))
        else:
            return sorted(set([m.group('dev')
                               for m in self._get_stats()])) + ['total']

    def get_mountpoints(self):
        devmatches = self._get_stats_for_this_device()
        return sorted([m.group('mountpoint') for m in devmatches])

    def get_value(self):
        devmatches = self._get_stats_for_this_device()
        return int(devmatches[0].group('usage'))

    def get_min(self):
        return 0

    def get_max(self):
        return 100
예제 #7
0
파일: main.py 프로젝트: 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
예제 #8
0
파일: main.py 프로젝트: IsSuEat/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
예제 #9
0
파일: config.py 프로젝트: tewe/genesis
 def __init__(self):
     ConfigParser.__init__(self)
     self.set('platform', detect_platform())  # TODO: move this out
     arch, board = detect_architecture()
     self.set('arch', arch)
     self.set('board', board)
예제 #10
0
파일: config.py 프로젝트: Bugsbane/genesis
 def __init__(self):
     ConfigParser.__init__(self)
     self.set('platform', detect_platform()) # TODO: move this out
     arch, board = detect_architecture()
     self.set('arch', arch)
     self.set('board', board)
예제 #11
0
 def __init__(self):
     ConfigParser.__init__(self)
     self.set('platform', detect_platform())  # TODO: move this out