Skip to content

Commit 63332d5

Browse files
committed
Merge remote-tracking branch 'origin/main' into avalanching-numba-patch
2 parents 16d5792 + 2224cfd commit 63332d5

File tree

6 files changed

+2727
-764
lines changed

6 files changed

+2727
-764
lines changed

aeolis/avalanching.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ def avalanche(s, p):
9696
if p['process_avalanche']:
9797
nx = p['nx'] + 1
9898
ny = p['ny'] + 1
99+
nx = p['nx'] + 1
100+
ny = p['ny'] + 1
99101

100102
# parameters - only dynamic angle used in loop for now.
101103
# Static angle can be used for more complex criterions in later

aeolis/console.py

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
3737
Commands:
3838
examples sets up some examples for AeoLiS.
39+
gui starts the AeoLiS graphical user interface (GUI).
3940
run runs model for simulating supply-limited aeolian sediment...
4041
wind A wind time series generation tool for the aeolis model.
4142
@@ -45,6 +46,14 @@
4546
4647
aeolis run <path_to_model_configuration_file.txt>
4748
49+
> Start the GUI
50+
51+
aeolis gui
52+
53+
Or with a configuration file:
54+
55+
aeolis gui <path_to_model_configuration_file.txt>
56+
4857
> To generate a wind time series
4958
5059
aeolis wind <path_to_wind.txt>
@@ -208,6 +217,56 @@ def examples(
208217
print("Done. Examples copied to: \n %s" % destination_path)
209218

210219

220+
@aeolis_app.command(name="gui", help="starts the AeoLiS graphical user interface (GUI).")
221+
def gui(
222+
config: Annotated[
223+
Optional[str],
224+
typer.Argument(
225+
help="optional configuration file to load on startup"
226+
),
227+
] = None,
228+
):
229+
print_license()
230+
231+
try:
232+
import tkinter as tk
233+
from aeolis.gui import AeolisGUI
234+
import aeolis.inout
235+
except ImportError as e:
236+
print(f"Error: Failed to import required GUI modules: {e}")
237+
print("Make sure tkinter is installed on your system.")
238+
sys.exit(1)
239+
240+
# Load configuration if provided, otherwise use defaults
241+
if config and os.path.isfile(config):
242+
print(f"Loading configuration from: {config}")
243+
dic = aeolis.inout.read_configfile(config)
244+
configfile = config
245+
else:
246+
if config:
247+
print(f"Warning: Configuration file '{config}' not found. Using defaults.")
248+
print("Starting GUI with default configuration...")
249+
dic = {}
250+
configfile = "No file selected"
251+
252+
# Create and start the GUI
253+
root = tk.Tk()
254+
255+
# Set the configfile in the gui module
256+
import aeolis.gui as gui_module
257+
gui_module.configfile = configfile
258+
259+
app = AeolisGUI(root, dic)
260+
261+
# Make window appear on top at startup
262+
root.lift()
263+
root.attributes('-topmost', True)
264+
root.after_idle(root.attributes, '-topmost', False)
265+
root.focus_force()
266+
267+
root.mainloop()
268+
269+
211270
def print_license():
212271
print("AeoLiS Copyright (c) 2023 AeoLiS Development Team")
213272
print("This program comes with ABSOLUTELY NO WARRANTY.")

0 commit comments

Comments
 (0)