diff --git a/base.py b/base.py
index 71dab8c..e116115 100644
--- a/base.py
+++ b/base.py
@@ -1,5 +1,6 @@
import sys
import os
+import platform
import configparser
from mouseevents import MouseEvents
from pynput import mouse
@@ -16,6 +17,8 @@ def init():
data = {}
data["move"] = False
data["active_sight"] = "main"
+ data["platform"] = {}
+ data["platform"]["system"] = platform.system()
data["sight_processes"] = {}
data["mouse_distance_x"] = 0
data["mouse_distance_y"] = 0
@@ -33,6 +36,7 @@ def loadConfigTemplate():
config.read(data["template_dir"]+"config.ini")
if "DEFAULT" in config:
data["default_template"] = config["DEFAULT"]["default_template"]
+ data["default_template_page"] = config["DEFAULT"]["default_template_page"]
data["default_template_dir"] = data["template_dir"]+data["default_template"]+os.path.sep
data["sight_mode"] = config["DEFAULT"]["sight_mode"]
print("Template config is loaded!")
@@ -41,7 +45,7 @@ def loadConfigTemplate():
def start():
# Creating the main Sight
- sights.create("main","main");
+ sights.create("main", data["default_template_page"]);
sights.processes();
sights.show("main");
diff --git a/browser.py b/browser.py
index c127325..53d43aa 100644
--- a/browser.py
+++ b/browser.py
@@ -14,6 +14,6 @@ class Browser(QWebEngineView):
self.channel.registerObject(id, self.handler)
self.page().setWebChannel(self.channel)
- def loadContent(self, type):
- print(base.data["default_template_dir"]+type+".html")
- self.load(QUrl.fromLocalFile(base.data["default_template_dir"]+type+".html"))
\ No newline at end of file
+ def loadContent(self, page):
+ print(base.data["default_template_dir"]+page+".html")
+ self.load(QUrl.fromLocalFile(base.data["default_template_dir"]+page+".html"))
\ No newline at end of file
diff --git a/callhandler.py b/callhandler.py
index 983421f..7c66172 100644
--- a/callhandler.py
+++ b/callhandler.py
@@ -30,9 +30,13 @@ class CallHandler(QObject):
def setHeight(self, height):
self.sight.resize(self.sight.width(), height);
+ @pyqtSlot(result=str)
+ def system(self):
+ return base.data["platform"]["system"]
+
@pyqtSlot(str, str, result=str)
- def create(self, id, type):
- new_id = base.sights.create(id, type)
+ def create(self, id, page):
+ new_id = base.sights.create(id, page)
if new_id is not None:
base.sights.show(new_id)
""" The id will be added to its parent. When parent close will be its children closed as well """
diff --git a/place/js/sight.js b/place/js/sight.js
index 9ceeb60..f6a0198 100644
--- a/place/js/sight.js
+++ b/place/js/sight.js
@@ -9,7 +9,7 @@ if(navigator.userAgent.indexOf("QtWebEngine") > 0) {
$.fn.s_create = function() {
$(document).on( "click", "#screate", function(event) {
event.preventDefault();
- window.sight.create($(this).data("id"), $(this).data("type"), function(sight_id) {
+ window.sight.create($(this).data("id"), $(this).data("page"), function(sight_id) {
});
})
diff --git a/place/templates/base/content/main/content.html b/place/templates/base/content/main/content.html
index 628d3ed..5fc9920 100644
--- a/place/templates/base/content/main/content.html
+++ b/place/templates/base/content/main/content.html
@@ -1,3 +1,3 @@
-Create an "Other" sight!
+Create an "Other" sight!
-Create an "Other" no id sight!
\ No newline at end of file
+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 e366a4b..0cff76f 100644
--- a/place/templates/base/main.html
+++ b/place/templates/base/main.html
@@ -20,8 +20,9 @@
$(document).ready(function(){
/*addData("name", "Balazs", true);
getData("name");*/
-
-
+ window.sight.system(function(result) {
+ alert(result)
+ });
});
function message(label, data) {
diff --git a/place/templates/config.ini b/place/templates/config.ini
index 05bd174..7dd7e2b 100644
--- a/place/templates/config.ini
+++ b/place/templates/config.ini
@@ -1,3 +1,4 @@
[DEFAULT]
default_template = base
+default_template_page = main
sight_mode = normal
\ No newline at end of file
diff --git a/sight.py b/sight.py
index 8107a3c..67a3396 100644
--- a/sight.py
+++ b/sight.py
@@ -5,11 +5,11 @@ from PyQt6.QtCore import Qt
from PyQt6.QtWidgets import QMainWindow, QWidget, QVBoxLayout
class Sight(QWidget):
- def __init__(self, id, type):
+ def __init__(self, id, page):
super().__init__()
self.id = id
- self.type = type
+ self.page = page
self.data = {} # private data(s) of the sight
self.children = []
self.parent = None
@@ -22,7 +22,7 @@ class Sight(QWidget):
self.browser = Browser()
self.browser.addObject('handler', CallHandler(self) )
- self.browser.loadContent(type)
+ self.browser.loadContent(page)
self.layout = QVBoxLayout()
self.layout.addWidget(self.browser)
diff --git a/sightfactory.py b/sightfactory.py
index 7507885..531747c 100644
--- a/sightfactory.py
+++ b/sightfactory.py
@@ -7,11 +7,11 @@ class SightFactory():
self.list = {}
self.data = {} #Global data(s) for the sight(s)
- def create(self, id, type):
- print("----- "+type+"-"+str(id)+"-------")
+ def create(self, id, page):
+ print("----- "+page+"-"+str(id)+"-------")
if str(id) == "main" and self.checkKey(id):
- 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' page sight!")
return None
if base.data["sight_mode"] == "unique":
@@ -19,7 +19,7 @@ class SightFactory():
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!")
+ print("This ['"+page+"'-'"+str(id)+"'] already exist!")
return None
if base.data["sight_mode"] == "auto":
if len(id) == 0:
@@ -28,13 +28,13 @@ class SightFactory():
id = self.createUniqueId()
if base.data["sight_mode"] == "normal":
if self.checkKey(id) and len(id) != 0:
- print("This ['"+type+"'-'"+str(id)+"'] already exist!")
+ print("This ['"+page+"'-'"+str(id)+"'] already exist!")
return None
if len(id) == 0:
id = self.createUniqueId()
- self.list[id] = Sight(id, type)
- print("The ['"+type+"'-'"+str(id)+"'] is created now!")
+ self.list[id] = Sight(id, page)
+ print("The ['"+page+"'-'"+str(id)+"'] is created now!")
return id
def show(self, id):