mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
pep8
This commit is contained in:
parent
e4c79f81af
commit
1e5036ab73
@ -82,7 +82,8 @@ class FilenamePattern(QWidget, Ui_Form): # {{{
|
||||
val = prefs['filename_pattern']
|
||||
self.re.lineEdit().setText(val)
|
||||
|
||||
val_hist += gprefs.get('filename_pattern_history', ['(?P<title>.+)', '(?P<author>[^_-]+) -?\s*(?P<series>[^_0-9-]*)(?P<series_index>[0-9]*)\s*-\s*(?P<title>[^_].+) ?'])
|
||||
val_hist += gprefs.get('filename_pattern_history', [
|
||||
'(?P<title>.+)', '(?P<author>[^_-]+) -?\s*(?P<series>[^_0-9-]*)(?P<series_index>[0-9]*)\s*-\s*(?P<title>[^_].+) ?'])
|
||||
if val in val_hist:
|
||||
del val_hist[val_hist.index(val)]
|
||||
val_hist.insert(0, val)
|
||||
@ -136,7 +137,6 @@ class FilenamePattern(QWidget, Ui_Form): # {{{
|
||||
|
||||
self.isbn.setText(_('No match') if mi.isbn is None else str(mi.isbn))
|
||||
|
||||
|
||||
def pattern(self):
|
||||
pat = unicode(self.re.lineEdit().text())
|
||||
return re.compile(pat)
|
||||
@ -186,7 +186,6 @@ class FormatList(QListWidget): # {{{
|
||||
if d.err is None:
|
||||
self.formats_dropped.emit(event, [d.fpath])
|
||||
|
||||
|
||||
def dragMoveEvent(self, event):
|
||||
event.acceptProposedAction()
|
||||
|
||||
@ -736,13 +735,11 @@ class PythonHighlighter(QSyntaxHighlighter): # {{{
|
||||
|
||||
CONSTANTS = ["False", "True", "None", "NotImplemented", "Ellipsis"]
|
||||
|
||||
|
||||
def __init__(self, parent=None):
|
||||
super(PythonHighlighter, self).__init__(parent)
|
||||
if not self.Config:
|
||||
self.loadConfig()
|
||||
|
||||
|
||||
self.initializeFormats()
|
||||
|
||||
PythonHighlighter.Rules.append((QRegExp(
|
||||
@ -752,7 +749,7 @@ class PythonHighlighter(QSyntaxHighlighter): # {{{
|
||||
"|".join([r"\b%s\b" % builtin for builtin in self.BUILTINS])),
|
||||
"builtin"))
|
||||
PythonHighlighter.Rules.append((QRegExp(
|
||||
"|".join([r"\b%s\b" % constant \
|
||||
"|".join([r"\b%s\b" % constant
|
||||
for constant in self.CONSTANTS])), "constant"))
|
||||
PythonHighlighter.Rules.append((QRegExp(
|
||||
r"\b[+-]?[0-9]+[lL]?\b"
|
||||
@ -812,7 +809,6 @@ class PythonHighlighter(QSyntaxHighlighter): # {{{
|
||||
Config["%sfontbold" % name] = QVariant(bold).toBool()
|
||||
Config["%sfontitalic" % name] = QVariant(italic).toBool()
|
||||
|
||||
|
||||
@classmethod
|
||||
def initializeFormats(cls):
|
||||
Config = cls.Config
|
||||
@ -829,7 +825,6 @@ class PythonHighlighter(QSyntaxHighlighter): # {{{
|
||||
format.setFontItalic(Config["%sfontitalic" % name])
|
||||
PythonHighlighter.Formats[name] = format
|
||||
|
||||
|
||||
def highlightBlock(self, text):
|
||||
NORMAL, TRIPLESINGLE, TRIPLEDOUBLE, ERROR = range(4)
|
||||
|
||||
@ -900,7 +895,6 @@ class PythonHighlighter(QSyntaxHighlighter): # {{{
|
||||
self.setFormat(i, text.length(),
|
||||
PythonHighlighter.Formats["string"])
|
||||
|
||||
|
||||
def rehighlight(self):
|
||||
QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
|
||||
QSyntaxHighlighter.rehighlight(self)
|
||||
@ -1045,11 +1039,13 @@ class Splitter(QSplitter):
|
||||
@dynamic_property
|
||||
def side_index_size(self):
|
||||
def fget(self):
|
||||
if self.count() < 2: return 0
|
||||
if self.count() < 2:
|
||||
return 0
|
||||
return self.sizes()[self.side_index]
|
||||
|
||||
def fset(self, val):
|
||||
if self.count() < 2: return
|
||||
if self.count() < 2:
|
||||
return
|
||||
if val == 0 and not self.is_side_index_hidden:
|
||||
self.save_state()
|
||||
sizes = list(self.sizes())
|
||||
@ -1081,7 +1077,8 @@ class Splitter(QSplitter):
|
||||
self.resize_timer.start()
|
||||
|
||||
def get_state(self):
|
||||
if self.count() < 2: return (False, 200)
|
||||
if self.count() < 2:
|
||||
return (False, 200)
|
||||
return (self.desired_show, self.desired_side_size)
|
||||
|
||||
def apply_state(self, state, save_desired=True):
|
||||
@ -1142,3 +1139,4 @@ class Splitter(QSplitter):
|
||||
|
||||
# }}}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user