diff --git a/.idea/sightplace-rep.iml b/.idea/sightplace-rep.iml index e3d8eed..f13dc48 100644 --- a/.idea/sightplace-rep.iml +++ b/.idea/sightplace-rep.iml @@ -11,6 +11,7 @@ + diff --git a/callhandler.py b/callhandler.py index ab0cf74..f75051e 100644 --- a/callhandler.py +++ b/callhandler.py @@ -50,10 +50,9 @@ class CallHandler(QObject): @pyqtSlot() def activeSight(self): - print("active") if base.data["active_sight"] != self.sight.getId(): - print(self.sight.getId()) - base.data["active_sight"] = self.sight.getId() + print("Active - " + self.sight.getId()) + base.data["active_sight"] = self.sight.getId() @pyqtSlot() def close(self): diff --git a/place/js/sight.js b/place/js/sight.js index d85b9aa..40cbde9 100644 --- a/place/js/sight.js +++ b/place/js/sight.js @@ -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(); } diff --git a/place/templates/base/content/main/content.html b/place/templates/base/content/main/content.html index ecf63d5..628d3ed 100644 --- a/place/templates/base/content/main/content.html +++ b/place/templates/base/content/main/content.html @@ -1 +1,3 @@ -Create an "Other" sight! \ No newline at end of file +Create an "Other" sight! + +Create an "Other" no id sight! \ No newline at end of file diff --git a/place/templates/base/main.html b/place/templates/base/main.html index 66ad134..d382806 100644 --- a/place/templates/base/main.html +++ b/place/templates/base/main.html @@ -31,7 +31,6 @@ - MAIN diff --git a/place/templates/config.ini b/place/templates/config.ini index 5b58ad9..05bd174 100644 --- a/place/templates/config.ini +++ b/place/templates/config.ini @@ -1,3 +1,3 @@ [DEFAULT] default_template = base -sight_mode = single \ No newline at end of file +sight_mode = normal \ No newline at end of file diff --git a/sight.py b/sight.py index 16a6fe8..75ff285 100644 --- a/sight.py +++ b/sight.py @@ -34,6 +34,7 @@ class Sight(QWidget): def setTitle(self, title): self.title = title + def getTitle(self): return self.title def getId(self): diff --git a/sightfactory.py b/sightfactory.py index 425e738..ac6a225 100644 --- a/sightfactory.py +++ b/sightfactory.py @@ -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