~ubuntu-branches/ubuntu/vivid/youker-assistant/vivid

« back to all changes in this revision

Viewing changes to backends/youker-assistant-daemon/src/cleaner/common.py

  • Committer: Package Import Robot
  • Author(s): Kobe Lee (kylinkobe)
  • Date: 2013-09-18 16:22:14 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20130918162214-6nqyjyf3cd3ynqky
Tags: 0.2.1-0ubuntu1
* Modify the mouse events of MonitorBall.
* Add reset button for clear pages.
* Add policykit for apt clear in sudodbus.
* Fixed the bug about software status and add masklayer.
* Rewrite the code of system information.
* Add some signals and slots.
* Fixed the bug about Software signals(LP: #1226389).
* Modify KThread and add base.py.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
import apt_pkg
22
22
 
23
23
 
 
24
def confirm_filesize_unit(size):
 
25
    unit_list = ['B', 'KB', 'MB', 'GB', 'TB']
 
26
    flag = 0
 
27
    while True:
 
28
        if size > 512:
 
29
            size /= 1024.0
 
30
            flag += 1
 
31
        else:                                                                            break
 
32
    tmp = "%.2f" % size
 
33
    finalsize = tmp + ' ' + unit_list[flag]
 
34
    return finalsize
 
35
 
24
36
def get_dir_size(path):
25
37
    size = 0L
26
38
    for root, dirs, files in os.walk(path):
74
86
                else:
75
87
                    final_path = os.path.expanduser('%s/%s/' % (app_path, cfg.get(flag_pro_section, 'Path')))
76
88
            else:
77
 
                print 'profile.ini has error!'
 
89
                raise Exception('profile.ini has error!')
78
90
        else:
79
91
            pass
80
92
    else:
81
 
        final_path = 'Can not find the file!'
 
93
        raise Exception('Can not find the file!')
82
94
    return final_path
83
95