Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Persefone desktop
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Package registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Persefone
Persefone desktop
Commits
9d2a55b0
Commit
9d2a55b0
authored
1 year ago
by
Marco Matthies
Browse files
Options
Downloads
Patches
Plain Diff
Change for formatting for main.qml for better readability
parent
d5985468
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main.qml
+186
-187
186 additions, 187 deletions
src/main.qml
with
186 additions
and
187 deletions
src/main.qml
+
186
−
187
View file @
9d2a55b0
...
@@ -10,210 +10,209 @@ import QtQuick.Dialogs
...
@@ -10,210 +10,209 @@ import QtQuick.Dialogs
import
QtQuick
.
Layouts
import
QtQuick
.
Layouts
ApplicationWindow
{
ApplicationWindow
{
id
:
mainWindow
id
:
mainWindow
title
:
"
Persefone.jl Desktop
"
title
:
"
Persefone.jl Desktop
"
width
:
1024
width
:
1024
height
:
768
height
:
768
visibility
:
"
Maximized
"
visibility
:
"
Maximized
"
visible
:
true
visible
:
true
menuBar
:
MenuBar
{
Menu
{
title
:
"
&Simulation
"
Action
{
text
:
"
&New Simulation
"
onTriggered
:
{
vars
.
launching
=
true
}
//TODO select config file
}
Action
{
text
:
"
&Configure Simulation
"
onTriggered
:
{
Julia
.
configwindow
()
}
}
Action
{
text
:
"
&Load Saved State
"
onTriggered
:
{
loadFileChooser
.
open
()
}
}
Action
{
text
:
"
&Save Current State
"
onTriggered
:
{
saveFileChooser
.
open
()
}
}
MenuSeparator
{
}
Action
{
text
:
"
&Quit
"
onTriggered
:
{
mainWindow
.
close
()
}
}
}
Menu
{
title
:
"
&Data
"
Action
{
text
:
"
Show &Population Graph
"
onTriggered
:
{
populationGraph
.
visible
=
true
}
}
Action
{
text
:
"
Save &Simulation Output
"
onTriggered
:
{
Julia
.
saveoutput
()
}
}
}
Menu
{
title
:
"
&Help
"
Action
{
text
:
"
&Documentation
"
onTriggered
:
{
Qt
.
openUrlExternally
(
"
https://persefone-model.eu/documentation
"
)
}
}
Action
{
text
:
"
&Website
"
onTriggered
:
{
Qt
.
openUrlExternally
(
"
https://persefone-model.eu/
"
)
}
}
Action
{
text
:
"
&About
"
onTriggered
:
{
aboutDialog
.
open
()
}
}
}
}
// visualise the model map and the locations of animals
menuBar
:
MenuBar
{
MakieViewport
{
Menu
{
id
:
mapviewport
title
:
"
&Simulation
"
anchors.fill
:
parent
Action
{
renderFunction
:
render_map_callback
text
:
"
&New Simulation
"
onTriggered
:
{
vars
.
launching
=
true
}
//TODO select config file
}
Action
{
text
:
"
&Configure Simulation
"
onTriggered
:
{
Julia
.
configwindow
()
}
}
Action
{
text
:
"
&Load Saved State
"
onTriggered
:
{
loadFileChooser
.
open
()
}
}
Action
{
text
:
"
&Save Current State
"
onTriggered
:
{
saveFileChooser
.
open
()
}
}
MenuSeparator
{
}
Action
{
text
:
"
&Quit
"
onTriggered
:
{
mainWindow
.
close
()
}
}
}
Menu
{
title
:
"
&Data
"
Action
{
text
:
"
Show &Population Graph
"
onTriggered
:
{
populationGraph
.
visible
=
true
}
}
Action
{
text
:
"
Save &Simulation Output
"
onTriggered
:
{
Julia
.
saveoutput
()
}
}
}
Menu
{
title
:
"
&Help
"
Action
{
text
:
"
&Documentation
"
onTriggered
:
{
Qt
.
openUrlExternally
(
"
https://persefone-model.eu/documentation
"
)
}
}
Action
{
text
:
"
&Website
"
onTriggered
:
{
Qt
.
openUrlExternally
(
"
https://persefone-model.eu/
"
)
}
}
Action
{
text
:
"
&About
"
onTriggered
:
{
aboutDialog
.
open
()
}
}
}
}
}
// the main control bar, with pause/step/run buttons, the progress
// visualise the model map and the locations of animals
// bar and a speed slider
MakieViewport
{
footer
:
ToolBar
{
id
:
mapviewport
RowLayout
{
anchors.fill
:
parent
//TODO change button texts to icons
renderFunction
:
render_map_callback
// (https://doc.qt.io/qt-6/qtquickcontrols-icons.html)
}
id
:
controlBar
anchors.fill
:
parent
// the main control bar, with pause/step/run buttons, the progress
Layout.alignment
:
Qt
.
AlignVCenter
// bar and a speed slider
Layout.fillWidth
:
true
footer
:
ToolBar
{
// anchors.topMargin: 5 //FIXME
RowLayout
{
// anchors.bottomMargin: 5
//TODO change button texts to icons
Button
{
// (https://doc.qt.io/qt-6/qtquickcontrols-icons.html)
id
:
backButton
id
:
controlBar
text
:
"
<
"
anchors.fill
:
parent
ToolTip.text
:
"
Back
"
Layout.alignment
:
Qt
.
AlignVCenter
ToolTip.visible
:
hovered
Layout.fillWidth
:
true
onClicked
:
{
Julia
.
previousstep
()
}
// anchors.topMargin: 5 //FIXME
}
// anchors.bottomMargin: 5
Button
{
Button
{
id
:
stepButton
id
:
backButton
text
:
"
>
"
text
:
"
<
"
ToolTip.text
:
"
Step
"
ToolTip.text
:
"
Back
"
ToolTip.visible
:
hovered
ToolTip.visible
:
hovered
onClicked
:
{
Julia
.
nextstep
()
}
onClicked
:
{
Julia
.
previousstep
()
}
}
}
Button
{
Button
{
id
:
runButton
id
:
stepButton
text
:
vars
.
runbuttontext
text
:
"
>
"
ToolTip.text
:
vars
.
runbuttontip
ToolTip.text
:
"
Step
"
ToolTip.visible
:
hovered
ToolTip.visible
:
hovered
onClicked
:
{
vars
.
running
=
!
vars
.
running
}
onClicked
:
{
Julia
.
nextstep
()
}
}
}
ProgressBar
{
Button
{
id
:
progressBar
id
:
runButton
value
:
vars
.
progress
text
:
vars
.
runbuttontext
Layout.fillWidth
:
true
ToolTip.text
:
vars
.
runbuttontip
ToolTip.text
:
"
Simulation progress
"
ToolTip.visible
:
hovered
ToolTip.visible
:
hovered
onClicked
:
{
vars
.
running
=
!
vars
.
running
}
}
}
Slider
{
ProgressBar
{
id
:
speedSlider
id
:
progressBar
from
:
0.0
value
:
vars
.
progress
to
:
2.0
Layout.fillWidth
:
true
value
:
vars
.
delay
ToolTip.text
:
"
Simulation progress
"
stepSize
:
0.1
ToolTip.visible
:
hovered
snapMode
:
Slider
.
SnapAlways
}
ToolTip.text
:
"
Time delay between updates
"
Slider
{
ToolTip.visible
:
hovered
id
:
speedSlider
onValueChanged
:
vars
.
delay
=
value
from
:
0.0
}
to
:
2.0
Text
{
value
:
vars
.
delay
id
:
dateText
stepSize
:
0.1
text
:
Julia
.
datestring
()
snapMode
:
Slider
.
SnapAlways
//width: //TODO
ToolTip.text
:
"
Time delay between updates
"
}
ToolTip.visible
:
hovered
}
onValueChanged
:
vars
.
delay
=
value
}
Text
{
id
:
dateText
text
:
Julia
.
datestring
()
//width: //TODO
}
}
}
}
// extra windows
// extra windows
MessageDialog
{
MessageDialog
{
id
:
aboutDialog
id
:
aboutDialog
text
:
"
Persefone.jl Desktop
"
text
:
"
Persefone.jl Desktop
"
informativeText
:
"
A mechanistic model of agricultural landscapes
\
informativeText
:
"
A mechanistic model of agricultural landscapes
\
and ecosystems in Europe.
\n\n\
and ecosystems in Europe.
\n\n\
© 2023 Daniel Vedder, Lea Kolb, Guy Pe'er
\n\
© 2023 Daniel Vedder, Lea Kolb, Guy Pe'er
\n\
Distributed under the MIT license.
"
Distributed under the MIT license.
"
}
}
FileDialog
{
FileDialog
{
id
:
loadFileChooser
id
:
loadFileChooser
defaultSuffix
:
"
dat
"
defaultSuffix
:
"
dat
"
nameFilters
:
[
"
Save files (*.dat)
"
]
nameFilters
:
[
"
Save files (*.dat)
"
]
onAccepted
:
{
Julia
.
loadsimulation
(
selectedFile
.
toString
())
}
onAccepted
:
{
Julia
.
loadsimulation
(
selectedFile
.
toString
())
}
}
}
FileDialog
{
FileDialog
{
id
:
saveFileChooser
id
:
saveFileChooser
defaultSuffix
:
"
dat
"
defaultSuffix
:
"
dat
"
fileMode
:
FileDialog
.
SaveFile
fileMode
:
FileDialog
.
SaveFile
nameFilters
:
[
"
Save files (*.dat)
"
]
nameFilters
:
[
"
Save files (*.dat)
"
]
onAccepted
:
{
Julia
.
savesimulation
(
selectedFile
.
toString
())
}
onAccepted
:
{
Julia
.
savesimulation
(
selectedFile
.
toString
())
}
}
}
Window
{
Window
{
id
:
populationGraph
id
:
populationGraph
title
:
"
Population Graph
"
title
:
"
Population Graph
"
width
:
512
width
:
512
height
:
512
height
:
512
visible
:
false
visible
:
false
MakieViewport
{
MakieViewport
{
id
:
plotviewport
id
:
plotviewport
anchors.fill
:
parent
anchors.fill
:
parent
renderFunction
:
render_plot_callback
renderFunction
:
render_plot_callback
}
}
}
}
Popup
{
id
:
splashPopup
parent
:
Overlay
.
overlay
closePolicy
:
Popup
.
NoAutoClose
modal
:
true
padding
:
0
Popup
{
width
:
600
id
:
splashPopup
height
:
250
parent
:
Overlay
.
overlay
x
:
Math
.
round
((
parent
.
width
-
width
)
/
2
)
closePolicy
:
Popup
.
NoAutoClose
y
:
Math
.
round
((
parent
.
height
-
height
)
/
2
)
modal
:
true
padding
:
0
width
:
600
Image
{
height
:
250
anchors.fill
:
parent
x
:
Math
.
round
((
parent
.
width
-
width
)
/
2
)
source
:
"
persefonejl_logo_v3_splash.png
"
y
:
Math
.
round
((
parent
.
height
-
height
)
/
2
)
Image
{
anchors.fill
:
parent
source
:
"
persefonejl_logo_v3_splash.png
"
}
}
}
}
// set up connections and signals to update the simulation and the display
// set up connections and signals to update the simulation and the display
Connections
{
Connections
{
target
:
timer
target
:
timer
function
onTimeout
()
{
vars
.
ticks
+=
1
}
function
onTimeout
()
{
vars
.
ticks
+=
1
}
}
JuliaSignals
{
signal
updateMakie
()
onUpdateMakie
:
{
dateText
.
text
=
Julia
.
datestring
();
mapviewport
.
update
();
plotviewport
.
update
();
}
}
signal
showSplash
()
JuliaSignals
{
onShowSplash
:
{
signal
updateMakie
()
splashPopup
.
open
()
onUpdateMakie
:
{
dateText
.
text
=
Julia
.
datestring
();
mapviewport
.
update
();
plotviewport
.
update
();
}
signal
showSplash
()
onShowSplash
:
{
splashPopup
.
open
()
}
signal
closeSplash
()
onCloseSplash
:
{
splashPopup
.
close
()
}
}
}
signal
closeSplash
()
onCloseSplash
:
{
splashPopup
.
close
()
}
}
}
}
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