Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
fossils
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Boman Romain
fossils
Commits
60220c3f
Commit
60220c3f
authored
2 years ago
by
Boman Romain
Browse files
Options
Downloads
Patches
Plain Diff
add workspace folder
parent
6ef669df
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#7084
passed
2 years ago
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
fossils.py
+25
-8
25 additions, 8 deletions
fossils.py
fossils.ui
+23
-6
23 additions, 6 deletions
fossils.ui
ui_fossils.py
+18
-7
18 additions, 7 deletions
ui_fossils.py
with
66 additions
and
21 deletions
fossils.py
+
25
−
8
View file @
60220c3f
...
...
@@ -29,6 +29,7 @@ class Window(QWidget, Ui_Form):
settings
=
QSettings
()
# self.restoreGeometry(settings.value("Geometry", self.saveGeometry()))
self
.
inpFileLineEdit
.
setText
(
settings
.
value
(
"
inpFile
"
,
""
))
self
.
wrkspLineEdit
.
setText
(
settings
.
value
(
"
workspace
"
,
""
))
self
.
action
=
'
cancelled
'
...
...
@@ -48,18 +49,24 @@ class Window(QWidget, Ui_Form):
def
on_inpFilePushButton_pressed
(
self
):
# print("inpFilePushButton...")
fname
=
QFileDialog
.
getOpenFileName
(
None
,
'
Select input file
'
,
''
,
filter
=
'
Python File (*.py)
'
)
# print(fname)
None
,
'
Select input file
'
,
''
,
filter
=
'
Python File (*.py)
'
)
pyfile
=
fname
[
0
]
if
pyfile
:
self
.
inpFileLineEdit
.
setText
(
QDir
.
toNativeSeparators
(
pyfile
))
def
on_wrkspPushButton_pressed
(
self
):
dir
=
QFileDialog
.
getExistingDirectory
(
self
,
"
Select output folder
"
,
self
.
wrkspLineEdit
.
text
())
if
dir
:
self
.
wrkspLineEdit
.
setText
(
QDir
.
toNativeSeparators
(
dir
))
def
closeEvent
(
self
,
event
):
"""
save settings to registry and quit
"""
settings
=
QSettings
()
# settings.setValue("Geometry", QVariant(self.saveGeometry()))
settings
.
setValue
(
"
inpfile
"
,
QVariant
(
self
.
inpFileLineEdit
.
text
()))
settings
.
setValue
(
"
workspace
"
,
QVariant
(
self
.
wrkspLineEdit
.
text
()))
event
.
accept
()
...
...
@@ -108,7 +115,7 @@ if __name__ == "__main__":
print
(
f
"
OMP_NUM_THREADS=[not set]
"
)
# ask for a file if not given
# ask for a file if not given
=> starts the GUI
if
not
args
.
file
:
# QApplication.setAttribute(Qt.AA_EnableHighDpiScaling)
app
=
QApplication
(
sys
.
argv
)
...
...
@@ -118,23 +125,33 @@ if __name__ == "__main__":
win
.
setWindowTitle
(
"
Fossils
"
)
win
.
show
()
app
.
lastWindowClosed
.
connect
(
app
.
quit
)
app
.
exec_
()
app
.
exec_
()
workspace
=
win
.
wrkspLineEdit
.
text
()
action
=
win
.
action
testname
=
win
.
inpFileLineEdit
.
text
()
else
:
workspace
=
None
action
=
'
run
'
testname
=
os
.
path
.
abspath
(
args
.
file
)
# run the simulation
print
(
f
'
action=
{
action
}
'
)
if
action
==
'
run
'
or
action
==
'
post
'
:
testname
=
os
.
path
.
normcase
(
testname
)
# F:/ => f:/ on Windows
print
(
f
'
testname =
{
testname
}
'
)
# create workspace
common
=
os
.
path
.
commonprefix
((
testname
,
thisdir
+
os
.
sep
))
resdir
=
testname
[
len
(
common
):].
replace
(
os
.
sep
,
"
_
"
)
resdir
,
ext
=
os
.
path
.
splitext
(
resdir
)
wdir
=
os
.
path
.
join
(
'
workspace
'
,
resdir
)
if
workspace
:
common
=
os
.
path
.
basename
(
testname
)
resdir
=
common
.
replace
(
os
.
sep
,
"
_
"
)
resdir
,
ext
=
os
.
path
.
splitext
(
resdir
)
wdir
=
os
.
path
.
join
(
workspace
,
resdir
)
else
:
common
=
os
.
path
.
commonprefix
((
testname
,
thisdir
+
os
.
sep
))
resdir
=
testname
[
len
(
common
):].
replace
(
os
.
sep
,
"
_
"
)
resdir
,
ext
=
os
.
path
.
splitext
(
resdir
)
wdir
=
os
.
path
.
join
(
'
workspace
'
,
resdir
)
print
(
'
workspace=
'
,
wdir
)
if
not
os
.
path
.
isdir
(
wdir
):
...
...
This diff is collapsed.
Click to expand it.
fossils.ui
+
23
−
6
View file @
60220c3f
...
...
@@ -6,8 +6,8 @@
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
546
</width>
<height>
1
0
4
</height>
<width>
827
</width>
<height>
1
2
4
</height>
</rect>
</property>
<property
name=
"windowTitle"
>
...
...
@@ -15,24 +15,41 @@
</property>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout"
>
<item>
<layout
class=
"Q
HBox
Layout"
name=
"
horizontal
Layout"
>
<item>
<layout
class=
"Q
Grid
Layout"
name=
"
grid
Layout"
>
<item
row=
"0"
column=
"0"
>
<widget
class=
"QLabel"
name=
"inpFilelabel"
>
<property
name=
"text"
>
<string>
input file
</string>
</property>
</widget>
</item>
<item>
<item
row=
"0"
column=
"1"
>
<widget
class=
"QLineEdit"
name=
"inpFileLineEdit"
/>
</item>
<item>
<item
row=
"0"
column=
"2"
>
<widget
class=
"QPushButton"
name=
"inpFilePushButton"
>
<property
name=
"text"
>
<string>
...
</string>
</property>
</widget>
</item>
<item
row=
"1"
column=
"0"
>
<widget
class=
"QLabel"
name=
"wrksplabel"
>
<property
name=
"text"
>
<string>
workspace
</string>
</property>
</widget>
</item>
<item
row=
"1"
column=
"1"
>
<widget
class=
"QLineEdit"
name=
"wrkspLineEdit"
/>
</item>
<item
row=
"1"
column=
"2"
>
<widget
class=
"QPushButton"
name=
"wrkspPushButton"
>
<property
name=
"text"
>
<string>
...
</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
...
...
This diff is collapsed.
Click to expand it.
ui_fossils.py
+
18
−
7
View file @
60220c3f
...
...
@@ -14,21 +14,30 @@ from PyQt5 import QtCore, QtGui, QtWidgets
class
Ui_Form
(
object
):
def
setupUi
(
self
,
Form
):
Form
.
setObjectName
(
"
Form
"
)
Form
.
resize
(
546
,
1
0
4
)
Form
.
resize
(
827
,
1
2
4
)
self
.
verticalLayout
=
QtWidgets
.
QVBoxLayout
(
Form
)
self
.
verticalLayout
.
setObjectName
(
"
verticalLayout
"
)
self
.
horizontal
Layout
=
QtWidgets
.
Q
HBox
Layout
()
self
.
horizontal
Layout
.
setObjectName
(
"
horizontal
Layout
"
)
self
.
grid
Layout
=
QtWidgets
.
Q
Grid
Layout
()
self
.
grid
Layout
.
setObjectName
(
"
grid
Layout
"
)
self
.
inpFilelabel
=
QtWidgets
.
QLabel
(
Form
)
self
.
inpFilelabel
.
setObjectName
(
"
inpFilelabel
"
)
self
.
horizontal
Layout
.
addWidget
(
self
.
inpFilelabel
)
self
.
grid
Layout
.
addWidget
(
self
.
inpFilelabel
,
0
,
0
,
1
,
1
)
self
.
inpFileLineEdit
=
QtWidgets
.
QLineEdit
(
Form
)
self
.
inpFileLineEdit
.
setObjectName
(
"
inpFileLineEdit
"
)
self
.
horizontal
Layout
.
addWidget
(
self
.
inpFileLineEdit
)
self
.
grid
Layout
.
addWidget
(
self
.
inpFileLineEdit
,
0
,
1
,
1
,
1
)
self
.
inpFilePushButton
=
QtWidgets
.
QPushButton
(
Form
)
self
.
inpFilePushButton
.
setObjectName
(
"
inpFilePushButton
"
)
self
.
horizontalLayout
.
addWidget
(
self
.
inpFilePushButton
)
self
.
verticalLayout
.
addLayout
(
self
.
horizontalLayout
)
self
.
gridLayout
.
addWidget
(
self
.
inpFilePushButton
,
0
,
2
,
1
,
1
)
self
.
wrksplabel
=
QtWidgets
.
QLabel
(
Form
)
self
.
wrksplabel
.
setObjectName
(
"
wrksplabel
"
)
self
.
gridLayout
.
addWidget
(
self
.
wrksplabel
,
1
,
0
,
1
,
1
)
self
.
wrkspLineEdit
=
QtWidgets
.
QLineEdit
(
Form
)
self
.
wrkspLineEdit
.
setObjectName
(
"
wrkspLineEdit
"
)
self
.
gridLayout
.
addWidget
(
self
.
wrkspLineEdit
,
1
,
1
,
1
,
1
)
self
.
wrkspPushButton
=
QtWidgets
.
QPushButton
(
Form
)
self
.
wrkspPushButton
.
setObjectName
(
"
wrkspPushButton
"
)
self
.
gridLayout
.
addWidget
(
self
.
wrkspPushButton
,
1
,
2
,
1
,
1
)
self
.
verticalLayout
.
addLayout
(
self
.
gridLayout
)
self
.
horizontalLayout_2
=
QtWidgets
.
QHBoxLayout
()
self
.
horizontalLayout_2
.
setObjectName
(
"
horizontalLayout_2
"
)
spacerItem
=
QtWidgets
.
QSpacerItem
(
40
,
20
,
QtWidgets
.
QSizePolicy
.
Expanding
,
QtWidgets
.
QSizePolicy
.
Minimum
)
...
...
@@ -51,5 +60,7 @@ class Ui_Form(object):
Form
.
setWindowTitle
(
_translate
(
"
Form
"
,
"
Form
"
))
self
.
inpFilelabel
.
setText
(
_translate
(
"
Form
"
,
"
input file
"
))
self
.
inpFilePushButton
.
setText
(
_translate
(
"
Form
"
,
"
...
"
))
self
.
wrksplabel
.
setText
(
_translate
(
"
Form
"
,
"
workspace
"
))
self
.
wrkspPushButton
.
setText
(
_translate
(
"
Form
"
,
"
...
"
))
self
.
runPushButton
.
setText
(
_translate
(
"
Form
"
,
"
Run
"
))
self
.
viewPushButton
.
setText
(
_translate
(
"
Form
"
,
"
View
"
))
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment