mirror of https://gitlab.com/pamhyr/pamhyr2
doc: dev: Update documentation.
parent
ec91a8b63f
commit
145c301eed
|
|
@ -1,5 +1,5 @@
|
|||
# documentation.org -- Pamhyr developers documentation
|
||||
# Copyright (C) 2023 INRAE
|
||||
# Copyright (C) 2023-2024 INRAE
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -546,8 +546,8 @@ generic value from optional parameters, for examples:
|
|||
_pamhyr_ui = "MyUI"
|
||||
_pamhyr_name = "My window"
|
||||
|
||||
def __init__(self, my_data=None,
|
||||
study=None, config=None,
|
||||
def __init__(self, study=None, config=None,
|
||||
my_data=None,
|
||||
parent=None):
|
||||
self._my_data = my_data
|
||||
|
||||
|
|
@ -661,11 +661,13 @@ creation, this stack is accessible at =self._undo_stack=.
|
|||
|
||||
*** Plot
|
||||
|
||||
To define a new plot you can create a class who inherit to APlot. The
|
||||
creator need threee argument:
|
||||
To define a new plot you can create a class who inherit to
|
||||
PamhyrPlot. The creator need at leaste five argument:
|
||||
- A =canvas= of type =MplCanvas=
|
||||
- A (optional) =trad= of type =PamhyrTranslate=
|
||||
- A =data= used in =draw= and =update= to create and update the plot
|
||||
- A optional =toolbar= of type =PamhyrToolbar=
|
||||
- A =parent= window
|
||||
This class must implement two method =draw= and =update=, the first
|
||||
method to draw the plot from scratch, the second to update the plot if
|
||||
data has changed.
|
||||
|
|
@ -673,19 +675,36 @@ data has changed.
|
|||
#+begin_src python :python python3 :results output :noweb yes
|
||||
from View.Tools.PamhyrPlot import PamhyrPlot
|
||||
|
||||
class MyPlot(APlot):
|
||||
def __init__(self, canvas=None, data=None, toolbar=None):
|
||||
class MyPlot(PamhyrPlot):
|
||||
def __init__(self, canvas=None, trad=None, toolbar=None
|
||||
data=None, parent=None):
|
||||
super(MyPlot, self).__init__(
|
||||
canvas=canvas,
|
||||
trad=trad,
|
||||
data=data,
|
||||
toolbar=toolbar
|
||||
toolbar=toolbar,
|
||||
parent=parent
|
||||
)
|
||||
|
||||
self.label_x = self._trad["x"]
|
||||
self.label_y = self._trad["y"]
|
||||
|
||||
# Optional configuration
|
||||
self._isometric_axis = False
|
||||
|
||||
self._auto_relim_update = True
|
||||
self._autoscale_update = True
|
||||
|
||||
def draw(self):
|
||||
# Draw function code...
|
||||
|
||||
def update(self, ind = None):
|
||||
def update(self):
|
||||
# Update function code...
|
||||
|
||||
def clear(self):
|
||||
# Clear plot values...
|
||||
|
||||
# ...
|
||||
#+end_src
|
||||
|
||||
** Solver
|
||||
|
|
@ -745,7 +764,7 @@ execute a code on distant computer, for example, over ssh.
|
|||
style=dashed;
|
||||
subgraph cluster021 {
|
||||
label="Solver Classes";
|
||||
classSolverM7[label="Mage7", fillcolor=6];
|
||||
//classSolverM7[label="Mage7", fillcolor=6];
|
||||
classSolverM8[label="Mage8", fillcolor=6];
|
||||
classSolverR[label="RubarBE", fillcolor=6];
|
||||
}
|
||||
|
|
@ -828,7 +847,7 @@ solver and get results:
|
|||
- (2.1) The solver read the input file(s)
|
||||
- (2.2) The solver compute results and write it to solver output
|
||||
file(s)
|
||||
- (3) Pamhyr2 create a Reuslts
|
||||
- (3) Pamhyr2 create a =Results= object
|
||||
- (3.1) The Pamhyr2 solver class read solver output file(s) and
|
||||
complete Results with readed data
|
||||
|
||||
|
|
@ -958,8 +977,16 @@ different methods:
|
|||
|
||||
** Unit tests
|
||||
|
||||
The unit tests is actually not implemented in Pamhyr2, it is a *work
|
||||
in progress*.
|
||||
A very small part of Pamhyr2 has unit test. This part is limited to the Model.
|
||||
|
||||
#+begin_src shell
|
||||
python3 -m venv test
|
||||
. test test/bin/activate
|
||||
pip3 install -U -r ./full-requirements.txt
|
||||
|
||||
cd src/
|
||||
python3 -Walways -m unittest discovert -v -t .
|
||||
#+end_src
|
||||
|
||||
** The debug mode
|
||||
|
||||
|
|
@ -970,14 +997,14 @@ line:
|
|||
./Pamhyr2 debug
|
||||
#+end_src
|
||||
|
||||
This mode add some log and add two action in main window menu:
|
||||
"About/Debug" open a window with Python Repl in current Python
|
||||
environement, and "About/Debug SQLite" who open the application
|
||||
This mode add some log and add two action in main window menu: "About
|
||||
> Debug" open a window with Python Repl in current Python
|
||||
environement, and "About > Debug SQLite" who open the application
|
||||
SQLiteBrowser (if installed) on current Study to explore the study
|
||||
data base file.
|
||||
|
||||
#+NAME: debug-repl
|
||||
#+ATTR_LATEX: :width 12cm
|
||||
#+ATTR_LATEX: :width 14cm
|
||||
#+CAPTION: Pamhyr2 debug Python REPL
|
||||
[[./images/python-debug-repl.png]]
|
||||
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 74 KiB After Width: | Height: | Size: 51 KiB |
Loading…
Reference in New Issue