| 
									
										
										
										
											2023-05-17 10:16:15 +00:00
										 |  |  | import base | 
					
						
							| 
									
										
										
										
											2023-11-02 19:17:25 +00:00
										 |  |  | from base import * | 
					
						
							| 
									
										
										
										
											2023-05-17 10:16:15 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | from PyQt6.QtWebChannel import QWebChannel | 
					
						
							|  |  |  | from PyQt6.QtWebEngineWidgets import QWebEngineView | 
					
						
							|  |  |  | from PyQt6.QtCore import QUrl | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class Browser(QWebEngineView): | 
					
						
							|  |  |  |     def __init__(self): | 
					
						
							|  |  |  |         super().__init__() | 
					
						
							|  |  |  |         self.channel = QWebChannel() | 
					
						
							|  |  |  |      | 
					
						
							|  |  |  |     def addObject(self, id, call_handler): | 
					
						
							|  |  |  |         self.handler = call_handler | 
					
						
							|  |  |  |         self.channel.registerObject(id, self.handler) | 
					
						
							|  |  |  |         self.page().setWebChannel(self.channel) | 
					
						
							|  |  |  |     | 
					
						
							| 
									
										
										
										
											2023-10-27 13:14:49 +00:00
										 |  |  |     def loadContent(self, page): | 
					
						
							| 
									
										
										
										
											2023-10-31 07:20:44 +00:00
										 |  |  |         self.load(QUrl.fromLocalFile(base.data["default_template_dir"]+page+".html")) | 
					
						
							| 
									
										
										
										
											2023-11-02 19:17:25 +00:00
										 |  |  |         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") |