Skip to content
Snippets Groups Projects
Commit 7bc1305b authored by Boman Romain's avatar Boman Romain
Browse files

improve GUI

parent e6bdff9e
No related branches found
No related tags found
No related merge requests found
Pipeline #7112 passed
...@@ -27,6 +27,9 @@ class Window(QWidget, Ui_Form): ...@@ -27,6 +27,9 @@ class Window(QWidget, Ui_Form):
self.runPushButton.setIcon(QIcon(':/media-seek-forward.png')) self.runPushButton.setIcon(QIcon(':/media-seek-forward.png'))
self.viewPushButton.setIcon(QIcon(':/video-display.png')) self.viewPushButton.setIcon(QIcon(':/video-display.png'))
self.inpFileResetPushButton.setIcon(QIcon(':/edit-undo.png'))
self.wrkspResetPushButton.setIcon(QIcon(':/edit-undo.png'))
# read Qt settings for the application # read Qt settings for the application
settings = QSettings() settings = QSettings()
# self.restoreGeometry(settings.value("Geometry", self.saveGeometry())) # self.restoreGeometry(settings.value("Geometry", self.saveGeometry()))
...@@ -40,6 +43,12 @@ class Window(QWidget, Ui_Form): ...@@ -40,6 +43,12 @@ class Window(QWidget, Ui_Form):
def on_runPushButton_pressed(self): def on_runPushButton_pressed(self):
# print("runPushButton...") # print("runPushButton...")
if not os.path.isfile(self.inpFileLineEdit.text()):
QMessageBox.critical(self, "Error", "Input file does not exist!")
return
if not os.path.isdir(self.wrkspLineEdit.text()):
QMessageBox.critical(self, "Error", "Workspace does not exist!")
return
self.action = 'run' self.action = 'run'
self.close() self.close()
...@@ -49,13 +58,21 @@ class Window(QWidget, Ui_Form): ...@@ -49,13 +58,21 @@ class Window(QWidget, Ui_Form):
self.close() self.close()
def on_inpFilePushButton_pressed(self): def on_inpFilePushButton_pressed(self):
# print("inpFilePushButton...") # try to set a relevant starting folder
default = os.path.join(os.path.dirname(__file__), 'models')
curfile = self.inpFileLineEdit.text()
if curfile:
curfolder = os.path.dirname(curfile)
if os.path.isdir(curfolder):
default = curfolder
fname = QFileDialog.getOpenFileName( fname = QFileDialog.getOpenFileName(
None, 'Select input file', '', filter='Python File (*.py)') self, 'Select input file', default, filter='Python File (*.py)')
pyfile = fname[0] pyfile = fname[0]
if pyfile: if pyfile:
self.inpFileLineEdit.setText(QDir.toNativeSeparators(pyfile)) self.inpFileLineEdit.setText(QDir.toNativeSeparators(pyfile))
def on_inpFileEditPushButton_pressed(self): def on_inpFileEditPushButton_pressed(self):
"""Open input file with a text editor """Open input file with a text editor
""" """
...@@ -69,6 +86,9 @@ class Window(QWidget, Ui_Form): ...@@ -69,6 +86,9 @@ class Window(QWidget, Ui_Form):
subprocess.Popen([ editor, self.inpFileLineEdit.text() ]) subprocess.Popen([ editor, self.inpFileLineEdit.text() ])
break break
def on_inpFileResetPushButton_pressed(self):
self.inpFileLineEdit.setText("")
def on_wrkspExplorePushButton_pressed(self): def on_wrkspExplorePushButton_pressed(self):
"""Browse workspace folder with system explorer """Browse workspace folder with system explorer
""" """
...@@ -80,6 +100,10 @@ class Window(QWidget, Ui_Form): ...@@ -80,6 +100,10 @@ class Window(QWidget, Ui_Form):
if dir: if dir:
self.wrkspLineEdit.setText(QDir.toNativeSeparators(dir)) self.wrkspLineEdit.setText(QDir.toNativeSeparators(dir))
def on_wrkspResetPushButton_pressed(self):
self.wrkspLineEdit.setText("")
def closeEvent(self, event): def closeEvent(self, event):
"""save settings to registry and quit """save settings to registry and quit
""" """
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>708</width> <width>745</width>
<height>154</height> <height>154</height>
</rect> </rect>
</property> </property>
...@@ -18,6 +18,12 @@ ...@@ -18,6 +18,12 @@
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="inpFilelabel"> <widget class="QLabel" name="inpFilelabel">
<property name="toolTip">
<string>name of the python file</string>
</property>
<property name="statusTip">
<string/>
</property>
<property name="text"> <property name="text">
<string>input file</string> <string>input file</string>
</property> </property>
...@@ -28,6 +34,12 @@ ...@@ -28,6 +34,12 @@
</item> </item>
<item row="0" column="2"> <item row="0" column="2">
<widget class="QToolButton" name="inpFilePushButton"> <widget class="QToolButton" name="inpFilePushButton">
<property name="toolTip">
<string>select a python file</string>
</property>
<property name="whatsThis">
<string/>
</property>
<property name="text"> <property name="text">
<string>...</string> <string>...</string>
</property> </property>
...@@ -35,13 +47,38 @@ ...@@ -35,13 +47,38 @@
</item> </item>
<item row="0" column="3"> <item row="0" column="3">
<widget class="QToolButton" name="inpFileEditPushButton"> <widget class="QToolButton" name="inpFileEditPushButton">
<property name="toolTip">
<string>open a text editor</string>
</property>
<property name="whatsThis">
<string/>
</property>
<property name="text"> <property name="text">
<string>Edit</string> <string>Edit</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="4">
<widget class="QToolButton" name="inpFileResetPushButton">
<property name="toolTip">
<string>reset to default</string>
</property>
<property name="whatsThis">
<string/>
</property>
<property name="text">
<string>Reset</string>
</property>
</widget>
</item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QLabel" name="wrksplabel"> <widget class="QLabel" name="wrksplabel">
<property name="toolTip">
<string>folder where the results are stored</string>
</property>
<property name="statusTip">
<string/>
</property>
<property name="text"> <property name="text">
<string>workspace</string> <string>workspace</string>
</property> </property>
...@@ -52,6 +89,12 @@ ...@@ -52,6 +89,12 @@
</item> </item>
<item row="1" column="2"> <item row="1" column="2">
<widget class="QToolButton" name="wrkspPushButton"> <widget class="QToolButton" name="wrkspPushButton">
<property name="toolTip">
<string>select a folder</string>
</property>
<property name="whatsThis">
<string/>
</property>
<property name="text"> <property name="text">
<string>...</string> <string>...</string>
</property> </property>
...@@ -59,11 +102,30 @@ ...@@ -59,11 +102,30 @@
</item> </item>
<item row="1" column="3"> <item row="1" column="3">
<widget class="QToolButton" name="wrkspExplorePushButton"> <widget class="QToolButton" name="wrkspExplorePushButton">
<property name="toolTip">
<string>open the folder in the explorer</string>
</property>
<property name="whatsThis">
<string/>
</property>
<property name="text"> <property name="text">
<string>Explore</string> <string>Explore</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="4">
<widget class="QToolButton" name="wrkspResetPushButton">
<property name="toolTip">
<string>reset to default</string>
</property>
<property name="whatsThis">
<string/>
</property>
<property name="text">
<string>Reset</string>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
<item> <item>
...@@ -83,6 +145,12 @@ ...@@ -83,6 +145,12 @@
</item> </item>
<item> <item>
<widget class="QPushButton" name="runPushButton"> <widget class="QPushButton" name="runPushButton">
<property name="toolTip">
<string>start the simulation!</string>
</property>
<property name="statusTip">
<string/>
</property>
<property name="text"> <property name="text">
<string>Run</string> <string>Run</string>
</property> </property>
...@@ -90,6 +158,12 @@ ...@@ -90,6 +158,12 @@
</item> </item>
<item> <item>
<widget class="QPushButton" name="viewPushButton"> <widget class="QPushButton" name="viewPushButton">
<property name="toolTip">
<string>read/display the results stored in the folder of the workspace</string>
</property>
<property name="statusTip">
<string/>
</property>
<property name="text"> <property name="text">
<string>View</string> <string>View</string>
</property> </property>
......
pics/edit-undo.png

