Skip to content

Commit

Permalink
Fix urwid support: subclass Widget for widgets
Browse files Browse the repository at this point in the history
* Fix urwid warnings
Fix: wardi#30
  • Loading branch information
Aleksei Stepanov committed Jan 22, 2024
1 parent 43b25e8 commit 7873247
Showing 1 changed file with 4 additions and 4 deletions.
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

0 comments on commit 7873247

Please sign in to comment.