They can send message to each other using the window.sight.message function. It will run "runJavaScript" a "message()" function from the every sights which run and their executes if it needs.
parent
4965e87980
commit
617bbe47cc
|
|
@ -98,7 +98,6 @@ class CallHandler(QObject):
|
|||
def move(self):
|
||||
base.data["move"] = True
|
||||
|
||||
|
||||
@pyqtSlot()
|
||||
def endmove(self):
|
||||
base.data["move"] = False
|
||||
|
|
@ -112,3 +111,12 @@ class CallHandler(QObject):
|
|||
if(new_width<250):
|
||||
new_width = 250
|
||||
self.sight.resize( new_width, new_height)
|
||||
|
||||
@pyqtSlot(str)
|
||||
def message(self, label):
|
||||
print("label - " + label)
|
||||
for sight in base.sights.getSights().values():
|
||||
sight.browser.page().runJavaScript("message('"+label+"')", self.ready)
|
||||
|
||||
def ready(self, returnValue):
|
||||
print(returnValue)
|
||||
|
|
@ -148,6 +148,11 @@ function load(url, element)
|
|||
xhttp.send();
|
||||
}
|
||||
|
||||
/*function message(label) {
|
||||
alert("what")
|
||||
return "message came"
|
||||
}
|
||||
*/
|
||||
$(document).ready(function(){
|
||||
const scontent = document.querySelectorAll('[scontent]');
|
||||
scontent.forEach((element) => {
|
||||
|
|
@ -204,6 +209,7 @@ $(document).ready(function(){
|
|||
$("#sminimize").empty();
|
||||
$("#sminimize").prepend('<img src="img/minimize.png" height="20px" />');
|
||||
}
|
||||
|
||||
/*window.sight.getTitle(function(result) {
|
||||
setTitle(result);
|
||||
});*/
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@
|
|||
'width' : 300,
|
||||
'height' : 300
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<script src="../../js/sight.js"></script>
|
||||
|
|
@ -18,7 +20,16 @@
|
|||
$(document).ready(function(){
|
||||
/*addData("name", "Balazs", true);
|
||||
getData("name");*/
|
||||
|
||||
|
||||
});
|
||||
|
||||
function message(label) {
|
||||
if(label === "price_change") {
|
||||
window.sight.message("changed_now")
|
||||
return "I update my price - "+label
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
|||
|
|
@ -9,7 +9,14 @@
|
|||
<script>
|
||||
$(document).ready(function(){
|
||||
//getData("name", true);
|
||||
window.sight.message("price_change")
|
||||
});
|
||||
|
||||
function message(label) {
|
||||
if(label === "changed_now") {
|
||||
return "everything alright - " + label
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
|||
|
|
@ -45,6 +45,9 @@ class SightFactory():
|
|||
print("This '"+str(id)+"' id isn't exist to show!")
|
||||
return False
|
||||
|
||||
def getSights(self):
|
||||
return self.list
|
||||
|
||||
def get(self, id):
|
||||
if self.checkKey(id):
|
||||
return self.list[id]
|
||||
|
|
|
|||
Loading…
Reference in New Issue