Skip to content

Commit

Permalink
pep8
Browse files Browse the repository at this point in the history
  • Loading branch information
kovidgoyal committed Jan 26, 2025
1 parent 90a97ca commit c6c7ed4
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 47 deletions.
25 changes: 2 additions & 23 deletions src/calibre/gui2/preferences/look_feel.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
__copyright__ = '2010, Kovid Goyal <[email protected]>'
__docformat__ = 'restructuredtext en'

import json
from collections import defaultdict
from functools import partial
from threading import Thread
Expand Down Expand Up @@ -36,7 +35,6 @@
Qt,
QTableWidget,
QTableWidgetItem,
QTabWidget,
QVBoxLayout,
QWidget,
pyqtSignal,
Expand All @@ -46,32 +44,13 @@
from calibre.constants import ismacos, iswindows
from calibre.ebooks.metadata.book.render import DEFAULT_AUTHOR_LINK
from calibre.ebooks.metadata.sources.prefs import msprefs
from calibre.gui2 import (
choose_files,
choose_save_file,
config,
default_author_link,
error_dialog,
gprefs,
icon_resource_manager,
open_local_file,
qt_app,
question_dialog,
)

from calibre.gui2 import config, default_author_link, error_dialog, gprefs, icon_resource_manager, open_local_file, qt_app, question_dialog
from calibre.gui2.custom_column_widgets import get_field_list as em_get_field_list
from calibre.gui2.dialogs.quickview import get_qv_field_list
from calibre.gui2.library.alternate_views import CM_TO_INCH, auto_height
from calibre.gui2.preferences import ConfigWidgetBase, Setting, set_help_tips, test_widget
from calibre.gui2.preferences.coloring import EditRules
from calibre.gui2.preferences.look_feel_tabs import (
DisplayedFields,
export_layout,
import_layout,
move_field_down,
move_field_up,
reset_layout,
)
from calibre.gui2.preferences.look_feel_tabs import DisplayedFields, export_layout, import_layout, move_field_down, move_field_up, reset_layout
from calibre.gui2.preferences.look_feel_ui import Ui_Form
from calibre.gui2.widgets import BusyCursor
from calibre.gui2.widgets2 import Dialog
Expand Down
11 changes: 4 additions & 7 deletions src/calibre/gui2/preferences/look_feel_tabs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,7 @@

from qt.core import QAbstractListModel, QIcon, QItemSelectionModel, Qt

from calibre.gui2 import (
choose_files,
choose_save_file,
config,
error_dialog,
gprefs,
)
from calibre.gui2 import choose_files, choose_save_file, error_dialog
from calibre.gui2.book_details import get_field_list


Expand Down Expand Up @@ -108,6 +102,7 @@ def move(self, idx, delta):
self.changed = True
return idx


def export_layout(in_widget, model=None):
filename = choose_save_file(in_widget, 'look_feel_prefs_import_export_field_list',
_('Save column list to file'),
Expand All @@ -120,6 +115,7 @@ def export_layout(in_widget, model=None):
error_dialog(in_widget, _('Export field layout'),
_('<p>Could not write field list. Error:<br>%s')%err, show=True)


def import_layout(in_widget, model=None):
filename = choose_files(in_widget, 'look_feel_prefs_import_export_field_list',
_('Load column list from file'),
Expand All @@ -134,6 +130,7 @@ def import_layout(in_widget, model=None):
error_dialog(in_widget, _('Import layout'),
_('<p>Could not read field list. Error:<br>%s')%err, show=True)


def reset_layout(in_widget, model=None):
model.initialize(use_defaults=True)
in_widget.changed_signal.emit()
Expand Down
2 changes: 1 addition & 1 deletion src/calibre/gui2/preferences/look_feel_tabs/cover_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

from calibre.gui2 import config, gprefs
from calibre.gui2.dialogs.template_dialog import TemplateDialog
from calibre.gui2.preferences import LazyConfigWidgetBase, ConfigWidgetBase, set_help_tips
from calibre.gui2.preferences import ConfigWidgetBase, LazyConfigWidgetBase, set_help_tips
from calibre.gui2.preferences.look_feel_tabs.cover_view_ui import Ui_Form


Expand Down
10 changes: 2 additions & 8 deletions src/calibre/gui2/preferences/look_feel_tabs/tb_display.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,10 @@
from calibre.db.categories import is_standard_category
from calibre.gui2 import config, gprefs
from calibre.gui2.preferences import ConfigWidgetBase, LazyConfigWidgetBase
from calibre.gui2.preferences.look_feel_tabs import (
DisplayedFields,
import_layout,
export_layout,
move_field_down,
move_field_up,
reset_layout
)
from calibre.gui2.preferences.look_feel_tabs import DisplayedFields, export_layout, import_layout, move_field_down, move_field_up, reset_layout
from calibre.gui2.preferences.look_feel_tabs.tb_display_ui import Ui_Form


class TBDisplayedFields(DisplayedFields): # {{{
# The code in this class depends on the fact that the tag browser is
# initialized before this class is instantiated.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from functools import partial

from calibre.gui2 import gprefs
from calibre.gui2 import gprefs
from calibre.gui2.preferences import ConfigWidgetBase, LazyConfigWidgetBase
from calibre.gui2.preferences.look_feel_tabs import DisplayedFields, export_layout, import_layout, reset_layout
from calibre.gui2.preferences.look_feel_tabs.tb_partitioning_ui import Ui_Form
Expand Down Expand Up @@ -44,7 +44,7 @@ def initialize(self, use_defaults=False, pref_data_override=None):
ans = [[k, True] for k in cats.keys()]
self.changed = True
elif pref_data_override:
po = {k:v for k,v in pref_data_override}
po = dict(pref_data_override)
ans = [[k, po.get(k, True)] for k in cats.keys()]
self.changed = True
else:
Expand Down Expand Up @@ -93,6 +93,3 @@ def lazy_initialize(self):
def commit(self):
self.tb_categories_to_part_model.commit()
return ConfigWidgetBase.commit(self)



5 changes: 2 additions & 3 deletions src/calibre/gui2/preferences/look_feel_tabs/tb_quickview.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
from calibre.gui2 import gprefs
from calibre.gui2.actions.show_quickview import get_quickview_action_plugin
from calibre.gui2.dialogs.quickview import get_qv_field_list
from calibre.gui2.preferences import LazyConfigWidgetBase, ConfigWidgetBase
from calibre.gui2.preferences import ConfigWidgetBase, LazyConfigWidgetBase
from calibre.gui2.preferences.look_feel_tabs import DisplayedFields, move_field_down, move_field_up
from calibre.gui2.preferences.look_feel_tabs.tb_quickview_ui import Ui_Form


class QVDisplayedFields(DisplayedFields): # {{{

def __init__(self, db, parent=None):
Expand Down Expand Up @@ -70,5 +71,3 @@ def commit(self, *args):
rr = ConfigWidgetBase.commit(self, *args)
self.qv_display_model.commit()
return rr


0 comments on commit c6c7ed4

Please sign in to comment.