Three sight running mode defined and redefined. Now it has unique, auto and normal running mode.

main
Balazs Birtalan 2023-10-26 16:58:46 +01:00
parent 912f974e76
commit 346c22193d
8 changed files with 21 additions and 57 deletions

View File

@ -11,6 +11,7 @@
<component name="PyDocumentationSettings">
<option name="format" value="EPYTEXT" />
<option name="myDocStringFormat" value="Epytext" />
<option name="renderExternalDocumentation" value="true" />
</component>
<component name="TemplatesService">
<option name="TEMPLATE_FOLDERS">

View File

@ -50,9 +50,8 @@ class CallHandler(QObject):
@pyqtSlot()
def activeSight(self):
print("active")
if base.data["active_sight"] != self.sight.getId():
print(self.sight.getId())
print("Active - " + self.sight.getId())
base.data["active_sight"] = self.sight.getId()
@pyqtSlot()

View File

@ -139,56 +139,12 @@ function setTitle(title) {
***/
function load(url, element)
{
/*fetch(url,{
method: "POST",
headers: {"Content-type": "application/javascript;charset=UTF-8"}
}).then(res => {
return res.text();
}).then((html) => {
element.innerHTML = html;
});*/
/*
const xhttp = new XMLHttpRequest();
xhttp.open("GET", url, true);*/
xhttp.open("GET", url, true);
/*xhttp.onreadystatechange = function() {
if (xhttp.readyState == XMLHttpRequest.DONE) {
if (xhttp.status == 200) {
// create a `div` elemenent, append response to `div` element
// get specific elements by `id`, append `script` element to `document.body`
var content = document.createElement("div");
content.innerHTML = xhttp.responseText
var contentScript = content.querySelector("script");
var script = document.createElement("script");
script.textContent = contentScript.textContent;
element.innerHTML = content.innerHTML;
//window.sight.console(script.textContent)
var rand = Math.random()*1000
//script.setAttribute("script_run_"+rand)
document.body.appendChild(script);
//document.body.removeChild(list.firstElementChild);
}
}
};*/
/*
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
var doc = new DOMParser().parseFromString(this.responseText, "text/html");
/*var fragmentElement = document.createDocumentFragment();
var tempElement = fragmentElement.appendChild(doc.content.body);
alert(tempElement)
document.body.appendChild(tempElement);*/
//element.innerHTML = this.responseText;
/* }
};
*/
/*xhttp.onload = function() {
xhttp.onload = function() {
element.innerHTML = this.responseText;
}*/
}
xhttp.send();
}

View File

@ -1 +1,3 @@
<a href="#" id="screate" data-type="other" data-id="other">Create an "Other" sight!</a>
<a href="#" id="screate" data-type="other">Create an "Other" no id sight!</a>

View File

@ -31,7 +31,6 @@
</div>
<div id="content">
<div scontent="main"></div>
MAIN
<div scontent="main_text"></div>
</div>
<div id="sresize"></div>

View File

@ -1,3 +1,3 @@
[DEFAULT]
default_template = base
sight_mode = single
sight_mode = normal

View File

@ -34,6 +34,7 @@ class Sight(QWidget):
def setTitle(self, title):
self.title = title
def getTitle(self):
return self.title
def getId(self):

View File

@ -14,20 +14,26 @@ class SightFactory():
print("The 'main' window already exist! You can't create more than one 'main' type window!")
return None
if base.data["sight_mode"] == "single":
if base.data["sight_mode"] == "unique":
if len(id) == 0:
print("No ID was given! In single mode need declare an ID to the Sight in advance!")
return None
if self.checkKey(id):
print("This ['"+type+"'-'"+str(id)+"'] already exist!")
return None
if base.data["sight_mode"] == "multiple":
if base.data["sight_mode"] == "auto":
if len(id) == 0:
id = self.createUniqueId()
if len(id) > 0 and self.checkKey(id) and str(id) != "main":
id = self.createUniqueId()
if base.data["sight_mode"] == "normal":
if self.checkKey(id) and len(id) != 0:
print("This ['"+type+"'-'"+str(id)+"'] already exist!")
return None
if len(id) == 0:
id = self.createUniqueId()
self.list[id] = Sight(id,type)
self.list[id] = Sight(id, type)
print("The ['"+type+"'-'"+str(id)+"'] is created now!")
return id
@ -67,7 +73,7 @@ class SightFactory():
return False
def addGlobalData(self, key, value):
self.data[key] = value
def getGlobalData(self, key):
def getGlobauniquelData(self, key):
if key in self.data:
return self.data[key]
return None