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

wxGUI/mapswipe: fix saving display to file #3185

Merged
merged 2 commits into from
Sep 27, 2023

Conversation

tmszi
Copy link
Member

@tmszi tmszi commented Sep 24, 2023

Describe the bug
Map Swipe tool Save display to file tool doesn't work an prints an error message.

To Reproduce
Steps to reproduce the behavior:

  1. Launch Map Swipe tool g.gui.mapswipe
  2. Display some two comparable maps
  3. Try activate Save display to file tool from the main toolbar
  4. Save display to file
  5. See error
Traceback (most recent call last):
  File "/usr/lib64/grass84/gui/wxpython/core/gthread.py", line 138, in OnDone
    event.ondone(event)
  File "/usr/lib64/grass84/gui/wxpython/core/render.py", line 510, in OnRenderDone
    self.updateProgress.emit(env=event.userdata["env"], layer=self.layer)
  File "/usr/lib64/grass84/etc/python/grass/pydispatch/signal.py", line 233, in emit
    dispatcher.send(signal=self, *args, **kwargs)
  File "/usr/lib64/grass84/etc/python/grass/pydispatch/dispatcher.py", line 343, in send
    response = robustapply.robustApply(
  File "/usr/lib64/grass84/etc/python/grass/pydispatch/robustapply.py", line 60, in robustApply
    return receiver(*arguments, **named)
  File "/usr/lib64/grass84/gui/wxpython/core/render.py", line 813, in ReportProgress
    self.renderDone.emit(env=env)
  File "/usr/lib64/grass84/etc/python/grass/pydispatch/signal.py", line 233, in emit
    dispatcher.send(signal=self, *args, **kwargs)
  File "/usr/lib64/grass84/etc/python/grass/pydispatch/dispatcher.py", line 343, in send
    response = robustapply.robustApply(
  File "/usr/lib64/grass84/etc/python/grass/pydispatch/robustapply.py", line 60, in robustApply
    return receiver(*arguments, **named)
  File "/usr/lib64/grass84/gui/wxpython/mapwin/buffered.py", line 772, in _saveToFileDone
    self.Draw(self.pdc, img=self.textdict[id], drawid=id, pdctype="text")
  File "/usr/lib64/grass84/gui/wxpython/mapswipe/mapwindow.py", line 137, in Draw
    return super(SwipeBufferedWindow, self).Draw(
  File "/usr/lib64/grass84/gui/wxpython/mapwin/buffered.py", line 514, in Draw
    pdc.DrawText(img["text"], coords[0], coords[1])
TypeError: PseudoDC.DrawText(): arguments did not match any overloaded call:
  overload 1: argument 2 has unexpected type 'float'
  overload 2: argument 2 has unexpected type 'float'

Expected behavior
Map Swipe tool Save display to file tool should work.

System description:

  • Operating System: GNU/Linux
  • GRASS GIS version: all
GRASS nc_spm_08_grass7/landsat:~ > python3 -c "import sys, wx; print(sys.version); print(wx.version())"
3.10.13 (main, Sep 16 2023, 22:24:59) [GCC 12.3.1 20230526]
4.2.0 gtk3 (phoenix) wxWidgets 3.2.2.1

@tmszi tmszi added bug Something isn't working GUI wxGUI related backport to 8.3 PR needs to be backported to release branch 8.3 backport to 8.2 PR needs to be backported to release branch 8.2 labels Sep 24, 2023
@tmszi tmszi added this to the 8.3.1 milestone Sep 24, 2023
Copy link
Contributor

@petrasovaa petrasovaa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like there are 2 instances of DrawRotatedText, could you please incorporate the second one as well? (Unless I missed it and it's in another PR)
https://github.com/search?q=repo%3AOSGeo%2Fgrass%20DrawRotatedText&type=code

And there may be some places with DrawText that are not yet updated as well.

@tmszi
Copy link
Member Author

tmszi commented Sep 26, 2023

Looks like there are 2 instances of DrawRotatedText, could you please incorporate the second one as well? (Unless I missed it and it's in another PR) https://github.com/search?q=repo%3AOSGeo%2Fgrass%20DrawRotatedText&type=code

Suggestion incorporated.

And there may be some places with DrawText that are not yet updated as well.

Yes, it is possible, we should detect them by testing.

@tmszi tmszi merged commit 40c3183 into OSGeo:main Sep 27, 2023
18 checks passed
tmszi added a commit to tmszi/grass that referenced this pull request Sep 27, 2023
* wxGUI/psmap: fix wx.adv.PseudoDC() class DrawRotatedText() method x, y
param arg int type
tmszi added a commit to tmszi/grass that referenced this pull request Sep 27, 2023
* wxGUI/psmap: fix wx.adv.PseudoDC() class DrawRotatedText() method x, y
param arg int type
@tmszi tmszi removed backport to 8.3 PR needs to be backported to release branch 8.3 backport to 8.2 PR needs to be backported to release branch 8.2 labels Sep 27, 2023
@tmszi tmszi deleted the wxgui-mapswipe-fix-save-display-to-file branch September 27, 2023 10:44
landam pushed a commit to landam/grass that referenced this pull request Oct 25, 2023
* wxGUI/psmap: fix wx.adv.PseudoDC() class DrawRotatedText() method x, y
param arg int type
neteler pushed a commit to nilason/grass that referenced this pull request Nov 7, 2023
* wxGUI/psmap: fix wx.adv.PseudoDC() class DrawRotatedText() method x, y
param arg int type
HuidaeCho pushed a commit to HuidaeCho/grass that referenced this pull request Jan 9, 2024
* wxGUI/psmap: fix wx.adv.PseudoDC() class DrawRotatedText() method x, y
param arg int type
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working GUI wxGUI related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants