Skip to content

Commit

Permalink
Merge branch 'main' into flake8-dbmgr
Browse files Browse the repository at this point in the history
  • Loading branch information
arohanajit authored Sep 25, 2024
2 parents 9e6f20c + 09c629d commit 2ff8e85
Show file tree
Hide file tree
Showing 23 changed files with 78 additions and 127 deletions.
1 change: 0 additions & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ per-file-ignores =
doc/python/m.distance.py: E501
doc/gui/wxpython/example/dialogs.py: F401
gui/scripts/d.wms.py: E501
gui/wxpython/datacatalog/tree.py: E731, E402
gui/wxpython/dbmgr/dialogs.py: E722
gui/wxpython/docs/wxgui_sphinx/conf.py: E402, W291
gui/wxpython/gcp/manager.py: E722
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/additional_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:

steps:
- name: Checkout repository contents
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
with:
fetch-depth: 31

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/clang-format-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
name: Formatting Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
with:
persist-credentials: false
- uses: DoozyX/clang-format-lint-action@c71d0bf4e21876ebec3e5647491186f8797fde31 # v0.18.2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- name: Set up Python
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/coverity.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-22.04
if: github.repository == 'OSGeo/grass'
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0

- name: Get dependencies
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/create_release_draft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
contents: write
steps:
- name: Checks-out repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
with:
ref: ${{ github.ref }}
fetch-depth: 0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
with:
fetch-depth: 0
- name: Docker meta
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gcc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
fail-fast: false

steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- name: Get dependencies
run: |
sudo apt-get update -y
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
-mindepth 1 -maxdepth 1 -type f -print -delete
# Rehash to forget about the deleted files
hash -r
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- name: Get current date cache key segment
id: date
# Year and week of year so cache key changes weekly
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/osgeo4w.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- uses: msys2/setup-msys2@ddf331adaebd714795f1042345e6ca57bd66cea8 # v2.24.1
with:
path-type: inherit
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/periodic_update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Create URL to the run output
id: vars
run: echo "run-url=https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" >> $GITHUB_OUTPUT
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- name: "Check that autoconf scripts are up-to-date:"
run: |
rm -f config.guess config.sub
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
PYTHONWARNINGS: always

steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0

- name: Set up Python
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
echo Bandit: ${{ env.BANDIT_VERSION }}
echo Ruff: ${{ env.RUFF_VERSION }}
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0

- name: Set up Python
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/super-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
statuses: write

steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
with:
# super-linter needs the full git history to get the
# list of files that changed across commits
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-nix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
contents: read

steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0

- name: Install nix
uses: DeterminateSystems/nix-installer-action@da36cb69b1c3247ad7a1f931ebfd954a1105ef14 # v14
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/titles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout base repository (doesn't include the PR changes)
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- name: Call PR title validation function
run: python utils/generate_release_notes.py check "${PR_TITLE}" "" ""
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
fail-fast: false

steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0

- name: Invert inclusion list to an exclusion list
id: get-exclude
Expand Down
2 changes: 1 addition & 1 deletion docker/alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM alpine:3.20@sha256:e72ad0747b9dc266fca31fb004580d316b6ae5b0fdbbb65f17bbe371a5b24cff as common
FROM alpine:3.20@sha256:beefdbd8a1da6d2915566fde36db9db0b524eb737fc57cd1367effd16dc0d06d as common

# Based on:
# https://github.com/mundialis/docker-grass-gis/blob/master/Dockerfile
Expand Down
23 changes: 14 additions & 9 deletions gui/wxpython/datacatalog/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -1378,15 +1378,20 @@ def OnPasteMap(self, event):
)
if not new_name:
continue
callback = lambda gisrc2=gisrc2, gisrc=gisrc, cLayer=self.copy_layer[
i
], cMapset=self.copy_mapset[
i
], cMode=self.copy_mode, sMapset=self.selected_mapset[
0
], name=new_name: self._onDoneReprojection(
env2, gisrc2, gisrc, cLayer, cMapset, cMode, sMapset, name
)

def callback(
gisrc2=gisrc2,
gisrc=gisrc,
cLayer=self.copy_layer[i],
cMapset=self.copy_mapset[i],
cMode=self.copy_mode,
sMapset=self.selected_mapset[0],
name=new_name,
):
self._onDoneReprojection(
env2, gisrc2, gisrc, cLayer, cMapset, cMode, sMapset, name
)

