diff --git a/src/DynamoCore/DynamoCore.csproj b/src/DynamoCore/DynamoCore.csproj index b1100b3cca2..cad82bee639 100644 --- a/src/DynamoCore/DynamoCore.csproj +++ b/src/DynamoCore/DynamoCore.csproj @@ -31,7 +31,7 @@ - + diff --git a/src/DynamoCoreWpf/DynamoCoreWpf.csproj b/src/DynamoCoreWpf/DynamoCoreWpf.csproj index 6991abf7249..61cf848aa8e 100644 --- a/src/DynamoCoreWpf/DynamoCoreWpf.csproj +++ b/src/DynamoCoreWpf/DynamoCoreWpf.csproj @@ -189,7 +189,7 @@ - + diff --git a/src/DynamoCoreWpf/Properties/Resources.Designer.cs b/src/DynamoCoreWpf/Properties/Resources.Designer.cs index 89e76447cf8..2f115a7510b 100644 --- a/src/DynamoCoreWpf/Properties/Resources.Designer.cs +++ b/src/DynamoCoreWpf/Properties/Resources.Designer.cs @@ -1,4 +1,4 @@ -//------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ // // This code was generated by a tool. // Runtime Version:4.0.30319.42000 @@ -5646,6 +5646,33 @@ public static string PackageDeprecatedTooltip { } } + /// + /// Looks up a localized string similar to COMPATIBILITY. + /// + public static string PackageDetailsCompatibility { + get { + return ResourceManager.GetString("PackageDetailsCompatibility", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Compatible with your current setup. + /// + public static string PackageDetailsCompatibilityWithSetup { + get { + return ResourceManager.GetString("PackageDetailsCompatibilityWithSetup", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to This version should be compatible with your current setup. + /// + public static string PackageDetailsCompatibleVersionTooltip { + get { + return ResourceManager.GetString("PackageDetailsCompatibleVersionTooltip", resourceCulture); + } + } + /// /// Looks up a localized string similar to Copyright Holder. /// @@ -5664,6 +5691,15 @@ public static string PackageDetailsCopyRightYear { } } + /// + /// Looks up a localized string similar to Depends on. + /// + public static string PackageDetailsDependsOn { + get { + return ResourceManager.GetString("PackageDetailsDependsOn", resourceCulture); + } + } + /// /// Looks up a localized string similar to DESCRIPTION. /// @@ -5691,6 +5727,15 @@ public static string PackageDetailsHost { } } + /// + /// Looks up a localized string similar to This version may be incompatible with your current setup. + /// + public static string PackageDetailsIncompatibileVersionTooltip { + get { + return ResourceManager.GetString("PackageDetailsIncompatibileVersionTooltip", resourceCulture); + } + } + /// /// Looks up a localized string similar to KEYWORDS. /// @@ -5736,6 +5781,15 @@ public static string PackageDetailsPython { } } + /// + /// Looks up a localized string similar to Release notes. + /// + public static string PackageDetailsReleaseNotes { + get { + return ResourceManager.GetString("PackageDetailsReleaseNotes", resourceCulture); + } + } + /// /// Looks up a localized string similar to Size. /// @@ -5745,6 +5799,15 @@ public static string PackageDetailsSize { } } + /// + /// Looks up a localized string similar to The compatibility of this version has not been verified. It may or may not be compatible with your current setup. + /// + public static string PackageDetailsUnknownCompatibilityVersionTooltip { + get { + return ResourceManager.GetString("PackageDetailsUnknownCompatibilityVersionTooltip", resourceCulture); + } + } + /// /// Looks up a localized string similar to Versions. /// @@ -6016,6 +6079,24 @@ public static string PackageManagerFinishedPackagePackagePath { } } + /// + /// Looks up a localized string similar to This version is incompatible with your current setup (Dynamo and host version, if applicable). It may not work properly. Do you want to install it anyway?. + /// + public static string PackageManagerIncompatibleVersionDownloadMsg { + get { + return ResourceManager.GetString("PackageManagerIncompatibleVersionDownloadMsg", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Incompatible version. + /// + public static string PackageManagerIncompatibleVersionDownloadTitle { + get { + return ResourceManager.GetString("PackageManagerIncompatibleVersionDownloadTitle", resourceCulture); + } + } + /// /// Looks up a localized string similar to Install. /// @@ -6512,7 +6593,7 @@ public static string PackageSearchResultRequirements { } /// - /// Looks up a localized string similar to View Details. + /// Looks up a localized string similar to Info. /// public static string PackageSearchResultViewDetails { get { @@ -10357,6 +10438,33 @@ public static string UnsavedChangesMessageBoxTitle { } } + /// + /// Looks up a localized string similar to Set Python Engine. + /// + public static string UpdateAllPythonEngineMainMenuHeader { + get { + return ResourceManager.GetString("UpdateAllPythonEngineMainMenuHeader", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Update all {0} python nodes in the current workspace to use {1} engine?. + /// + public static string UpdateAllPythonEngineWarning { + get { + return ResourceManager.GetString("UpdateAllPythonEngineWarning", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Update All Python Nodes. + /// + public static string UpdateAllPythonEngineWarningTitle { + get { + return ResourceManager.GetString("UpdateAllPythonEngineWarningTitle", resourceCulture); + } + } + /// /// Looks up a localized string similar to An update is available for Dynamo. ///Installing the latest update requires Dynamo and any host applications to close. @@ -10586,38 +10694,5 @@ public static string ZoomLevel { return ResourceManager.GetString("ZoomLevel", resourceCulture); } } - - /// - /// Looks up a localized string similar to Update all {0} python nodes in the current workspace to use {1} engine?. - /// - public static string UpdateAllPythonEngineWarning - { - get - { - return ResourceManager.GetString("UpdateAllPythonEngineWarning", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Update All Python Nodes. - /// - public static string UpdateAllPythonEngineWarningTitle - { - get - { - return ResourceManager.GetString("UpdateAllPythonEngineWarningTitle", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Set Python Engine. - /// - public static string UpdateAllPythonEngineMainMenuHeader - { - get - { - return ResourceManager.GetString("UpdateAllPythonEngineMainMenuHeader", resourceCulture); - } - } } } diff --git a/src/DynamoCoreWpf/Properties/Resources.en-US.resx b/src/DynamoCoreWpf/Properties/Resources.en-US.resx index 0b891e0236f..f0ad09bd3b1 100644 --- a/src/DynamoCoreWpf/Properties/Resources.en-US.resx +++ b/src/DynamoCoreWpf/Properties/Resources.en-US.resx @@ -2892,7 +2892,7 @@ If the toggle is off custom packages that are not already loaded will load once Header in Package Search 'Sort By' Button Context Menu - View Details + Info In package search result card. @@ -4045,4 +4045,34 @@ To make this file into a new template, save it to a different folder, then move Set Python Engine + + Release notes + + + Depends on + + + COMPATIBILITY + + + Compatible with your current setup + + + Size + + + This version should be compatible with your current setup + + + The compatibility of this version has not been verified. It may or may not be compatible with your current setup + + + This version may be incompatible with your current setup + + + This version is incompatible with your current setup (Dynamo and host version, if applicable). It may not work properly. Do you want to install it anyway? + + + Incompatible version + diff --git a/src/DynamoCoreWpf/Properties/Resources.resx b/src/DynamoCoreWpf/Properties/Resources.resx index 85f5b6d1e48..2677838dd7f 100644 --- a/src/DynamoCoreWpf/Properties/Resources.resx +++ b/src/DynamoCoreWpf/Properties/Resources.resx @@ -1512,7 +1512,7 @@ If the toggle is off custom packages that are not already loaded will load once Sort by - View Details + Info In package search result card. @@ -4032,4 +4032,34 @@ To make this file into a new template, save it to a different folder, then move Set Python Engine + + Release notes + + + Depends on + + + COMPATIBILITY + + + Compatible with your current setup + + + Size + + + This version should be compatible with your current setup + + + The compatibility of this version has not been verified. It may or may not be compatible with your current setup + + + This version may be incompatible with your current setup + + + This version is incompatible with your current setup (Dynamo and host version, if applicable). It may not work properly. Do you want to install it anyway? + + + Incompatible version + diff --git a/src/DynamoCoreWpf/PublicAPI.Unshipped.txt b/src/DynamoCoreWpf/PublicAPI.Unshipped.txt index 3416ded0706..bbbc8a21c76 100644 --- a/src/DynamoCoreWpf/PublicAPI.Unshipped.txt +++ b/src/DynamoCoreWpf/PublicAPI.Unshipped.txt @@ -183,6 +183,10 @@ Dynamo.Controls.DateToPackageLabelConverter Dynamo.Controls.DateToPackageLabelConverter.Convert(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture) -> object Dynamo.Controls.DateToPackageLabelConverter.ConvertBack(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture) -> object Dynamo.Controls.DateToPackageLabelConverter.DateToPackageLabelConverter() -> void +Dynamo.Controls.DateToPackageTooltipConverter +Dynamo.Controls.DateToPackageTooltipConverter.Convert(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture) -> object +Dynamo.Controls.DateToPackageTooltipConverter.ConvertBack(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture) -> object +Dynamo.Controls.DateToPackageTooltipConverter.DateToPackageTooltipConverter() -> void Dynamo.Controls.DateToVisibilityCollapsedConverter Dynamo.Controls.DateToVisibilityCollapsedConverter.Convert(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture) -> object Dynamo.Controls.DateToVisibilityCollapsedConverter.ConvertBack(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture) -> object @@ -337,6 +341,10 @@ Dynamo.Controls.InverseBoolToVisibilityConverter Dynamo.Controls.InverseBoolToVisibilityConverter.Convert(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture) -> object Dynamo.Controls.InverseBoolToVisibilityConverter.ConvertBack(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture) -> object Dynamo.Controls.InverseBoolToVisibilityConverter.InverseBoolToVisibilityConverter() -> void +Dynamo.Controls.InverseEmptyListToVisibilityConverter +Dynamo.Controls.InverseEmptyListToVisibilityConverter.Convert(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture) -> object +Dynamo.Controls.InverseEmptyListToVisibilityConverter.ConvertBack(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture) -> object +Dynamo.Controls.InverseEmptyListToVisibilityConverter.InverseEmptyListToVisibilityConverter() -> void Dynamo.Controls.LacingToAbbreviationConverter Dynamo.Controls.LacingToAbbreviationConverter.Convert(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture) -> object Dynamo.Controls.LacingToAbbreviationConverter.ConvertBack(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture) -> object @@ -460,6 +468,10 @@ Dynamo.Controls.NonEmptyStringToCollapsedConverter Dynamo.Controls.NonEmptyStringToCollapsedConverter.Convert(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture) -> object Dynamo.Controls.NonEmptyStringToCollapsedConverter.ConvertBack(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture) -> object Dynamo.Controls.NonEmptyStringToCollapsedConverter.NonEmptyStringToCollapsedConverter() -> void +Dynamo.Controls.NullOrEmptyListToVisibilityVisibleConverter +Dynamo.Controls.NullOrEmptyListToVisibilityVisibleConverter.Convert(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture) -> object +Dynamo.Controls.NullOrEmptyListToVisibilityVisibleConverter.ConvertBack(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture) -> object +Dynamo.Controls.NullOrEmptyListToVisibilityVisibleConverter.NullOrEmptyListToVisibilityVisibleConverter() -> void Dynamo.Controls.NullOrEmptyStringToVisibiltyCollapsedConverter Dynamo.Controls.NullOrEmptyStringToVisibiltyCollapsedConverter.Convert(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture) -> object Dynamo.Controls.NullOrEmptyStringToVisibiltyCollapsedConverter.ConvertBack(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture) -> object @@ -1295,6 +1307,8 @@ Dynamo.PackageManager.ViewModels.PackageManagerSearchElementViewModel.Hosts.get Dynamo.PackageManager.ViewModels.PackageManagerSearchElementViewModel.IsDeprecated.get -> bool Dynamo.PackageManager.ViewModels.PackageManagerSearchElementViewModel.IsEnabledForInstall.get -> bool Dynamo.PackageManager.ViewModels.PackageManagerSearchElementViewModel.IsOnwer.get -> bool +Dynamo.PackageManager.ViewModels.PackageManagerSearchElementViewModel.IsSelectedVersionCompatible.get -> bool? +Dynamo.PackageManager.ViewModels.PackageManagerSearchElementViewModel.IsSelectedVersionCompatible.set -> void Dynamo.PackageManager.ViewModels.PackageManagerSearchElementViewModel.LatestVersion.get -> string Dynamo.PackageManager.ViewModels.PackageManagerSearchElementViewModel.LatestVersionCreated.get -> string Dynamo.PackageManager.ViewModels.PackageManagerSearchElementViewModel.Maintainers.get -> string @@ -1306,11 +1320,14 @@ Dynamo.PackageManager.ViewModels.PackageManagerSearchElementViewModel.PackageSea Dynamo.PackageManager.ViewModels.PackageManagerSearchElementViewModel.PkgVersion.get -> System.Collections.Generic.IEnumerable Dynamo.PackageManager.ViewModels.PackageManagerSearchElementViewModel.RequestDownload -> Dynamo.PackageManager.ViewModels.PackageManagerSearchElementViewModel.PackageSearchElementDownloadHandler Dynamo.PackageManager.ViewModels.PackageManagerSearchElementViewModel.RequestShowFileDialog -> System.EventHandler +Dynamo.PackageManager.ViewModels.PackageManagerSearchElementViewModel.ReversedVersionInformationList.get -> System.ComponentModel.ICollectionView Dynamo.PackageManager.ViewModels.PackageManagerSearchElementViewModel.SearchElementModel.get -> Dynamo.PackageManager.PackageManagerSearchElement -Dynamo.PackageManager.ViewModels.PackageManagerSearchElementViewModel.SelectedVersion.get -> string +Dynamo.PackageManager.ViewModels.PackageManagerSearchElementViewModel.SelectedVersion.get -> Dynamo.PackageManager.VersionInformation Dynamo.PackageManager.ViewModels.PackageManagerSearchElementViewModel.SelectedVersion.set -> void Dynamo.PackageManager.ViewModels.PackageManagerSearchElementViewModel.UpvoteCommand.get -> System.Windows.Input.ICommand Dynamo.PackageManager.ViewModels.PackageManagerSearchElementViewModel.UpvoteCommand.set -> void +Dynamo.PackageManager.ViewModels.PackageManagerSearchElementViewModel.VersionInformationList.get -> System.Collections.Generic.List +Dynamo.PackageManager.ViewModels.PackageManagerSearchElementViewModel.VersionInformationList.set -> void Dynamo.PackageManager.ViewModels.PackageManagerSearchElementViewModel.Versions.get -> System.Collections.Generic.List>> Dynamo.PackageManager.ViewModels.PackageManagerSearchElementViewModel.VisitRepositoryCommand.get -> System.Windows.Input.ICommand Dynamo.PackageManager.ViewModels.PackageManagerSearchElementViewModel.VisitRepositoryCommand.set -> void @@ -4982,17 +4999,24 @@ static Dynamo.Wpf.Properties.Resources.PackageContextMenuUnmarkDeletePackageTool static Dynamo.Wpf.Properties.Resources.PackageContextMenuUnmarkUnloadPackageText.get -> string static Dynamo.Wpf.Properties.Resources.PackageContextMenuUnmarkUnloadPackageTooltip.get -> string static Dynamo.Wpf.Properties.Resources.PackageDeprecatedTooltip.get -> string +static Dynamo.Wpf.Properties.Resources.PackageDetailsCompatibility.get -> string +static Dynamo.Wpf.Properties.Resources.PackageDetailsCompatibilityWithSetup.get -> string +static Dynamo.Wpf.Properties.Resources.PackageDetailsCompatibleVersionTooltip.get -> string static Dynamo.Wpf.Properties.Resources.PackageDetailsCopyRightHolder.get -> string static Dynamo.Wpf.Properties.Resources.PackageDetailsCopyRightYear.get -> string +static Dynamo.Wpf.Properties.Resources.PackageDetailsDependsOn.get -> string static Dynamo.Wpf.Properties.Resources.PackageDetailsDescription.get -> string static Dynamo.Wpf.Properties.Resources.PackageDetailsGroup.get -> string static Dynamo.Wpf.Properties.Resources.PackageDetailsHost.get -> string +static Dynamo.Wpf.Properties.Resources.PackageDetailsIncompatibileVersionTooltip.get -> string static Dynamo.Wpf.Properties.Resources.PackageDetailsKeywords.get -> string static Dynamo.Wpf.Properties.Resources.PackageDetailsLicense.get -> string static Dynamo.Wpf.Properties.Resources.PackageDetailsLinks.get -> string static Dynamo.Wpf.Properties.Resources.PackageDetailsPackage.get -> string static Dynamo.Wpf.Properties.Resources.PackageDetailsPython.get -> string +static Dynamo.Wpf.Properties.Resources.PackageDetailsReleaseNotes.get -> string static Dynamo.Wpf.Properties.Resources.PackageDetailsSize.get -> string +static Dynamo.Wpf.Properties.Resources.PackageDetailsUnknownCompatibilityVersionTooltip.get -> string static Dynamo.Wpf.Properties.Resources.PackageDetailsVersions.get -> string static Dynamo.Wpf.Properties.Resources.PackageDetailsVersionsAndPackageRequirements.get -> string static Dynamo.Wpf.Properties.Resources.PackageDownloadConfirmMessageBoxTitle.get -> string @@ -5023,6 +5047,8 @@ static Dynamo.Wpf.Properties.Resources.PackageManagerClearAllButtonText.get -> s static Dynamo.Wpf.Properties.Resources.PackageManagerFinishedPackageFilesPublishedMessage.get -> string static Dynamo.Wpf.Properties.Resources.PackageManagerFinishedPackageFilesUploadedMessage.get -> string static Dynamo.Wpf.Properties.Resources.PackageManagerFinishedPackagePackagePath.get -> string +static Dynamo.Wpf.Properties.Resources.PackageManagerIncompatibleVersionDownloadMsg.get -> string +static Dynamo.Wpf.Properties.Resources.PackageManagerIncompatibleVersionDownloadTitle.get -> string static Dynamo.Wpf.Properties.Resources.PackageManagerInstall.get -> string static Dynamo.Wpf.Properties.Resources.PackageManagerInstalledPackagesTab.get -> string static Dynamo.Wpf.Properties.Resources.PackageManagerLoadingTimedOutWarningMessage.get -> string diff --git a/src/DynamoCoreWpf/UI/Converters.cs b/src/DynamoCoreWpf/UI/Converters.cs index 469b7ecd994..dcd8ea1cfcc 100644 --- a/src/DynamoCoreWpf/UI/Converters.cs +++ b/src/DynamoCoreWpf/UI/Converters.cs @@ -170,6 +170,42 @@ public object ConvertBack(object value, Type targetType, object parameter, Cultu } } + /// + /// Returns Visibility.Visible if the collection is empty, otherwise returns Visibility.Collapsed. + /// + public class NullOrEmptyListToVisibilityVisibleConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (!(value is ICollection collection)) return Visibility.Visible; + + return collection.Count == 0 ? Visibility.Visible : Visibility.Collapsed; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return null; + } + } + + /// + /// Returns Visible if the collection is not empty, otherwise returns Collapsed + /// + public class InverseEmptyListToVisibilityConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (!(value is ICollection collection)) return Visibility.Collapsed; + + return collection.Count == 0 ? Visibility.Collapsed : Visibility.Visible; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return null; + } + } + public class PackageSearchStateToStringConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, @@ -1549,6 +1585,40 @@ public object ConvertBack(object value, Type targetType, object parameter, Syste } } + /// + /// Used to determine the tooltip which appears next to a package when it's either + /// brand new, recently updated, or deprecated. + /// If the package was updated in the last 30 days it says 'Updated'. + /// If the package is brand new (only has 1 version) and is less than 30 days it says 'New'. + /// + public class DateToPackageTooltipConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + if (!(value is Dynamo.PackageManager.PackageManagerSearchElement packageManagerSearchElement)) return String.Empty; + if (packageManagerSearchElement.IsDeprecated) return Resources.PackageDeprecatedTooltip; + + DateTime.TryParse(packageManagerSearchElement.LatestVersionCreated, out DateTime dateLastUpdated); + + // For testing purposes + var test = DateTime.TryParse((string)parameter, out DateTime testDate); + TimeSpan difference = test ? testDate - dateLastUpdated : DateTime.Now - dateLastUpdated; + + int numberVersions = packageManagerSearchElement.Header.num_versions; + + if (numberVersions > 1) + { + return difference.TotalDays >= 30 ? "" : Resources.PackageFilterUpdatedTooltip; + } + return Resources.PackageFilterNewTooltip; + } + + public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + throw new NotSupportedException(); + } + } + public class InverseBoolToVisibilityConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) diff --git a/src/DynamoCoreWpf/UI/Themes/Modern/DynamoColorsAndBrushes.xaml b/src/DynamoCoreWpf/UI/Themes/Modern/DynamoColorsAndBrushes.xaml index 5e1c7521e16..b8e10e3a1c2 100644 --- a/src/DynamoCoreWpf/UI/Themes/Modern/DynamoColorsAndBrushes.xaml +++ b/src/DynamoCoreWpf/UI/Themes/Modern/DynamoColorsAndBrushes.xaml @@ -33,7 +33,7 @@ #2EFFFFFF #66999999 #F5F5F5 - + @@ -194,7 +194,24 @@ - + + + + #DFDFDF + #5F5F5F + #3f3f3f + #474747 + #87B340 + #EB5555 + #73C5FF + + + + + + + + diff --git a/src/DynamoCoreWpf/UI/Themes/Modern/DynamoModern.xaml b/src/DynamoCoreWpf/UI/Themes/Modern/DynamoModern.xaml index 32b3fdf8f62..814db03e096 100644 --- a/src/DynamoCoreWpf/UI/Themes/Modern/DynamoModern.xaml +++ b/src/DynamoCoreWpf/UI/Themes/Modern/DynamoModern.xaml @@ -3,9 +3,9 @@ xmlns:avalonedit="clr-namespace:ICSharpCode.AvalonEdit;assembly=ICSharpCode.AvalonEdit" xmlns:clr="clr-namespace:System;assembly=mscorlib" xmlns:controls="clr-namespace:Dynamo.Views;assembly=DynamoCoreWpf" - xmlns:nodes="clr-namespace:Dynamo.Nodes;assembly=DynamoCoreWpf" xmlns:dynui="clr-namespace:Dynamo.UI.Controls;assembly=DynamoCoreWpf" xmlns:fa="clr-namespace:FontAwesome5;assembly=FontAwesome5.Net" + xmlns:nodes="clr-namespace:Dynamo.Nodes;assembly=DynamoCoreWpf" xmlns:p="clr-namespace:Dynamo.Wpf.Properties;assembly=DynamoCoreWpf" xmlns:ui="clr-namespace:Dynamo.UI;assembly=DynamoCoreWpf"> @@ -53,9 +53,9 @@ Black #808080 - - - + + + @@ -72,7 +72,7 @@ 53 - + @@ -143,12 +143,38 @@ - - - + + + - - + + @@ -168,19 +194,48 @@ - - - - + + + + BorderThickness="0,0,0,1" /> - - + + - - + + - - + + BorderThickness="0" /> - - + + - + - + - - - - + - + - - - - - - - - - - - - - - - - - - + - + - - + + - + - + - - - + + - + - - + + - - + + + + + + + + + + + + + + + + - + - + - - + + + + + + + + + + + + + + + + #999999 #CCCCCC #38abdf @@ -5783,32 +5777,33 @@ - + - + - + - - + + - + @@ -5957,42 +5968,38 @@ - - - - + + + + @@ -6016,17 +6023,16 @@ - + @@ -6035,34 +6041,34 @@ - - + + - + - + - - + + - + - - + + - + - + - + - + - + - + - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/DynamoCoreWpf/ViewModels/PackageManager/PackageManagerClientViewModel.cs b/src/DynamoCoreWpf/ViewModels/PackageManager/PackageManagerClientViewModel.cs index d3e52b4f8bb..4bb304d263c 100644 --- a/src/DynamoCoreWpf/ViewModels/PackageManager/PackageManagerClientViewModel.cs +++ b/src/DynamoCoreWpf/ViewModels/PackageManager/PackageManagerClientViewModel.cs @@ -9,7 +9,6 @@ using System.Threading.Tasks; using System.Windows; using System.Windows.Input; -using Dynamo.Controls; using Dynamo.Core; using Dynamo.Graph.Nodes.CustomNodes; using Dynamo.Graph.Workspaces; @@ -749,11 +748,28 @@ private bool WarnAboutDuplicatePackageConflicts(PackageVersion package, internal async void ExecutePackageDownload(string name, PackageVersion package, string installPath) { - string msg = String.IsNullOrEmpty(installPath) ? + string msg; + MessageBoxResult result; + + var compatible = PackageManagerSearchElement.CalculateCompatibility(package.compatibility_matrix); + if (compatible == false && !DynamoModel.IsTestMode) + { + msg = Resources.PackageManagerIncompatibleVersionDownloadMsg; + result = MessageBoxService.Show(ViewModelOwner, msg, + Resources.PackageManagerIncompatibleVersionDownloadTitle, + MessageBoxButton.OKCancel, MessageBoxImage.Warning); + + if (result != MessageBoxResult.OK) + { + return; + } + } + + msg = String.IsNullOrEmpty(installPath) ? String.Format(Resources.MessageConfirmToInstallPackage, name, package.version) : String.Format(Resources.MessageConfirmToInstallPackageToFolder, name, package.version, installPath); - var result = MessageBoxService.Show(ViewModelOwner, msg, + result = MessageBoxService.Show(ViewModelOwner, msg, Resources.PackageDownloadConfirmMessageBoxTitle, MessageBoxButton.OKCancel, MessageBoxImage.Question); @@ -1099,6 +1115,7 @@ public void GoToWebsite() Process.Start(sInfo); } } + } } diff --git a/src/DynamoCoreWpf/ViewModels/PackageManager/PackageManagerSearchElementViewModel.cs b/src/DynamoCoreWpf/ViewModels/PackageManager/PackageManagerSearchElementViewModel.cs index c91081b8ea0..fecf1340d3c 100644 --- a/src/DynamoCoreWpf/ViewModels/PackageManager/PackageManagerSearchElementViewModel.cs +++ b/src/DynamoCoreWpf/ViewModels/PackageManager/PackageManagerSearchElementViewModel.cs @@ -1,7 +1,10 @@ using System; using System.Collections.Generic; +using System.ComponentModel; using System.Diagnostics; using System.Linq; +using System.Windows; +using System.Windows.Data; using System.Windows.Input; using Dynamo.ViewModels; using Dynamo.Wpf.ViewModels; @@ -14,7 +17,6 @@ public class PackageManagerSearchElementViewModel : BrowserItemViewModel, IEquat { public ICommand DownloadLatestCommand { get; set; } public ICommand UpvoteCommand { get; set; } - public ICommand VisitSiteCommand { get; set; } public ICommand VisitRepositoryCommand { get; set; } public ICommand DownloadLatestToCustomPathCommand { get; set; } @@ -66,7 +68,39 @@ public class PackageManagerSearchElementViewModel : BrowserItemViewModel, IEquat /// /// The currently selected version of a package /// - public string SelectedVersion { get; set; } + private VersionInformation selectedVersion; + + public bool? IsSelectedVersionCompatible + { + get { return isSelectedVersionCompatible; } + set + { + if (isSelectedVersionCompatible != value) + { + isSelectedVersionCompatible = value; + RaisePropertyChanged(nameof(IsSelectedVersionCompatible)); + } + } + } + + /// + /// Keeps track of the currently selected package version in the UI + /// + public VersionInformation SelectedVersion + { + get { return selectedVersion; } + set + { + if (selectedVersion != value) + { + selectedVersion = value; + + // Update the compatibility info so the icon of the currently selected version is updated + IsSelectedVersionCompatible = selectedVersion.IsCompatible; + SearchElementModel.SelectedVersion = selectedVersion; + } + } + } /// /// Alternative constructor to assist communication between the @@ -83,14 +117,19 @@ public PackageManagerSearchElementViewModel(PackageManagerSearchElement element, CanInstall = install; IsEnabledForInstall = isEnabledForInstall; - this.SelectedVersion = this.SearchElementModel.LatestVersion; + // Attempts to show the latest compatible version. If no compatible, will return the latest instead. + this.SelectedVersion = this.SearchElementModel.LatestCompatibleVersion; + this.VersionInformationList = this.SearchElementModel.VersionDetails; + WeakEventManager + .AddHandler(this.SearchElementModel, nameof(INotifyPropertyChanged.PropertyChanged), OnSearchElementModelPropertyChanged); + this.ToggleIsExpandedCommand = new DelegateCommand(() => this.SearchElementModel.IsExpanded = !this.SearchElementModel.IsExpanded); this.DownloadLatestCommand = new DelegateCommand( - () => OnRequestDownload(SearchElementModel.Header.versions.First(x => x.version.Equals(SelectedVersion)), false), + () => OnRequestDownload(false), () => !SearchElementModel.IsDeprecated && CanInstall); - this.DownloadLatestToCustomPathCommand = new DelegateCommand(() => OnRequestDownload(SearchElementModel.Header.versions.First(x => x.version.Equals(SelectedVersion)), true)); + this.DownloadLatestToCustomPathCommand = new DelegateCommand(() => OnRequestDownload(true)); this.UpvoteCommand = new DelegateCommand(SearchElementModel.Upvote, () => canLogin); @@ -100,6 +139,19 @@ public PackageManagerSearchElementViewModel(PackageManagerSearchElement element, new DelegateCommand(() => GoToUrl(FormatUrl(SearchElementModel.RepositoryUrl)), () => !String.IsNullOrEmpty(SearchElementModel.RepositoryUrl)); } + private void OnSearchElementModelPropertyChanged(object sender, PropertyChangedEventArgs e) + { + if (e.PropertyName == nameof(SearchElementModel.LatestCompatibleVersion)) + { + this.SelectedVersion = this.SearchElementModel.LatestCompatibleVersion; + } + if (e.PropertyName == nameof(SearchElementModel.VersionDetails)) + { + this.VersionInformationList = this.SearchElementModel.VersionDetails; + } + } + + /// /// PackageManagerSearchElementViewModel Constructor (only used for testing in Dynamo). /// @@ -181,6 +233,9 @@ private static void GoToUrl(string url) } } + /// + /// A collection of key-value pairs to allow the download of specific package version + /// public List>> Versions { get @@ -193,8 +248,39 @@ public List>> Versions } } + private List versionInformationList; + + /// + /// A collection containing all package versions + /// + public List VersionInformationList + { + get { return versionInformationList; } + set + { + if (value != versionInformationList) + { + versionInformationList = value; + RaisePropertyChanged(nameof(VersionInformationList)); + } + } + } + + /// + /// Display the reversed version list - newest to oldest + /// + public ICollectionView ReversedVersionInformationList + { + get + { + var reversedList = VersionInformationList?.AsEnumerable().Reverse().ToList(); + return CollectionViewSource.GetDefaultView(reversedList); + } + } + private List CustomPackageFolders; - + private bool? isSelectedVersionCompatible; + public delegate void PackageSearchElementDownloadHandler( PackageManagerSearchElement element, PackageVersion version, string downloadPath = null); public event PackageSearchElementDownloadHandler RequestDownload; @@ -215,6 +301,24 @@ public void OnRequestDownload(PackageVersion version, bool downloadToCustomPath) RequestDownload(this.SearchElementModel, version, downloadPath); } + private void OnRequestDownload(bool downloadToCustomPath) + { + var version = this.SearchElementModel.Header.versions.First(x => x.version.Equals(SelectedVersion.Version)); + + string downloadPath = String.Empty; + + if (downloadToCustomPath) + { + downloadPath = GetDownloadPath(); + + if (String.IsNullOrEmpty(downloadPath)) + return; + } + + if (RequestDownload != null) + RequestDownload(this.SearchElementModel, version, downloadPath); + } + /// /// Comparator of two PackageManagerSearchElementViewModel based on package Id. /// Override for package results union. diff --git a/src/DynamoCoreWpf/Views/PackageManager/Controls/ControlColorsAndBrushes.xaml b/src/DynamoCoreWpf/Views/PackageManager/Controls/ControlColorsAndBrushes.xaml index a17172d23a1..a86afbed395 100644 --- a/src/DynamoCoreWpf/Views/PackageManager/Controls/ControlColorsAndBrushes.xaml +++ b/src/DynamoCoreWpf/Views/PackageManager/Controls/ControlColorsAndBrushes.xaml @@ -1,4 +1,5 @@ - @@ -6,56 +7,56 @@ - + #555 - + - + - - - + - + - + - + + + + + + + + + + + + + @@ -82,7 +124,7 @@ - + @@ -165,20 +203,16 @@ - + @@ -191,77 +225,94 @@ Margin="15,15,5,0" LastChildFill="False"> - - + + + + + + + + + + + + + + + + + - + + + - + + + - - - + Foreground="{StaticResource PMForegroundColorBrush}" + Text="{Binding Path=Model, Converter={StaticResource DateToPackageLabelTextConverter}}"> + + + + @@ -567,8 +564,9 @@ Margin="5,0" DockPanel.Dock="Left" Style="{StaticResource resultLabelStyle}" - Text="{Binding Hosts, Converter={StaticResource DependencyListToStringConverter}}" - Visibility="{Binding Path=Hosts, Converter={StaticResource ListHasMoreThanNItemsToVisibilityConverter}}" /> + Text="{Binding Hosts, Converter={StaticResource DependencyListToStringConverter}}" /> + + @@ -577,9 +575,62 @@ Margin="15,0,5,15" VerticalAlignment="Bottom" LastChildFill="True"> - + + + + + + + @@ -592,8 +643,10 @@ + + @@ -606,52 +659,28 @@ + + - - + StrokeThickness="1" /> - - - - - - - - - - - - - + - - - + + + @@ -693,211 +717,199 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -