-
Notifications
You must be signed in to change notification settings - Fork 635
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
Dynamo Package Dependency View Extension #9787
Conversation
I found adding extension project inside Dynamo repo is such a pain 👎 Localization resources seems a must-have and now getting this error which I have never encountered myself. Had no clue comparing with other view extensions and stackoverflow, will continue to look at the error |
src/PackageDependencyViewExtension/PackageDependencyViewExtension.csproj
Outdated
Show resolved
Hide resolved
src/PackageDependencyViewExtension/PackageDependencyView.xaml.cs
Outdated
Show resolved
Hide resolved
src/PackageDependencyViewExtension/PackageDependencyViewExtension.cs
Outdated
Show resolved
Hide resolved
this is getting cool. |
1. Using ready param instead of data context 2. Exposed workspace cleared event for extension to watch for and clear dependency data
src/PackageDependencyViewExtension/PackageDependencyView.xaml.cs
Outdated
Show resolved
Hide resolved
@QilongTang you might have missed moving |
@aparajit-pratap It is moved already, see my picture shot in PR discription |
currentWorkspace = p.CurrentWorkspaceModel as WorkspaceModel; | ||
p.CurrentWorkspaceChanged += OnWorkspaceChanged; | ||
p.CurrentWorkspaceCleared += OnWorkspaceCleared; | ||
currentWorkspace.PropertyChanged += OnWorkspacePropertyChanged; |
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.
you need to unsubscribe this event handler.
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.
I see how this could always be the same workspace - but I think for safety's sake we should unsub this when the workspace changes and re sub it there.
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.
yup, I removed because this is causing crashes sometimes (I think I showed you).. Let me add it back and test
{ | ||
DependencyRegen(obj as WorkspaceModel); | ||
currentWorkspace = obj as WorkspaceModel; | ||
currentWorkspace.PropertyChanged += OnWorkspacePropertyChanged; |
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.
I think here we should unsubscribe the old workspace before subscribing the new one - even if they are usually the same.
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.
Added back
src/PackageDependencyViewExtension/PackageDependencyViewExtension.cs
Outdated
Show resolved
Hide resolved
src/PackageDependencyViewExtension/PackageDependencyViewExtension.cs
Outdated
Show resolved
Hide resolved
@QilongTang one more UI point - the text editing cursor should not be shown over users hover over the entries in the list - this implies they can edit the field, which they cant. I would look at a textBlock instead of a text box with readonly set. Or if you prefer set the hover cursor manually. Of course we can improve this in another PR. https://docs.microsoft.com/en-us/dotnet/api/system.windows.controls.textblock?view=netframework-4.8 |
@mjkkirschner Please check the latest commit, addressed |
@@ -38,6 +38,7 @@ internal void OnWorkspaceCleared(IWorkspaceModel obj) | |||
{ | |||
if (obj is WorkspaceModel) | |||
{ | |||
currentWorkspace.PropertyChanged -= OnWorkspacePropertyChanged; |
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.
this seems like an odd place to do this -couldn't the workspace be cleared for some other reason... and if you clear the workspace but then don't add the the subscription back then you're not watching the workspace any longer...
I would have imagined this would be done in the onCurrentWorkspaceChanged
handler - you cache the current workspace, unsubscribe the handler, then get the new current workspace and then subscribe?
Does that not work?
@QilongTang I think the logic for workspace event subscription is not correct. I know it's not straight forward because the workspace removed is rarely triggered, and the workspaceCleared is triggered at unexpected times but even with that it mind it seems odd... How do you want to proceed with tests, as a followup? |
@mjkkirschner Yes, I would like to address tests as follow up and we should really manual test this together |
LGTM |
@QilongTang This is awesome! |
continue; | ||
} | ||
} | ||
// TODO: Not ideal! O(N * M) complexicty, would like LoadedPackageDependencies to be a dictionary or something with constant package name search time |
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.
Good point. I think we could improve these properties/objects a lot. What if we removed LoadedPackageDependencies
and just added an IsLoaded
property to the PackageDependencyInfo
type?
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.
I think there are a few reasons that it might make sense to split PackageDependencyInfo
into two classes: PackageInfo
and PackageDependency
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.
@scottmitchell We have to also not only deal with loaded but also higher version which are compatible and other cases, like lower version exist but not sure if they should satisfy.. Any case, there are some aspects to think more here
@mjkkirschner @reddyashish Three UI recorded tests to be fixed but is more related to the view injection API behavior, merging |
* Initial Commit * Update csproj to use project config imports * Add Data bind * Workspace Open with package info * adjust styling and make cells read only * adjust styling * reduce package cell width * Code clean Up 1. Using ready param instead of data context 2. Exposed workspace cleared event for extension to watch for and clear dependency data * Add Property watch for Package Dependencies * use name of * Some UI tunning * Styling changes * Using View injection API * grid styling * Highlight packages not installed * Add Download Button and view injection Menu Item * Some comments missing * code clean up * Address Comments * UI Adjustment * Update unsubscribe logic * More comments * Fix Unit Tests
Please Note:
DynamoRevit
repo will need to be cherry-picked into all the DynamoRevit Release branches that Dynamo supports. Contributors will be responsible for cherry-picking their reviewed commits to the other branches after aLGTM
label is added to the PR.Purpose
Dynamo Package Dependency View Extension using DataGrid.
This PR:
Declarations
Check these if you believe they are true
*.resx
filesReviewers
@DynamoDS/dynamo
FYIs