Exemplo n.º 1
0
    def render(self, max_col_row, focus=False):
        maxcol, maxrow = max_col_row
        left = max(0, len(self.log) - maxcol)
        pad = maxcol - (len(self.log) - left)

        topl = self.local_maximums(pad, left)
        yvals = [max(self.bar[i]) for i in topl]
        yvals = urwid.scale_bar_values(yvals, graph_range(), maxrow)

        graphtop = self.graph
        for i, y in zip(topl, yvals):
            s = self.log[i]
            txt = urwid.Text(readable_speed(s))
            label = urwid.AttrWrap(urwid.Filler(txt), 'reading')

            graphtop = urwid.Overlay(label, graphtop,
                                     ('fixed left', pad + i - 4 - left), 10,
                                     ('fixed top', max(0, y - 2)), 1)

        return graphtop.render((maxcol, maxrow), focus)
Exemplo n.º 2
0
		bar = self.bar[ -maxcol:]
		if len(bar) < maxcol:
			bar = [[0]]*(maxcol-len(bar)) + bar
		return bar, 20, [15,10,5]
	
	def selectable(self):
		return False
	
	def render(self, (maxcol, maxrow), focus=False):
		
		left = max(0, len(self.log)-maxcol)
		pad = maxcol-(len(self.log)-left)
		
		topl = self.local_maximums(pad, left)
		yvals = [ max(self.bar[i]) for i in topl ]
		yvals = urwid.scale_bar_values(yvals, 20, maxrow)
		
		graphtop = self.graph
		for i,y in zip(topl, yvals):
			s = self.log[ i ]
			txt = urwid.Text( readable_speed( s ) )
			label = urwid.AttrWrap( urwid.Filler( txt ), 'reading')

			graphtop = urwid.Overlay( label, graphtop,
				('fixed left', pad+i-4-left), 9,
				('fixed top', max(0,y-2) ), 1 )
		
		return graphtop.render( (maxcol, maxrow), focus )

	def local_maximums(self, pad, left):
		"""
Exemplo n.º 3
0
        bar = self.bar[-maxcol:]
        if len(bar) < maxcol:
            bar = [[0]]*(maxcol-len(bar)) + bar
        return bar, graph_range(), graph_lines()

    def selectable(self):
        return False

    def render(self, (maxcol, maxrow), focus=False):

        left = max(0, len(self.log)-maxcol)
        pad = maxcol-(len(self.log)-left)

        topl = self.local_maximums(pad, left)
        yvals = [ max(self.bar[i]) for i in topl ]
        yvals = urwid.scale_bar_values(yvals, graph_range(), maxrow)

        graphtop = self.graph
        for i,y in zip(topl, yvals):
            s = self.log[ i ]
            txt = urwid.Text(readable_speed(s))
            label = urwid.AttrWrap(urwid.Filler(txt), 'reading')

            graphtop = urwid.Overlay(label, graphtop,
                ('fixed left', pad+i-4-left), 10,
                ('fixed top', max(0,y-2)), 1)

        return graphtop.render((maxcol, maxrow), focus)

    def local_maximums(self, pad, left):
        """
Exemplo n.º 4
0
        bar = self.bar[-maxcol:]
        if len(bar) < maxcol:
            bar = [[0]] * (maxcol - len(bar)) + bar
        return bar, graph_range(), graph_lines()

    def selectable(self):
        return False

    def render(self, (maxcol, maxrow), focus=False):

        left = max(0, len(self.log) - maxcol)
        pad = maxcol - (len(self.log) - left)

        topl = self.local_maximums(pad, left)
        yvals = [max(self.bar[i]) for i in topl]
        yvals = urwid.scale_bar_values(yvals, graph_range(), maxrow)

        graphtop = self.graph
        for i, y in zip(topl, yvals):
            s = self.log[i]
            txt = urwid.Text(readable_speed(s))
            label = urwid.AttrWrap(urwid.Filler(txt), 'reading')

            graphtop = urwid.Overlay(label, graphtop,
                                     ('fixed left', pad + i - 4 - left), 10,
                                     ('fixed top', max(0, y - 2)), 1)

        return graphtop.render((maxcol, maxrow), focus)

    def local_maximums(self, pad, left):
        """