def restore_specific(files, path, date=None, backend = None, encrypt = True, dest = None): global srcdir files = [os.path.join(srcdir, f) for f in files] args = ['--restore'] + files start_deja_dup(args=args, waitfor='frmRestore') if backend is not None: walk_restore_prefs('frmRestore', backend=backend, dest=dest) ldtp.click('frmRestore', 'btnForward') wait_for_finish('frmRestore', 'lblRestoreFromWhen?', 200) if date: ldtp.comboselect('frmRestore', 'cboDate', date) ldtp.click('frmRestore', 'btnForward') ldtp.click('frmRestore', 'btnRestore') if encrypt is not None: wait_for_encryption('frmRestore', encrypt) if len(files) == 1: lbl = 'lblYourfilewassuccessfullyrestored' else: lbl = 'lblYourfilesweresuccessfullyrestored' wait_for_finish('frmRestore', lbl, 400) ldtp.click('frmRestore', 'btnClose') ldtp.waittillguinotexist('frmRestore')
def walk_restore_prefs(dlg, backend, dest): if backend == 'file': ldtp.comboselect(dlg, 'cboLocation', 'Local Folder') wait_for_combo(dlg, 'cboLocation', 'Local Folder') # this menu acts slowly, because of custom widgets remap(dlg) ldtp.settextvalue(dlg, 'txtFileFolder', dest) ldtp.wait(1) # without this, sometimes ldtp moves so fast, deja-dup doesn't notice dest
def restore_simple(path, date=None, backend = None, encrypt=True, dest = None): start_deja_dup(executable='deja-dup-preferences') if guivisible('frmBackup', 'btnIwanttorestorefilesfromapreviousbackup…'): ldtp.click('frmBackup', 'btnIwanttorestorefilesfromapreviousbackup…') else: ldtp.selecttab('frmBackup', 'ptlCategories', 'Overview') ldtp.click('frmBackup', 'btnRestore…') waitforgui('frmRestore') if backend is not None: walk_restore_prefs('frmRestore', backend, dest) ldtp.click('frmRestore', 'btnForward') wait_for_finish('frmRestore', 'lblRestoreFromWhen?', 200) if date: ldtp.comboselect('frmRestore', 'cboDate', date) ldtp.click('frmRestore', 'btnForward') ldtp.click('frmRestore', 'rbtnRestoretospecificfolder') ldtp.comboselect('frmRestore', 'cboRestorefolder', 'Other...') waitforgui('dlgChoosedestinationforrestoredfiles') # Make sure path ends in '/' if path[-1] != '/': path += '/' ldtp.selectlastrow('dlgChoosedestinationforrestoredfiles', 'tblPlaces') # must switch away from Recent Files view to get txtLocation ldtp.wait(1) # give the dlg a second to settle ldtp.settextvalue('dlgChoosedestinationforrestoredfiles', 'txtLocation', path) ldtp.click('dlgChoosedestinationforrestoredfiles', 'btnOpen') ldtp.wait(1) # give the combo a second to settle ldtp.click('frmRestore', 'btnForward') ldtp.wait(1) # give the dlg a second to settle ldtp.click('frmRestore', 'btnRestore') if encrypt is not None: wait_for_encryption('frmRestore', encrypt) wait_for_finish('frmRestore', 'lblYourfilesweresuccessfullyrestored', 400) ldtp.click('frmRestore', 'btnClose') ldtp.waittillguinotexist('frmRestore')
def walk_prefs(backend, dest, includes, excludes): if backend == 'file': ldtp.selecttab('frmBackup', 'ptlCategories', 'Storage') if dest is None: dest = get_temp_name('local') os.system('mkdir -p %s' % dest) elif dest[0] != '/' and dest.find(':') == -1: dest = os.getcwd()+'/'+dest ldtp.comboselect('frmBackup', 'cboLocation', 'Local Folder') wait_for_combo('frmBackup', 'cboLocation', 'Local Folder') # this menu acts slowly, because of custom widgets remap('frmBackup') ldtp.settextvalue('frmBackup', 'txtFileFolder', dest) ldtp.wait(1) # without this, sometimes ldtp moves so fast, deja-dup doesn't notice dest ldtp.selecttab('frmBackup', 'ptlCategories', 'Folders') if includes is not None: set_file_list('frmBackup', 'tblIncludeList', 'btnIncludeListAdd', 'btnIncludeListRemove', includes) if excludes is not None: set_file_list('frmBackup', 'tblExcludeList', 'btnExcludeListAdd', 'btnExcludeListRemove', excludes)
def combo_select(self, window_name, component_name, item_name): """ [关键字概要] Select a menu item or list item in a combo box based on name :param window_name: 窗口名称 :param component_name: 组件名称 :param item_name: menu item or list item :return: 1 on success, LdtpExecutionError exception on failure """ try: self._info('combo select (%s, %s, %s)' % (window_name, component_name, item_name)) return ldtp.comboselect(window_name, component_name, item_name) except LdtpExecutionError: raise LdtpExecutionError('combo select failed.')