Skip to content

Commit

Permalink
Merge branch 'main' into ubuntu-max-py313
Browse files Browse the repository at this point in the history
  • Loading branch information
echoix authored Sep 30, 2024
2 parents 1c335d7 + 33d0d15 commit 234761f
Show file tree
Hide file tree
Showing 140 changed files with 1,362 additions and 1,414 deletions.
17 changes: 5 additions & 12 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,15 @@ 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/base.py: E722
gui/wxpython/dbmgr/dialogs.py: E722
gui/wxpython/dbmgr/sqlbuilder.py: E722
gui/wxpython/dbmgr/manager.py: E722
gui/wxpython/docs/wxgui_sphinx/conf.py: E402, W291
gui/wxpython/gcp/manager.py: E722
gui/wxpython/gui_core/*: E266, E722
gui/wxpython/gui_core/*: E722
gui/wxpython/gui_core/dialogs.py: E722
gui/wxpython/gui_core/forms.py: E722
gui/wxpython/gui_core/ghelp.py: E722
gui/wxpython/gui_core/gselect.py: E266, E722
gui/wxpython/gui_core/preferences.py: E266
gui/wxpython/gui_core/widgets.py: E722, E266
gui/wxpython/image2target/*: F841, E722, E265
gui/wxpython/image2target/g.gui.image2target.py: E501, E265, F841
gui/wxpython/gui_core/gselect.py: E722
gui/wxpython/gui_core/widgets.py: E722
gui/wxpython/image2target/*: F841, E722
gui/wxpython/image2target/g.gui.image2target.py: E501, F841
gui/wxpython/iscatt/*: F841, E722, F405, F403
gui/wxpython/lmgr/frame.py: F841, E722
# layertree still includes some formatting issues (it is ignored by Black)
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
6 changes: 3 additions & 3 deletions .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 All @@ -56,7 +56,7 @@ jobs:
if: ${{ matrix.language == 'c-cpp' }}

- name: Initialize CodeQL
uses: github/codeql-action/init@461ef6c76dfe95d5c364de2f431ddbd31a417628 # v3.26.9
uses: github/codeql-action/init@e2b3eafc8d227b0241d48be5f425d47c2d750a13 # v3.26.10
with:
languages: ${{ matrix.language }}
config-file: ./.github/codeql/codeql-config.yml
Expand All @@ -81,6 +81,6 @@ jobs:
run: .github/workflows/build_ubuntu-22.04.sh "${HOME}/install"

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@461ef6c76dfe95d5c364de2f431ddbd31a417628 # v3.26.9
uses: github/codeql-action/analyze@e2b3eafc8d227b0241d48be5f425d47c2d750a13 # v3.26.10
with:
category: "/language:${{matrix.language}}"
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
4 changes: 2 additions & 2 deletions .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 All @@ -76,7 +76,7 @@ jobs:
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@5cd11c3a4ced054e52742c5fd54dca954e0edd85 # v6.7.0
uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # v6.9.0
with:
push: true
pull: true
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
6 changes: 3 additions & 3 deletions .github/workflows/python-code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
# renovate: datasource=pypi depName=bandit
BANDIT_VERSION: "1.7.10"
# renovate: datasource=pypi depName=ruff
RUFF_VERSION: "0.6.7"
RUFF_VERSION: "0.6.8"

runs-on: ${{ matrix.os }}
permissions:
Expand All @@ -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 Expand Up @@ -135,7 +135,7 @@ jobs:
path: bandit.sarif

- name: Upload SARIF File into Security Tab
uses: github/codeql-action/upload-sarif@461ef6c76dfe95d5c364de2f431ddbd31a417628 # v3.26.9
uses: github/codeql-action/upload-sarif@e2b3eafc8d227b0241d48be5f425d47c2d750a13 # v3.26.10
with:
sarif_file: bandit.sarif

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 .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ repos:
)
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.6.7
rev: v0.6.8
hooks:
# Run the linter.
- id: ruff
Expand Down
4 changes: 1 addition & 3 deletions gui/wxpython/animation/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,9 +465,7 @@ def EvaluateInput(self, animationData):
mapCount.add(len(layer.maps))
windowIndex.append(anim.windowIndex)

if maps and stds:
temporalMode = TemporalMode.NONTEMPORAL
elif maps:
if (maps and stds) or maps:
temporalMode = TemporalMode.NONTEMPORAL
elif stds:
temporalMode = TemporalMode.TEMPORAL
Expand Down
17 changes: 10 additions & 7 deletions gui/wxpython/animation/dialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
import wx
import copy
import datetime

from pathlib import Path

import wx.lib.filebrowsebutton as filebrowse
import wx.lib.scrolledpanel as SP
import wx.lib.colourselect as csel
Expand Down Expand Up @@ -488,7 +491,7 @@ def _create3DPanel(self, parent):
labelText=_("Workspace file:"),
dialogTitle=_("Choose workspace file to import 3D view parameters"),
buttonText=_("Browse"),
startDirectory=os.getcwd(),
startDirectory=str(Path.cwd()),
fileMode=0,
fileMask="GRASS Workspace File (*.gxw)|*.gxw",
)
Expand Down Expand Up @@ -1089,7 +1092,7 @@ def _createDecorationsProperties(self, panel):
labelText=_("Image file:"),
dialogTitle=_("Choose image file"),
buttonText=_("Browse"),
startDirectory=os.getcwd(),
startDirectory=str(Path.cwd()),
fileMode=wx.FD_OPEN,
changeCallback=self.OnSetImage,
)
Expand Down Expand Up @@ -1191,7 +1194,7 @@ def _createExportFormatPanel(self, notebook):
labelText=_("Directory:"),
dialogTitle=_("Choose directory for export"),
buttonText=_("Browse"),
startDirectory=os.getcwd(),
startDirectory=str(Path.cwd()),
)

dirGridSizer = wx.GridBagSizer(hgap=5, vgap=5)
Expand Down Expand Up @@ -1219,7 +1222,7 @@ def _createExportFormatPanel(self, notebook):
labelText=_("GIF file:"),
dialogTitle=_("Choose file to save animation"),
buttonText=_("Browse"),
startDirectory=os.getcwd(),
startDirectory=str(Path.cwd()),
fileMode=wx.FD_SAVE,
)
gifGridSizer = wx.GridBagSizer(hgap=5, vgap=5)
Expand All @@ -1242,7 +1245,7 @@ def _createExportFormatPanel(self, notebook):
labelText=_("SWF file:"),
dialogTitle=_("Choose file to save animation"),
buttonText=_("Browse"),
startDirectory=os.getcwd(),
startDirectory=str(Path.cwd()),
fileMode=wx.FD_SAVE,
)
swfGridSizer = wx.GridBagSizer(hgap=5, vgap=5)
Expand Down Expand Up @@ -1273,7 +1276,7 @@ def _createExportFormatPanel(self, notebook):
labelText=_("AVI file:"),
dialogTitle=_("Choose file to save animation"),
buttonText=_("Browse"),
startDirectory=os.getcwd(),
startDirectory=str(Path.cwd()),
fileMode=wx.FD_SAVE,
)
encodingLabel = StaticText(
Expand Down Expand Up @@ -1572,7 +1575,7 @@ def _export_file_validation(self, filebrowsebtn, file_path, file_postfix):
caption=_("Overwrite?"),
style=wx.YES_NO | wx.YES_DEFAULT | wx.ICON_QUESTION,
)
if not overwrite_dlg.ShowModal() == wx.ID_YES:
if overwrite_dlg.ShowModal() != wx.ID_YES:
overwrite_dlg.Destroy()
return False
overwrite_dlg.Destroy()
Expand Down
5 changes: 3 additions & 2 deletions gui/wxpython/animation/temporal_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"""

import datetime
from operator import itemgetter

import grass.script as gs
import grass.temporal as tgis
Expand Down Expand Up @@ -195,9 +196,9 @@ def GetLabelsAndMaps(self):
# by a temporary dataset, I don't know how it would work with point
# data
if self.temporalType == TemporalType.ABSOLUTE:
timestamps = sorted(list(labelListSet), key=lambda x: x[0])
timestamps = sorted(list(labelListSet), key=itemgetter(0))
else:
timestamps = sorted(list(labelListSet), key=lambda x: x[0])
timestamps = sorted(list(labelListSet), key=itemgetter(0))

newMapLists = []
for mapList, labelList in zip(mapLists, labelLists):
Expand Down
10 changes: 5 additions & 5 deletions gui/wxpython/core/gcmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -645,11 +645,11 @@ def _formatMsg(text):
for line in text.splitlines():
if len(line) == 0:
continue
elif "GRASS_INFO_MESSAGE" in line:
message += line.split(":", 1)[1].strip() + "\n"
elif "GRASS_INFO_WARNING" in line:
message += line.split(":", 1)[1].strip() + "\n"
elif "GRASS_INFO_ERROR" in line:
elif (
"GRASS_INFO_MESSAGE" in line
or "GRASS_INFO_WARNING" in line
or "GRASS_INFO_ERROR" in line
):
message += line.split(":", 1)[1].strip() + "\n"
elif "GRASS_INFO_END" in line:
return message
Expand Down
5 changes: 4 additions & 1 deletion gui/wxpython/core/watchdog.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@

import os
import time

from pathlib import Path

import wx
from wx.lib.newevent import NewEvent

Expand Down Expand Up @@ -59,7 +62,7 @@ def on_modified(self, event):
not event.is_directory
and os.path.basename(event.src_path) == self.rcfile_name
):
timestamp = os.stat(event.src_path).st_mtime
timestamp = Path(event.src_path).stat().st_mtime
if timestamp - self.modified_time < 0.5:
return
self.modified_time = timestamp
Expand Down
7 changes: 6 additions & 1 deletion gui/wxpython/datacatalog/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
import wx
import os

from pathlib import Path

from core.debug import Debug
from datacatalog.tree import DataCatalogTree
from datacatalog.toolbars import DataCatalogToolbar, DataCatalogSearch
Expand Down Expand Up @@ -200,7 +202,10 @@ def OnReloadCurrentMapset(self, event):
def OnAddGrassDB(self, event):
"""Add grass database"""
dlg = wx.DirDialog(
self, _("Choose GRASS data directory:"), os.getcwd(), wx.DD_DEFAULT_STYLE
self,
_("Choose GRASS data directory:"),
str(Path.cwd()),
wx.DD_DEFAULT_STYLE,
)
if dlg.ShowModal() == wx.ID_OK:
grassdatabase = dlg.GetPath()
Expand Down
Loading

0 comments on commit 234761f

Please sign in to comment.