misc fixes

This commit is contained in:
Peter Vilim 2015-01-06 04:03:21 -06:00
parent dfa276a20c
commit f828e554f7
2 changed files with 11 additions and 12 deletions

View File

@ -1246,22 +1246,22 @@ class ConfirmQuit(List):
raise configexc.ValidationError(value, "List cannot contain never!")
# Always can't be set with other options
elif 'always' in values and len(values) > 1:
raise configexc.ValidationError(value,
"List cannot contain always!")
raise configexc.ValidationError(
value, "List cannot contain always!")
# Values have to be valid
elif not set(values).issubset(set(self.valid_values.values)):
raise configexc.ValidationError(value, "List contains invalid"
" values!")
raise configexc.ValidationError(
value, "List contains invalid values!")
# List can't have duplicates
elif len(set(values)) != len(values):
raise configexc.ValidationError(value, "List contains duplicate"
" values!")
raise configexc.ValidationError(
value, "List contains duplicate values!")
def complete(self):
combinations = []
# Generate combinations of the options that can be combined
for size in range(2, len(self.combinable_values) + 1):
combinations = combinations + list(
combinations += list(
itertools.combinations(self.combinable_values, size))
out = []
# Add valid single values
@ -1270,8 +1270,7 @@ class ConfirmQuit(List):
# Add combinations to list of options
for val in combinations:
desc = ''
val = ','.join(val)
out.append((val, desc))
out.append((','.join(val), desc))
return out

View File

@ -332,8 +332,8 @@ class MainWindow(QWidget):
window=self.win_id)
download_count = download_manager.rowCount()
quit_texts = []
# Close if set to never ask for confirmation (backward compatible)
if confirm_quit == 'never' or 'never' in confirm_quit:
# Close if set to never ask for confirmation
if 'never' in confirm_quit:
pass
# Ask if multiple-tabs are open
if 'multiple-tabs' in confirm_quit and tab_count > 1:
@ -352,7 +352,7 @@ class MainWindow(QWidget):
default=True)
# Stop asking if the user cancels
if not confirmed:
log.destroy.debug("Cancelling losing of window {}".format(
log.destroy.debug("Cancelling closing of window {}".format(
self.win_id))
e.ignore()
return