1
1
import names
2
2
import squish
3
+ import object
3
4
from os import path
4
5
from helpers .SetupClientHelper import (
5
6
getCurrentUserSyncPath ,
@@ -21,11 +22,17 @@ class SyncConnectionWizard:
21
22
"visible" : 1 ,
22
23
"window" : names .add_Folder_Sync_Connection_OCC_FolderWizard ,
23
24
}
24
- NEXT_BUTTON = {
25
- "name " : "__qt__passive_wizardbutton1" ,
25
+ BACK_BUTTON = {
26
+ "window " : names . add_Folder_Sync_Connection_OCC_FolderWizard ,
26
27
"type" : "QPushButton" ,
28
+ "text" : "< &Back" ,
27
29
"visible" : 1 ,
30
+ }
31
+ NEXT_BUTTON = {
28
32
"window" : names .add_Folder_Sync_Connection_OCC_FolderWizard ,
33
+ "type" : "QPushButton" ,
34
+ "text" : "&Next >" ,
35
+ "visible" : 1 ,
29
36
}
30
37
SELECTIVE_SYNC_ROOT_FOLDER = {
31
38
"column" : 0 ,
@@ -75,6 +82,37 @@ class SyncConnectionWizard:
75
82
"type" : "Label" ,
76
83
"visible" : True ,
77
84
}
85
+ CREATE_REMOTE_FOLDER_BUTTON = {
86
+ "container" : names .add_Folder_Sync_Connection_groupBox_QGroupBox ,
87
+ "name" : "addFolderButton" ,
88
+ "type" : "QPushButton" ,
89
+ "visible" : 1 ,
90
+ }
91
+ CREATE_REMOTE_FOLDER_INPUT = {
92
+ "buddy" : names .create_Remote_Folder_Enter_the_name_of_the_new_folder_to_be_created_below_QLabel ,
93
+ "type" : "QLineEdit" ,
94
+ "unnamed" : 1 ,
95
+ "visible" : 1 ,
96
+ }
97
+ CREATE_REMOTE_FOLDER_CONFIRM_BUTTON = {
98
+ "text" : "OK" ,
99
+ "type" : "QPushButton" ,
100
+ "unnamed" : 1 ,
101
+ "visible" : 1 ,
102
+ "window" : names .create_Remote_Folder_QInputDialog ,
103
+ }
104
+ REFRESH_BUTTON = {
105
+ "container" : names .add_Folder_Sync_Connection_groupBox_QGroupBox ,
106
+ "name" : "refreshButton" ,
107
+ "type" : "QPushButton" ,
108
+ "visible" : 1 ,
109
+ }
110
+ REMOTE_FOLDER_SELECTION_INPUT = {
111
+ "name" : "folderEntry" ,
112
+ "type" : "QLineEdit" ,
113
+ "visible" : 1 ,
114
+ "window" : names .add_Folder_Sync_Connection_OCC_FolderWizard ,
115
+ }
78
116
79
117
@staticmethod
80
118
def setSyncPathInSyncConnectionWizardOc10 (sync_path = '' ):
@@ -101,6 +139,10 @@ def setSyncPathInSyncConnectionWizard(sync_path=''):
101
139
def nextStep ():
102
140
squish .clickButton (squish .waitForObject (SyncConnectionWizard .NEXT_BUTTON ))
103
141
142
+ @staticmethod
143
+ def back ():
144
+ squish .clickButton (squish .waitForObject (SyncConnectionWizard .BACK_BUTTON ))
145
+
104
146
@staticmethod
105
147
def selectRemoteDestinationFolder (folder ):
106
148
squish .mouseClick (
@@ -239,3 +281,60 @@ def syncSpace(spaceName):
239
281
path .join (getCurrentUserSyncPath (), spaceName )
240
282
)
241
283
SyncConnectionWizard .addSyncConnection ()
284
+
285
+ @staticmethod
286
+ def create_folder_in_remote_destination (folder_name ):
287
+ squish .clickButton (
288
+ squish .waitForObject (SyncConnectionWizard .CREATE_REMOTE_FOLDER_BUTTON )
289
+ )
290
+ squish .type (
291
+ squish .waitForObject (SyncConnectionWizard .CREATE_REMOTE_FOLDER_INPUT ),
292
+ folder_name ,
293
+ )
294
+ squish .clickButton (
295
+ squish .waitForObject (
296
+ SyncConnectionWizard .CREATE_REMOTE_FOLDER_CONFIRM_BUTTON
297
+ )
298
+ )
299
+
300
+ @staticmethod
301
+ def refresh_remote ():
302
+ squish .clickButton (squish .waitForObject (SyncConnectionWizard .REFRESH_BUTTON ))
303
+
304
+ @staticmethod
305
+ def generate_remote_folder_selector (folder_name , parent_container = None ):
306
+ if not parent_container :
307
+ parent_container = {
308
+ "container" : names .groupBox_folderTreeWidget_QTreeWidget ,
309
+ "text" : "ownCloud" ,
310
+ "type" : "QModelIndex" ,
311
+ }
312
+ return {
313
+ "container" : parent_container ,
314
+ "text" : folder_name ,
315
+ "type" : "QModelIndex" ,
316
+ }
317
+
318
+ @staticmethod
319
+ def has_remote_folder (folder_name ):
320
+ folder_tree = folder_name .strip ("/" ).split ("/" )
321
+ parent_container = None
322
+
323
+ for folder in folder_tree :
324
+ folder_selector = SyncConnectionWizard .generate_remote_folder_selector (
325
+ folder , parent_container
326
+ )
327
+ try :
328
+ if parent_container :
329
+ squish .doubleClick (parent_container )
330
+
331
+ squish .waitForObject (folder_selector )
332
+
333
+ parent_container = folder_selector
334
+ except :
335
+ return False , None
336
+ return True , parent_container
337
+
338
+ @staticmethod
339
+ def is_remote_folder_selected (folder_selector ):
340
+ return squish .waitForObjectExists (folder_selector ).selected
0 commit comments