mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
micro-optimization: sorted() can take any iterable and returns a list
So there is no need to convert everything to lists before and after. Also, all_formats is immediately converted to a set, and kept that way, so it does not need to always be accessed as set(all_formats).
This commit is contained in:
parent
04a37cdf3b
commit
c9f8ffedb1
@ -35,11 +35,11 @@ class ConfigWidget(QWidget, Ui_ConfigWidget):
|
||||
except TypeError:
|
||||
self.device_name = getattr(device, 'gui_name', None) or _('Device')
|
||||
if device.USER_CAN_ADD_NEW_FORMATS:
|
||||
all_formats = set(all_formats) | set(BOOK_EXTENSIONS)
|
||||
all_formats = all_formats | set(BOOK_EXTENSIONS)
|
||||
|
||||
format_map = settings.format_map
|
||||
disabled_formats = list(set(all_formats).difference(format_map))
|
||||
for format in format_map + list(sorted(disabled_formats)):
|
||||
disabled_formats = all_formats.difference(format_map)
|
||||
for format in format_map + sorted(disabled_formats):
|
||||
item = QListWidgetItem(format, self.columns)
|
||||
item.setData(Qt.UserRole, (format))
|
||||
item.setFlags(Qt.ItemIsEnabled|Qt.ItemIsUserCheckable|Qt.ItemIsSelectable)
|
||||
|
Loading…
x
Reference in New Issue
Block a user