]> Softwares of Agnibho - medscript.git/commitdiff
Prescription not passed to webapp
authorAgnibho Mondal <mondal@agnibho.com>
Mon, 13 Nov 2023 21:02:14 +0000 (02:32 +0530)
committerAgnibho Mondal <mondal@agnibho.com>
Mon, 13 Nov 2023 21:02:14 +0000 (02:32 +0530)
README
plugin.py

diff --git a/README b/README
index 2968a30bec291eba68f222534f0bfe49e3819987..51b6b744f8e8d2d20be5906db3a74e986728c459 100644 (file)
--- a/README
+++ b/README
@@ -427,17 +427,16 @@ An example plugin, that modifies the name of the patient, may be as follows:
 Plugins may also contain a web app written in HTML/JavaScript. To use it the
 plugin must contain a function called `web` which takes the prescription object
 and returns a tuple containing the URL of the web app and a json string
-containing any data to be passed on to the web app. The `run` function of such a plugin must
-take two arguments, the prescription and the data returned from the web app.
+containing any data to be passed on to the web app. The `run` function of such
+a plugin must take two arguments, the prescription and the data returned from
+the web app.
 
 The web app itself must include the `qtwebchannel.js` from PyQt6
 (qrc:///qtwebchannel/qwebchannel.js). The webchannel exposes an object named
-`js` to the web app. The web app may access the prescription by using the
-`js.getPrescription()` and the data from the plugin by using the `js.getData()`
-function. The webapp may return data to the plugin by calling the `run`
-function of the exposed `js` object with two arguments, first being a json
-string containing the prescription object and the second being any data as
-string to be passed onto the plugin.
+`js` to the web app. The web app may access the data from the plugin by using
+the `js.get()` function. The web app may return data to the plugin by calling
+the `run` function of the exposed `js` object with the return data as the
+argument.
 
 Template Development
 --------------------
index 8381f57b80a3d86768733ba875e6692cd1281e8c..0238cf8147113e5c1b969d886ff8d3511e3e4e0b 100644 (file)
--- a/plugin.py
+++ b/plugin.py
@@ -180,9 +180,8 @@ class JS(QObject):
         self.prescription=prescription
         self.data=data
 
-    @pyqtSlot(str, str)
-    def run(self, prescription, result):
-        self.prescription.set_data_from_json(json.loads(prescription))
+    @pyqtSlot(str)
+    def run(self, result):
         try:
             message=self.module.run(self.prescription, result)
             if(message):
@@ -193,11 +192,7 @@ class JS(QObject):
             logging.exception(e)
 
     @pyqtSlot(result=str)
-    def getPrescription(self):
-        return self.prescription.get_json()
-
-    @pyqtSlot(result=str)
-    def getData(self):
+    def get(self):
         return self.data
 
 class Worker(QThread):