1.56 KiB

This diff is collapsed.
...@@ -5,5 +5,6 @@ ...@@ -5,5 +5,6 @@
<file alias="document-open.png">pics/document-open.png</file> <file alias="document-open.png">pics/document-open.png</file>
<file alias="video-display.png">pics/video-display.png</file> <file alias="video-display.png">pics/video-display.png</file>
<file alias="media-seek-forward.png">pics/media-seek-forward.png</file> <file alias="media-seek-forward.png">pics/media-seek-forward.png</file>
<file alias="edit-undo.png">pics/edit-undo.png</file>
</qresource> </qresource>
</RCC> </RCC>
\ No newline at end of file
...@@ -14,44 +14,60 @@ from PyQt5 import QtCore, QtGui, QtWidgets ...@@ -14,44 +14,60 @@ from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Form(object): class Ui_Form(object):
def setupUi(self, Form): def setupUi(self, Form):
Form.setObjectName("Form") Form.setObjectName("Form")
Form.resize(708, 154) Form.resize(745, 154)
self.verticalLayout = QtWidgets.QVBoxLayout(Form) self.verticalLayout = QtWidgets.QVBoxLayout(Form)
self.verticalLayout.setObjectName("verticalLayout") self.verticalLayout.setObjectName("verticalLayout")
self.gridLayout = QtWidgets.QGridLayout() self.gridLayout = QtWidgets.QGridLayout()
self.gridLayout.setObjectName("gridLayout") self.gridLayout.setObjectName("gridLayout")
self.inpFilelabel = QtWidgets.QLabel(Form) self.inpFilelabel = QtWidgets.QLabel(Form)
self.inpFilelabel.setStatusTip("")
self.inpFilelabel.setObjectName("inpFilelabel") self.inpFilelabel.setObjectName("inpFilelabel")
self.gridLayout.addWidget(self.inpFilelabel, 0, 0, 1, 1) self.gridLayout.addWidget(self.inpFilelabel, 0, 0, 1, 1)
self.inpFileLineEdit = QtWidgets.QLineEdit(Form) self.inpFileLineEdit = QtWidgets.QLineEdit(Form)
self.inpFileLineEdit.setObjectName("inpFileLineEdit") self.inpFileLineEdit.setObjectName("inpFileLineEdit")
self.gridLayout.addWidget(self.inpFileLineEdit, 0, 1, 1, 1) self.gridLayout.addWidget(self.inpFileLineEdit, 0, 1, 1, 1)
self.inpFilePushButton = QtWidgets.QToolButton(Form) self.inpFilePushButton = QtWidgets.QToolButton(Form)
self.inpFilePushButton.setWhatsThis("")
self.inpFilePushButton.setObjectName("inpFilePushButton") self.inpFilePushButton.setObjectName("inpFilePushButton")
self.gridLayout.addWidget(self.inpFilePushButton, 0, 2, 1, 1) self.gridLayout.addWidget(self.inpFilePushButton, 0, 2, 1, 1)
self.inpFileEditPushButton = QtWidgets.QToolButton(Form) self.inpFileEditPushButton = QtWidgets.QToolButton(Form)
self.inpFileEditPushButton.setWhatsThis("")
self.inpFileEditPushButton.setObjectName("inpFileEditPushButton") self.inpFileEditPushButton.setObjectName("inpFileEditPushButton")
self.gridLayout.addWidget(self.inpFileEditPushButton, 0, 3, 1, 1) self.gridLayout.addWidget(self.inpFileEditPushButton, 0, 3, 1, 1)
self.inpFileResetPushButton = QtWidgets.QToolButton(Form)
self.inpFileResetPushButton.setWhatsThis("")
self.inpFileResetPushButton.setObjectName("inpFileResetPushButton")
self.gridLayout.addWidget(self.inpFileResetPushButton, 0, 4, 1, 1)
self.wrksplabel = QtWidgets.QLabel(Form) self.wrksplabel = QtWidgets.QLabel(Form)
self.wrksplabel.setStatusTip("")
self.wrksplabel.setObjectName("wrksplabel") self.wrksplabel.setObjectName("wrksplabel")
self.gridLayout.addWidget(self.wrksplabel, 1, 0, 1, 1) self.gridLayout.addWidget(self.wrksplabel, 1, 0, 1, 1)
self.wrkspLineEdit = QtWidgets.QLineEdit(Form) self.wrkspLineEdit = QtWidgets.QLineEdit(Form)
self.wrkspLineEdit.setObjectName("wrkspLineEdit") self.wrkspLineEdit.setObjectName("wrkspLineEdit")
self.gridLayout.addWidget(self.wrkspLineEdit, 1, 1, 1, 1) self.gridLayout.addWidget(self.wrkspLineEdit, 1, 1, 1, 1)
self.wrkspPushButton = QtWidgets.QToolButton(Form) self.wrkspPushButton = QtWidgets.QToolButton(Form)
self.wrkspPushButton.setWhatsThis("")
self.wrkspPushButton.setObjectName("wrkspPushButton") self.wrkspPushButton.setObjectName("wrkspPushButton")
self.gridLayout.addWidget(self.wrkspPushButton, 1, 2, 1, 1) self.gridLayout.addWidget(self.wrkspPushButton, 1, 2, 1, 1)
self.wrkspExplorePushButton = QtWidgets.QToolButton(Form) self.wrkspExplorePushButton = QtWidgets.QToolButton(Form)
self.wrkspExplorePushButton.setWhatsThis("")
self.wrkspExplorePushButton.setObjectName("wrkspExplorePushButton") self.wrkspExplorePushButton.setObjectName("wrkspExplorePushButton")
self.gridLayout.addWidget(self.wrkspExplorePushButton, 1, 3, 1, 1) self.gridLayout.addWidget(self.wrkspExplorePushButton, 1, 3, 1, 1)
self.wrkspResetPushButton = QtWidgets.QToolButton(Form)
self.wrkspResetPushButton.setWhatsThis("")
self.wrkspResetPushButton.setObjectName("wrkspResetPushButton")
self.gridLayout.addWidget(self.wrkspResetPushButton, 1, 4, 1, 1)
self.verticalLayout.addLayout(self.gridLayout) self.verticalLayout.addLayout(self.gridLayout)
self.horizontalLayout_2 = QtWidgets.QHBoxLayout() self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.horizontalLayout_2.setObjectName("horizontalLayout_2")
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_2.addItem(spacerItem) self.horizontalLayout_2.addItem(spacerItem)
self.runPushButton = QtWidgets.QPushButton(Form) self.runPushButton = QtWidgets.QPushButton(Form)
self.runPushButton.setStatusTip("")
self.runPushButton.setObjectName("runPushButton") self.runPushButton.setObjectName("runPushButton")
self.horizontalLayout_2.addWidget(self.runPushButton) self.horizontalLayout_2.addWidget(self.runPushButton)
self.viewPushButton = QtWidgets.QPushButton(Form) self.viewPushButton = QtWidgets.QPushButton(Form)
self.viewPushButton.setStatusTip("")
self.viewPushButton.setObjectName("viewPushButton") self.viewPushButton.setObjectName("viewPushButton")
self.horizontalLayout_2.addWidget(self.viewPushButton) self.horizontalLayout_2.addWidget(self.viewPushButton)
spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
...@@ -64,11 +80,23 @@ class Ui_Form(object): ...@@ -64,11 +80,23 @@ class Ui_Form(object):
def retranslateUi(self, Form): def retranslateUi(self, Form):
_translate = QtCore.QCoreApplication.translate _translate = QtCore.QCoreApplication.translate
Form.setWindowTitle(_translate("Form", "Form")) Form.setWindowTitle(_translate("Form", "Form"))
self.inpFilelabel.setToolTip(_translate("Form", "name of the python file"))
self.inpFilelabel.setText(_translate("Form", "input file")) self.inpFilelabel.setText(_translate("Form", "input file"))
self.inpFilePushButton.setToolTip(_translate("Form", "select a python file"))
self.inpFilePushButton.setText(_translate("Form", "...")) self.inpFilePushButton.setText(_translate("Form", "..."))
self.inpFileEditPushButton.setToolTip(_translate("Form", "open a text editor"))
self.inpFileEditPushButton.setText(_translate("Form", "Edit")) self.inpFileEditPushButton.setText(_translate("Form", "Edit"))
self.inpFileResetPushButton.setToolTip(_translate("Form", "reset to default"))
self.inpFileResetPushButton.setText(_translate("Form", "Reset"))
self.wrksplabel.setToolTip(_translate("Form", "folder where the results are stored"))
self.wrksplabel.setText(_translate("Form", "workspace")) self.wrksplabel.setText(_translate("Form", "workspace"))
self.wrkspPushButton.setToolTip(_translate("Form", "select a folder"))
self.wrkspPushButton.setText(_translate("Form", "...")) self.wrkspPushButton.setText(_translate("Form", "..."))
self.wrkspExplorePushButton.setToolTip(_translate("Form", "open the folder in the explorer"))
self.wrkspExplorePushButton.setText(_translate("Form", "Explore")) self.wrkspExplorePushButton.setText(_translate("Form", "Explore"))
self.wrkspResetPushButton.setToolTip(_translate("Form", "reset to default"))
self.wrkspResetPushButton.setText(_translate("Form", "Reset"))
self.runPushButton.setToolTip(_translate("Form", "start the simulation!"))
self.runPushButton.setText(_translate("Form", "Run")) self.runPushButton.setText(_translate("Form", "Run"))
self.viewPushButton.setToolTip(_translate("Form", "read/display the results stored in the folder of the workspace"))
self.viewPushButton.setText(_translate("Form", "View")) self.viewPushButton.setText(_translate("Form", "View"))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment