pyfa-org / Pyfa

Python fitting assistant, cross-platform fitting tool for EVE Online
GNU General Public License v3.0
1.6k stars 405 forks source link

Crash on startup #1265

Closed traugdor closed 6 years ago

traugdor commented 7 years ago

Software just completely fails to startup on a forwarded X11 session over SSH

OS version: Ubuntu Server 16.04.3 LTS Python: 2.7.12 wxPython: 3.0.2.0 SQLAlchemy: 1.2.0b2 Logbook: 1.1.0 pyfa version: YC119.7 - v1.30.0

[2017-08-04 18:01:35.704901] CRITICAL: __main__: Exception in main thread: 'PFTabsContainer' object has no attribute 'efxBmp'
[2017-08-04 18:01:35.705103] CRITICAL: __main__:   File "/home/user/Desktop/pyfa/gui/chromeTabs.py", line 1173, in OnPaint
[2017-08-04 18:01:35.705276] CRITICAL: __main__:     mdc.DrawBitmap(self.efxBmp, posx, posy, True)

Issue is able to be reproduced consistently on my system as outlined above. Downgrading any dependencies did not help that I could see.

ThatLurker commented 7 years ago

why are you running it over a forwarded X11 session?

tommyapeldk commented 7 years ago

Same here running locally python 2.7.13 wxpython 3.0.2.0 sqlalchemy 1.1.11 logbook 1.0.0 pyfa master v1.31.0

blitzmann commented 6 years ago

@tommyapeldk can you please post the error that you get as well?

As for this issue... forwarded X11 session. I'm sorry, but I have absolutely no experience in this. @traugdor Approx how long would it take to get a test bed set up using ubuntu server with a ubuntu / debian client? Would you be willing to get with me sometime to walk me through it? Please let me know, and sorry for the late reply!

tommyapeldk commented 6 years ago

Can't copy the text so you'll have to do with a screenshot, sorry. https://imgur.com/a/J8qG3

traugdor commented 6 years ago

You can install Ubuntu Server onto any old machine you have laying around. It's very lightweight and doesn't require any special configuration outside of the normal configuration for a fresh headless Linux installation.

I can explain how I got everything setup and then you can use that to test.

blitzmann commented 6 years ago

@traugdor are you by chance getting the same error when running locally instead of via X11 forwarding?

I am familiar with linux, but extremely unfamiliar with running X11 in a client/server setting, and I've never tunneled it through ssh before. So it would be great if you can supply a quick how to. However, since @tommyapeldk is getting the same error on his local machine, methinks it's not about the X11 forwarding. Will take a look after downloading Ubuntu server and installing on VM, hopefully I can reproduce :)

tommyapeldk commented 6 years ago

No worries, if you need help just give a shout

blitzmann commented 6 years ago

@traugdor @tommyapeldk

I can't reproduce unfortunately, so I'm gonna need some help from you guys. Can you replace the UpdateTabFX() function found on line 1188 in gui/chromeTabs with:

   def UpdateTabFX(self):
        self.tabShadow.SetSize((self.tabMinWidth, self.height + 1))
        fxBmp = self.tabShadow.Render()

        simg = fxBmp.ConvertToImage()
        if not simg.HasAlpha():
            simg.InitAlpha()
        simg = simg.Blur(2)
        simg = simg.AdjustChannels(0.3, 0.3, 0.3, 0.35)

        self.efxBmp = wx.BitmapFromImage(simg)

The error is complaining about self.efxBmp being missing, and UpdateTabFX is where it's created. However there originally is a conditional there that may be blocking it from running (presumably so we don't have to re-draw it if we don't have to - this is old code from years ago, so I'm not 100% sure of the specifics of each line).

If that works for you guys, that's a new clue as to what may be happening, and hopefully I can get a fix ut for it.) Additionally, if either of you have any development experience, feel free to load up pyCharm and use the debugger to try to figure out the cause of it breaking.

tommyapeldk commented 6 years ago

bingo, that worked for me, everything renders now.

blitzmann commented 6 years ago

@tommyapeldk k, well that gives us a hint, but it's not really a fix. That function now runs all the time, instead of when needed (pretty inefficient).

Can you try this:

    def UpdateTabFX(self):
        w, h = self.tabShadow.GetSize()
        if self.efxBmp is None or w != self.tabMinWidth:
            self.tabShadow.SetSize((self.tabMinWidth, self.height + 1))
            fxBmp = self.tabShadow.Render()

            simg = fxBmp.ConvertToImage()
            if not simg.HasAlpha():
                simg.InitAlpha()
            simg = simg.Blur(2)
            simg = simg.AdjustChannels(0.3, 0.3, 0.3, 0.35)

            self.efxBmp = wx.BitmapFromImage(simg)

That should check if efxBmp exists and, if not, create it regardless of if that other check happens.

(you'll also have to add self.efxBmp = None to the __init__() function near line 695, but beneath the wx.Panel.__init__() line, or you can just grab this file and overwrite it https://gist.github.com/blitzmann/df3df56a09e3337dca34f04a99fa5bb7)

tommyapeldk commented 6 years ago

OS version: Linux-4.12.5-gentoo-x86_64-Intel-R-_Core-TM-_i5-4670KCPU@_3.40GHz-with-gentoo-2.4.1 Python: 2.7.13 wxPython: 3.0.2.0 SQLAlchemy: 1.1.11 Logbook: 1.0.0 pyfa version: 1.31.0 Stable - YC119.8 1.0 pyfa root: /home/tommy/pyfa save path: /home/tommy/.pyfa fs encoding: UTF-8

EXCEPTION: 'PFTabsContainer' object has no attribute 'efxBmp'

File "./pyfa.py", line 384, in MainFrame(options.title) File "/home/tommy/pyfa/gui/mainFrame.py", line 178, in init self.additionsPane = AdditionsPane(self.fitting_additions_split) File "/home/tommy/pyfa/gui/additionsPane.py", line 62, in init self.notebook.AddPage(self.drone, "Drones", tabImage=droneImg, showClose=False) File "/home/tommy/pyfa/gui/chromeTabs.py", line 229, in AddPage self.tabsContainer.AddTab(tabTitle, tabImage, showClose) File "/home/tommy/pyfa/gui/chromeTabs.py", line 1208, in AddTab self.AdjustTabsSize() File "/home/tommy/pyfa/gui/chromeTabs.py", line 1269, in AdjustTabsSize self.UpdateTabFX() File "/home/tommy/pyfa/gui/chromeTabs.py", line 1189, in UpdateTabFX if self.efxBmp is None or w != self.tabMinWidth:

blitzmann commented 6 years ago

Use the file that I linked - I realized there were a few other changes that you needed to do before this would work (initializing eftBmp in __init__). That should work

tommyapeldk commented 6 years ago

sorry didn't see that link, I applied the patch and it still works.

blitzmann commented 6 years ago

Sweet, that should do it then. New release will be out tonight :) Thanks for taking the time to help troubleshoot!

tommyapeldk commented 6 years ago

sure no problem, have you comitted to bug/1265 branch yet?

blitzmann commented 6 years ago

yep, just merged into master :)

tommyapeldk commented 6 years ago

sweet, I'll switch back to master then

tommyapeldk commented 6 years ago

ok, back on master and everything works again as expected, thanks for the effort.