mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-04-30 01:22:59 +02:00
Replace deprecated __defineGetter__ and __defineSetter___
__defineGetter__ was not working in Qt 5, this caused the following regressions: PDF Output: Header and footer templates not working in calibre 2.0. Fixes #1361483 [Headers and footers don't appear EPUB to PDF](https://bugs.launchpad.net/calibre/+bug/1361483) E-book viewer: The Table of Contents not displaying the currently viewed section in bold if the section is a link to a location in the middle of a file.
This commit is contained in:
parent
fb416ddffe
commit
bad6acf8b3
4 changed files with 13 additions and 21 deletions
|
|
@ -149,11 +149,9 @@ def load_js(self):
|
|||
self.mainFrame().addToJavaScriptWindowObject("py_bridge", self)
|
||||
self.evaljs(self.js)
|
||||
self.evaljs('''
|
||||
py_bridge.__defineGetter__('value', function() {
|
||||
return JSON.parse(this._pass_json_value);
|
||||
});
|
||||
py_bridge.__defineSetter__('value', function(val) {
|
||||
this._pass_json_value = JSON.stringify(val);
|
||||
Object.defineProperty(py_bridge, 'value', {
|
||||
get : function() { return JSON.parse(this._pass_json_value); },
|
||||
set : function(val) { this._pass_json_value = JSON.stringify(val); }
|
||||
});
|
||||
''')
|
||||
# }}}
|
||||
|
|
|
|||
|
|
@ -345,11 +345,9 @@ def do_paged_render(self):
|
|||
self.load_mathjax()
|
||||
|
||||
evaljs('''
|
||||
py_bridge.__defineGetter__('value', function() {
|
||||
return JSON.parse(this._pass_json_value);
|
||||
});
|
||||
py_bridge.__defineSetter__('value', function(val) {
|
||||
this._pass_json_value = JSON.stringify(val);
|
||||
Object.defineProperty(py_bridge, 'value', {
|
||||
get : function() { return JSON.parse(this._pass_json_value); },
|
||||
set : function(val) { this._pass_json_value = JSON.stringify(val); }
|
||||
});
|
||||
|
||||
document.body.style.backgroundColor = "white";
|
||||
|
|
|
|||
|
|
@ -250,11 +250,9 @@ def do_paged_render(self):
|
|||
evaljs = self.view.page().mainFrame().evaluateJavaScript
|
||||
evaljs(self.paged_js)
|
||||
evaljs('''
|
||||
py_bridge.__defineGetter__('value', function() {
|
||||
return JSON.parse(this._pass_json_value);
|
||||
});
|
||||
py_bridge.__defineSetter__('value', function(val) {
|
||||
this._pass_json_value = JSON.stringify(val);
|
||||
Object.defineProperty(py_bridge, 'value', {
|
||||
get : function() { return JSON.parse(this._pass_json_value); },
|
||||
set : function(val) { this._pass_json_value = JSON.stringify(val); }
|
||||
});
|
||||
|
||||
document.body.style.backgroundColor = "white";
|
||||
|
|
|
|||
|
|
@ -180,12 +180,10 @@ def fit_images(self):
|
|||
def add_window_objects(self):
|
||||
self.mainFrame().addToJavaScriptWindowObject("py_bridge", self)
|
||||
self.javascript('''
|
||||
py_bridge.__defineGetter__('value', function() {
|
||||
return JSON.parse(this._pass_json_value);
|
||||
});
|
||||
py_bridge.__defineSetter__('value', function(val) {
|
||||
this._pass_json_value = JSON.stringify(val);
|
||||
});
|
||||
Object.defineProperty(py_bridge, 'value', {
|
||||
get : function() { return JSON.parse(this._pass_json_value); },
|
||||
set : function(val) { this._pass_json_value = JSON.stringify(val); }
|
||||
});
|
||||
''')
|
||||
self.loaded_javascript = False
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue