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

[Bug] Menu icon shift #2078

Closed
kikislater opened this issue Jan 10, 2022 · 31 comments
Closed

[Bug] Menu icon shift #2078

kikislater opened this issue Jan 10, 2022 · 31 comments
Labels
bug Something isn't working
Milestone

Comments

@kikislater
Copy link
Contributor

Describe the bug
Icons are not in the right place making GUI unusable

To Reproduce
Steps to reproduce the behavior:

  1. Install GRASS 7.8.7 under archlinux based distribution with the following parameters
# Maintainer: Sylvain POULAIN <sylvain dot poulain at giscan dot com>
# Contributor: Doug Newgard <scimmia at archlinux dot org>
# Contributor: Maciej Sieczka <msieczka at sieczka dot org>

pkgname=grass
pkgver=7.8.7B1
pkgrel=1
_shortver=${pkgver%.*}; _shortver=${_shortver/./}
pkgdesc='Geospatial data management and analysis, image processing, graphics/maps production, spatial modeling and visualization'
arch=('i686' 'x86_64')
url='http://grass.osgeo.org/'
license=('GPL')
depends=('bzip2' 'cairo' 'fftw' 'fontconfig' 'freetype2' 'gcc-libs' 'gdal' 'geos' 'glibc' 'glu'
         'libpng' 'libtiff' 'libx11' 'libgl' 'netcdf' 'pdal' 'proj' 'python-gdal' 'python-numpy'
         'python-pillow' 'python-wxpython41' 'readline' 'zlib' 'zstd')
makedepends=('libxt')
optdepends=('postgresql: PostgreSQL database interface'
            'sqlite: SQLite database interface')
#source=("http://grass.osgeo.org/grass$_shortver/source/$pkgname-$pkgver.tar.gz")
source=("https://github.com/OSGeo/grass/archive/refs/heads/releasebranch_7_8.zip")
md5sums=('SKIP')

build() {
  mv $pkgname-releasebranch_7_8 $pkgname-$pkgver
  cd $pkgname-$pkgver

  # Ancient autoconf used upstream can't handle CPPFLAGS correctly, so set CPP to ignore warnings
  CPP="gcc -E -w" \
  ./configure \
    --prefix=/opt/$pkgname \
    --with-freetype-includes=/usr/include/freetype2 \
    --with-wxwidgets \
    --with-readline \
    --with-pthread \
    --with-netcdf \
    --with-nls \
    --with-geos \
    --with-postgres \
    --with-pdal \
    --with-bzlib \
    --with-zstd

  LC_ALL=C
  make
}

package() {
  cd $pkgname-$pkgver

  make exec_prefix="$pkgdir/usr" INST_DIR="$pkgdir/opt/$pkgname" install

  # Install linker config file, needed for qgis to find grass
  install -d "$pkgdir/etc/ld.so.conf.d/"
  echo "/opt/$pkgname/lib" > "$pkgdir/etc/ld.so.conf.d/$pkgname.conf"

  cd "$pkgdir/opt/$pkgname"
  # Put freedesktop.org files in correct location
  mv share "$pkgdir/usr"

  # Fix some paths that get hard coded by make install
  sed -i "s|$pkgdir||g" demolocation/.grassrc$_shortver \
                        include/Make/{Platform,Grass}.make \
                        etc/fontcap \
                        "$pkgdir/usr/bin/grass$_shortver"
}
  1. Launch GRASS Sector/Region
  2. Watch strange icons arrangement => screenshot below

Expected behavior
Icons fit the right place with right mouse hover

Screenshots
If applicable, add screenshots to help explain your problem.

image

System description (please complete the following information):

  • Operating System: Manjaro Linux x86_64
  • GRASS GIS version
g.version -rge
version=7.8.7dev
date=2022
revision=f08edf6
build_date=2022-01-10
build_platform=x86_64-pc-linux-gnu
build_off_t_size=8
libgis_revision=2022-01-10T15:37:02+00:00
libgis_date=2022-01-10T09:00:00+01:00
proj=8.2.0
gdal=3.4.0
geos=3.9.1
sqlite=3.37.0
$ python3 -c "import sys, wx; print(sys.version); print(wx.version())"
3.10.1 (main, Dec 18 2021, 23:53:45) [GCC 11.1.0]
4.1.1 gtk3 (phoenix) wxWidgets 3.1.5

Additional context
It doesn't happen with GRASS 8.0.0RC1 (screenshot below)
image

@kikislater kikislater added the bug Something isn't working label Jan 10, 2022
@veroandreo
Copy link
Contributor

See #2040 for reference. Seems the same issue. Maybe wxpython or wxwidgets didn't get the fixes yet (?)

@kikislater
Copy link
Contributor Author

Hum ok, That's what I was looking for but I didn't find it unfortunately ...

@tmszi
Copy link
Member

tmszi commented Jan 10, 2022

Yes it is related to Python 3.10 version and wxPython 4.1.1 (last official release is from 2020-11-21 00:00) in this case. The release of the new version will probably take some time.

I think it would be good to inform users what combination of Python and wxPython will allow the G7/G8 version to work through our website (not all users are able to apply wxPython patches).

@kikislater
Copy link
Contributor Author

I think it would be good to inform users what combination of Python and wxPython will allow the G7/G8 version to work through our website (not all users are able to apply wxPython patches).

Agreed with that. IMO from user experience, these wx bugs are annoying

@veroandreo
Copy link
Contributor

Yes it is related to Python 3.10 version and wxPython 4.1.1 (last official release is from 2020-11-21 00:00) in this case. The release of the new version will probably take some time.

I think it would be good to inform users what combination of Python and wxPython will allow the G7/G8 version to work through our website (not all users are able to apply wxPython patches).

Agreed! Would you mind helping out with a small text snippet regarding which python/wxpython versions work well with which GRASS versions? An advise for advanced users might be worth it as well.

@petrasovaa
Copy link
Contributor

A simple advice is to use Python <= 3.9. If you need Python >= 3.10, you need latest GRASS and latest wxPython. WxPython daily snapshots for Mac and Windows are available here, for linux you need to compile wxPython yourself.

@kikislater
Copy link
Contributor Author

So I rebuild python-wxpython 4.1.1 with this patch : wxWidgets/Phoenix@aa3dca0 as suggested in other linked issue
Then rebuild grass and ... it doesn't work ! Icons are still shifted whereas in 8 it works.

Grass 8.0.0RC1 doesn't work better in Archlinux based distributions :

  • Problem with extensions : g.extension.all -f is broken
  • GRASS scripts like v.triangle have a grass 7 check. They need to be updated. So no stable usage at this time
  • Building QGIS with GRASS 8 and QGIS will not find GRASS
  • No single UI or I didn't find the option to enable it

@veroandreo
Copy link
Contributor

* Problem with extensions :  `g.extension.all -f` is broken

Would you please open a separate bug report for this and set the 8.0.0 milestone

* GRASS scripts like v.triangle have a grass 7 check. They need to be updated. So no stable usage at this time

Which GRASS version is this module or add-on from? I do not find it in core or addons lists. In any case, the version checks for addons are a work in progress and ideally addon authors should take care of that. If this is not in GRASS official repo, you could report with the author.

* Building QGIS with GRASS 8 and QGIS will not find GRASS

Maybe this could be reported/requested in QGIS too. IIRC it was a hardcoded thing. For the GRASS plugin though, you can customize the GRASS version you want

* No single UI or I didn't find the option to enable it

This is only available in main branch, so you'd need to compile that one. It's planned for 8.2 release

@petrasovaa
Copy link
Contributor

So I rebuild python-wxpython 4.1.1 with this patch : wxWidgets/Phoenix@aa3dca0 as suggested in other linked issue Then rebuild grass and ... it doesn't work ! Icons are still shifted whereas in 8 it works.

There are many more patches needed... I think this one is an important one as well.

@tmszi
Copy link
Member

