Skip to content
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

potential 2.4 dep viewer cherry picks #9922

Merged
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 39 additions & 7 deletions src/DynamoCore/Graph/Workspaces/PackageDependencyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,45 @@ namespace Dynamo.Graph.Workspaces
/// <summary>
/// Enum containing the different types of package dependency states.
/// </summary>
internal enum PackageDependencyState
public enum PackageDependencyState
{
Loaded, // Correct package and version loaded.
IncorrectVersion, // Correct package but incorrect version.
Missing, // package is completely missing.
Warning, // Actual package is missing but the nodes are resolved by some other package.
RequiresRestart // Restart needed inorder to complete the uninstall of some package.
RequiresRestart // Restart needed in order to complete the uninstall of some package.
}

/// <summary>
/// Interface for types containing info about a package
/// </summary>
public interface IPackageInfo
{
/// <summary>
/// Name of the package
/// </summary>
string Name { get; }

/// <summary>
/// Version of the package
/// </summary>
Version Version { get; }
}

/// <summary>
/// Class containing info about a package
/// </summary>
public class PackageInfo
public class PackageInfo : IPackageInfo
{
/// <summary>
/// Name of the package
/// </summary>
internal string Name { get; set; }
public string Name { get; private set; }

/// <summary>
/// Version of the package
/// </summary>
internal Version Version { get; set; }
public Version Version { get; internal set; }

/// <summary>
/// Create a package info object from the package name and version
Expand Down Expand Up @@ -133,12 +149,17 @@ interface INodeLibraryDependencyInfo
/// </summary>
[Obsolete("This property is obsolete", false)]
bool IsLoaded { get; set; }

/// <summary>
/// The state of this dependency
/// </summary>
PackageDependencyState State { get; }
}

/// <summary>
/// Class containing info about a workspace package dependency
/// </summary>
internal class PackageDependencyInfo : INodeLibraryDependencyInfo
internal class PackageDependencyInfo : INodeLibraryDependencyInfo, IPackageInfo
{
private PackageDependencyState _state;
/// <summary>
Expand All @@ -154,7 +175,18 @@ internal class PackageDependencyInfo : INodeLibraryDependencyInfo
/// <summary>
/// Version of the package
/// </summary>
public Version Version => PackageInfo.Version;
public Version Version
{
get
{
return PackageInfo.Version;
}
internal set
{
if(PackageInfo.Version != value)
PackageInfo.Version = value;
}
}

/// <summary>
/// Indicates whether this package is loaded in the current session
Expand Down
1 change: 1 addition & 0 deletions src/DynamoCoreWpf/DynamoCoreWpf.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@
<Compile Include="ViewModels\Core\GalleryViewModel.cs" />
<Compile Include="ViewModels\Core\HomeWorkspaceViewModel.cs" />
<Compile Include="ViewModels\Core\SerializationExtensions.cs" />
<Compile Include="ViewModels\PackageManager\IPackageInstaller.cs" />
<Compile Include="ViewModels\PackageManager\PackagePathViewModel.cs" />
<Compile Include="ViewModels\Preview\CompactBubbleViewModel.cs" />
<Compile Include="ViewModels\RunSettingsViewModel.cs" />
Expand Down
16 changes: 13 additions & 3 deletions src/DynamoCoreWpf/Extensions/ViewLoadedParams.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Windows.Controls;
using Dynamo.Controls;
using Dynamo.Extensions;
using Dynamo.Logging;
mjkkirschner marked this conversation as resolved.
Show resolved Hide resolved
using Dynamo.Selection;
using Dynamo.Utilities;
using Dynamo.ViewModels;
Expand Down Expand Up @@ -49,6 +50,15 @@ public IRenderPackageFactory RenderPackageFactory
get { return dynamoViewModel.RenderPackageFactoryViewModel.Factory; }
}

/// <summary>
/// A reference to package install operations on the package manager
/// </summary>
public IPackageInstaller PackageInstaller
{
get { return dynamoViewModel.PackageManagerClientViewModel; }
}


/// <summary>
/// A reference to the Dynamo Window object. Useful for correctly setting the parent of a
/// newly created window.
Expand Down Expand Up @@ -82,7 +92,7 @@ public void AddMenuItem(MenuBarType type, MenuItem menuItem, int index = -1)
/// <param name="viewExtension">Instance of the view extension object that is being added to the extensions side bar.</param>
/// <param name="contentControl">Control UI element with a single piece of content of any type.</param>
/// <returns></returns>
internal void AddToExtensionsSideBar(IViewExtension viewExtension, ContentControl contentControl)
public void AddToExtensionsSideBar(IViewExtension viewExtension, ContentControl contentControl)
{
TabItem tabItem = dynamoView.AddTabItem(viewExtension, contentControl);

Expand Down Expand Up @@ -141,8 +151,8 @@ private void AddItemToMenu(MenuBarType type, Control itemToAdd, int index)
}

