add/remove include and exclude directories to a set

This commit is contained in:
Rob Weber 2019-08-22 12:38:17 -05:00
parent 6c33e7c9ba
commit 4d891ab551
2 changed files with 29 additions and 16 deletions

View File

@ -470,7 +470,7 @@ msgid "Select root"
msgstr "" msgstr ""
msgctxt "#30120" msgctxt "#30120"
msgid "Add Exclusion" msgid "Add Exclude Folder"
msgstr "" msgstr ""
msgctxt "#30121" msgctxt "#30121"
@ -523,4 +523,12 @@ msgstr ""
msgctxt "#30133" msgctxt "#30133"
msgid "Game Saves" msgid "Game Saves"
msgstr ""
msgctxt "#30134"
msgid "Include"
msgstr ""
msgctxt "#30135"
msgid "Add Include Folder"
msgstr "" msgstr ""

View File

@ -109,26 +109,34 @@ class AdvancedBackupEditor:
optionSelected = '' optionSelected = ''
while(optionSelected != -1): while(optionSelected != -1):
options = [utils.getString(30120),utils.getString(30121) + ": " + backupSet['root']] options = [utils.getString(30120),utils.getString(30135),utils.getString(30121) + ": " + backupSet['root']]
for aDir in backupSet['dirs']: for aDir in backupSet['dirs']:
if(aDir['type'] == 'exclude'): if(aDir['type'] == 'exclude'):
options.append(utils.getString(30129) + ': ' + aDir['path']) options.append(utils.getString(30129) + ': ' + aDir['path'])
elif(aDir['type'] == 'include'):
options.append(utils.getString(30134) + ': ' + aDir['path'])
optionSelected = self.dialog.select(utils.getString(30122) + ' ' + name,options) optionSelected = self.dialog.select(utils.getString(30122) + ' ' + name,options)
if(optionSelected == 0): if(optionSelected == 0 or optionSelected == 1):
#add an exclusion #add a folder, will equal root if cancel is hit
excludeFolder = self.dialog.browse(type=0,heading=utils.getString(30120),shares='files',defaultt=backupSet['root']) addFolder = self.dialog.browse(type=0,heading=utils.getString(30120),shares='files',defaultt=backupSet['root'])
#will equal root if cancel is hit #cannot add root as an exclusion
if(excludeFolder != backupSet['root']): if(optionSelected == 0 and addFolder != backupSet['root']):
backupSet['dirs'].append({"path":excludeFolder,"type":"exclude"}) backupSet['dirs'].append({"path":addFolder,"type":"exclude"})
elif(optionSelected == 1): elif(optionSelected == 1):
#can add root as inclusion
backupSet['dirs'].append({"path":addFolder,"type":"include","recurse":True})
elif(optionSelected == 2):
self.dialog.ok(utils.getString(30121),utils.getString(30130),backupSet['root']) self.dialog.ok(utils.getString(30121),utils.getString(30130),backupSet['root'])
elif(optionSelected > 1): elif(optionSelected > 2):
#remove exclusion folder
del backupSet['dirs'][optionSelected - 2] if(self.dialog.yesno(heading=utils.getString(30123),line1=utils.getString(30128))):
#remove folder
del backupSet['dirs'][optionSelected - 3]
return backupSet return backupSet
@ -161,9 +169,6 @@ class AdvancedBackupEditor:
menuOption = self.dialog.select(heading=utils.getString(30124),list=[utils.getString(30122),utils.getString(30123)],preselect=0) menuOption = self.dialog.select(heading=utils.getString(30124),list=[utils.getString(30122),utils.getString(30123)],preselect=0)
if(menuOption == 0): if(menuOption == 0):
#get the set
aSet = customPaths.getSet(exitCondition -1)
#edit the set #edit the set
updatedSet = self.editSet(aSet['name'],aSet['set']) updatedSet = self.editSet(aSet['name'],aSet['set'])