sharppy / SHARPpy

Sounding/Hodograph Analysis and Research Program in Python
https://sharppy.github.io/SHARPpy/index.html
Other
216 stars 112 forks source link

[BUG] QTFont Error results in crashed SHARPpy GUI #240

Open iancornejo opened 2 years ago

iancornejo commented 2 years ago

Before submitting an issue to Github about SHARPpy, please follow the below checklist to ensure that your issue can be resolved quickly.

The management team for SHARPpy is a small team of volunteers. Being as thorough as possible with your issue submission will help us help you!

Describe the bug

I am encountering a problem when trying to load in sounding data into the GUI. I've tested this with custom data and with sounding data from http://weather.ou.edu/~dscg1/sounding/. The crash has something to do with qtpy or the configuration of my computer but not certain. I was able to run this approximately one month ago (April 2022) with no problems.

To Reproduce

  1. Open Anaconda Prompt
  2. "Conda Activate sharppy"
  3. "sharppy --debug"
  4. Decline downloading new version (1.4) of sharppy. I already have 1.4 running and am not sure why I'm still getting this error.
  5. See window with map of sounding sites in the US.
  6. Click File and Open.
  7. Select sounding file.
  8. Another blank window opens, then crashes.

Expected behavior Expectation is to load in the sonde data and display the GUI

Screenshots

image image

Versioning Information (please complete the following information):

**

Additional context I am running conda 4.8.5. I was also able to replicate this problem using miniconda on an Ubuntu 5.10.102.1-microsoft-standard-WSL2 on the same machine. The steps are the same with the exception of opening a Xlauncher to create a window.

JeauxyPatton commented 2 years ago

I am also experiencing this same issue with a fresh install in a new conda environment. Also running Windows 11, and I'm also getting the error message about updating the v1.4.0 although I have already installed that version. Can't open any soundings from any source and it immediately crashes the program. Thought I was going crazy!

keltonhalbert commented 2 years ago

Hi Ian and Joey, sorry about the issues! Looks like you aren't the only ones, something in Qt isn't behaving nicely with bold fonts. The good news, is that it's an easy fix. The bad news, is that for right now, it requires a manual fix.

If you go to line 277 of sharppy/viz/winter.py, you should see this:

    def drawPrecipType(self, qp):
        big = QtGui.QFont('Helvetica', round(self.hgt * self.font_ratio) + 5, bold=True)

Remove the bold=True argument such that it looks like this:

    def drawPrecipType(self, qp):
        big = QtGui.QFont('Helvetica', round(self.hgt * self.font_ratio) + 5)

Not exactly elegant until we can push the fix to the master branch, but it should work. In your case Ian, the file is located at C:\Users\IanCornejo\anaconda3\envs\sharppy\viz\winter.py

resmaili commented 2 years ago

Yeah, agreed, this fixed the issue when I reproduced the error in a Windows 11 WM. I'm working on pushing the changes. In the meantime you can use Kelton's fix. You can also turn off the 'newer version of SHARPpy is available.' by commenting out ln 1208-1219 in python setup.py install in runsharp/full_gui.py.

iancornejo commented 2 years ago

Thank you both. Adding onto Kelton's response and for future viewers of this thread, you also need to remove "bold = False" in line 288 of winter.py.

From: small = QtGui.QFont('Helvetica', round(self.hgt * self.font_ratio) -1 , bold = False)

To: small = QtGui.QFont('Helvetica', round(self.hgt * self.font_ratio) -1)

I'm not sure if this is a related bug or if I should open up a new thread, but when I open up a skew-T on the GUI via anaconda prompt, it's really low resolution making it hard to read some of the text. When I open it on my Ubuntu WSL, it's high resolution but the font is blown up. Not sure if it's due to the configuration of my computer for the anaconda prompt method, the configuration of my VcXsrv when I use my ubuntu WSL, or something within SHARPpy. Here are the same soundings but through different methods.

Anaconda Prompt Method low_res

Ubuntu WSL method

test

Let me know if I should start a new thread for this issue. I appreciate all the help.