Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

d.rast.edit: Fixed E722 in d.rast.edit/ #4568

Merged
merged 2 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ per-file-ignores =
scripts/i.pansharpen/i.pansharpen.py: E722, E501
scripts/r.in.srtm/r.in.srtm.py: E722
scripts/r.fillnulls/r.fillnulls.py: E722
scripts/d.rast.edit/d.rast.edit.py: E722
scripts/v.what.strds/v.what.strds.py: E501
# Line too long (esp. module interface definitions)
scripts/*/*.py: E501
Expand Down
21 changes: 1 addition & 20 deletions scripts/d.rast.edit/d.rast.edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -647,28 +647,9 @@ def update_status(self, row, col):
if self.angles:
self.status["aspect"] = self.angles[row][col]

def force_color(self, val):
run("g.region", rows=1, cols=1)
run("r.mapcalc", expression="%s = %d" % (self.tempmap, val))
run("r.colors", map=self.tempmap, rast=self.inmap)
run("r.out.ppm", input=self.tempmap, out=self.tempfile)
run("g.remove", flags="f", type="raster", name=self.tempmap)

tempimg = wx.Image(self.tempfile)
gs.try_remove(self.tempfile)

rgb = tempimg.get(0, 0)
color = "#%02x%02x%02x" % rgb
self.colors[val] = color
tempimg.delete()

def get_color(self, val):
if val not in self.colors:
try:
self.force_color(val)
except:
self.colors[val] = "#ffffff"

self.colors[val] = "#ffffff"
return self.colors[val]

def refresh_canvas(self):
Expand Down
Loading