mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 02:34:06 -04: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
@ -149,11 +149,9 @@ class Page(QWebPage): # {{{
|
|||||||
self.mainFrame().addToJavaScriptWindowObject("py_bridge", self)
|
self.mainFrame().addToJavaScriptWindowObject("py_bridge", self)
|
||||||
self.evaljs(self.js)
|
self.evaljs(self.js)
|
||||||
self.evaljs('''
|
self.evaljs('''
|
||||||
py_bridge.__defineGetter__('value', function() {
|
Object.defineProperty(py_bridge, 'value', {
|
||||||
return JSON.parse(this._pass_json_value);
|
get : function() { return JSON.parse(this._pass_json_value); },
|
||||||
});
|
set : function(val) { this._pass_json_value = JSON.stringify(val); }
|
||||||
py_bridge.__defineSetter__('value', function(val) {
|
|
||||||
this._pass_json_value = JSON.stringify(val);
|
|
||||||
});
|
});
|
||||||
''')
|
''')
|
||||||
# }}}
|
# }}}
|
||||||
|
@ -345,11 +345,9 @@ class PDFWriter(QObject):
|
|||||||
self.load_mathjax()
|
self.load_mathjax()
|
||||||
|
|
||||||
evaljs('''
|
evaljs('''
|
||||||
py_bridge.__defineGetter__('value', function() {
|
Object.defineProperty(py_bridge, 'value', {
|
||||||
return JSON.parse(this._pass_json_value);
|
get : function() { return JSON.parse(this._pass_json_value); },
|
||||||
});
|
set : function(val) { this._pass_json_value = JSON.stringify(val); }
|
||||||
py_bridge.__defineSetter__('value', function(val) {
|
|
||||||
this._pass_json_value = JSON.stringify(val);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
document.body.style.backgroundColor = "white";
|
document.body.style.backgroundColor = "white";
|
||||||
|
@ -250,11 +250,9 @@ class PDFWriter(QObject): # {{{
|
|||||||
evaljs = self.view.page().mainFrame().evaluateJavaScript
|
evaljs = self.view.page().mainFrame().evaluateJavaScript
|
||||||
evaljs(self.paged_js)
|
evaljs(self.paged_js)
|
||||||
evaljs('''
|
evaljs('''
|
||||||
py_bridge.__defineGetter__('value', function() {
|
Object.defineProperty(py_bridge, 'value', {
|
||||||
return JSON.parse(this._pass_json_value);
|
get : function() { return JSON.parse(this._pass_json_value); },
|
||||||
});
|
set : function(val) { this._pass_json_value = JSON.stringify(val); }
|
||||||
py_bridge.__defineSetter__('value', function(val) {
|
|
||||||
this._pass_json_value = JSON.stringify(val);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
document.body.style.backgroundColor = "white";
|
document.body.style.backgroundColor = "white";
|
||||||
|
@ -180,12 +180,10 @@ class Document(QWebPage): # {{{
|
|||||||
def add_window_objects(self):
|
def add_window_objects(self):
|
||||||
self.mainFrame().addToJavaScriptWindowObject("py_bridge", self)
|
self.mainFrame().addToJavaScriptWindowObject("py_bridge", self)
|
||||||
self.javascript('''
|
self.javascript('''
|
||||||
py_bridge.__defineGetter__('value', function() {
|
Object.defineProperty(py_bridge, 'value', {
|
||||||
return JSON.parse(this._pass_json_value);
|
get : function() { return JSON.parse(this._pass_json_value); },
|
||||||
});
|
set : function(val) { this._pass_json_value = JSON.stringify(val); }
|
||||||
py_bridge.__defineSetter__('value', function(val) {
|
});
|
||||||
this._pass_json_value = JSON.stringify(val);
|
|
||||||
});
|
|
||||||
''')
|
''')
|
||||||
self.loaded_javascript = False
|
self.loaded_javascript = False
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user