Finish dynamic Alert updates

This commit is contained in:
Tim Bentley 2011-10-16 08:59:21 +01:00
parent 9652a690b3
commit 8ebf7ff131
2 changed files with 8 additions and 7 deletions

View File

@ -132,7 +132,9 @@ class MainDisplay(QtGui.QGraphicsView):
self.screen[u'size'].width(), self.screen[u'size'].height()) self.screen[u'size'].width(), self.screen[u'size'].height())
self.page = self.webView.page() self.page = self.webView.page()
self.frame = self.page.mainFrame() self.frame = self.page.mainFrame()
self.webView.settings().setAttribute(7, True) if self.isLive and log.getEffectiveLevel() == logging.DEBUG:
self.webView.settings().setAttribute(
QtWebKit.QWebSettings.DeveloperExtrasEnabled, True)
QtCore.QObject.connect(self.webView, QtCore.QObject.connect(self.webView,
QtCore.SIGNAL(u'loadFinished(bool)'), self.isWebLoaded) QtCore.SIGNAL(u'loadFinished(bool)'), self.isWebLoaded)
self.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) self.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)

View File

@ -71,10 +71,9 @@ JAVASCRIPT = """
function update_css(align, font, size, color, bgcolor){ function update_css(align, font, size, color, bgcolor){
var text = document.getElementById('alert'); var text = document.getElementById('alert');
alert("Hello"); text.style.verticalAlign = align;
document.getElementById('alert').style.verticalalign = align; text.style.fontSize = size + "pt";
text.style.fontfamily = font; text.style.fontFamily = font;
text.style.size = size;
text.style.color = color; text.style.color = color;
text.style.backgroundColor = bgcolor; text.style.backgroundColor = bgcolor;
} }
@ -194,6 +193,6 @@ class AlertsPlugin(Plugin):
def refreshCss(self, frame): def refreshCss(self, frame):
align = VerticalType.Names[self.settings_tab.location] align = VerticalType.Names[self.settings_tab.location]
frame.evaluateJavaScript(u'update_css("%s,%s,%s,%s,%s")' % (align, frame.evaluateJavaScript(u'update_css("%s", "%s", "%s", "%s", "%s")' %
self.settings_tab.font_face, self.settings_tab.font_size, (align, self.settings_tab.font_face, self.settings_tab.font_size,
self.settings_tab.font_color, self.settings_tab.bg_color)) self.settings_tab.font_color, self.settings_tab.bg_color))