\ No newline at end of file
diff --git a/admin/base/content/logs/style.css b/admin/base/content/logs/style.css
new file mode 100644
index 0000000..13b930a
--- /dev/null
+++ b/admin/base/content/logs/style.css
@@ -0,0 +1,3 @@
+#display_logs {
+ font-size: 10pt;
+}
\ No newline at end of file
diff --git a/admin/base/content/main/content.html b/admin/base/content/main/content.html
new file mode 100644
index 0000000..5fc9920
--- /dev/null
+++ b/admin/base/content/main/content.html
@@ -0,0 +1,3 @@
+Create an "Other" sight!
+
+Create an "Other" no id sight!
\ No newline at end of file
diff --git a/admin/base/content/main_text/content.html b/admin/base/content/main_text/content.html
new file mode 100644
index 0000000..cddb42e
--- /dev/null
+++ b/admin/base/content/main_text/content.html
@@ -0,0 +1,15 @@
+
+
+
This is a sentence.
+
+
+
+
\ No newline at end of file
diff --git a/core/template/base/content/main_text/test.css b/admin/base/content/main_text/test.css
similarity index 100%
rename from core/template/base/content/main_text/test.css
rename to admin/base/content/main_text/test.css
diff --git a/core/template/base/css/template.css b/admin/base/css/template.css
similarity index 81%
rename from core/template/base/css/template.css
rename to admin/base/css/template.css
index d6db84a..5bbffac 100644
--- a/core/template/base/css/template.css
+++ b/admin/base/css/template.css
@@ -1,6 +1,10 @@
body {
background-color: white;
}
+#sight {
+ background-color: #26324d;
+ color: white;
+}
#sight #stitlebar {
background-color: #4f9af3;
}
@@ -12,8 +16,8 @@ body {
font-size: larger;
float: left;
}
-#sight {
- border: 4px solid #4f9af3;
+#sight[display="show"]{
+ border: 4px solid #4f9af3;
}
#sight #content {
padding: 5px;
diff --git a/core/template/base/img/close.png b/admin/base/img/close.png
similarity index 100%
rename from core/template/base/img/close.png
rename to admin/base/img/close.png
diff --git a/core/template/base/img/maximized.png b/admin/base/img/maximized.png
similarity index 100%
rename from core/template/base/img/maximized.png
rename to admin/base/img/maximized.png
diff --git a/core/template/base/img/minimize.png b/admin/base/img/minimize.png
similarity index 100%
rename from core/template/base/img/minimize.png
rename to admin/base/img/minimize.png
diff --git a/core/template/base/img/restoredown.png b/admin/base/img/restoredown.png
similarity index 100%
rename from core/template/base/img/restoredown.png
rename to admin/base/img/restoredown.png
diff --git a/admin/base/main.html b/admin/base/main.html
new file mode 100644
index 0000000..84a08a5
--- /dev/null
+++ b/admin/base/main.html
@@ -0,0 +1,52 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Main Template
+
+
+
+
+
+
+
+
+
+
+
diff --git a/admin/base/template.js b/admin/base/template.js
new file mode 100644
index 0000000..92b80b7
--- /dev/null
+++ b/admin/base/template.js
@@ -0,0 +1,6 @@
+var s_template={
+ 'name' : "Admin",
+ 'author' : 'Balazs Birtalan',
+ 'URL' : '/admin/base',
+ 'created': '2023'
+}
\ No newline at end of file
diff --git a/base.py b/base.py
index bf9b0d9..c2fa15c 100644
--- a/base.py
+++ b/base.py
@@ -2,6 +2,12 @@ import sys
import os
import platform
import configparser
+from log import Log
+log = Log(3)
+log.debugOn()
+log.debug_level = 3
+log.eventOff()
+
from mouseevents import MouseEvents
from pynput import mouse
from sightfactory import SightFactory
@@ -10,15 +16,16 @@ from pynput.mouse import Controller
import subprocess
def init():
- global data, sights, mousectrl, app
+ global sights, mousectrl, app, data
+ data = {}
#init the basic values
app = QApplication(sys.argv)
mousectrl = Controller()
sights = SightFactory()
- data = {}
data["move"] = False
data["active_sight"] = "main"
+
data["platform"] = {}
data["platform"]["system"] = platform.system()
data["mouse_distance_x"] = 0
@@ -30,6 +37,8 @@ def init():
data["display_server"] = result.decode('ascii')
data["base_dir"]=os.path.abspath(os.getcwd())+os.path.sep
data["template_dir"]=data["base_dir"]+"place"+os.path.sep+"templates"+os.path.sep
+
+ data["admin_template"] = data["base_dir"] + "admin" +os.path.sep + "base"+os.path.sep
#LOAD the template config.ini file's content
loadConfigTemplate()
@@ -42,20 +51,6 @@ def frameSupported():
return False
return True
-
-def where():
- # for current func name, specify 0 or no argument.
- # for name of caller of current func, specify 1.
- # for name of caller of caller of current func, specify 2. etc.
- currentFuncName = lambda n=0: sys._getframe(n + 1).f_code.co_name
-
- try:
- currentClassName = sys._getframe(1).f_locals["self"].__class__.__name__
- except KeyError:
- currentClassName = None
-
- return str(currentClassName) + " -> " + currentFuncName(1)
-
def loadConfigTemplate():
config = configparser.ConfigParser()
config.sections()
@@ -65,18 +60,18 @@ def loadConfigTemplate():
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"]
- logMsg("LOADED","CONFIG.INI file", where())
+ log.byCode("CFL1000S","CONFIG.INI file")
else:
- logMsg("ERROR", "Missing 'DEFAULT' data from the templates config.ini folder. It can't start!", where())
+ log.byCode( "CFL1000F", "Missing 'DEFAULT' data from the templates config.ini folder. It can't start!")
def start():
+ # Creating admin sight
+ sights.create("sight-admin", "main")
+ sights.show("sight-admin")
+
# Creating the main Sight
sights.create("main", data["default_template_page"])
sights.show("main")
-
- app.exec()
-def logMsg(status, msg, where = ""):
- if len(str(where)) > 0:
- where = "("+where+")"
- print("["+status+"]", str(msg), where, sep='\t')
\ No newline at end of file
+
+ app.exec()
diff --git a/browser.py b/browser.py
index 281e7c8..dd562fc 100644
--- a/browser.py
+++ b/browser.py
@@ -1,4 +1,5 @@
import base
+from base import *
from PyQt6.QtWebChannel import QWebChannel
from PyQt6.QtWebEngineWidgets import QWebEngineView
@@ -16,4 +17,8 @@ class Browser(QWebEngineView):
def loadContent(self, page):
self.load(QUrl.fromLocalFile(base.data["default_template_dir"]+page+".html"))
- base.logMsg("LOADED", base.data["default_template_dir"]+page+".html", base.where())
\ No newline at end of file
+ log.byCode("BLC1000S", base.data["default_template_dir"]+page+".html")
+
+ def loadAdminContent(self, page):
+ self.load(QUrl.fromLocalFile(base.data["admin_template"] + page + ".html"))
+ log.byCode("BLC1001S", base.data["admin_template"] + page + ".html")
diff --git a/callhandler.py b/callhandler.py
index 1b332cc..0cf2069 100644
--- a/callhandler.py
+++ b/callhandler.py
@@ -1,6 +1,7 @@
-import base
import json
import random
+import base
+from base import log
from PyQt6.QtCore import QObject, pyqtSlot
@@ -11,7 +12,7 @@ class CallHandler(QObject):
@pyqtSlot(str)
def console(self, msg):
- base.logMsg("CONSOLE", msg)
+ log.console(msg)
@pyqtSlot(str, result=str)
def test2(self, t):
@@ -34,6 +35,14 @@ class CallHandler(QObject):
def setHeight(self, height):
self.sight.resize(self.sight.width(), height);
+ @pyqtSlot(int, int)
+ def setSize(self, width, height):
+ self.sight.resize(width,height);
+
+ @pyqtSlot(int,int)
+ def setPosition(self, x, y):
+ self.sight.move(x,y)
+
@pyqtSlot(result=str)
def system(self):
return base.data["platform"]["system"]
@@ -105,6 +114,8 @@ class CallHandler(QObject):
def endmove(self):
base.data["move"] = False
+
+
@pyqtSlot()
def resize(self):
new_height = base.mousectrl.position[1] - self.sight.pos().y()
@@ -119,7 +130,6 @@ class CallHandler(QObject):
def message(self, label, sight_id_json, data):
sight_list = json.loads(sight_id_json)
- base.logMsg("MESSAGE",label, base.where())
if len(sight_list) == 0:
for sight in base.sights.getSights().values():
sight.browser.page().runJavaScript("message('" + label + "', '"+data+"')", self.ready)
diff --git a/core/template/base/content/main/content.html b/core/template/base/content/main/content.html
deleted file mode 100644
index ecf63d5..0000000
--- a/core/template/base/content/main/content.html
+++ /dev/null
@@ -1 +0,0 @@
-Create an "Other" sight!
\ No newline at end of file
diff --git a/core/template/base/content/main/content.html.bak b/core/template/base/content/main/content.html.bak
deleted file mode 100644
index 1cfc492..0000000
--- a/core/template/base/content/main/content.html.bak
+++ /dev/null
@@ -1 +0,0 @@
-Create an "Other" sight!
\ No newline at end of file
diff --git a/core/template/base/content/main/main.html.bak b/core/template/base/content/main/main.html.bak
deleted file mode 100644
index e69de29..0000000
diff --git a/core/template/base/content/main_text/content.html b/core/template/base/content/main_text/content.html
deleted file mode 100644
index 1e61d87..0000000
--- a/core/template/base/content/main_text/content.html
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
This is a sentence.
-
\ No newline at end of file
diff --git a/core/template/base/content/main_text/content.html.bak b/core/template/base/content/main_text/content.html.bak
deleted file mode 100644
index 792c4b3..0000000
--- a/core/template/base/content/main_text/content.html.bak
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
This is a sentence.
-
\ No newline at end of file
diff --git a/core/template/base/main.html b/core/template/base/main.html
deleted file mode 100644
index 262556b..0000000
--- a/core/template/base/main.html
+++ /dev/null
@@ -1,40 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Main Template
-
-
-
-
-
-
- MAIN
-
-
-
-
-
-
\ No newline at end of file
diff --git a/core/template/base/main.html.bak b/core/template/base/main.html.bak
deleted file mode 100644
index c756937..0000000
--- a/core/template/base/main.html.bak
+++ /dev/null
@@ -1,40 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Main Template
-
-
-
-
-
-
- MAIN
-
-
-
-
-
-
\ No newline at end of file
diff --git a/core/template/base/other.html.bak b/core/template/base/other.html.bak
deleted file mode 100644
index b99c0c9..0000000
--- a/core/template/base/other.html.bak
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/core/template/base/template.conf.bak b/core/template/base/template.conf.bak
deleted file mode 100644
index e69de29..0000000
diff --git a/core/template/base/template.js b/core/template/base/template.js
deleted file mode 100644
index d36ed3b..0000000
--- a/core/template/base/template.js
+++ /dev/null
@@ -1,13 +0,0 @@
-var s_template={
- 'name' : "Base",
- 'author' : 'Balazs Birtalan',
- 'URL' : '/template/base',
- 'created': '2023'
-}
-
-// first element: "key" is the ID where the content html will be embedded
-// second element: "value" is the folder name of that content folder where the content.html file's contents will be embedded
-var s_contents={
- 'main_content':"main",
- 'main_text':"main_text",
-}
\ No newline at end of file
diff --git a/core/template/base/template.js.bak b/core/template/base/template.js.bak
deleted file mode 100644
index 6556055..0000000
--- a/core/template/base/template.js.bak
+++ /dev/null
@@ -1,13 +0,0 @@
-var s_template={
- 'name' : "Base",
- 'author' : 'Balazs Birtalan',
- 'URL' : '/template/base',
- 'created': '2023'
-}
-
-// first element "key" is the ID where the content html will be embedded
-// second element "value" is the folder name of that content folder where the content.html file's contents will be embedded
-var s_contents={
- 'main_content':"main",
- 'main_text':"main_text",
-}
\ No newline at end of file
diff --git a/core/template/config.ini b/core/template/config.ini
deleted file mode 100644
index 5b58ad9..0000000
--- a/core/template/config.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[DEFAULT]
-default_template = base
-sight_mode = single
\ No newline at end of file
diff --git a/core/template/config.ini.bak b/core/template/config.ini.bak
deleted file mode 100644
index 2b10775..0000000
--- a/core/template/config.ini.bak
+++ /dev/null
@@ -1,3 +0,0 @@
-[DEFAULT]
-default_template = base
-sight_mode = multiple
\ No newline at end of file
diff --git a/place/css/sight.css b/core/template_files/css/sight.css
similarity index 100%
rename from place/css/sight.css
rename to core/template_files/css/sight.css
diff --git a/place/js/jquery-3.6.4.min.js b/core/template_files/js/jquery-3.6.4.min.js
similarity index 100%
rename from place/js/jquery-3.6.4.min.js
rename to core/template_files/js/jquery-3.6.4.min.js
diff --git a/place/js/sight.js b/core/template_files/js/sight.js
similarity index 95%
rename from place/js/sight.js
rename to core/template_files/js/sight.js
index 0e7f14b..13bba14 100644
--- a/place/js/sight.js
+++ b/core/template_files/js/sight.js
@@ -177,7 +177,7 @@ function load(url, element)
$(document).ready(function(){
if(typeof window.sight.console === "undefined") {
/* Maybe the document ready but still the window.sight didnt loaded in the time */
- location.reload();
+ location.reload();
}
const scontent = document.querySelectorAll('[scontent]');
@@ -188,8 +188,7 @@ $(document).ready(function(){
// INIT the Sight from init_sight variable
if (typeof init_sight !== 'undefined') {
- for ( const [key,value] of Object.entries( init_sight ) ) {
-
+ /*for ( const [key,value] of Object.entries( init_sight ) ) {
window.sight.console(key + " - " + value)
switch(key) {
case 'width':
@@ -199,7 +198,12 @@ $(document).ready(function(){
window.sight.setHeight(value)
break;
}
- }
+ }*/
+ if(init_sight["width"]!== 'undefined' && init_sight["height"]!== 'undefined')
+ window.sight.setSize(init_sight["width"],init_sight["height"])
+
+ if(init_sight["pos_x"]!== 'undefined' && init_sight["pos_y"]!== 'undefined')
+ window.sight.setPosition(init_sight["pos_x"], init_sight["pos_y"])
}
// INIT
/*window.sight.getDefaultTemplate(function(default_template) {
diff --git a/design/admin-base/content/main/content.html b/design/admin-base/content/main/content.html
new file mode 100644
index 0000000..5fc9920
--- /dev/null
+++ b/design/admin-base/content/main/content.html
@@ -0,0 +1,3 @@
+Create an "Other" sight!
+
+Create an "Other" no id sight!
\ No newline at end of file
diff --git a/design/admin-base/content/main_text/content.html b/design/admin-base/content/main_text/content.html
new file mode 100644
index 0000000..cddb42e
--- /dev/null
+++ b/design/admin-base/content/main_text/content.html
@@ -0,0 +1,15 @@
+
+
+
This is a sentence.
+
+
+
+
\ No newline at end of file
diff --git a/design/admin-base/content/main_text/test.css b/design/admin-base/content/main_text/test.css
new file mode 100644
index 0000000..11c8899
--- /dev/null
+++ b/design/admin-base/content/main_text/test.css
@@ -0,0 +1,3 @@
+#example {
+ background-color: yellow;
+}
\ No newline at end of file
diff --git a/core/template/base/css/template.css.bak b/design/admin-base/css/template.css
similarity index 70%
rename from core/template/base/css/template.css.bak
rename to design/admin-base/css/template.css
index 67dbb73..5bbffac 100644
--- a/core/template/base/css/template.css.bak
+++ b/design/admin-base/css/template.css
@@ -1,6 +1,10 @@
body {
background-color: white;
}
+#sight {
+ background-color: #26324d;
+ color: white;
+}
#sight #stitlebar {
background-color: #4f9af3;
}
@@ -12,17 +16,8 @@ body {
font-size: larger;
float: left;
}
-#sight #sresize {
- width: 15px;
- height: 15px;
- background-color: none;
- right: 0;
- float: right;
- bottom: 0;
- position: absolute;
-}
-#sight {
- border: 4px solid #4f9af3;
+#sight[display="show"]{
+ border: 4px solid #4f9af3;
}
#sight #content {
padding: 5px;
diff --git a/design/admin-base/img/close.png b/design/admin-base/img/close.png
new file mode 100644
index 0000000..a4f8492
Binary files /dev/null and b/design/admin-base/img/close.png differ
diff --git a/design/admin-base/img/maximized.png b/design/admin-base/img/maximized.png
new file mode 100644
index 0000000..7e659de
Binary files /dev/null and b/design/admin-base/img/maximized.png differ
diff --git a/design/admin-base/img/minimize.png b/design/admin-base/img/minimize.png
new file mode 100644
index 0000000..0ac804d
Binary files /dev/null and b/design/admin-base/img/minimize.png differ
diff --git a/design/admin-base/img/restoredown.png b/design/admin-base/img/restoredown.png
new file mode 100644
index 0000000..bfd2475
Binary files /dev/null and b/design/admin-base/img/restoredown.png differ
diff --git a/design/admin-base/main.html b/design/admin-base/main.html
new file mode 100644
index 0000000..78ec772
--- /dev/null
+++ b/design/admin-base/main.html
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Main Template
+
+
+
+
+
+ ADMIN
+
+
+
+
+
diff --git a/core/template/base/other.html b/design/admin-base/other.html
similarity index 61%
rename from core/template/base/other.html
rename to design/admin-base/other.html
index 0b5204f..564ca8c 100644
--- a/core/template/base/other.html
+++ b/design/admin-base/other.html
@@ -9,7 +9,23 @@
diff --git a/design/admin-base/template.js b/design/admin-base/template.js
new file mode 100644
index 0000000..92b80b7
--- /dev/null
+++ b/design/admin-base/template.js
@@ -0,0 +1,6 @@
+var s_template={
+ 'name' : "Admin",
+ 'author' : 'Balazs Birtalan',
+ 'URL' : '/admin/base',
+ 'created': '2023'
+}
\ No newline at end of file
diff --git a/log.py b/log.py
new file mode 100644
index 0000000..a7a0128
--- /dev/null
+++ b/log.py
@@ -0,0 +1,123 @@
+import sys
+import os.path
+import datetime
+
+import html
+from log_event_codes import loge_codes
+import base
+
+class Log():
+ def __init__(self, specify=1):
+ loge_codes.addEventCode("LOG0001X", "The event code is not exist!")
+
+ self.specify = specify
+ self.debug = False
+ self.debug_level = 1
+ self.event_on = True
+
+ self.debug_modes = {}
+ self.debug_modes[0] = ["info", "console", "message", "success"]
+ self.debug_modes[1] = ["alert", "warning", "event"]
+ self.debug_modes[2] = ["failed", "error"]
+ self.debug_modes[3] = ["all"]
+ print("--- LOG STARTED ----")
+
+ def debugOn(self):
+ self.debug = True
+ def debugOff(self):
+ self.debug = False
+
+ def eventOn(self):
+ self.event_on = True
+ def eventOff(self):
+ self.event_on = False
+ def debugLevel(self, number):
+ if number < 1:
+ self.debug_level = 1
+ elif number > 3:
+ self.debug_level = 3
+ else:
+ self.debug_level = number
+
+ def whereis(self):
+ # for current func name, specify 0 or no argument.
+ # for name of caller of current func, specify 1.
+ # for name of caller of caller of current func, specify 2. etc.
+ # self.specify
+ currentFuncName = lambda n=0: sys._getframe(n + 1).f_code.co_name
+
+ try:
+ currentClassName = sys._getframe(self.specify).f_locals["self"].__class__.__name__
+ except KeyError:
+ currentClassName = None
+
+ if currentClassName is None:
+ currentClassName = "No Class"
+ return str(currentClassName) + " -> " + currentFuncName(self.specify)
+
+ def byCode(self, event_code, msg = "", wheres = ""):
+ code_data = loge_codes.getEventCode(event_code)
+ if code_data is not None:
+ if event_code[:3].upper() == "LOG":
+ self.msg(code_data["type"], event_code, msg, wheres, True)
+ else:
+ self.msg(code_data["type"], event_code, msg, wheres)
+ else:
+ self.byCode("LOG0001X", event_code + " is not exist!")
+
+ def msg(self, type, event_code, msg="", wheres="", serious_error=False):
+ dnow = datetime.datetime.now()
+
+ if serious_error is True:
+ type = "SERIOUS"
+ code_data = loge_codes.getEventCode(event_code)
+ event_state = ""
+ if code_data is not None:
+ if len(code_data["event_state"]) > 0:
+ event_state = code_data["event_state"]
+ msg = event_state+" "+code_data["details"] + " " + msg
+
+ if len(wheres) == 0:
+ wheres = self.whereis()
+
+ """ LOG FILE WRITING """
+ if type not in self.debug_modes[0] and type.upper() != "EVENT":
+ filename = str(dnow.strftime("%d"))+"-"+str(dnow.strftime("%m"))+"-"+str(dnow.year)+".log"
+ directory = '.'+os.path.sep+"logs"+os.path.sep
+ file_path = os.path.join(directory, filename)
+ if not os.path.isdir(directory):
+ os.mkdir(directory)
+ content = "["+type.upper()+"]\t{"+event_code+"}\t"+str(msg)+"\t("+wheres+")\t"+"<"+str(dnow)+">\n"
+ if os.path.exists(file_path):
+ with open(file_path, 'a') as file:
+ file.write(content)
+ file.close()
+ else:
+ f = open(file_path, "w")
+ f.write(content)
+ f.close()
+ """ END LOG FILE WRITING """
+
+ """ LOG DISPLAY """
+ if serious_error is False:
+ if type.upper() == "EVENT" and self.event_on is False:
+ return
+ if type not in self.debug_modes[0] and self.debug_level != 3:
+ if self.debug is True and type not in self.debug_modes[self.debug_level]:
+ return
+ dict = {}
+ dict["type"] = type.upper()
+ dict["event_code"] = str(event_code)
+ dict["msg"] = msg.replace('\\', '\\\\')
+ dict["event_state"] = str(event_state)
+ dict["date"] = str(dnow)
+ base.sights.sendMessage("logs", ["sight-admin"], dict)
+
+ print("["+type.upper()+"]",event_code, str(msg), wheres, "["+str(dnow)+"]", sep='\t')
+ """ END LOG DISPLAY """
+
+ def console(self, msg, wheres = ""):
+ self.msg("console", "", msg, wheres)
+
+ def message(self, msg, wheres = ""):
+ self.msg("message", "", msg, wheres)
\ No newline at end of file
diff --git a/log_event_codes.py b/log_event_codes.py
new file mode 100644
index 0000000..8250370
--- /dev/null
+++ b/log_event_codes.py
@@ -0,0 +1,41 @@
+
+class LogEventCodes():
+ def __init__(self, specify=1):
+ self.code_list = {}
+
+ def addEventCode(self, code, details, event_state=""):
+ self.code_list[code] = {}
+ self.code_list[code]["details"] = details
+ self.code_list[code]["event_state"] = event_state
+ last_letter = code[len(code)-1]
+ type = "info"
+ match last_letter.upper():
+ case 'S': type = "success"
+ case 'F': type = "failed"
+ case 'W': type = "warning"
+ case 'E': type = "event"
+ case 'X': type = "error"
+ case 'A': type = "alert"
+ self.code_list[code]["type"] = type
+
+ def getEventCode(self, code):
+ if code in self.code_list:
+ return self.code_list[code]
+ return None
+
+loge_codes = LogEventCodes()
+
+loge_codes.addEventCode("CFL1000S", "The Config File loaded and the [DEFAULT] datablock is loaded.")
+loge_codes.addEventCode("CFL1000X", "The [DEFAULT] datablock isn't loaded or founded, but the config file loaded.")
+loge_codes.addEventCode("BLC1000S", "The html file content is loaded in the browser")
+loge_codes.addEventCode("BLC1001S", "The admin html file content is loaded in the browser")
+loge_codes.addEventCode("SF1000E", "The sight is being created.","CREATING")
+loge_codes.addEventCode("SF1000W", "The sight is already exist with that ID. It can't be create a new one with that id.s")
+loge_codes.addEventCode("SF1001W", "The sight ID is not exist. It can't be shown!")
+
+#EVENT BASED
+loge_codes.addEventCode("MES1000E", "Mouse dragged the Sight and move to other position.", "MOVING")
+loge_codes.addEventCode("MES1001E", "Mouse pressed on that windows which was in the background and it is become now active.", "PRESSED")
+loge_codes.addEventCode("MES1002E", "Mouse released", "RELEASED")
+loge_codes.addEventCode("MES1003E", "Mouse scrolling down", "SCROLLING_DOWN")
+loge_codes.addEventCode("MES1004E", "Mouse scrolling up", "SCROLLING_UP")
\ No newline at end of file
diff --git a/logs/02-11-2023.log b/logs/02-11-2023.log
new file mode 100644
index 0000000..929b611
--- /dev/null
+++ b/logs/02-11-2023.log
@@ -0,0 +1,2 @@
+[SERIOUS] {LOG0001X} The event code is not exist! SF1001E is not exist! (Log -> byCode) <2023-11-02 15:22:48.165720>
+[WARNING] {SF1001W} The sight ID is not exist. It can't be shown! This 'sight-admin-main' id isn't exist to show! (SightFactory -> show) <2023-11-02 16:34:22.302591>
diff --git a/main.py b/main.py
index 447f60b..9a8b87d 100644
--- a/main.py
+++ b/main.py
@@ -1,2 +1,2 @@
import base
-base.init()
\ No newline at end of file
+base.init()
diff --git a/mouseevents.py b/mouseevents.py
index bb7d3a3..93b7e40 100644
--- a/mouseevents.py
+++ b/mouseevents.py
@@ -1,4 +1,5 @@
import base
+from base import log
from pynput import mouse
class MouseEvents():
@@ -12,7 +13,6 @@ class MouseEvents():
# MOUSE EVENTS/LISTENER
def on_move(x, y):
if base.data["move"]:
- print("MOVING")
if base.data["mouse_distance_x"] == 0:
base.data["mouse_distance_x"] = base.sights.get(base.data["active_sight"]).pos().x()-x
@@ -21,21 +21,21 @@ def on_move(x, y):
x_point = x+base.data["mouse_distance_x"]
y_point = y+base.data["mouse_distance_y"]
-
- print( str(x_point) + " x " + str(y_point))
+
+ log.byCode("MES1000E",str(x_point) + " x " + str(y_point))
base.sights.get(base.data["active_sight"]).move(x_point, y_point)
def on_click(x, y, button, pressed):
if pressed:
- print("pressed on " +base.data["active_sight"])
+ log.byCode("MES1001E", base.data["active_sight"])
else:
- print("released")
+ log.byCode("MES1002E", base.data["active_sight"])
base.data["mouse_distance_x"] = 0
base.data["mouse_distance_y"] = 0
base.data["move"] = False
def on_scroll(x, y, dx, dy):
- print('Scrolled {0} at {1}'.format(
- 'down' if dy < 0 else 'up',
- (x, y)))
-
+ if dy < 0:
+ log.byCode("MES1003E", 'Scrolled {0} at {1}'.format('down',(x, y)))
+ else:
+ log.byCode("MES1004E", 'Scrolled {0} at {1}'.format('up',(x, y)))
diff --git a/place/css/sight.css.bak b/place/css/sight.css.bak
deleted file mode 100644
index 3042a8e..0000000
--- a/place/css/sight.css.bak
+++ /dev/null
@@ -1,34 +0,0 @@
-body {
- background-color: white;
-}
-* {
- cursor: default;
-}
-a {
- cursor: pointer;
-}
-body {
- margin: 0px;
- display: flex;
-}
-#sight #smove, #sight #sresize {
- -webkit-touch-callout: none; /* iOS Safari */
- -webkit-user-select: none; /* Chrome/Safari/Opera */
- -khtml-user-select: none; /* Konqueror */
- -moz-user-select: none; /* Firefox */
- -ms-user-select: none; /* Internet Explorer/Edge */
- user-select: none; /* Non-prefixed version, currently supported by any browser but < IE9 */
-}
-#sight #sresize {
- cursor: nw-resize;
-}
-#sight {
- border: 4px solid grey;
- display: block;
- width: 100%;
-}
-#sight #stitlebar {
- width: 100%;
- height: 25px;
- background-color: grey;
-}
\ No newline at end of file
diff --git a/place/js/sight.js.bak b/place/js/sight.js.bak
deleted file mode 100644
index 3686b66..0000000
--- a/place/js/sight.js.bak
+++ /dev/null
@@ -1,267 +0,0 @@
-if(navigator.userAgent.indexOf("QtWebEngine") > 0) {
- new QWebChannel(qt.webChannelTransport, function (channel) {
- // now I retrieve my object
- window.sight = channel.objects.handler;
- });
-}
-/*
-function docReady(fn) {
- if(document.readyState === "complete" || document.readyState === "interactive") {
- setTimeout(fn, 1);
- } else {
- setTimeout(fn, 2);
- document.addEventListener("DOMContentLoaded", fn);
- }
-}
-
-
- document.querySelectorAll('a').forEach(link => {
- link.onclick = function() { alert("ss"); }
-
- link.addEventListener("click", (e) => {
- e.preventDefault();
- alert("sds");
- });
- });
-
-document.addEventListener('DOMContentLoaded', (event) => {
-
-
- document.querySelectorAll('#screate').forEach(link => {
- alert("1");
- link.addEventListener("click", (e) => {
- alert("sds");
- });
- });
-
-
- const screate = document.getElementById("screate");
- screate.addEventListener("click",myFunc);
-
- document.getElementById("screate").onclick = e => {
- alert("ss")
- }
-});*/
-/*
-document.getElementById("screate").onclick = e => {
- alert("ss")
-}*/
-
-/*const screate = document;*/
-
-(function ( $ ) {
-/* $.fn.s_create = function() {
- $(document).on( "click", "#screate", function() {
- event.preventDefault();
- window.sight.create($(this).data("id"), $(this).data("type"), function(sight_id) {
-
- });
- })
- };*/
- $.fn.s_close = function() {
- $("body").on( "click", "#sclose", function() {
- event.preventDefault();
- window.sight.close();
- })
- };
- $.fn.s_exit = function() {
- this.bind("click.s_exit", function (event) {
- event.preventDefault();
- window.sight.exit();
- });
- };
- $.fn.s_toggled = function() {
- this.bind("click.s_toggled", function (event) {
- event.preventDefault();
- $(this).empty();
- if($(this).attr('state') != "maximized") { // set to the maximized
- window.sight.setMaximized();
- $(this).attr("state", "maximized");
- $(this).prepend('')
- } else { // set to the restore down
- window.sight.restoreDown();
- $(this).attr("state", "restoredown");
- $(this).prepend('')
- }
- });
- };
- $.fn.s_maximized = function() {
- this.bind("click.s_maximized", function (event) {
- if($(this).attr('state') != "maximized") {
- event.preventDefault();
- $("#stoggled").empty();
- window.sight.setMaximized()
- $("#stoggled").prepend('')
- $("#stoggled").attr("state", "maximized");
- }
- });
- };
- $.fn.s_restoredown = function() {
- this.bind("click.s_restoredown", function (event) {
- if($(this).attr('state') != "restoredown") {
- event.preventDefault();
- $("#stoggled").empty();
- window.sight.restoreDown();
- $("#stoggled").attr("state", "restoredown");
- $("#stoggled").prepend('')
- }
- });
- };
- $.fn.s_minimize = function() {
- this.bind("click.s_minimize", function (event) {
- event.preventDefault();
- window.sight.setMinimize();
- });
- };
- $.fn.s_fullscreen = function() {
- this.bind("click.s_fullscreen", function (event) {
- event.preventDefault();
- window.sight.setFullscreen();
- });
- };
- $.fn.s_title = function() {
- $(this).text(window.sight.getTitle());
- };
- $.fn.s_titlebar = function() {
- /* DISABLE TEXT SELECT */
- $( this ).attr('unselectable', 'on').css('user-select', 'none').on('selectstart dragstart', false);
- $( this ).mousedown(function() {
- /*$( "body" ).attr('unselectable', 'on').css('user-select', 'none').on('selectstart dragstart', false);*/
- if($(this).children("#stoggled").attr('state') == "restoredown")
- window.sight.move();
- })
- .mouseup(function() {
- /*$( "body" ).attr('unselectable', 'off').css('user-select', 'yes').on('selectstart dragstart', true);*/
- window.sight.endmove();
- });
-
- };
- $.fn.s_global_add = function() {
- this.bind("click.s_global_add", function (event) {
- event.preventDefault();
- //window.sight.global($(this));
- });
- };
- $(document).mousemove(function(e){
- if(resizing)
- window.sight.resize();
- });
- $(document).mouseup(function(e){
- resizing = false
- });
- $(document).mousedown(function(e){
- window.sight.activeSight();
- });
- var resizing = false;
- $.fn.s_resize = function() {
- $(this).mousemove(function(e){
- event.preventDefault();
- if(e.buttons==1)
- resizing = true
- });
- };
-}( jQuery ));
-function addData(key, value, is_global = false) {
- window.sight.addData(key,value, is_global);
-}
-function getData(key, is_global = false) {
- window.sight.getData(key, is_global, function(result) {
- alert(result)
- });
-}
-function sclose() {
- window.sight.close();
-}
-function setTitle(title) {
- $("#stitle").text(title);
-}
-
-$(document).ready(function(){
- // LOAD the contents into the Sight
- if (typeof s_contents !== 'undefined') {
- for ( const [id_name,content_folder] of Object.entries( s_contents ) ) {
- /*$("#"+id_name).load("content/"+content_folder+"/content.html");*/
- $("#"+id_name).load("content/"+content_folder+"/content.html", function() {
- document.querySelectorAll('#screate').forEach(link => {
- link.addEventListener("click", (e) => {
- e.preventDefault();
- window.sight.create(e.target.dataset.id, e.target.dataset.type, function(sight_id) {
-
- });
- });
- });
- });
-
- }
- }
-
-
-
-
- // INIT the Sight from init_sight variable
- if (typeof init_sight !== 'undefined') {
-
- for ( const [key,value] of Object.entries( init_sight ) ) {
- window.sight.test(key + " - " + value)
- switch(key) {
- case 'width':
- window.sight.setWidth(value)
- break;
- case 'height':
- window.sight.setHeight(value)
- break;
- }
- }
- }
- // INIT
- /*window.sight.getDefaultTemplate(function(default_template) {
- $('a[href]:not([href^="http://"]), a[href]:not([href^="https://"]), a[href]:not([href^="#"])').each(function(){
- if(!$(this).hasClass( "nav-link" )) {
- window.sight.test($(this).attr("href") + " je1");
- var newUrl = './templates/'+default_template+'/'+$(this).attr("href");
- $(this).attr("href", newUrl);
- window.sight.test(newUrl + " je2");
- }
- });
- });*/
-
- if($("#stoggled").length) {
- var attr = $("#stoggled").attr("state")
- if (typeof attr !== 'undefined' && attr !== false && (attr == "restoredown" || attr == "maximized")) {
-
- png_button = "restoredown"
- if(attr == "restoredown")
- png_button = "maximized"
- $("#stoggled").prepend('');
-
- if(attr == "maximized")
- window.sight.setMaximized();
- } else {
- $("#stoggled").attr("state", "restoredown");
- $("#stoggled").prepend('');
- }
- }
- if($("#sclose").length) {
- $("#sclose:not([except])").empty();
- $("#sclose:not([except])").prepend('');
- }
- if($("#sminimize").length) {
- $("#sminimize").empty();
- $("#sminimize").prepend('');
- }
- /*window.sight.getTitle(function(result) {
- setTitle(result);
- });*/
- // INIT END
-
- /*$( "#screate" ).s_create();*/
- $( "#sclose" ).s_close();
- $( "#sexit" ).s_exit();
- $( "#smaximized" ).s_maximized();
- $( "#sminimize" ).s_minimize();
- $( "#sresize" ).s_resize();
- $( "#srestoredown" ).s_restoredown();
- $( "#sfullscreen" ).s_fullscreen();
- $( "#stitlebar" ).s_titlebar();
- $( "#stoggled" ).s_toggled();
-});
\ No newline at end of file
diff --git a/place/js/xtr-translator/demo/index.html b/place/js/xtr-translator/demo/index.html
deleted file mode 100644
index db1e695..0000000
--- a/place/js/xtr-translator/demo/index.html
+++ /dev/null
@@ -1,82 +0,0 @@
-
-
-
-
-
-
-
-
-jQuery xtr.js plugin Demo
-
-
-
-