コード例 #1
0
ファイル: console.py プロジェクト: bbglab/qmap
    def __init__(self, status):
        """
        Widget containing the execution status

        Args:
            status:

        """

        self.exec_status = status

        # Manager information
        self.progress = urwid.ProgressBar(
            "pg normal",
            "pg complete",
            current=len(self.exec_status.groups[JobStatus.DONE]),
            done=self.exec_status.total)
        self.progress_info = urwid.Text(str(self.exec_status))

        self.widget = urwid.Pile([self.progress, self.progress_info])

        BaseTimedWidgetWrap.__init__(self, self.widget)
コード例 #2
0
    def monitor_encoding(self):
        self.check_task_completion()

        # Start more encodes if we're able to
        if len(self.videos) > 0 and len(
                self.active_encodes) < self.parallel_encodes:
            self.todo_list.body.pop(0)
            filename, out_filename = self.videos.popleft()
            self.active_encodes[filename] = EncodingTask(
                filename, out_filename)
            active_encode_ui = urwid.Pile([
                urwid.Text(filename),
                urwid.Text(""),
                urwid.ProgressBar("normal", "complete"),
                urwid.Text(
                    f"Output: {self.active_encodes[filename].out_filename}"),
                urwid.Divider("-")
            ])
            self.active_list.body.append(active_encode_ui)

        total_fps = 0
        for k, enc in self.active_encodes.items():
            if "fps" in enc.encode_stats:
                total_fps += enc.encode_stats["fps"]
        self.main_widget.footer.set_text(
            f"Todo: {len(self.videos)}. Total FPS: {round(total_fps, 2)}. ESC to Cancel/Quit"
        )

        # Check which UI column is selected and style the title to indicate it
        columns = self.main_widget.body
        for c in columns.contents:
            title = c[0].title_widget
            if c[0] == columns.focus:
                title.set_text(("selected_column", title.text))
            else:
                title.set_text(("default_text", title.text))
コード例 #3
0
    def __init__(self):

        # Colors palette
        self._palette = [
             ('pg normal', 'white', 'black', 'standout'),
             ('pg complete', 'white', 'dark green'),
             ('pg smooth', 'dark magenta', 'black'),
             ('text activate', 'light green', 'black'),
             ('text enabled', 'white', 'dark blue')
             ]

        # Frame components
        self.text = urwid.Text('Engine Power:','left')

        self.progressBar = urwid.ProgressBar(
            'pg normal',
            'pg complete',
            satt='pg smooth')

        self.header = urwid.Columns(
            [self.text, self.progressBar])

        self.footer = urwid.Text('[*] Waiting for packages...')

        # Movement indicators
        self.forwardText = urwid.Text(('pg normal','Forward'))
        self.forwardMap = urwid.AttrMap(self.forwardText, '')
        self.forward = urwid.Padding(
            self.forwardMap,
            'right',
            ('relative', 75))

        self.fallbackText = urwid.Text(('pg normal','Fallback'))
        self.fallbackMap = urwid.AttrMap(self.fallbackText, '')
        self.fallback = urwid.Padding(
            self.fallbackMap,
            'right',
            ('relative', 75))

        self.leftText = urwid.Text(('pg normal','Left'))
        self.left =  urwid.AttrMap(self.leftText, '')

        self.rightText = urwid.Text(('pg normal','Right'))
        self.right = urwid.AttrMap(self.rightText, '')

        self.columnsLeftRight = urwid.Columns(
            [self.left, self.right])

        self.movementIndicators = urwid.Frame(
            urwid.Filler(self.columnsLeftRight),
            self.forward,
            self.fallback)

        # Movement in site
        self.turnLeftText = urwid.Text(('pg normal','Turn Left'), 'left')
        self.turnLeft = urwid.AttrMap(self.turnLeftText, '')

        self.turnRightText = urwid.Text(('pg normal','Turn Right'), 'right')
        self.turnRight = urwid.AttrMap(self.turnRightText, '')

        # Container all movements componenents
        self.body = urwid.Columns(
                [self.turnLeft, urwid.BoxAdapter(self.movementIndicators, 5), self.turnRight])

        # Container for all components
        self.frame = urwid.Frame(
            urwid.Filler(self.body),
            self.header,
            self.footer)

        #Component father.
        self.display = urwid.LineBox(self.frame,'Syma X5SW Telemetry Display')
        self.mainLoop = urwid.MainLoop(self.display, self._palette, unhandled_input=self.inputQuit)