tmszi commented Jan 10, 2022

* Problem with extensions :  `g.extension.all -f` is broken

Reinstallation of composed addons such as wx.metadata (multiple modules) is problematic and doesn't work.

@neteler
Copy link
Member

neteler commented Jan 10, 2022

See #2040 for reference. Seems the same issue. Maybe wxpython or wxwidgets didn't get the fixes yet (?)

You can locally patch your wxpython installation with wxWidgets/Phoenix@aa3dca0

If it helps (very likely, as it did for me), then pls tell the wxpython maintainer in archlinux to patch the wxpython package accordingly. As @petrasovaa says, many more patches are needed. You may cherry-pick them from here: https://src.fedoraproject.org/rpms/python-wxpython4/commits/rawhide

@neteler
Copy link
Member

neteler commented Jan 10, 2022

So I rebuild python-wxpython 4.1.1 with this patch : wxWidgets/Phoenix@aa3dca0 as suggested in other linked issue Then rebuild grass and

BTW: AFAIK no need to recompile GRASS when fixing wxpython. It will run out of the box (or not).

@kikislater
Copy link
Contributor Author

@veroandreo : Thank you, I will report g.extension bug but @tmszi already says it will not work. It was just an alert from grass 7 that we have to rebuild extensions so should it be ignored in 8's version ?
For grass scripts, there are only fews and minor editing is needed : https://github.com/amuriy/GRASS-scripts
Ok for the main Ui, it's a bit confusing as it seems to be the main feature users would like to test with 8

@petrasovaa : it works now ! Thanks
@neteler : Thanks, it works with more patches like said above without rebuilding grass. BTW, building GRASS is not that long nowaday (we have more powerfull laptops/desktops) ...

@kikislater
Copy link
Contributor Author

But there is something disturbing :
wxPython is released as 4.1.1 ... no new version since this one, so advising about wxPython not released is more than confusing. All distribution will be break for GRASS and not be able to run GRASS GIS ...

@neteler
Copy link
Member

neteler commented Jan 10, 2022

If you refer to https://github.com/wxWidgets/Phoenix/releases then I don't know. You find the current releases actually here:
https://pypi.org/project/wxPython/#history

Check the commit history, there are plenty of recent improvements (and some even came from @petrasovaa!):
https://github.com/wxWidgets/Phoenix/commits/master

All distribution will be break for GRASS and not be able to run GRASS GIS ...

Not exactly: e.g. in Fedora the shipped version is wxPython 4.0.7, with plenty of backports. It works quite nicely and reported issues have been quickly fixed. See here that many distros still stick to wxPython 4.0.7: https://repology.org/project/python:wxpython/versions

@kikislater
Copy link
Contributor Author

I was referring to https://wxpython.org/
WxWidgets is too confusing for me ^^ I never understood this break between 4.0.7 and newer version as some consider 4.1.1 to be a development version

@nilason
Copy link
Contributor

nilason commented Jan 10, 2022

It is changes in Python 3.10 that triggers these problems, independent of wxPython version.
Please see wxWidgets/Phoenix#2038 for discussion.

@tmszi
Copy link
Member

tmszi commented Jan 11, 2022

Agreed! Would you mind helping out with a small text snippet regarding which python/wxpython versions work well with which GRASS versions? An advise for advanced users might be worth it as well.

Supported Python / wxPython versions

Python / wxPython version GRASS GIS 7.8.6 GRASS GIS 8.0.0 RC1
Python <= 3.9 / wxPython = 4.0.7.post2 gtk3 (phoenix) wxWidgets 3.0.5 1 work work
Python <= 3.9 / wxPython = 4.1.1 gtk3 (phoenix) wxWidgets 3.1.5 1 work work
Python = 3.10 / wxPython = 4.0.7.post2 gtk3 (phoenix) wxWidgets 3.0.5 1 doesn't work doesn't work
Python = 3.10 / wxPython = 4.1.1 gtk3 (phoenix) wxWidgets 3.1.5 1 doesn't work doesn't work
Python = 3.10 / wxPython = last code from master git branch 2 doesn't work 3 work

