-
-
Notifications
You must be signed in to change notification settings - Fork 1
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
Improving the readability through minor changes to structure #6
base: master
Are you sure you want to change the base?
Conversation
This just does some more reorganisation for pattern recognition for future changes (HINT: Possibly improved way to do reimports cleanly)
You could implement the function into your base utill or something to reduce the ugly multi-line reimport being done. I may have not have considered you would need to reimport the module containing the reimport function but even then, you can reduce every multi line import to two lines of 1 reimporting the other modules, and 2: reimporting explicitly the module containing the reimport so x amount of lines becomes 2 lines unless you wish to indent the list of modules being requested to re-import as such: From: ` importlib.reload(utils) importlib.reload(events) importlib.reload(manifest) importlib.reload(error) ` To: ` ReImport_List(utils, events, manifest, error, ...) importlib.reload(ReImport_List_Base_Module_Thing)`
I did this in two separate pull requests to allow you to choose which you prefer as for your layout it may not be what you wish to do so you to you mate. I know that for my utilities I will definitely be adding that method in as I do like the concept of refreshing the modules on runs. Edit: I still clearly dont know how to use github, This is just one pull, you can replace the akward import function with the imports in the comment i made above to return it to normal. |
Possibly just check the Commits tab to see what i ment to show |
This commit expands upon the past few by relocating some comments and shifting a few commands to allow readability to be greatly increased. The arbitrary "NAME" variable that is only used once now gets a complement: "VERSION" which makes the button def look nicer and make it clear what is happening. In my version on fusion i also made one called "CHECKBOX_DESCRIPTION" which contained: "Enables or disables the movement of components by dragging in the canvas." which only further increases the readability but is too pointless to put into a commit
If you are curious, The reason I am slowly submitting portions is I do not adhere to python code standards, for example: I enjoy having some same line comments or reducing a "else: \n return False" to "else: return False" because it makes it more readable and less bloated in many cases (IMO) etc etc so i have to translate my bad code to be in line with the standard set fourth by you. I also prefer tabs over spaces, python can suck it. C# > python If you find any errors, id be happy to send you the source code i am working on as i test each and every change i make to your code to ensure it still has full functionality |
UPDATE: I have tossed that "ReImport_List" method into your "utils" file and called it as so: from .thomasa88lib import utils, events, manifest, error and i have not seen any change in behaviour which means it functions as intended. I also had to import "importLib" in your utils so i can reference it obviously. This allows me to remove the import of it from the command script all together Im starting to question reimporting modules which will already be freshly imported on the line literally just above it though. You would want to make this a function or something callable so you can refresh when you desire but i dont see any point since you would need to refresh the command anyhow to see changes which means you will always be using the most up to date modules unless you intend on creating a refresh button separately from this command but as that is a project i am currently working on, this is not the way to do it. |
Hi @Zxynine, unfortunately I don't have much time to spend on the Fusion 360 add-ins and as I don't use NoComponentDrag myself, it far down on the priority list. If you want to improve on this add-in, I'm happy if you do a (better :) ) fork. There have been several complaints about errors from users (Issue: #7 , App comment: https://apps.autodesk.com/FUSION/en/Detail/Index?id=9024622425935165907&appLang=en&os=Win64 ). So if you want to release an improved version, I'm all for it, whether its under a new name or the same name (I hope I can ask Autodesk to allow you to publish the add-in in the same name, in that cas.) |
I will probably take you up on that offer! I have been working on my own addin creator to replace all of fusions since i hate it and your command was one of the first i ended up converting. While i did it, i noticed that I dont think your event queue actually delays anything. You just stacked up a couple commands and they would fire in order and that worked for the "fusion workspace not ready when launching" but it only did so because you gave the app some paperwork to do while it loaded its workspace. When i cut down on the load time, the issue came back and I had to design a threading manager for my app (since i had no clue how yours works). I think thats whats going on with all of the new errors people are having. |
If you want, you can check out my current version here- https://github.com/Zxynine/NoComponentDrag EDIT: Also the problem of documentactivated handler has been fixed apperently, I just tried it today I was consistantly getting replies from your document activated command in nocomponent drag. |
Regarding the event queue: My assumption was that Fusion had queued some function calls/events that needed to be done before I could set my own things up. I still believe that my function does put the actions as the end of the Fusion event queue/loop (but I might be wrong), but that my initial assumption was wrong. I thought that I could just let Fusion run some queued functions while in reality I should have waited for some time. Workspace activation: Thanks for reporting your results. That solution looks a lot more correct than the "random" waiting. Regarding the add-in: I have no problems removing my version from the app store in case you feel like publishing a version, but if I understand you correctly, you don't want to maintain a separate add-in, but rather as a sample as part of your add-in tools? |
Hey, so part of what i mean regarding the add in is that it just feels wrong to publish it under my name since I didn't originally create it, i just helped a bit after it finished. With that said, when I was telling my girlfriend about this she though it was dumb for me not to since it would be great on my resume. So we can probably work it out but with finals happening right now im too stressed to think about all of that lol. Ill reach out to you about it in a little bit and we can sort the specifics out then if that's alright. I changed the "readme.md" file in my branch to reflect how I will probably have it should we swap primary matenence if you want to check it out. |
That sounds good. All I will require is that you mention me once, and I'm good! Actually, I actually prefer my name not to be a link - keeps me somehow more distanced from the Internet. Let's sync when you have time. :) I might check out your framework in the future. |
So I was cleaning up my custom event manager and I looked at the comments in Nocomponent drag.
That probably comes from you having the check environment function in the handlers which get put into separate threads. I think I just finished up my finals so Im down to work anything out we need to now. I removed your linked name from my readme and replaced it with just your name as you normally had it (I totally get distancing yourself from the internet a bit haha), let me know if there's any other changes you would like. I included my ko-fi link in place of yours, but the links to your addins and github are still included at the bottom, Ill probably keep them and put mine along side them since its hard to find fusion addins anywhere. |
Ah, I see. Thanks for clearing that up.
My impression is that all events are run on the main thread, through a main loop or message queue. I do create threads for the custom events, but they only call fireCustomEvent(), which I think would put an event in the event queue to run in the main loop.
Looks totally fine to me! Would you like to take over publishing NoComponentDrag on the app store? (Just to be clear, it is a bit of a hassle, with all the fields to fill and the reviewers making odd requests before you can publish. However, once you get OK once, updates are usually easy to get through the review). https://apps.autodesk.com/FUSION/en/Detail/Index?id=9024622425935165907&appLang=en&os=Win64 |
I checked it out and it does seem like a bit of a pain, but I actually got my whole account set up to be able to post addins now so I feel like this would be a great learning experence! I wish we could just hit a button like how github has it to transfer, but of course with fusion it can never be that easy smh. Ill head over and start getting a draft ready to publish to the app store. |
Would you be okay if I change the liscence from MIT to the GNU GPL 3? I find it more ideal as an individual who is posting software since it requires alterations to be marked as such so not to be confused with the original. Sort of like how I have it marked on the read me that you originally made it. |
app store: Great! Should we continue this conversation in e-mail? Can you contact me on thomasa88 on gmail? I think the next step is that I inform Autodesk that you will publish an "app" in the same name and mine shall be removed (or if they can just transfer app ownership). License: I hereby grant you to change the license of NoComponentDrag code retrieved from github.com/thomasa88 to GPLv3, as you and I are the sole authors of the code. However, I'm pretty sure the Autodesk publisher agreement has a clause about not publishing add-ins with a license that could risk them having to expose their source code. I'm not saying that GPLv3 does that, but I think that Autodesk do. Did a quick Google for the publisher agreement, so I cannot swear that these are the latest docs: https://apps.autodesk.com/en/Publisher/TermsAndConditions?forceshow=True Paragraph 1.17 (from Definitions)
Paragraph 6:
|
You could implement the function into your base utill or something to reduce the ugly multi-line reimport being done. I may have not have considered you would need to reimport the module containing the reimport function but even then, you can reduce every multi line import to two lines of 1 reimporting the other modules, and 2: reimporting explicitly the module containing the reimport so x amount of lines becomes 2 lines unless you wish to indent the list of modules being requested to re-import as such:
From:
importlib.reload(utils)
importlib.reload(events)
importlib.reload(manifest)
importlib.reload(error)
To:
ReImport_List(utils, events, manifest, error, ...)
importlib.reload(ReImport_List_Base_Module_Thing)