~ubuntu-branches/ubuntu/lucid/iotop/lucid

« back to all changes in this revision

Viewing changes to iotop/ui.py

  • Committer: Bazaar Package Importer
  • Author(s): Paul Wise
  • Date: 2009-02-24 18:09:50 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20090224180950-jl97nbr2rr0t9qbk
Tags: 0.2.1-1
* New upstream release (Closes: #511649)
* List needed kernel config options in description (Closes: #497360)
* Avoid use of first-person in description
* Build-dep on python-setuptools instead of using the egg
* Switch from cdbs to debhelper 7
* Add a README.source pointing to the quilt one

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
import curses
2
2
import errno
 
3
import locale
3
4
import optparse
4
5
import os
5
6
import pwd
154
155
            io_delay, swapin_delay, read_bytes, write_bytes = stats
155
156
            line = '%5d %-8s %11s %11s %7s %7s ' % (p.pid, p.user[:8],
156
157
                                read_bytes, write_bytes, swapin_delay, io_delay)
157
 
            if self.options.batch:
158
 
                max_cmdline_length = 4096
159
 
            else:
160
 
                max_cmdline_length = self.width - len(line)
161
 
            line += p.get_cmdline()[:max_cmdline_length]
 
158
            line += p.get_cmdline()
 
159
            if not self.options.batch:
 
160
                line = line[:self.width - 1]
162
161
            return line
163
162
 
164
163
        def should_format(p):
196
195
                    title += self.sorting_reverse and '>' or '<'
197
196
                self.win.addstr(title, attr)
198
197
            for i in xrange(len(lines)):
199
 
                self.win.insstr(i + 2, 0, lines[i])
 
198
                self.win.addstr(i + 2, 0, lines[i].encode('utf-8'))
200
199
            self.win.refresh()
201
200
 
202
201
def run_iotop(win, options):
219
218
a refresh''' % sys.argv[0]
220
219
 
221
220
def main():
 
221
    locale.setlocale(locale.LC_ALL, '')
222
222
    parser = optparse.OptionParser(usage=USAGE, version='iotop ' + VERSION)
223
223
    parser.add_option('-o', '--only', action='store_true',
224
224
                      dest='only', default=False,