Each function mentioned above may return a string which will be displayed to
the user by the program.
+Plugins may get input from the user by implementing one or more of the
+following functions:
+
+ def input(string text)
+ Get text input from the user.
+ def fileopen(string path)
+ Get file to open. Only called before "run" function.
+ def filesave(string path)
+ Get file to save. Only called before "run" function.
+
The plugin may implement one or more functions mentioned above, it is not
necessary to implement all.
# You should have received a copy of the GNU General Public License along with MedScript. If not, see <https://www.gnu.org/licenses/>.
import os, importlib
-from PyQt6.QtWidgets import QMessageBox, QInputDialog
+from PyQt6.QtWidgets import QMessageBox, QInputDialog, QFileDialog
from glob import glob
from config import config
if(hasattr(module, "run") and callable(module.run)):
if(hasattr(module, "input") and callable(module.input)):
module.input(self.input())
+ if(hasattr(module, "fileopen") and callable(module.fileopen)):
+ module.fileopen(QFileDialog.getOpenFileName()[0])
+ if(hasattr(module, "filesave") and callable(module.filesave)):
+ module.filesave(QFileDialog.getSaveFileName()[0])
msg=module.run(prescription)
if(msg):
QMessageBox.information(None, "Information", msg)