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
1883f724
Commit
1883f724
authored
1 year ago
by
xo30xoqa
Browse files
Options
Downloads
Patches
Plain Diff
Wrote most of the configuration window
parent
5b430335
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
desktop.jl
+7
-9
7 additions, 9 deletions
desktop.jl
run.jl
+0
-10
0 additions, 10 deletions
run.jl
src/config.jl
+60
-0
60 additions, 0 deletions
src/config.jl
src/config.qml
+246
-0
246 additions, 0 deletions
src/config.qml
with
313 additions
and
19 deletions
desktop.jl
+
7
−
9
View file @
1883f724
#!/usr/bin/env julia
# Start Persefone Desktop
# A very thin wrapper to start Persefone Desktop.
# (This is not included in PersefoneDesktop.jl in order to enable the latter to
# be used as a library/package.) #XXX does this make sense?
#
using
GLMakie
#using Makie
using
QML
using
Pkg
Pkg
.
activate
(
"."
)
using
PersefoneDesktop
# MUST disable threading in Qt
ENV
[
"QSG_RENDER_LOOP"
]
=
"basic"
loadqml
(
"src/main.qml"
)
exec
()
launch
()
This diff is collapsed.
Click to expand it.
run.jl
deleted
100755 → 0
+
0
−
10
View file @
5b430335
#!/usr/bin/env julia
# A very thin wrapper to start Persefone Desktop.
# (This is not included in PersefoneDesktop.jl in order to enable the latter to
# be used as a library/package.) #XXX does this make sense?
using
Pkg
Pkg
.
activate
(
"."
)
using
PersefoneDesktop
launch
()
This diff is collapsed.
Click to expand it.
src/config.jl
0 → 100644
+
60
−
0
View file @
1883f724
### PersefoneDesktop - a GUI to the Persefone model of agriculture and ecosystems
###
### This file manages the backend of the setup window.
###
const
userconfigfile
=
Observable
(
"userconfig.toml"
)
const
outdir
=
Observable
(
"persefone_output"
)
const
csvoutput
=
Observable
(
false
)
const
loglevel
=
Observable
(
"warn"
)
const
processors
=
Observable
(
1
)
const
seed
=
Observable
(
2
)
const
startdateday
=
Observable
(
1
)
const
startdatemonth
=
Observable
(
1
)
const
startdateyear
=
Observable
(
2022
)
const
enddateday
=
Observable
(
31
)
const
enddatemonth
=
Observable
(
12
)
const
enddateyear
=
Observable
(
2022
)
const
region
=
Observable
(
"Jena"
)
#const farmmodel = Observable("FieldManager") #XXX not yet implemented
#const targetspecies = Observable()
#const insectmodel = Observable() #TODO not sure how to configure a list?
const
cropmodel
=
Observable
(
"ALMaSS"
)
#XXX alternatives not yet implemented
# TODO create config file with fixed options:
# - overwrite = true (?)
# - storedata = true
# - indoutfreq = "daily"
# - popoutfreq = "daily"
function
writeconfig
()
println
(
"Wrote config file."
)
#TODO
end
function
configwindow
()
#TODO
@qmlfunction
splashscreen
@qmlfunction
writeconfig
@qmlfunction
newsimulation
qmlfile
=
joinpath
(
dirname
(
@__FILE__
),
"config.qml"
)
loadqml
(
qmlfile
,
conf
=
JuliaPropertyMap
(
"userconfigfile"
=>
userconfigfile
,
"outdir"
=>
outdir
,
"csvoutput"
=>
csvoutput
,
"loglevel"
=>
loglevel
,
"processors"
=>
processors
,
"seed"
=>
seed
,
"startdateday"
=>
startdateday
,
"startdatemonth"
=>
startdatemonth
,
"startdateyear"
=>
startdateyear
,
"enddateday"
=>
enddateday
,
"enddatemonth"
=>
enddatemonth
,
"enddateyear"
=>
enddateyear
,
"region"
=>
region
,
"cropmodel"
=>
cropmodel
))
exec
()
end
This diff is collapsed.
Click to expand it.
src/config.qml
0 → 100644
+
246
−
0
View file @
1883f724
/// PersefoneDesktop - a GUI to the Persefone model of agriculture and ecosystems
///
/// This file defines the layout of the configuration window.
///
import
QtQuick
import
QtQuick
.
Window
import
QtQuick
.
Controls
import
QtQuick
.
Layouts
import
QtQuick
.
Dialogs
import
org
.
julialang
ApplicationWindow
{
id
:
configWindow
title
:
"
Configure simulation
"
width
:
700
height
:
350
visible
:
true
ColumnLayout
{
id
:
generalSettings
anchors.top
:
parent
.
top
anchors.left
:
parent
.
left
anchors.leftMargin
:
20
anchors.topMargin
:
20
spacing
:
8
Text
{
text
:
"
General Settings:
"
horizontalAlignment
:
Text
.
AlignCenter
font.bold
:
true
}
RowLayout
{
Label
{
text
:
"
Configuration file:
"
}
Label
{
text
:
conf
.
userconfigfile
font.italic
:
true
}
Button
{
text
:
"
Select...
"
onClicked
:
conffileChooser
.
open
()
}
FileDialog
{
id
:
conffileChooser
defaultSuffix
:
"
toml
"
fileMode
:
FileDialog
.
SaveFile
nameFilters
:
[
"
Configuration files (*.toml)
"
]
onAccepted
:
conf
.
userconfigfile
=
selectedFile
}
}
RowLayout
{
Label
{
text
:
"
Output folder:
"
}
Label
{
text
:
conf
.
outdir
font.italic
:
true
}
Button
{
text
:
"
Select...
"
onClicked
:
outdirChooser
.
open
()
}
FolderDialog
{
id
:
outdirChooser
selectedFolder
:
conf
.
outdir
onAccepted
:
conf
.
outdir
=
selectedFolder
}
}
//XXX Not all regions have data available!
// (currently, only Jena is fully configured)
RowLayout
{
Label
{
text
:
"
Region:
"
}
ComboBox
{
currentIndex
:
3
model
:
[
"
Bodensee
"
,
"
Eichsfeld
"
,
"
Hohenlohe
"
,
"
Jena
"
,
"
Oberrhein
"
,
"
Thüringer Becken
"
]
onCurrentIndexChanged
:
conf
.
region
=
currentText
}
}
RowLayout
{
Label
{
text
:
"
Crop model:
"
}
ComboBox
{
currentIndex
:
0
model
:
[
"
ALMaSS
"
,
"
AquaCrop
"
]
onCurrentIndexChanged
:
conf
.
cropmodel
=
currentText
}
}
//XXX For which years do I actually have data?
RowLayout
{
Label
{
text
:
"
Start date:
"
}
SpinBox
{
Layout.maximumWidth
:
100
from
:
1
to
:
31
value
:
conf
.
startdateday
editable
:
true
wrap
:
true
onValueModified
:
conf
.
startdateday
=
value
}
SpinBox
{
Layout.maximumWidth
:
100
from
:
1
to
:
12
value
:
conf
.
startdatemonth
editable
:
true
wrap
:
true
onValueModified
:
conf
.
startdatemonth
=
value
}
SpinBox
{
Layout.maximumWidth
:
100
from
:
2000
to
:
2050
value
:
conf
.
startdateyear
editable
:
true
wrap
:
true
textFromValue
:
function
(
value
)
{
return
Number
(
value
).
toString
();
}
onValueModified
:
conf
.
startdateyear
=
value
}
}
RowLayout
{
Label
{
text
:
"
End date:
"
}
SpinBox
{
Layout.maximumWidth
:
100
from
:
1
to
:
31
value
:
conf
.
enddateday
editable
:
true
wrap
:
true
onValueModified
:
conf
.
enddateday
=
value
}
SpinBox
{
Layout.maximumWidth
:
100
from
:
1
to
:
12
value
:
conf
.
enddatemonth
editable
:
true
wrap
:
true
onValueModified
:
conf
.
enddatemonth
=
value
}
SpinBox
{
Layout.maximumWidth
:
100
from
:
2000
to
:
2050
value
:
conf
.
enddateyear
editable
:
true
wrap
:
true
textFromValue
:
function
(
value
)
{
return
Number
(
value
).
toString
();
}
onValueModified
:
conf
.
enddateyear
=
value
}
}
}
ColumnLayout
{
id
:
advancedSettings
anchors.top
:
parent
.
top
anchors.right
:
parent
.
right
anchors.left
:
generalSettings
.
right
anchors.rightMargin
:
20
anchors.topMargin
:
20
anchors.leftMargin
:
20
spacing
:
8
Text
{
text
:
"
Advanced Settings:
"
horizontalAlignment
:
Text
.
AlignCenter
font.bold
:
true
}
RowLayout
{
Label
{
text
:
"
Random seed:
"
}
SpinBox
{
from
:
0
to
:
2147483647
value
:
2
editable
:
true
onValueModified
:
conf
.
seed
=
value
}
}
RowLayout
{
Label
{
text
:
"
Log level:
"
}
ComboBox
{
currentIndex
:
2
model
:
[
"
debug
"
,
"
info
"
,
"
warn
"
]
onCurrentIndexChanged
:
conf
.
loglevel
=
currentText
}
}
RowLayout
{
Label
{
text
:
"
Processors:
"
}
SpinBox
{
from
:
1
to
:
8
value
:
conf
.
processors
editable
:
true
onValueModified
:
conf
.
processors
=
value
}
}
CheckBox
{
checked
:
conf
.
csvoutput
text
:
"
Write CSV output
"
onClicked
:
conf
.
csvoutput
=
checked
}
//TODO add config options for:
// farmmodel
// targetspecies
// insectmodel
}
footer
:
ToolBar
{
RowLayout
{
anchors.right
:
parent
.
right
layoutDirection
:
Qt
.
RightToLeft
Button
{
text
:
"
Start new simulation
"
onClicked
:
{
//Julia.splashscreen() //FIXME crashes
Julia
.
writeconfig
()
Julia
.
newsimulation
()
configWindow
.
close
()
}
}
Button
{
text
:
"
Save configuration
"
onClicked
:
{
Julia
.
writeconfig
()
configWindow
.
close
()
}
}
Button
{
text
:
"
Cancel
"
onClicked
:
configWindow
.
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