-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathSettings.py
More file actions
95 lines (84 loc) · 3.07 KB
/
Settings.py
File metadata and controls
95 lines (84 loc) · 3.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
import names
import squish
class Settings:
CHECKBOX_OPTION_ITEM = {
"container": names.stack_scrollArea_QScrollArea,
"type": "QCheckBox",
"visible": 1,
}
NETWORK_OPTION_ITEM = {
"container": names.stack_scrollArea_QScrollArea,
"type": "QGroupBox",
"visible": 1,
}
ABOUT_BUTTON = {
"container": names.settings_stack_QStackedWidget,
"name": "about_pushButton",
"type": "QPushButton",
"visible": 1,
}
ABOUT_DIALOG = {
"name": "OCC__AboutDialog",
"type": "OCC::AboutDialog",
"visible": 1,
}
ABOUT_DIALOG_OK_BUTTON = {
"text": "OK",
"type": "QPushButton",
"unnamed": 1,
"visible": 1,
"window": ABOUT_DIALOG,
}
GENERAL_OPTIONS_MAP = {
"Start on Login": "autostartCheckBox",
"Use Monochrome Icons in the system tray": "monoIconsCheckBox",
"Language": "languageDropdown",
"Show desktop Notifications": "desktopNotificationsCheckBox",
}
ADVANCED_OPTION_MAP = {
"Sync hidden files": "syncHiddenFilesCheckBox",
"Show crash reporter": "",
"Edit ignored files": "ignoredFilesButton",
"Log settings": "logSettingsButton",
"Ask for confirmation before synchronizing folders larger than 500 MB": "newFolderLimitCheckBox",
"Ask for confirmation before synchronizing external storages": "newExternalStorage",
}
NETWORK_OPTION_MAP = {
"Download Bandwidth": "downloadBox",
"Upload Bandwidth": "uploadBox",
}
@staticmethod
def get_checkbox_option_selector(name):
selector = Settings.CHECKBOX_OPTION_ITEM.copy()
selector.update({"name": name})
if name == "languageDropdown":
selector.update({"type": "QComboBox"})
elif name in ("ignoredFilesButton", "logSettingsButton"):
selector.update({"type": "QPushButton"})
return selector
@staticmethod
def get_network_option_selector(name):
selector = Settings.NETWORK_OPTION_ITEM.copy()
selector.update({"name": name})
return selector
@staticmethod
def check_general_option(option):
selector = Settings.GENERAL_OPTIONS_MAP[option]
squish.waitForObjectExists(Settings.get_checkbox_option_selector(selector))
@staticmethod
def check_advanced_option(option):
selector = Settings.ADVANCED_OPTION_MAP[option]
squish.waitForObjectExists(Settings.get_checkbox_option_selector(selector))
@staticmethod
def check_network_option(option):
selector = Settings.NETWORK_OPTION_MAP[option]
squish.waitForObjectExists(Settings.get_network_option_selector(selector))
@staticmethod
def open_about_button():
squish.clickButton(squish.waitForObject(Settings.ABOUT_BUTTON))
@staticmethod
def wait_for_about_dialog_to_be_visible():
squish.waitForObjectExists(Settings.ABOUT_DIALOG)
@staticmethod
def close_about_dialog():
squish.clickButton(squish.waitForObjectExists(Settings.ABOUT_DIALOG_OK_BUTTON))