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
"container" : names .add_Folder_Sync_Connection_tableView_QTableView ,
76
83
"type" : "QModelIndex" ,
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 (
@@ -251,3 +293,61 @@ def syncSpace(spaceName):
251
293
path .join (getCurrentUserSyncPath (), spaceName )
252
294
)
253
295
SyncConnectionWizard .addSyncConnection ()
296
+
297
+ @staticmethod
298
+ def create_folder_in_remote_destination (folder_name ):
299
+ squish .clickButton (
300
+ squish .waitForObject (SyncConnectionWizard .CREATE_REMOTE_FOLDER_BUTTON )
301
+ )
302
+ squish .type (
303
+ squish .waitForObject (SyncConnectionWizard .CREATE_REMOTE_FOLDER_INPUT ),
304
+ folder_name ,
305
+ )
306
+ squish .clickButton (
307
+ squish .waitForObject (
308
+ SyncConnectionWizard .CREATE_REMOTE_FOLDER_CONFIRM_BUTTON
309
+ )
310
+ )
311
+
312
+ @staticmethod
313
+ def refresh_remote ():
314
+ squish .clickButton (squish .waitForObject (SyncConnectionWizard .REFRESH_BUTTON ))
315
+
316
+ @staticmethod
317
+ def generate_remote_folder_selector (folder_name , parent_container = None ):
318
+ if not parent_container :
319
+ parent_container = {
320
+ "container" : names .groupBox_folderTreeWidget_QTreeWidget ,
321
+ "text" : "ownCloud" ,
322
+ "type" : "QModelIndex" ,
323
+ }
324
+ return {
325
+ "container" : parent_container ,
326
+ "text" : folder_name ,
327
+ "type" : "QModelIndex" ,
328
+ }
329
+
330
+ @staticmethod
331
+ def has_remote_folder (folder_name ):
332
+ folder_tree = folder_name .strip ("/" ).split ("/" )
333
+ parent_container = None
334
+
335
+ for folder in folder_tree :
336
+ folder_selector = SyncConnectionWizard .generate_remote_folder_selector (
337
+ folder , parent_container
338
+ )
339
+ try :
340
+ if parent_container :
341
+ squish .doubleClick (parent_container )
342
+
343
+ squish .waitForObject (folder_selector )
344
+
345
+ parent_container = folder_selector
346
+ except Exception as e :
347
+ print (e )
348
+ return False , None
349
+ return True , parent_container
350
+
351
+ @staticmethod
352
+ def is_remote_folder_selected (folder_selector ):
353
+ return squish .waitForObjectExists (folder_selector ).selected
0 commit comments