1 offcial wxPython release without patches
2 require self compilation
3 require self compiled last code from releasebranch_7_8 git branch

How to detect the Python / wxPython version?

tomas@gentoo-gnu-linux:~$ python -c "import sys, wx; print(sys.version, wx.version())"
3.9.9 (main, Dec  5 2021, 18:02:20) 
[GCC 11.2.0] 4.0.7.post2 gtk3 (phoenix) wxWidgets 3.0.5

Python 3.9.9 version
wxPython 4.0.7.post2 gtk3 (phoenix) wxWidgets 3.0.5 version

wxPython self compilation (universal way)

wxPython self compilation (OS GNU/Linux) require compiler collection (gcc, gcc-c+...) to be installed and last wxPython code from master git branch. After the compilation process is complete, Python binary wheel file wxPython-4.1.2a1-cp310-cp310-linux_x86_64.whl is created for installation in an isolated virtual Python environment.

tomas@gentoo-gnu-linux:~/src/wxpython-master-branch$ git clone https://github.com/wxWidgets/Phoenix.git 

tomas@gentoo-gnu-linux:~/src/wxpython-master-branch$ cd Phoenix/

tomas@gentoo-gnu-linux:~/src/wxpython-master-branch$ git submodule update --init --recursive

tomas@gentoo-gnu-linux:~/src/wxpython-master-branch/Phoenix$ python3.10 -m venv ../venv 

tomas@gentoo-gnu-linux:~/src/wxpython-master-branch/Phoenix$ source ../venv/bin/activate && pip install sip==5.5.0

(venv) tomas@gentoo-gnu-linux:~/src/wxpython-master-branch/Phoenix$ python build.py dox etg --nodoc sip build

(venv) tomas@gentoo-gnu-linux:~/src/wxpython-master-branch/Phoenix$ python setup.py bdist_wheel --universal

(venv) tomas@gentoo-gnu-linux:~/src/wxpython-master-branch/Phoenix$ pip install dist/wxPython-4.1.2a1-cp310-cp310-linux_x86_64.whl

(venv) tomas@gentoo-gnu-linux:~/src/wxpython-master-branch/Phoenix$ python -c "import wx; print(wx.version())"
4.1.2a1 gtk3 (phoenix) wxWidgets 3.1.5

@kikislater
Copy link
Contributor Author

kikislater commented Jan 11, 2022

Python <= 3.9 / wxPython = 4.0.7.post2 gtk3 (phoenix) wxWidgets 3.0.5 1

7.8.6 runs as well with Python <= 3.9 / wxPython = 4.1.1 / wxWidgets 3.0.5 1
I know it's not common but we had no issue with it !

@kikislater
Copy link
Contributor Author

kikislater commented Jan 11, 2022

And >= 7.8.5 needs wxPython 4.1.1 otherwise you fall into this issue : #1261

@neteler
Copy link
Member

neteler commented Jan 11, 2022

And >= 7.8.5 needs wxPython 4.1.1 otherwise you fall into this issue : #1261

Did you already try with the current release_branch_7_8 (upcoming 7.8.7)? Several GUI fixes have been done, for me it works fine with the enhanced wxpython 4.0.7 (Fedora 35).

@kikislater
Copy link
Contributor Author

kikislater commented Jan 11, 2022

yes it was mentionned in post 1 of this thread inside quoted PKGBUILD (bash script to build package on archlinux). But we don't have backports of patches you have in fedora 35 for wxpython 4.0.7

source=("https://github.com/OSGeo/grass/archive/refs/heads/releasebranch_7_8.zip")

