Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix urwid support: subclass Widget for widgets #31

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions speedometer.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import time
import sys
import os
import string
import math
import re
import psutil
Expand Down Expand Up @@ -231,9 +230,9 @@ def __init__(self, cols, urwid_ui, exit_on_complete, shiny_colors):
l.append(a)

graphs = urwid.Columns([urwid.Pile(a) for a in l], 1)
graphs = urwid.AttrWrap(graphs, 'background')
graphs = urwid.AttrMap(graphs, 'background')
title = urwid.Text(" Speedometer "+__version__)
title = urwid.AttrWrap(urwid.Filler(title), 'title')
title = urwid.AttrMap(urwid.Filler(title), 'title')
self.top = urwid.Overlay(title, graphs,
('fixed left', 5), 17, ('fixed top', 0), 1)

Expand Down Expand Up @@ -396,8 +395,9 @@ def update_readings(self):
self.est.set_text(readable_time(e,10))
return current < expected

class SpeedGraph:
class SpeedGraph(urwid.Widget):
def __init__(self, attlist, hatt=None, satt=None):
super().__init__()
if satt is None:
self.graph = urwid.BarGraph(attlist, hatt)
else:
Expand Down