Open aussieBIMguru opened 4 weeks ago
Example of the appearance vs toast.
Is it possible this is not a bug @aussieBIMguru Toast notification can be deactivated in Windows (at least this is what I have done on my setup long ago) https://answers.microsoft.com/en-us/windows/forum/all/windows-10-toast-notification/39677a5b-8a73-4c27-91fb-d377c5f04a4a
Yes in this case I've managed to get the toast forms triggering in lower versions on the same machine so I'm fairly sure it's pyRevit related. No errors trigger, it just doesn't show any toast notification when ran. I can get NotifyIcon() to work which is supressed similarly to toast if the user opts out of notifications.
Thanks @aussieBIMguru for the code sample! Some observations:
BalloonMessage
warning
instead of warnIcon
and use a more concise self.icon = ToolTipIcon.Warning if warning else ToolTipIcon.Info
click_callback
argument in the __init__
method in place of the filePath
and urlPath
, then in the on_click
method just call self.click_callback()
if it is not None
.And now that I get a better look at it, this could be turned into a function, no need to overengineer things! Just extract the show
method and add the parameters there 😉
Thanks! I'm not overly familiar with the pyRevit conventions and PR system but will do some research and put something forward in the forms library once I've got my head around it. It does load in some windows libraries to support dependency which have a slight speed hit in my experience, but can't see how to avoid that.
There still are no pyRevit conventions per se, I just trying to enforce best practices in the python world, but I understand that, given the intersection between python and c#, there is some style mixup... for now the important thing is to be consistent within your code: there's no place for underscores when you use camelCase and PascalCase, as snake_case is all lowecase.
For the PR:
Most of this can be done in Visual Studio Code, if you use that.
Yes that's moreso what I mean, need to spend some time figuring out the style of pyRevit. I've developed some habits (some good, some not) managing my own extension.
Personally I use camel after snake for functions as I find myself needing multiple words to describe the function beyond the primary object but I'll look at this when time allows to put it into a closer style at the least. Pascal for classes, camel for local variables and snake without camel for global variables. It's close to the typical but I appreciate not quite in line with industry style.
I generally use pyCharm but am familiar with VS/git systems as of late. It'll likely be a ways off as just trying to get my company code working before I get back to this but will see how I go. Thanks for the tips! I haven't found any other issues really aside from Microsoft Interop not working in NetCore forcing me back to csv for me (xlrd has issues with reading special characters), but will let the team know if I find anything else. Really nice work getting it 99% of the way there as a team!
Looks like the toast got burnt in pyRevit5!
Just leaving this here if it helps. I noticed in pyRevit 5 toast forms do not seem to trigger. From what I understand of the toast form it depends on another code library packaged into pyRevit that I suspect isn't netcore compatible.
I found the windows balloonforms work and can generate a pretty similar outcome, maybe below code might help the team if the toast form is difficult to reimplement. The main drawback is it's a bit less pretty and doesn't support the dictionary list for buttons like toast did.
The on click function is a bit rudimentary that I've built - attempts to support filepath/urlpath open on clicking the form generally vs giving the user extra buttons with tooltip to describe this being the behavior of doing so.