コード例 #4
0
palette = [('complete', 'light blue', 'default'),
           ('incomplete', 'white', 'default'),
           ('incorrect', 'light red', 'default'),
           ('response', 'light magenta', 'default'),
           ('pg normal', 'dark red', 'dark red'),
           ('pg complete', 'dark green', 'dark green')]

with open('prompts.txt', 'r') as f:
    text = random.choice(f.readlines()).strip()

# Widgets
prompt = Prompt(text)
div = u.Divider()
wpm = u.Text("Words Per Minute: ")
progress = u.ProgressBar('pg normal', 'pg complete', current=0, done=len(text))
progressText = u.Text("Progress: ")

response = u.Edit(('response', ''))


def on_resp_change(resp, newtext):
    """ Event signaling a change in the response text box"""

    prompt.process(newtext)

    # Start timing on first input
    if prompt.timeStart is None:
        prompt.timeStart = datetime.datetime.now()

    # Update WPM
コード例 #5
0
ファイル: control.py プロジェクト: Unrud/e32hw-control
    def __init__(self, vehicle):
        self._vehicle = vehicle
        palette = [('bg', 'black', 'white'), ('title', 'black,bold', 'white'),
                   ('progress_normal', 'black', 'light gray'),
                   ('progress_complete', 'white', 'black')]

        title = urwid.Text(('title', '\n{}\n'.format(TITLE)), align='center')

        def trim(obj, userdata):
            axis_name, value = userdata
            axis_name += '_trim'
            old_value = getattr(self._vehicle, axis_name)
            setattr(self._vehicle, axis_name, old_value + value)

        axis_labels = []
        axis_values = []
        self._bars = {}
        for e in vehicle.inputs:
            if e['type'] != 'axis':
                continue
            axis_labels.append(urwid.Text('{}:'.format(e['desc'])))
            bar = urwid.ProgressBar('progress_normal', 'progress_complete', 50)
            axis_values.append(bar)
            self._bars[e['id']] = bar
            if e.get('trim'):
                axis_labels.append(urwid.Text('{} Trim:'.format(e['desc'])))
                bar_trim = urwid.ProgressBar('progress_normal',
                                             'progress_complete', 50)
                trim_step = e['trim_step']
                dec = urwid.Button('-', trim, (e['id'], -trim_step))
                inc = urwid.Button('+', trim, (e['id'], +trim_step))
                axis_values.append(
                    urwid.Columns([('weight', 0, dec), ('weight', 1, bar_trim),
                                   ('weight', 0, inc)],
                                  min_width=5))
                self._bars['{}_trim'.format(e['id'])] = bar_trim

        labels = urwid.Pile(axis_labels)
        values = urwid.Pile(axis_values)

        labels_minwidth = max(w[0].pack()[0] for w in labels.contents)
        cols = urwid.Columns([(labels_minwidth, labels), values],
                             dividechars=1)

        def press(obj, state, userdata):
            _id, _type = userdata
            if _type == 'once' and getattr(self._vehicle, _id):
                return
            setattr(self._vehicle, _id, state)

        checkboxes = []
        self._checkboxes = {}

        for e in vehicle.inputs:
            if e['type'] == 'axis':
                continue
            ch = urwid.CheckBox('{}'.format(e['desc']),
                                on_state_change=press,
                                user_data=(e['id'], e['type']))
            checkboxes.append(ch)
            self._checkboxes[e['id']] = ch

        def exit(obj):
            raise urwid.ExitMainLoop()

        exit_btn = urwid.Button('Exit', on_press=exit)

        rows = urwid.Pile([title, cols, *checkboxes, exit_btn])
        top = urwid.AttrMap(urwid.Filler(rows, 'top'), 'bg')
        evl = urwid.AsyncioEventLoop(loop=asyncio.get_event_loop())
        self._loop = urwid.MainLoop(top, palette, event_loop=evl)
