Pass around win_id so we can use it in the error message handler
The message class needs a win_id to know where to send error messages. Just pass it through the jinja->js->qtwebbridge as it's just a simple int.
This commit is contained in:
parent
bf37d16896
commit
4fd4376c6a
@ -520,12 +520,12 @@ class ConfigManager(QObject):
|
||||
if self._initialized:
|
||||
self._after_set(sectname, optname)
|
||||
|
||||
@pyqtSlot(str, str, str)
|
||||
def set_javascript(self, sectname, optname, value):
|
||||
@pyqtSlot(int, str, str, str)
|
||||
def set_javascript(self, win_id, sectname, optname, value):
|
||||
try:
|
||||
self.set('conf', sectname, optname, value)
|
||||
except configtypes.ValidationError as e:
|
||||
message.error(e)
|
||||
message.error(win_id, e)
|
||||
|
||||
@cmdutils.register(instance='config')
|
||||
def save(self):
|
||||
|
@ -1,9 +1,10 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block script %}
|
||||
var win_id = {{ win_id }};
|
||||
var cset = function(section, option, el) {
|
||||
value = el.value;
|
||||
window.qutesettings.set_javascript(section, option, value);
|
||||
window.qutesettings.set_javascript(win_id, section, option, value);
|
||||
}
|
||||
{% endblock %}
|
||||
|
||||
|
@ -156,7 +156,7 @@ def qute_settings(win_id, request):
|
||||
frame.addToJavaScriptWindowObject("qutesettings", cfg)
|
||||
|
||||
html = jinja.env.get_template('settings.html').render(
|
||||
title='settings', config=configdata, cfg=cfg)
|
||||
win_id=win_id, title='settings', config=configdata, cfg=cfg)
|
||||
return html.encode('UTF-8', errors='xmlcharrefreplace')
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user