Skip to content

Commit

Permalink
DRYer
Browse files Browse the repository at this point in the history
  • Loading branch information
kovidgoyal committed Nov 11, 2021
1 parent add6a6e commit 23f3dbd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
3 changes: 2 additions & 1 deletion src/calibre/gui2/css_transform_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,13 +253,14 @@ class RulesDialog(RulesDialogBase): # {{{

DIALOG_TITLE = _('Edit style transform rules')
PREFS_NAME = 'edit-style-transform-rules'
PREFS_OBJECT_NAME = 'style-transform-rules'
RulesClass = Rules
TesterClass = Tester

def __init__(self, *args, **kw):
# This has to be loaded on instantiation as it can be shared by
# multiple processes
self.PREFS_OBJECT = JSONConfig('style-transform-rules')
self.PREFS_OBJECT = JSONConfig(self.PREFS_OBJECT_NAME)
RulesDialogBase.__init__(self, *args, **kw)
# }}}

Expand Down
8 changes: 1 addition & 7 deletions src/calibre/gui2/html_transform_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
RuleEditDialog as RuleEditDialogBase, RuleItem as RuleItemBase,
Rules as RulesBase, RulesDialog as RulesDialogBase
)
from calibre.utils.config import JSONConfig

# Classes for rule edit widget {{{

Expand Down Expand Up @@ -334,14 +333,9 @@ class RulesDialog(RulesDialogBase): # {{{

DIALOG_TITLE = _('Edit HTML transform rules')
PREFS_NAME = 'edit-html-transform-rules'
PREFS_OBJECT_NAME = 'html-transform-rules'
RulesClass = Rules
TesterClass = Tester

def __init__(self, *args, **kw):
# This has to be loaded on instantiation as it can be shared by
# multiple processes
self.PREFS_OBJECT = JSONConfig('html-transform-rules')
RulesDialogBase.__init__(self, *args, **kw)
# }}}


Expand Down

0 comments on commit 23f3dbd

Please sign in to comment.