/// <summary>
/// Searchs for dynamo parent menu item. Parent item can be:
/// file menu, edit menu, view menu and help mebu bars.
/// Searches for dynamo parent menu item. Parent item can be:
/// file menu, edit menu, view menu and help menu bars.
/// </summary>
/// <param name="menuBarType">File, Edit, View or Help.</param>
private MenuItem SearchForMenuItem(MenuBarType type)
Expand Down
38 changes: 19 additions & 19 deletions src/DynamoCoreWpf/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions src/DynamoCoreWpf/Properties/Resources.en-US.resx
Original file line number Diff line number Diff line change
Expand Up @@ -2207,15 +2207,9 @@ Restart Dynamo to complete the uninstall.

Uninstall the following packages: {0}?</value>
</data>
<data name="ProvideFeedbackButton" xml:space="preserve">
<value> Provide Feedback</value>
</data>
<data name="PreviewText" xml:space="preserve">
<value> This Feature is in Preview! </value>
</data>
<data name="ProvideFeedbackError" xml:space="preserve">
<value>Could not re-direct to the Dynamo forum page for feedback:</value>
</data>
<data name="PackageHostDependencyTooltip" xml:space="preserve">
<value>This package contains node(s) that depend on applications outside Dynamo. To fully utilize node(s) in this package, you will need to have these external applications installed.</value>
</data>
Expand All @@ -2228,6 +2222,12 @@ Uninstall the following packages: {0}?</value>
<data name="MessageUninstallSamePackage" xml:space="preserve">
<value>"The package {0} is already installed. To reinstall it, you must first uninstall it and restart to complete the uninstall. Would you like to mark {0} for uninstall?"</value>
</data>
<data name="MessagePackageNotFound" xml:space="preserve">
<value>{0} was not found and could not be downloaded.</value>
</data>
<data name="MessagePackageVersionNotFound" xml:space="preserve">
<value>Version {0} of {1} could not be found.</value>
</data>
<data name="PublishPackageViewPackageHostDependency" xml:space="preserve">
<value>External Dependency (optional)</value>
</data>
Expand Down
12 changes: 6 additions & 6 deletions src/DynamoCoreWpf/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -2210,15 +2210,9 @@ Restart Dynamo to complete the uninstall.

Uninstall the following packages: {0}?</value>
</data>
<data name="ProvideFeedbackButton" xml:space="preserve">
<value> Provide Feedback</value>
</data>
<data name="PreviewText" xml:space="preserve">
<value> This Feature is in Preview! </value>
</data>
<data name="ProvideFeedbackError" xml:space="preserve">
<value>Could not re-direct to the Dynamo forum page for feedback:</value>
</data>
<data name="PackageHostDependencyTooltip" xml:space="preserve">
<value>This package contains node(s) that depend on applications outside Dynamo. To fully utilize node(s) in this package, you will need to have these external applications installed.</value>
</data>
Expand All @@ -2231,6 +2225,12 @@ Uninstall the following packages: {0}?</value>
<data name="MessageUninstallSamePackage" xml:space="preserve">
<value>"The package {0} is already installed. To reinstall it, you must first uninstall it and restart to complete the uninstall. Would you like to mark {0} for uninstall?"</value>
</data>
<data name="MessagePackageNotFound" xml:space="preserve">
<value>{0} was not found and could not be downloaded.</value>
</data>
<data name="MessagePackageVersionNotFound" xml:space="preserve">
<value>Version {0} of {1} could not be found.</value>
</data>
<data name="PublishPackageViewPackageHostDependency" xml:space="preserve">
<value>External Dependency (optional)</value>
</data>
Expand Down
22 changes: 22 additions & 0 deletions src/DynamoCoreWpf/ViewModels/PackageManager/IPackageInstaller.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Dynamo.Graph.Workspaces;

namespace Dynamo.ViewModels
{
/// <summary>
/// An interface containing operations for installing Dynamo packages
/// </summary>
public interface IPackageInstaller
{
/// <summary>
/// Initiates download and install of a package
/// </summary>
/// <param name="package">Package Info of the package to be downloaded--includes package name and version</param>
/// <param name="downloadPath">Path to download location of the package</param>
void DownloadAndInstallPackage(IPackageInfo package, string downloadPath = null);
}
}
Loading