5
This is the "baobab" module.
7
This module provides a wrapper for LDTP to make writing Baobab tests easier.
12
from .main import Application
13
from ..gconfwrapper import GConf
14
from ..cmd import globals
18
gettext.install (True)
19
gettext.bindtextdomain (PACKAGE, globals.LOCALE_SHARE)
20
gettext.textdomain (PACKAGE)
21
t = gettext.translation(PACKAGE, globals.LOCALE_SHARE, fallback = True)
25
class Baobab(Application):
27
baobab manages the Baobab application.
32
WINDOW = 'frmDiskUsageAnalyzer'
34
DLG_SELECTFOLDER = _('dlgSelectFolder')
35
BTN_REFRESH = _('btnRefresh')
36
BTN_SCANFILESYSTEM = _('btnScanFilesystem')
37
BTN_SCANFOLDER = _('btnScanFolder')
38
BTN_SCANHOME = _('btnScanHome')
39
BTN_SCANREMOTEFOLDER = _('btnScanRemoteFolder')
40
BTN_STOP = _('btnStop')
41
BTN_TYPEAFILENAME = _('tbtnTypeafilename')
42
MNU_ABOUT = _('mnuAbout')
43
MNU_COLLAPSEALL = _('mnuCollapseAll')
44
MNU_CONTENTS = _('mnuContents')
45
MNU_EMPTY = _('mnuEmpty')
46
MNU_EMPTY1 = _('mnuEmpty1')
47
MNU_EMPTY2 = _('mnuEmpty2')
48
MNU_EMPTY3 = _('mnuEmpty3')
49
MNU_EXPANDALL = _('mnuExpandAll')
50
MNU_PREFERENCES = _('mnuPreferences')
51
MNU_QUIT = _('mnuQuit')
52
MNU_REFRESH = _('mnuRefresh')
53
MNU_SCANFILESYSTEM = _('mnuScanFilesystem')
54
MNU_SCANFOLDER = _('mnuScanFolder')
55
MNU_SCANHOMEFOLDER = _('mnuScanHomeFolder')
56
MNU_SCANREMOTEFOLDER = _('mnuScanRemoteFolder')
57
MNU_STOP = _('mnuStop')
58
MNU_VIEWASRINGSCHART = _('mnuViewasRingsChart')
59
MNU_VIEWASTREEMAPCHART = _('mnuViewasTreemapChart')
60
TXT_LOCATION = _('txtLocation')
61
CBO_VIEWAS = _('cboViewas*')
64
def baobab_scan_home(self):
65
baobab = ooldtp.context(self.name)
67
#Scan the home folder and wait till the end of the scan.
68
baobab.getchild(self.MNU_SCANHOMEFOLDER).selectmenuitem()
69
buttonStop = baobab.getchild(self.BTN_STOP)
71
while buttonStop.stateenabled():
74
self.baobab_change_views()
75
#Scan the home again now this time using the button in the toolbar.
76
baobab.getchild(self.BTN_SCANHOME).click()
78
while buttonStop.stateenabled():
81
self.baobab_change_views()
83
def baobab_scan_folder(self, path):
84
baobab = ooldtp.context(self.name)
86
baobab.getchild(self.BTN_SCANFOLDER).click()
88
ldtp.waittillguiexist(self.DLG_SELECTFOLDER)
90
if (ldtp.guiexist(self.DLG_SELECTFOLDER)):
91
selectFiles = ooldtp.context(self.DLG_SELECTFOLDER)
92
if not (selectFiles.getchild(self.TXT_LOCATION)):
93
ldtp.generatekeyevent('<ctrl>l')
94
textLocation = selectFiles.getchild(self.TXT_LOCATION)
95
textLocation.settextvalue(path)
96
ldtp.generatekeyevent('<return>')
99
buttonStop = baobab.getchild(self.BTN_STOP)
101
while buttonStop.stateenabled():
104
self.baobab_change_views()
106
def baobab_scan_filesystem(self):
107
baobab = ooldtp.context(self.name)
110
baobab.getchild(self.MNU_SCANFILESYSTEM).selectmenuitem()
111
buttonStop = baobab.getchild(self.BTN_STOP)
113
while buttonStop.stateenabled():
116
#Change the views again to see if that works and we don't get any crash.
117
self.baobab_change_views()
119
def baobab_change_views(self):
120
baobab = ooldtp.context(self.name)
122
#Change the graph view.
123
comboView = baobab.getchild(self.CBO_VIEWAS)
125
for item in comboView.getallitem():
127
comboView.selectitem(item)
129
#Collapse and expand the tree
130
baobab.getchild(self.MNU_EXPANDALL).selectmenuitem()
132
baobab.getchild(self.MNU_COLLAPSEALL).selectmenuitem()
135
Application.__init__(self)