But now everything (7.8.7 from yesterday) is ok since I patched wxpython 4.1.1 as mention above. I will stay with this version at this time as :

  • 8.0.0RC1 don't have single window and it still confuse with g.extension in this version,
  • Qgis support (even if I succeed to build it for 8 but Qgis CMake files still have grass 6, may be it's time to suggest to remove it or not ... But what I saw is removing grass support inside qgis so may be useless to push some modifications),
  • and some grass scripts I use still works with 7

@tmszi
Copy link
Member

tmszi commented Jan 11, 2022

* 8.0.0RC1 don't have single window and it still confuse with g.extension in this version,

If you want try experimental single window mode, you have to compile GRASS GIS dev main git branch (this functionality is not planned for version 8.0.0) as mentioned above.

Could you specify exactly what you have a problem with the g.extension module?

@neteler neteler added this to the 7.8.7 milestone Jan 13, 2022
@neteler neteler modified the milestones: 7.8.7, 7.8.8 Jan 20, 2022
@kikislater
Copy link
Contributor Author

kikislater commented Jan 24, 2022

Hi All,

Finally, WxPython 4.1 wasn't a solution ... Grass works well with it but it breaks others softwares like filezilla. Filezilla even dev branch doesn't build with wxgtk > 3.0.5. Filezilla consider (as well for Archlinux) that WxWidgets 3.1.5 and WxPython 4.1.1 is a development version ...
So Grass works but it breaks other software, not only filezilla ! (mediainfo, gnuplot, poedit, audacity among others.

Edit :

And I tried backporting patch to 4.0.7 but fail with same issue : #2019 as @petrasovaa said, it needs 4.1 ... Finally no solution !

@kikislater
Copy link
Contributor Author

kikislater commented Mar 8, 2022

Still happen in grass 8.0.1 on layer tab with WxWidgets 3.1.5 and WxPthon 4.1.1 :

image

@neteler
Copy link
Member

neteler commented Apr 29, 2022

@kikislater can you please try with 8.2.0RC2?

@neteler neteler modified the milestones: 7.8.8, 7.8.9 May 13, 2022
@kikislater
Copy link
Contributor Author

Do you mean RC1 ? I couldn't find RC2

@kikislater
Copy link
Contributor Author

problem still occur but now I found the culprit, problem is in wxpython flatnotebook.py, some values are still float. Errors could be shown in console output. I will a push a PR and will report here

Example with grass 8.0.2

Before :

image

image

After :

image

image

@neteler
Copy link
Member

neteler commented May 17, 2022

Perhaps the offending line in your version of flatnotebook.py needs to be

dc.DrawText(pc.GetPageText(tabIdx), int(posx + textOffset), imageYCoord)

Here are patches applied in the Fedora version which are AFAIK also merged in upstream:
https://src.fedoraproject.org/rpms/python-wxpython4/blob/b8b9030f9a6d1ee1ac443280e578cfac782df451/f/587f3418f2b772cfd24686f4448a29f340791e6b.patch

@kikislater
Copy link
Contributor Author

Mine was also be patched with this commit => wxWidgets/Phoenix@aa3dca0

Others lines needs to be modified :

$ cat flatnotebook.py | grep dc.DrawText
        mem_dc.DrawText("Opened tabs:", txtPt.x, txtPt.y)
        dc.DrawText(pc.GetPageText(tabIdx), posx + textOffset, imageYCoord)
        dc.DrawText(pc.GetPageText(tabIdx), int(posx + textOffset), imageYCoord)
        dc.DrawText(pc.GetPageText(tabIdx), posx + textOffset, imageYCoord)
        dc.DrawText(pc.GetPageText(tabIdx), posx + textOffset, imageYCoord)
        dc.DrawText(pc.GetPageText(tabIdx), posx + textOffset, imageYCoord)
        dc.DrawText(pc.GetPageText(tabIdx), posx + textOffset, int(imageYCoord))

@kikislater
Copy link
Contributor Author

So finally, I got it !

In Manjaro / Archlinux, we have the release of wxpython 4.1.1 in AUR (Arch User Repository) but these patches need to be added :

wxWidgets/Phoenix@aa3dca0
wxWidgets/Phoenix@f5a55e6
wxWidgets/Phoenix@d972511

Usable PKGBUILD available here : https://github.com/giscan/AUR/tree/main/python-wxpython-dev

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants