1
This commit is contained in:
Alex Yatskov 2016-05-01 20:58:55 -07:00
parent 09b007d5f0
commit 20e3290794
2 changed files with 9 additions and 5 deletions

View File

@ -273,7 +273,8 @@ class MainWindowReader(QtGui.QMainWindow, gen.reader_ui.Ui_MainWindowReader):
def onActionToggleWrap(self, wrap): def onActionToggleWrap(self, wrap):
self.preferences['wordWrap'] = wrap self.preferences['wordWrap'] = wrap
self.textContent.setLineWrapMode(QtGui.QPlainTextEdit.WidgetWidth if self.preferences['wordWrap'] else QtGui.QPlainTextEdit.NoWrap) mode = QtGui.QPlainTextEdit.WidgetWidth if self.preferences['wordWrap'] else QtGui.QPlainTextEdit.NoWrap
self.textContent.setLineWrapMode(mode)
def onActionHomepage(self): def onActionHomepage(self):
@ -559,10 +560,10 @@ class MainWindowReader(QtGui.QMainWindow, gen.reader_ui.Ui_MainWindowReader):
if options.get('trim', True): if options.get('trim', True):
defs = defs[:self.preferences['maxResults']] defs = defs[:self.preferences['maxResults']]
html = builder(defs, self.ankiIsFactValid)
scrollbar = control.verticalScrollBar() scrollbar = control.verticalScrollBar()
position = scrollbar.sliderPosition() position = scrollbar.sliderPosition()
html = builder(defs, self.ankiIsFactValid)
control.setHtml(html) control.setHtml(html)
if options.get('scroll', False): if options.get('scroll', False):

View File

@ -87,7 +87,10 @@ class RemoteApi:
def handler(self, request): def handler(self, request):
self.handlers.get(request.get('action'), self.apiInvalidRequest)(request.get('data')) action = request.get('action')
data = request.get('data')
self.handlers.get(action, self.apiInvalidRequest)(data)
def apiAddNote(self, data): def apiAddNote(self, data):
@ -107,4 +110,4 @@ class RemoteApi:
def apiInvalidRequest(self, data): def apiInvalidRequest(self, data):
return {} return None