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

View File

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