dlg = CatalogReprojectionDialog(
self,
self._giface,
Expand Down
48 changes: 47 additions & 1 deletion python/grass/jupyter/baseseriesmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import grass.script as gs

from .map import Map
from .utils import get_number_of_cores
from .utils import get_number_of_cores, save_gif


class BaseSeriesMap:
Expand Down Expand Up @@ -210,3 +210,49 @@ def change_image(index):
width="100%", display="inline-flex", flex_flow="row wrap"
)
return widgets.HBox([play, slider, out_img], layout=layout)

def save(
self,
filename,
duration=500,
label=True,
font=None,
text_size=12,
text_color="gray",
):
"""
Creates a GIF animation of rendered layers.
Text color must be in a format accepted by PIL ImageColor module. For supported
formats, visit:
https://pillow.readthedocs.io/en/stable/reference/ImageColor.html#color-names
param str filename: name of output GIF file
param int duration: time to display each frame; milliseconds
param bool label: include label on each frame
param str font: font file
param int text_size: size of label text
param str text_color: color to use for the text.
"""

# Render images if they have not been already
if not self._layers_rendered:
self.render()

input_files = []
for index in self._indices:
input_files.append(self._base_filename_dict[index])

save_gif(
input_files,
filename,
duration=duration,
label=label,
labels=self._labels,
font=font,
text_size=text_size,
text_color=text_color,
)

# Display the GIF
return filename
47 changes: 0 additions & 47 deletions python/grass/jupyter/seriesmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

from .map import Map
from .region import RegionManagerForSeries
from .utils import save_gif
from .baseseriesmap import BaseSeriesMap


Expand Down Expand Up @@ -165,49 +164,3 @@ def render(self):
)
tasks = [(i,) for i in range(self.baseseries)]
self._render(tasks)

def save(
self,
filename,
duration=500,
label=True,
font=None,
text_size=12,
text_color="gray",
):
"""
Creates a GIF animation of rendered layers.
Text color must be in a format accepted by PIL ImageColor module. For supported
formats, visit:
https://pillow.readthedocs.io/en/stable/reference/ImageColor.html#color-names
param str filename: name of output GIF file
param int duration: time to display each frame; milliseconds
param bool label: include label on each frame
param str font: font file
param int text_size: size of label text
param str text_color: color to use for the text
"""

# Render images if they have not been already
if not self._layers_rendered:
self.render()

tmp_files = []
for file in self._base_filename_dict.values():
tmp_files.append(file)

save_gif(
tmp_files,
filename,
duration=duration,
label=label,
labels=self._labels,
font=font,
text_size=text_size,
text_color=text_color,
)

# Display the GIF
return filename
5 changes: 0 additions & 5 deletions python/grass/jupyter/tests/timeseriesmap_test.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Test TimeSeriesMap functions"""

from pathlib import Path
import sys

import pytest

Expand Down Expand Up @@ -67,10 +66,6 @@ def test_render_layers(space_time_raster_dataset, fill_gaps):
assert Path(filename).is_file()


@pytest.mark.xfail(
sys.platform == "win32",
reason="DejaVuSans.ttf file isn't found and not installed with GRASS",
)
@pytest.mark.needs_solo_run
def test_save(space_time_raster_dataset, tmp_path):
"""Test returns from animate and time_slider are correct object types"""
Expand Down
47 changes: 0 additions & 47 deletions python/grass/jupyter/timeseriesmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

from .map import Map
from .region import RegionManagerForTimeSeries
from .utils import save_gif
from .baseseriesmap import BaseSeriesMap


Expand Down Expand Up @@ -312,49 +311,3 @@ def render(self):
filename = os.path.join(self._tmpdir.name, f"{layer}.png")
tasks.append((date, layer, filename))
self._render(tasks)

def save(
self,
filename,
duration=500,
label=True,
font="DejaVuSans.ttf",
text_size=12,
text_color="gray",
):
"""
Creates a GIF animation of rendered layers.
Text color must be in a format accepted by PIL ImageColor module. For supported
formats, visit:
https://pillow.readthedocs.io/en/stable/reference/ImageColor.html#color-names
param str filename: name of output GIF file
param int duration: time to display each frame; milliseconds
param bool label: include date/time stamp on each frame
param str font: font file
param int text_size: size of date/time text
param str text_color: color to use for the text.
"""

# Render images if they have not been already
if not self._layers_rendered:
self.render()

input_files = []
for date in self._labels:
input_files.append(self._base_filename_dict[date])

save_gif(
input_files,
filename,
duration=duration,
label=label,
labels=self._labels,
font=font,
text_size=text_size,
text_color=text_color,
)

# Display the GIF
return filename

0 comments on commit 2ff8e85

Please sign in to comment.