~er-abhinav-upadhyay/computer-janitor/bug-726616

« back to all changes in this revision

Viewing changes to computerjanitorapp/ui_cli.py

  • Committer: Bazaar Package Importer
  • Author(s): Lars Wirzenius
  • Date: 2009-08-21 15:48:12 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20090821154812-s89fcyo4co74tk7o
Tags: 1.13.2-0ubuntu1
* New upstream version. Closes bugs in Launchpad:
  - System cleaner removes explicitly installed third-party packages
    (LP: #285746)
  - I do not want to remove '/' (LP: #337241)
  - computer-janitor incomplete error description (LP: #365325)
  - computer-janitor commandline interface not pipe-friendly (LP: #375094)
  - Python 2.6 DeprecationWarning: Accessed deprecated property 
    Package.candidateDownloadable (LP: #407127)
  - Should use GtkBuilder rather than libglade (LP: #403537)
  - Ambiguous wording in confirmation alert box (LP: #349336)
  - computer-janitor-gtk crashed with UnicodeDecodeError in 
    get_description() (LP: #352461)
  - Can't deselect fixes with space in computer-janitor (LP: #355535)
  - relatime tweak will not be necessary in karmic (LP: #369151)
  - computer janitor needs filesize column (LP: #396522)
* Packaging now uses dh from debhelper 7.

Show diffs side-by-side

added added

removed removed

Lines of Context:
87
87
    
88
88
    def show_one_cruft(self, name, desc, s, width): #pragma: no cover
89
89
        if width is None:
90
 
            max = len(name) + len(desc)
 
90
            max = len(name) + len(desc or '')
91
91
        else:
92
92
            max = width
93
93
            max -= 9 # state column
94
94
            max -= 2 # two spaces
95
95
            max -= 1 # avoid the last column, some terminals word wrap there
96
96
 
97
 
        print "%-9s  %.*s " % (s, max, name)
 
97
        msg = ["%-9s  %.*s" % (s, max, name)]
98
98
        if desc:
99
99
            paras = desc.split("\n\n")
100
100
            for para in paras:
101
101
                for line in textwrap.wrap(para, max):
102
 
                    print "%9s  %s" % ("", line)
103
 
                print
 
102
                    msg.append("%9s  %s" % ("", line))
 
103
                msg.append("")
 
104
        print ("\n".join(msg)).encode('utf-8') # FIXME: horrible kludge
 
105
            # the above makes it possible to write out stuff even when
 
106
            # it's going to somewhere like a pipe, because we explicitly
 
107
            # encode it as utf-8 first. This ignores the user's desired
 
108
            # charset, which is bad, bad, bad, but I can't figure out a
 
109
            # way to make Python behave in a sensible way. *sigh*
 
110
            # --liw, 2009-08-18
104
111
    
105
112
    def show_cruft(self, options, args):
106
113
        list = []