summaryrefslogtreecommitdiff
path: root/src/ngspicetoModelica/ModelicaUI.py
diff options
context:
space:
mode:
authorEyantra698Sumanto2022-01-11 15:30:23 +0530
committerEyantra698Sumanto2022-01-25 19:10:05 +0530
commitc19d2338775920f02dc86c2463879517d6c95825 (patch)
tree21a5f6bf7d38ee598f6df097be88bce8d3e9de02 /src/ngspicetoModelica/ModelicaUI.py
parent840090d0eedac3c60026269f50f9bb8365e4801b (diff)
downloadeSim-c19d2338775920f02dc86c2463879517d6c95825.tar.gz
eSim-c19d2338775920f02dc86c2463879517d6c95825.tar.bz2
eSim-c19d2338775920f02dc86c2463879517d6c95825.zip
Adding search option for OpenModelica
Diffstat (limited to 'src/ngspicetoModelica/ModelicaUI.py')
-rwxr-xr-x[-rw-r--r--]src/ngspicetoModelica/ModelicaUI.py31
1 files changed, 26 insertions, 5 deletions
diff --git a/src/ngspicetoModelica/ModelicaUI.py b/src/ngspicetoModelica/ModelicaUI.py
index 6cd736b7..ecf15bd2 100644..100755
--- a/src/ngspicetoModelica/ModelicaUI.py
+++ b/src/ngspicetoModelica/ModelicaUI.py
@@ -28,7 +28,7 @@ class OpenModelicaEditor(QtWidgets.QWidget):
self.FileEdit.setText(self.ngspiceNetlist)
self.grid.addWidget(self.FileEdit, 0, 0)
- self.browsebtn = QtWidgets.QPushButton("Browse")
+ self.browsebtn = QtWidgets.QPushButton("Browse .cir.out")
self.browsebtn.clicked.connect(self.browseFile)
self.grid.addWidget(self.browsebtn, 0, 1)
@@ -40,10 +40,30 @@ class OpenModelicaEditor(QtWidgets.QWidget):
self.loadOMbtn.clicked.connect(self.callOMEdit)
self.grid.addWidget(self.loadOMbtn, 3, 1)
+
+ self.OMPathtext = QtWidgets.QLineEdit()
+ self.OMPathtext.setText("")
+ self.grid.addWidget(self.OMPathtext, 4, 0)
+
+ self.OMPathbrowsebtn = QtWidgets.QPushButton("Browse OM")
+ self.OMPathbrowsebtn.clicked.connect(self.OMPathbrowseFile)
+ self.grid.addWidget(self.OMPathbrowsebtn, 4, 1)
+
# self.setGeometry(300, 300, 350, 300)
self.setLayout(self.grid)
self.show()
+ def OMPathbrowseFile(self):
+ temp = QtCore.QDir.toNativeSeparators(
+ QtWidgets.QFileDialog.getExistingDirectory(
+ self, "Open Open Modelica Directory", "home"
+ )
+ )
+
+ if temp:
+ self.OMPath = temp
+ self.OMPathtext.setText(self.OMPath)
+
def browseFile(self):
temp = QtCore.QDir.toNativeSeparators(
QtWidgets.QFileDialog.getOpenFileName(
@@ -215,17 +235,18 @@ class OpenModelicaEditor(QtWidgets.QWidget):
)
def callOMEdit(self):
-
- if self.obj_validation.validateTool("OMEdit"):
+
+ try:
modelFiles = glob.glob(self.modelicaNetlist)
modelFiles = ' '.join(file for file in modelFiles)
- self.cmd2 = "OMEdit " + modelFiles
+ self.cmd2 = self.OMPath+"/OMEdit " + modelFiles
+ print(self.cmd2)
self.obj_workThread2 = Worker.WorkerThread(self.cmd2)
self.obj_workThread2.start()
print("OMEdit called")
self.obj_appconfig.print_info("OMEdit called")
- else:
+ except BaseException:
self.msg = QtWidgets.QMessageBox()
self.msgContent = (
"There was an error while opening OMEdit.<br/>"