-
Notifications
You must be signed in to change notification settings - Fork 11
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
error handling, fix #2 #3
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the invite.
Few comments below.
I have another idea I wanted to run by you. I want to propose to "the community" to create common plugin repository what do you think? |
I don't think having common plugin repository will work well. People have too different coding standards, styles, processes. And it's ok but it won't work well in a single repo with shared ownership. I had ideas about plugin manager in KiCad that would provide central discovery point as well as manage updates, compatibility checks. List of plugins showed there would be centrally managed by KiCad team and to apply to be listed a plugin would have to pass some conformity checks like have predefined format that plugin manager can parse to extract description, version info and other metadata. I think that will work much better in the long run. Once I finalize my proposal I will present it on kicad dev list. |
got it, thank you. one vote down :-) kicad-extra/arkon#1 |
I squashed the commits, perhaps it is easier to live test this pr now. |
I did some testing on both linux and win. Both platforms have their issues with current implementation that I outlined in comments above. I believe this should work:
|
great stuff, thank you. applying your ideas now. |
please test results so far:
wx.CallAfter still crashes here w/o wx.App. likely due to use of build options: current work around is based on:
works, except could not figure out how to auto-resize to fit text
works wow, based on the diagram https://docs.wxwidgets.org/3.0/classwx_message_dialog.html
works |
I dug a bit deeper on the wx.App issue and found this: It boils down to this. You can't do gui stuff from non-gui thread so you need wx.CallAfter, you can't do CallAfter without wx.App so you create one. But then you bork the global wxApp instance reference in c++ land and Kicad event loop never finishes. I guess not much can be done about it on plugin side at the moment so we will have to live with this. I tried to move wx.App() init into plugin method so that new App instance would be garbage collected. Plugin works but that makes things way worse with random crashes in c++ code after plugin finishes 🤣 which is not unexpected given the above.
Yeah, misleading, I know :) I think it's because wxGtk (and probably wxMsw too) use native error boxes that just don't have the needed APIs to handle EndModal and some other things so it's ignored.
Use wx.StaticText instead of TextCtrl and it will autosize properly on sizer.Fit(). |
I just had an idea that instead of trying to coerce gui thread to do what we need with CallAfter() we could do it the old fashioned way - by sending it an event. Some quick googling on the topic popped this great collection of the solutions: Very first one there is detailing the solution I am talking about and it has a great code example too. Keep the dialog around so that you have something to send an event to and treat the event handler as CallAfter() function. |
please review
cool, and @sethhillbrand seems to agree on the following work around
works, thank you
ok, thinking. look at what |
Yeah, it's doing same thing underneath but it's sending the event to App. You can avoid that if you send it to a dialog, that way you don't have to create your own App at all. Also feel free to commit this as is and update to event posting code later if you prefer. Change looks good to me. |
Result so far:
Yes, lets do that for now.
Thank you so much for your support! |
No description provided.