Added webkit ui class with browser to python calling logic
This commit is contained in:
@@ -13,6 +13,7 @@ from os import mkdir
|
||||
# Application imports
|
||||
from ..singleton import Singleton
|
||||
from .start_check_mixin import StartCheckMixin
|
||||
from .markdown_template_mixin import MarkdownTemplateMixin
|
||||
from .options.settings import Settings
|
||||
|
||||
|
||||
@@ -22,7 +23,7 @@ class MissingConfigError(Exception):
|
||||
|
||||
|
||||
|
||||
class SettingsManager(StartCheckMixin, Singleton):
|
||||
class SettingsManager(StartCheckMixin, MarkdownTemplateMixin, Singleton):
|
||||
def __init__(self):
|
||||
self._SCRIPT_PTH = path.dirname(path.realpath(__file__))
|
||||
self._USER_HOME = path.expanduser('~')
|
||||
@@ -30,6 +31,7 @@ class SettingsManager(StartCheckMixin, Singleton):
|
||||
self._USR_PATH = f"/usr/share/{app_name.lower()}"
|
||||
self._USR_CONFIG_FILE = f"{self._USR_PATH}/settings.json"
|
||||
|
||||
self._CONTEXT_PATH = f"{self._HOME_CONFIG_PATH}/context_path"
|
||||
self._PLUGINS_PATH = f"{self._HOME_CONFIG_PATH}/plugins"
|
||||
self._DEFAULT_ICONS = f"{self._HOME_CONFIG_PATH}/icons"
|
||||
self._CONFIG_FILE = f"{self._HOME_CONFIG_PATH}/settings.json"
|
||||
@@ -146,6 +148,7 @@ class SettingsManager(StartCheckMixin, Singleton):
|
||||
def get_ui_widgets_path(self) -> str: return self._UI_WIDEGTS_PATH
|
||||
def get_context_menu_data(self) -> str: return self._context_menu_data
|
||||
|
||||
def get_context_path(self) -> str: return self._CONTEXT_PATH
|
||||
def get_plugins_path(self) -> str: return self._PLUGINS_PATH
|
||||
def get_icon_theme(self) -> str: return self._ICON_THEME
|
||||
def get_css_file(self) -> str: return self._CSS_FILE
|
||||
|
60
src/utils/settings_manager/markdown_template_mixin.py
Normal file
60
src/utils/settings_manager/markdown_template_mixin.py
Normal file
@@ -0,0 +1,60 @@
|
||||
# Python imports
|
||||
|
||||
# Lib imports
|
||||
|
||||
# Application imports
|
||||
|
||||
|
||||
|
||||
class MarkdownTemplateMixin:
|
||||
def wrap_html_to_body(self, html):
|
||||
return f"""\
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" dir="ltr">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Markdown View</title>
|
||||
<style media="screen">
|
||||
html, body {{
|
||||
display: block;
|
||||
background-color: #32383e00;
|
||||
color: #ffffff;
|
||||
text-wrap: wrap;
|
||||
}}
|
||||
|
||||
img {{
|
||||
width: 100%;
|
||||
height: auto;
|
||||
}}
|
||||
|
||||
code {{
|
||||
border: 1px solid #32383e;
|
||||
background-color: #32383e;
|
||||
padding: 4px;
|
||||
}}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
{html}
|
||||
<span>Button in WebView
|
||||
<button onclick="say_hello()">Button in WebView</button>
|
||||
</span>
|
||||
|
||||
|
||||
<!-- For internal scripts... -->
|
||||
<script src="js/libs/jquery-3.7.1.min.js"></script>
|
||||
|
||||
<!-- For Bootstrap... -->
|
||||
<script src="resources/js/libs/bootstrap5/bootstrap.bundle.min.js"></script>
|
||||
|
||||
<!-- For Application... -->
|
||||
<script src="resources/js/ui-logic.js"></script>
|
||||
<script src="resources/js/post-ajax.js"></script>
|
||||
<script src="resources/js/ajax.js"></script>
|
||||
<script src="resources/js/events.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
"""
|
Reference in New Issue
Block a user