Three sight running mode defined and redefined. Now it has unique, auto and normal running mode.
parent
912f974e76
commit
346c22193d
|
|
@ -11,6 +11,7 @@
|
||||||
<component name="PyDocumentationSettings">
|
<component name="PyDocumentationSettings">
|
||||||
<option name="format" value="EPYTEXT" />
|
<option name="format" value="EPYTEXT" />
|
||||||
<option name="myDocStringFormat" value="Epytext" />
|
<option name="myDocStringFormat" value="Epytext" />
|
||||||
|
<option name="renderExternalDocumentation" value="true" />
|
||||||
</component>
|
</component>
|
||||||
<component name="TemplatesService">
|
<component name="TemplatesService">
|
||||||
<option name="TEMPLATE_FOLDERS">
|
<option name="TEMPLATE_FOLDERS">
|
||||||
|
|
|
||||||
|
|
@ -50,9 +50,8 @@ class CallHandler(QObject):
|
||||||
|
|
||||||
@pyqtSlot()
|
@pyqtSlot()
|
||||||
def activeSight(self):
|
def activeSight(self):
|
||||||
print("active")
|
|
||||||
if base.data["active_sight"] != self.sight.getId():
|
if base.data["active_sight"] != self.sight.getId():
|
||||||
print(self.sight.getId())
|
print("Active - " + self.sight.getId())
|
||||||
base.data["active_sight"] = self.sight.getId()
|
base.data["active_sight"] = self.sight.getId()
|
||||||
|
|
||||||
@pyqtSlot()
|
@pyqtSlot()
|
||||||
|
|
|
||||||
|
|
@ -139,56 +139,12 @@ function setTitle(title) {
|
||||||
***/
|
***/
|
||||||
function load(url, element)
|
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();
|
const xhttp = new XMLHttpRequest();
|
||||||
xhttp.open("GET", url, true);*/
|
xhttp.open("GET", url, true);
|
||||||
|
|
||||||
/*xhttp.onreadystatechange = function() {
|
xhttp.onload = 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() {
|
|
||||||
element.innerHTML = this.responseText;
|
element.innerHTML = this.responseText;
|
||||||
}*/
|
}
|
||||||
|
|
||||||
xhttp.send();
|
xhttp.send();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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" data-id="other">Create an "Other" sight!</a>
|
||||||
|
|
||||||
|
<a href="#" id="screate" data-type="other">Create an "Other" no id sight!</a>
|
||||||
|
|
@ -31,7 +31,6 @@
|
||||||
</div>
|
</div>
|
||||||
<div id="content">
|
<div id="content">
|
||||||
<div scontent="main"></div>
|
<div scontent="main"></div>
|
||||||
MAIN
|
|
||||||
<div scontent="main_text"></div>
|
<div scontent="main_text"></div>
|
||||||
</div>
|
</div>
|
||||||
<div id="sresize"></div>
|
<div id="sresize"></div>
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
[DEFAULT]
|
[DEFAULT]
|
||||||
default_template = base
|
default_template = base
|
||||||
sight_mode = single
|
sight_mode = normal
|
||||||
1
sight.py
1
sight.py
|
|
@ -34,6 +34,7 @@ class Sight(QWidget):
|
||||||
|
|
||||||
def setTitle(self, title):
|
def setTitle(self, title):
|
||||||
self.title = title
|
self.title = title
|
||||||
|
|
||||||
def getTitle(self):
|
def getTitle(self):
|
||||||
return self.title
|
return self.title
|
||||||
def getId(self):
|
def getId(self):
|
||||||
|
|
|
||||||
|
|
@ -14,18 +14,24 @@ class SightFactory():
|
||||||
print("The 'main' window already exist! You can't create more than one 'main' type window!")
|
print("The 'main' window already exist! You can't create more than one 'main' type window!")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
if base.data["sight_mode"] == "single":
|
if base.data["sight_mode"] == "unique":
|
||||||
if len(id) == 0:
|
if len(id) == 0:
|
||||||
print("No ID was given! In single mode need declare an ID to the Sight in advance!")
|
print("No ID was given! In single mode need declare an ID to the Sight in advance!")
|
||||||
return None
|
return None
|
||||||
if self.checkKey(id):
|
if self.checkKey(id):
|
||||||
print("This ['"+type+"'-'"+str(id)+"'] already exist!")
|
print("This ['"+type+"'-'"+str(id)+"'] already exist!")
|
||||||
return None
|
return None
|
||||||
if base.data["sight_mode"] == "multiple":
|
if base.data["sight_mode"] == "auto":
|
||||||
if len(id) == 0:
|
if len(id) == 0:
|
||||||
id = self.createUniqueId()
|
id = self.createUniqueId()
|
||||||
if len(id) > 0 and self.checkKey(id) and str(id) != "main":
|
if len(id) > 0 and self.checkKey(id) and str(id) != "main":
|
||||||
id = self.createUniqueId()
|
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!")
|
print("The ['"+type+"'-'"+str(id)+"'] is created now!")
|
||||||
|
|
@ -67,7 +73,7 @@ class SightFactory():
|
||||||
return False
|
return False
|
||||||
def addGlobalData(self, key, value):
|
def addGlobalData(self, key, value):
|
||||||
self.data[key] = value
|
self.data[key] = value
|
||||||
def getGlobalData(self, key):
|
def getGlobauniquelData(self, key):
|
||||||
if key in self.data:
|
if key in self.data:
|
||||||
return self.data[key]
|
return self.data[key]
|
||||||
return None
|
return None
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue