Workaround for pyqtSlot not accepting QList<int> on windows

This commit is contained in:
Kovid Goyal 2013-11-29 14:20:16 +05:30
parent 4af671be80
commit 42f2e6cff5
3 changed files with 4 additions and 3 deletions

Binary file not shown.

View File

@ -95,7 +95,7 @@ class PreviewIntegration
loc.push(num) loc.push(num)
parent = parent.parentNode parent = parent.parentNode
loc.reverse() loc.reverse()
window.py_bridge.request_split(loc) window.py_bridge.request_split(JSON.stringify(loc))
onload: () => onload: () =>
window.document.body.addEventListener('click', this.onclick, true) window.document.body.addEventListener('click', this.onclick, true)

View File

@ -6,7 +6,7 @@ from __future__ import (unicode_literals, division, absolute_import,
__license__ = 'GPL v3' __license__ = 'GPL v3'
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>' __copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
import time, textwrap import time, textwrap, json
from bisect import bisect_right from bisect import bisect_right
from base64 import b64encode from base64 import b64encode
from future_builtins import map from future_builtins import map
@ -319,9 +319,10 @@ class WebPage(QWebPage):
except (TypeError, ValueError, OverflowError, AttributeError): except (TypeError, ValueError, OverflowError, AttributeError):
pass pass
@pyqtSlot('QList<int>') @pyqtSlot(str)
def request_split(self, loc): def request_split(self, loc):
actions['split-in-preview'].setChecked(False) actions['split-in-preview'].setChecked(False)
loc = json.loads(unicode(loc))
if not loc: if not loc:
return error_dialog(self.view(), _('Invalid location'), return error_dialog(self.view(), _('Invalid location'),
_('Cannot split on the body tag'), show=True) _('Cannot split on the body tag'), show=True)