Added more match case statements
This commit is contained in:
parent
bc3bd30b38
commit
7a550f8fbd
1 changed files with 32 additions and 13 deletions
|
@ -224,6 +224,10 @@ class WorkerResticStats(QObject):
|
|||
capture_output=True,
|
||||
text=True)
|
||||
|
||||
case _:
|
||||
msg_box_error(self, "Pattern match not found")
|
||||
return False
|
||||
|
||||
except subprocess.CalledProcessError as error:
|
||||
# Process don't successful, send signal
|
||||
self.stats_error.emit(error.stderr)
|
||||
|
@ -948,12 +952,17 @@ class WorkerResticCheck(QObject):
|
|||
|
||||
# We get the current row from the List widget
|
||||
row = ActiveRow.get(self)
|
||||
|
||||
# Processing the subprocess.run
|
||||
result = None
|
||||
try:
|
||||
# restic function check
|
||||
if backup_data[row].rest == "0":
|
||||
if not backup_data[row].password:
|
||||
# check data
|
||||
match_list = [backup_data[row].rest, bool(backup_data[row].password)]
|
||||
|
||||
match match_list:
|
||||
|
||||
# backup_data[row].rest, bool(backup_data[row].password)
|
||||
case ["0", False]:
|
||||
# restic function check
|
||||
args = [restic,
|
||||
'-r',
|
||||
backup_data[row].repository,
|
||||
|
@ -969,8 +978,9 @@ class WorkerResticCheck(QObject):
|
|||
|
||||
# Delete the variable from the input
|
||||
del pass_word.pw
|
||||
else:
|
||||
# check data
|
||||
|
||||
case["0", True]:
|
||||
# restic function check
|
||||
args = [restic,
|
||||
'-r',
|
||||
backup_data[row].repository,
|
||||
|
@ -984,9 +994,8 @@ class WorkerResticCheck(QObject):
|
|||
capture_output=True,
|
||||
text=True)
|
||||
|
||||
else:
|
||||
if not backup_data[row].password:
|
||||
# Restic function
|
||||
case["1", False]:
|
||||
# restic function check
|
||||
args = [restic,
|
||||
'-r',
|
||||
'rest:https://%s:%s@%s:%s/%s' % (backup_data[row].rest_user,
|
||||
|
@ -1006,8 +1015,9 @@ class WorkerResticCheck(QObject):
|
|||
|
||||
# Delete the variable from the input
|
||||
del pass_word.pw
|
||||
else:
|
||||
# Restic function
|
||||
|
||||
case["1", True]:
|
||||
# restic function check
|
||||
args = [restic,
|
||||
'-r',
|
||||
'rest:https://%s:%s@%s:%s/%s' % (backup_data[row].rest_user,
|
||||
|
@ -1025,6 +1035,10 @@ class WorkerResticCheck(QObject):
|
|||
capture_output=True,
|
||||
text=True)
|
||||
|
||||
case _:
|
||||
msg_box_error(self, "Pattern match not found")
|
||||
return False
|
||||
|
||||
except subprocess.CalledProcessError as error:
|
||||
# Process don't successful, send signal
|
||||
self.check_error.emit(error.stderr)
|
||||
|
@ -1788,6 +1802,10 @@ class WorkerResticCallRepoVersion(QObject):
|
|||
capture_output=True,
|
||||
text=True)
|
||||
|
||||
case _:
|
||||
msg_box_error(self, "Pattern match not found")
|
||||
return False
|
||||
|
||||
except subprocess.CalledProcessError as error:
|
||||
# Process don't successful, send signal
|
||||
self.call_repo_version_error.emit(error.stderr)
|
||||
|
@ -4838,7 +4856,7 @@ class MainWindow(QMainWindow):
|
|||
self.statusBar().showMessage(backup_data[row].name)
|
||||
|
||||
case _:
|
||||
msg_box_error(self, "An error has occurred.")
|
||||
msg_box_error(self, "Pattern match not found")
|
||||
return False
|
||||
|
||||
###############################################
|
||||
|
@ -5150,9 +5168,10 @@ class MainWindow(QMainWindow):
|
|||
return False
|
||||
|
||||
case _:
|
||||
msg_box_error(self, "An error has occurred.")
|
||||
msg_box_error(self, "Pattern match not found")
|
||||
return False
|
||||
|
||||
|
||||
###############################################
|
||||
# UNLOCK
|
||||
###############################################
|
||||
|
|
Loading…
Add table
Reference in a new issue