summaryrefslogtreecommitdiff
path: root/src/main/python/utils/app.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/python/utils/app.py')
-rw-r--r--src/main/python/utils/app.py21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/main/python/utils/app.py b/src/main/python/utils/app.py
index 96a45b0..39c3674 100644
--- a/src/main/python/utils/app.py
+++ b/src/main/python/utils/app.py
@@ -1,14 +1,16 @@
"""
-Declare fbs application so that it can be imported in other modules.
+Declare fbs application and various contextual variables so that it can be imported in other modules.
"""
from fbs_runtime.application_context.PyQt5 import ApplicationContext
-from PyQt5.QtCore import QSettings, pyqtProperty
+from PyQt5.QtCore import QSettings, pyqtProperty, QResource
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import QWidget
from json import JSONEncoder, dumps, loads, dump, load
from os.path import join
+from resources import resources #application resources defined in resources.qrc
+
app = ApplicationContext()
settings = QSettings(QSettings.IniFormat, QSettings.UserScope ,"FOSSEE", "Chemical-PFD")
version = app.build_settings['version']
@@ -17,11 +19,14 @@ def fileImporter(*file):
# Helper function to fetch files from src/main/resources
return app.get_resource(join(*file))
+#set application stylesheet
with open(fileImporter("app.qss"), "r") as stylesheet:
app.app.setStyleSheet(stylesheet.read())
class JSON_Encoder:
-
+ """
+ Defines serialization methods for differnt data types for json module
+ """
def _encode(obj):
if isinstance(obj, dict):
## We'll need to iterate not just the value that default() usually gets passed
@@ -48,7 +53,9 @@ class JSON_Encoder:
return obj
class JSON_Typer(JSONEncoder):
-
+ """
+ derived class for redirecting encode calls
+ """
def default(self, o):
return o.__getstate__()
@@ -58,8 +65,4 @@ class JSON_Typer(JSONEncoder):
def encode(self, obj):
return super(JSON_Typer, self).encode(self._encode(obj))
-
-importer = pyqtProperty(str, fileImporter)
-
-shapeGrips = {}
-lines = {} \ No newline at end of file
+memMap = {} #memory map for id references for loading projects \ No newline at end of file