コード例 #6
0
 def _progress_bar(self, pct, theme):
     return urwid.ProgressBar(theme['progress_n'],
                              theme['progress_c'],
                              current=pct,
                              done=100)
コード例 #7
0
from __future__ import print_function

from contextlib import suppress

import urwid

from balto.suite import TestSuite

STATUS = urwid.Text("")
PROGRESS_BAR = urwid.ProgressBar("pg normal", "pg complete", 0, 1)
FOOTER = urwid.Columns([STATUS, PROGRESS_BAR])
SELECTED_TEST = set()


def set_selected_tests(tests):
    global SELECTED_TEST
    SELECTED_TEST = set(tests)


def get_selected_tests():
    global SELECTED_TEST
    return SELECTED_TEST


PALETTE = [
    ("body", "black", "light gray"),
    ("flagged", "black", "dark green", ("bold", "underline")),
    ("focus", "light gray", "dark blue", "standout"),
    ("focus Passing", "light green", "dark blue", "standout"),
    ("focus Failing", "light red", "dark blue", "standout"),
    ("flagged focus", "yellow", "dark cyan", ("bold", "standout", "underline")),
コード例 #8
0
    def main_window(self):
        self.last_update = urwid.Text(('button', "Last Updated: %s" % "Never"))

        self.outages = urwid.Button(('button', "Outages"))
        network_outages = urwid.Pile(
            [urwid.Text(('header', "Network Outages")), self.outages])

        self.health_hosts = urwid.ProgressBar('pg normal',
                                              'pg complete',
                                              100,
                                              satt='pg smooth')
        self.health_services = urwid.ProgressBar('pg normal',
                                                 'pg complete',
                                                 30,
                                                 satt='progress')
        network_health = urwid.Pile([
            urwid.Text(('header', "Network Health")), self.health_hosts,
            self.health_services
        ])

        network = urwid.Columns([network_outages, network_health])

        self.bHosts['down'] = urwid.Button(('button', "Down"))
        self.bHosts['unreachable'] = urwid.Button(('button', "Unreachable"))
        self.bHosts['up'] = urwid.Button(('button', "Up"))
        self.bHosts['pending'] = urwid.Button(('button', "Pending"))
        self.hosts_state = urwid.Columns([
            self.bHosts['down'], self.bHosts['unreachable'], self.bHosts['up'],
            self.bHosts['pending']
        ])

        self.bServices['critical'] = urwid.Button(('button', "Critical"))
        self.bServices['warning'] = urwid.Button(('button', "Warning"))
        self.bServices['unknown'] = urwid.Button(('button', "Unknown"))
        self.bServices['ok'] = urwid.Button(('button', "Ok"))
        self.bServices['pending'] = urwid.Button(('button', "Pending"))
        self.services_state = urwid.Columns([
            self.bServices['critical'], self.bServices['warning'],
            self.bServices['unknown'], self.bServices['ok'],
            self.bServices['pending']
        ])

        pile = urwid.Pile([
            urwid.LineBox(
                urwid.Pile([
                    self.last_update,
                    urwid.Text(('button',
                                "Updated every %s seconds" % REFRESH_INTERVAL))
                ])),
            urwid.Divider(bottom=2), network,
            urwid.Divider(),
            urwid.Text(('header', "Hosts")), self.hosts_state,
            urwid.Divider(),
            urwid.Text(('header', "Services")), self.services_state
        ])

        header = urwid.Text(('banner', "Tactical Monitoring Overview"),
                            align='center')
        footer = urwid.Text("Q to quit")
        fill = urwid.Filler(pile, 'middle')
        view = urwid.Frame(fill, header=header, footer=footer)
        map1 = urwid.AttrMap(view, 'bg')

        return map1
コード例 #9
0
 def _progress_status_widget(self):
     return urwid.ProgressBar("progressbar-normal", "progressbar-complete",
                              data.milestone_closed_points(self.milestone),
                              data.milestone_total_points(self.milestone),
                              "progressbar-smooth")
コード例 #10
0
streckButtonSignal = urwid.connect_signal(streckButton, 'click',
                                          handleStreckButton)

spelbarhetEdit = urwid.Edit(u"Lägsta spelbarhet: ", "1.00")
spelbarhetButton = urwid.Button(u"Set Spelbarhet")
SpelbarhetButtonSignal = urwid.connect_signal(spelbarhetButton, 'click',
                                              handleSpelbarhetButton)

oddsMaxEdit = urwid.IntEdit("Max oddsfavoriter: ", 9)
oddsMinEdit = urwid.IntEdit("Min oddsfavoriter: ", 1)
minUtdelningEdit = urwid.IntEdit("Min utdelning: ", 1000000)
maxLikaEdit = urwid.IntEdit("Max lika: ", 11)
reduceraButton = urwid.Button(u"Reducera")
reduceraButtonSignal = urwid.connect_signal(reduceraButton, 'click',
                                            handleReduceraButton)
pb = urwid.ProgressBar('pbIncomplete', 'pbComplete')

typeFill = urwid.Filler(urwid.Pile([
    stryk, eu,
    urwid.Divider(), infoText,
    urwid.Divider(),
    urwid.Padding(
        urwid.GridFlow([urwid.Text(u"1: "), cb11, cb1X, cb12], 5, 3, 1,
                       'left')),
    urwid.Padding(
        urwid.GridFlow([urwid.Text(u"2: "), cb21, cb2X, cb22], 5, 3, 1,
                       'left')),
    urwid.Padding(
        urwid.GridFlow([urwid.Text(u"3: "), cb31, cb3X, cb32], 5, 3, 1,
                       'left')),
    urwid.Padding(
コード例 #11
0
ファイル: install.py プロジェクト: ri0t/hfos
        def install_modules(self):
            plugins = []

            for plugin in Modules:
                if Modules[plugin]:
                    plugins.append(plugin)

            installtext = urwid.Text(('title', u"Installing"), align='center')
            installinfo = urwid.Text(('title', u"Preparing installation"),
                                     align='center')
            installwrap = urwid.AttrMap(
                urwid.Pile([installtext, blank, installinfo, blank]), 'bg')
            installprogressbar = urwid.ProgressBar('title', 'streak',
                                                   done=len(plugins))

            installlb = urwid.AttrMap(urwid.ListBox(
                urwid.SimpleListWalker([
                    installwrap,
                    installprogressbar,
                    blank
                ])
            ), 'bg')

            installlbfill = urwid.Filler(installlb, height=('relative', 50))

            self.body = installlbfill

            done = 0

            log = {}

            mode = "install" if self.installrbutton.state is True else \
                "develop"

            for plugin in plugins:
                self.footer.set_text(('banner',
                                      u" Using %s as installation mode to "
                                      u"install %s " % (
                                          mode, plugin)))
                setup = Popen(['python', 'setup.py', mode], cwd=plugin + "/",
                              stderr=PIPE, stdout=PIPE)
                setup.wait()
                pluginlog = setup.communicate()

                log[plugin] = pluginlog

                # self.installPlugin(plugin)
                installinfo.set_text(
                    (u"Installing package 'hfos-%s'" % plugin))
                done += 1
                installprogressbar.set_completion(done)
                self.loop.draw_screen()

            self.loop.stop()

            filename = mktemp("log", "hfos_plugin_installer")

            def writelog(fileobject, block):
                for line in block:
                    fileobject.write(line)

            header = "#" * 5

            def writeheader(fileobject, text):
                fileobject.write(header + " " + str(text) + " " + header +
                                 "\n")

            with open(filename, "w") as f:
                for plugin in log:
                    writeheader(f, "Install log for %s" % plugin)

                    writeheader(f, "Info output")
                    writelog(f, str(log[plugin][0]))
                    writeheader(f, "Error output")
                    writelog(f, str(log[plugin][1]))

            print("Done. Logfile written to %s " % filename)

            sys.exit()
コード例 #12
0
ファイル: dialog.py プロジェクト: michaelpalmeruw/mbib
 def make_widgets(self):
     self.set_widget('bar', urwid.ProgressBar(self.incomplete, self.complete, done=self.final_percent))
コード例 #13
0
ファイル: header.py プロジェクト: max-mal/yamusic
    def build(self, ui):
        self.ui = ui

        track = self.ui.player.getTrack()

        trackName = ''
        if (track != None):
            trackName = '{name} ({artists})'.format(
                name=track.title,
                artists=','.join(map(lambda a: a.name, track._artists)))

        statusText = 'Онлайн'
        if (not self.ui.repository.online):
            statusText = 'Оффлайн'

        loopText = ''
        if (self.ui.player.loop):
            loopText = '🔁  On (F7)'
        else:
            loopText = '🔁  (F7)'

        return urwid.LineBox(
            urwid.Pile([
                urwid.Columns([
                    urwid.Padding(urwid.AttrMap(urwid.Text(trackName),
                                                'greenColor'),
                                  right=3),
                    urwid.ProgressBar('progressbar.b', 'progressbar.a',
                                      self.ui.player.currentPosition * 100)
                ]),
                urwid.Columns([
                    urwid.Pile([
                        UiButton('Сейчас играет', self.on_playlist),
                        UiButton(statusText, on_press=self.toggle_offline),
                        urwid.Text('DL: ' +
                                   str(len(self.ui.downloader.queue))),
                    ]),
                    urwid.Text(' '),
                    urwid.Pile([
                        urwid.AttrMap(UiButton('▶  (F1)', on_press=self.play),
                                      'greenColor'),
                        urwid.AttrMap(UiButton('⏸  (F2)', on_press=self.pause),
                                      'yellowColor'),
                        urwid.AttrMap(UiButton('⏹  (F3)', on_press=self.stop),
                                      'redColor'),
                    ]),
                    urwid.Text(' '),
                    urwid.Pile([
                        UiButton('⏮  (F4)', on_press=self.prevTrack),
                        UiButton('⏭  (F5)', on_press=self.nextTrack),
                        UiButton('🔀 (F6)', on_press=self.shuffle)
                    ]),
                    urwid.Text(' '),
                    urwid.Pile([
                        UiButton(loopText, on_press=self.loop),
                        UiButton(self.getLikeDislikeText(track),
                                 on_press=self.on_like_press,
                                 user_data=track),
                        UiButton(self.getLikeDislikeText(track, True),
                                 on_press=self.on_dislike_press,
                                 user_data=track),
                    ])

                    #UiButton('Like'),
                    #UiButton('Dislike'),
                ])
            ]),
            title='Player')
コード例 #14
0
ファイル: terminal_gui.py プロジェクト: swipswaps/composer
def make_progress_bar(smooth=False):
    if smooth:
        return urwid.ProgressBar("pg normal", "pg complete", 0, 1, "pg smooth")
    return urwid.ProgressBar("pg normal", "pg complete", 0, 1)
コード例 #15
0
 def __init__(self, current, done):
     self._progressbar = urwid.ProgressBar(None, "progress.bar", current,
                                           done)
     linebox = urwid.LineBox(self._progressbar)
     urwid.WidgetWrap.__init__(self, linebox)
コード例 #16
0
 def progress_bar(self, smooth=False):
     if smooth:
         return urwid.ProgressBar('pg normal', 'pg complete', 0, 1,
                                  'pg smooth')
     else:
         return urwid.ProgressBar('pg normal', 'pg complete', 0, 1)
コード例 #17
0
	def __init__(self, controller, title, num_files, total_size, q, ev_skip, ev_suspend, ev_abort, ev_nodb, on_complete):
		self.controller = controller
		self.num_files = num_files
		self.total_size = total_size
		self.q = q
		self.ev_skip = ev_skip
		self.ev_suspend = ev_suspend
		self.ev_abort = ev_abort
		self.ev_nodb = ev_nodb
		self.on_complete = on_complete

		self.aborted = False

		self.source = urwid.Text(' ', layout=TildeLayout)
		self.target = urwid.Text(' ', layout=TildeLayout)
		self.progress_current = urwid.ProgressBar('dialog', 'progress')
		self.time_current = urwid.Text(f'{human_readable_size(0)}/{human_readable_size(0)} ETA {format_seconds(0)} ({human_readable_size(0)}/s)', layout=TildeLayout)
		w = urwid.Columns([(1, urwid.Text('[')), self.progress_current, (1, urwid.Text(']'))])
		w = urwid.Pile([
			(1, urwid.Filler(urwid.Text('Source'))),
			(1, urwid.Filler(self.source)),
			(1, urwid.Filler(urwid.Text('Target'))),
			(1, urwid.Filler(self.target)),
			(1, urwid.Filler(w)),
			(1, urwid.Filler(self.time_current)),
		])
		w = urwid.LineBox(urwid.Padding(w, left=1, right=1), title, title_attr='dialog_title', bline='')
		top = urwid.Padding(w, left=1, right=1)

		self.files = urwid.Text(f'Files processed: 0/{self.num_files}', layout=TildeLayout)
		self.time = urwid.Text(f'Time: {format_seconds(0)} ETA {format_seconds(0)} ({human_readable_size(0)}/s)', layout=TildeLayout)
		self.progress_total = urwid.ProgressBar('dialog', 'progress', 0, (total_size or 1))
		w = urwid.Columns([(1, urwid.Text('[')), self.progress_total, (1, urwid.Text(']'))])
		w = urwid.Pile([
			(1, urwid.Filler(w)),
			(1, urwid.Filler(self.files)),
			(1, urwid.Filler(self.time)),
		])
		self.divider = urwid.LineBox(urwid.Padding(w, left=1, right=1), f'Total: {human_readable_size(0)}/{human_readable_size(self.total_size)}', tlcorner='├', trcorner='┤', bline='')
		middle = urwid.Padding(self.divider, left=1, right=1)

		self.btn_skip = urwid.Button('Skip', lambda x: self.on_skip())
		attr_btn_skip = urwid.AttrMap(self.btn_skip, 'dialog', 'dialog_focus')
		self.btn_suspend = urwid.Button('Suspend', lambda x: self.on_suspend())
		attr_btn_suspend = urwid.AttrMap(self.btn_suspend, 'dialog', 'dialog_focus')
		self.btn_abort = urwid.Button('Abort', lambda x: self.on_abort())
		attr_btn_abort = urwid.AttrMap(self.btn_abort, 'dialog', 'dialog_focus')
		self.btn_nodb = urwid.Button('No DB', lambda x: self.on_nodb())
		attr_btn_nodb = urwid.AttrMap(self.btn_nodb, 'dialog', 'dialog_focus')
		w = urwid.Columns([urwid.Divider(' '), (8, attr_btn_skip), (1, urwid.Text(' ')), (12, attr_btn_suspend), (1, urwid.Text(' ')), (9, attr_btn_abort), (1, urwid.Text(' ')), (9, attr_btn_nodb), urwid.Divider(' ')])
		w = urwid.LineBox(urwid.Filler(w), tlcorner='├', trcorner='┤')
		bottom = urwid.Padding(w, left=1, right=1)

		w = urwid.Pile([
			(1, urwid.Filler(urwid.Text(' '))),
			(7, top),
			(4, middle),
			(3, bottom),
			(1, urwid.Filler(urwid.Text(' '))),
		])
		w = urwid.AttrMap(w, 'dialog')

		super().__init__(w)
コード例 #18
0
 def progress_bar(self):
     return urwid.ProgressBar('pg normal', 'pg complete', 0, 1)
コード例 #19
0
#     log("jo")
#
#     return True

if False:

    import urwid
    import urwid.raw_display

    ufile = urwid.Text("test", align='left')

    screen = urwid.raw_display.Screen()
    header = urwid.AttrWrap(urwid.Text("pentavideo"), 'header')

    blank = urwid.Divider()
    prog_bar = urwid.ProgressBar('pg normal', 'pg complete', 0, 1, 'pg smooth')
    log_text = urwid.Text("BLA")

    def log(*args):
        log_text.set_text(log_text.text + "\n".join([str(x) for x in args]))

    listbox_content = [
        blank,
        log_text,
        urwid.Padding(urwid.Text("hi there"), ('fixed left', 2),
                      ('fixed right', 2), 20),
        blank,
        prog_bar,
    ]

    listbox = urwid.ListBox(urwid.SimpleListWalker(listbox_content))