Your browser doesn't support the features required by impress.js, so you are presented with a simplified version of this presentation.
For the best experience please use the latest Chrome, Safari or Firefox browser.
Carmen Tawalika - mundialis - FOSSGIS 2024
#!/usr/bin/python
def main():
print("Created simple addon")
if __name__ == "__main__":
main()
HTML Datei, für Minimalversion leer
t.fossgis.fortune/
├── Makefile
├── t.fossgis.fortune.html
└── t.fossgis.fortune.py
Makefile
MODULE_TOPDIR = ../..
PGM = t.fossgis.fortune
include $(MODULE_TOPDIR)/include/Make/Script.make
default: script
v.example --> umbenennen
├── .flake8
├── .git [...]
├── .github
│ └── workflows
│ └── linting.yml
├── .pre-commit-config.yaml
├── .pylintrc
├── .pylintrc_allowed_to_fail
├── Makefile
├── README.md
├── renovate.json
├── testsuite
│ ├── data
│ │ ├── README.md
│ │ └── area_beuel.geojson
│ └── test_v_example.py
├── v.example.html --> umbenennen
├── v.example.py --> umbenennen
└── v_example.png
<h2>DESCRIPTION</h2>
<em>t.fossgis.fortune</em>
prints fortune cookie sayings.
<h2>SEE ALSO</h2>
<em>
<a href="g.message.html">
g.message</a>
</em>
<h2>AUTHOR</h2>
Carmen Tawalika, mundialis, Germany
# %
sind wichtig für den GRASS Parser!module
, option
, flag
und rules
rules
können Bedingungen für Parameter bestimmt werdenoptions['input']
t.fossgis.fortune input=elevation
# %Module
# % description: Prints fortune...
# % keyword: general
# % keyword: fortune
# %end
# %option G_OPT_V_INPUT
# % key: input
# % required: no
# % description: Polygon to...
# %end
# %option
# % key: box
# % description: Width and height
# % type: double
# % answer: 10,10
# % required: yes
# %end
# %flag
# % key: v
# % description: Print fortune...
# %end
# %rules
# % requires: input,box
# %end
def main():
ist erforderlich und liest alle Parameter ein (z.B. options['input']
)if __name__ == "__main__":
options, flags = grass.parser()
atexit.register(cleanup)
main()
def cleanup():
"""Cleanup function (can be extended)"""
nulldev = open(os.devnull, "w", encoding="utf-8")
kwargs = {"flags": "f", "quiet": True, "stderr": nuldev}
for rmvec in rm_vec:
if grass.find_file(name=rmvec, element="vector")["file"]:
grass.run_command("g.remove", type="vector", name=rmvec, **kwargs)
import grass.script as grass
try:
from fortune import fortune
except:
grass.fatal(_("No fortune"))
def main():
grass.message(_(fortune()))
if __name__ == "__main__":
options, flags = grass.parser()
atexit.register(cleanup)
main()
GRASS nc_spm_08/fossgis > g.extension extension=t.fossgis.fortune url=t.fossgis.fortune
WARNING: Extension <t.fossgis.fortune> already installed. Re-installing...
[...]
Installation of <t.fossgis.fortune> successfully finished
GRASS nc_spm_08/fossgis > t.fossgis.fortune --help
Prints fortune cookie sayings.
Usage:
t.fossgis.fortune [-v] [input=name] [box=value] [--help] [--verbose]
[--quiet] [--ui]
Flags:
-v Print fortune version and exit
Parameters:
input Name of input vector map
box Width and height
default: 10,10
GRASS nc_spm_08/fossgis > t.fossgis.fortune
Sanity and insanity overlap a fine grey line.
[flake8]
# E402 module level import not at top of file
# F821 undefined name '_'
exclude = .git
max-line-length = 80
per-file-ignores =
./v.example.py: F821, E402
name: Python Flake8, black and pylint code quality check
on: [push, pull_request]
jobs:
lint:
uses: mundialis/github-workflows/
.github/workflows/linting.yml@main
t.fossgis.fortune
├── .flake8
├── .git [...]
├── .github
│ └── workflows
│ └── linting.yml
├── .pre-commit-config.yaml
├── .pylintrc
├── .pylintrc_allowed_to_fail
├── Makefile
├── README.md
├── renovate.json
├── testsuite
│ ├── data
│ │ ├── README.md
│ │ └── area_beuel.geojson
│ └── test_v_example.py
├── t.fossgis.fortune.html
├── t.fossgis.fortune.py
└── t.fossgis.fortune.png
repos:
- repo: https://github.com/mundialis/github-workflows
rev: 1.0.3
hooks:
- id: linting
{
"$schema": "https://docs.renovatebot.com/
renovate-schema.json",
"extends": [
"config:base"
],
"pre-commit": {
"enabled": true
}
}
t.fossgis.fortune
├── .flake8
├── .git [...]
├── .github
│ └── workflows
│ └── linting.yml
├── .pre-commit-config.yaml
├── .pylintrc
├── .pylintrc_allowed_to_fail
├── Makefile
├── README.md
├── renovate.json
├── testsuite
│ ├── data
│ │ ├── README.md
│ │ └── area_beuel.geojson
│ └── test_v_example.py
├── t.fossgis.fortune.html
├── t.fossgis.fortune.py
└── t.fossgis.fortune.png
name: Run tests for GRASS GIS addons
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
tests:
uses: mundialis/github-workflows/.github/
workflows/grass-tests.yml@grass-tests
# set NC_TEST_DATA to 'NC' for using
# NC GRASS GIS sample location
with:
NC_TEST_DATA: 'NC'
t.fossgis.fortune
├── .flake8
├── .git [...]
├── .github
│ └── workflows
│ └── linting.yml
├── .pre-commit-config.yaml
├── .pylintrc
├── .pylintrc_allowed_to_fail
├── Makefile
├── README.md
├── renovate.json
├── testsuite
│ ├── data
│ │ ├── README.md
│ │ └── area_beuel.geojson
│ └── test_v_example.py
├── t.fossgis.fortune.html
├── t.fossgis.fortune.py
└── t.fossgis.fortune.png