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

Add dropdown to package preferences dialog for package paths for download #11747

Merged
merged 26 commits into from
Jun 22, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
95278c3
add dropdown for package paths for package download
aparajit-pratap Jun 10, 2021
a54a903
change dropdown width to Auto
aparajit-pratap Jun 10, 2021
283dd01
handle selected package path property change event
aparajit-pratap Jun 10, 2021
0d52f8c
filter out paths that are files
aparajit-pratap Jun 10, 2021
4eacb61
add label above dropdown
aparajit-pratap Jun 10, 2021
c0db39c
rename resource
aparajit-pratap Jun 10, 2021
048b973
filter programdata path from dropdown list
aparajit-pratap Jun 11, 2021
98d20e9
add tooltip to combobox
aparajit-pratap Jun 11, 2021
3db5932
attempt to set package download directory using selected path from dr…
aparajit-pratap Jun 11, 2021
e1732d0
change how default package directory is set in PackageLoader
aparajit-pratap Jun 11, 2021
10d4821
attempted fixes to set package download path in PathLoader
aparajit-pratap Jun 16, 2021
a21b72a
update default package install directory in path manager when selecte…
aparajit-pratap Jun 18, 2021
cd2ed3c
no need to reset DefaultPackageDirectory of PackageLoader
aparajit-pratap Jun 18, 2021
224a69e
Revert "no need to reset DefaultPackageDirectory of PackageLoader"
aparajit-pratap Jun 18, 2021
7a98dfe
align package upload directory with selected package install dir
aparajit-pratap Jun 18, 2021
1dd792c
review comments
aparajit-pratap Jun 18, 2021
a0b11b5
address more review comments
aparajit-pratap Jun 18, 2021
cff2767
resolve merge conflicts
aparajit-pratap Jun 18, 2021
787c79f
do not hardcode user data dir to AppData
aparajit-pratap Jun 21, 2021
ecee57f
cleanup and docs
aparajit-pratap Jun 21, 2021
5381e55
remove unused usings
aparajit-pratap Jun 21, 2021
4a57fc2
Merge branch 'master' of github.com:DynamoDS/Dynamo into dyn-3723
aparajit-pratap Jun 21, 2021
62ffe75
add unit tests
aparajit-pratap Jun 21, 2021
be89da3
review comments
aparajit-pratap Jun 22, 2021
87020e5
refactor based on review comments
aparajit-pratap Jun 22, 2021
3ff3e96
resolve merge conflicts
aparajit-pratap Jun 22, 2021
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
23 changes: 23 additions & 0 deletions src/DynamoCore/Configuration/PreferenceSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,28 @@ public string DefaultPythonEngine
/// </summary>
private static string defaultPythonEngine;

private string selectedPackagePathForInstall;
/// <summary>
/// Currently selected package path where all packages downloaded from the Package Manager
/// will be installed.
/// </summary>
public string SelectedPackagePathForInstall {
get
{
if (string.IsNullOrEmpty(selectedPackagePathForInstall))
{
var folder = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
selectedPackagePathForInstall = Path.Combine(Path.Combine(folder, "Dynamo", "Dynamo Core"), "2.12");
aparajit-pratap marked this conversation as resolved.
Show resolved Hide resolved
}

return selectedPackagePathForInstall;
}
set
{
selectedPackagePathForInstall = value;
}
}

/// <summary>
/// Indicates (if any) which namespaces should not be displayed in the Dynamo node library.
/// String format: "[library name]:[fully qualified namespace]"
Expand Down Expand Up @@ -434,6 +456,7 @@ public PreferenceSettings()
EnableNodeAutoComplete = true;
DefaultPythonEngine = string.Empty;
ViewExtensionSettings = new List<ViewExtensionSettings>();

}

/// <summary>
Expand Down
59 changes: 55 additions & 4 deletions src/DynamoCoreWpf/ViewModels/Menu/PreferencesViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using Dynamo.Graph.Workspaces;
using Dynamo.Logging;
using Dynamo.Models;
using Dynamo.Utilities;
using Dynamo.Wpf.ViewModels.Core.Converters;
using Res = Dynamo.Wpf.Properties.Resources;

Expand All @@ -31,16 +32,18 @@ public class PreferencesViewModel : ViewModelBase, INotifyPropertyChanged
private string savedChangesLabel;
private string savedChangesTooltip;
private ObservableCollection<string> languagesList;
private ObservableCollection<string> packagePathsForInstall;
private ObservableCollection<string> fontSizeList;
private ObservableCollection<string> numberFormatList;
private ObservableCollection<StyleItem> styleItemsList;
private StyleItem addStyleControl;
private ObservableCollection<string> _pythonEngineList;
private ObservableCollection<string> pythonEngineList;
aparajit-pratap marked this conversation as resolved.
Show resolved Hide resolved

private string selectedLanguage;
private string selectedFontSize;
private string selectedNumberFormat;
private string selectedPythonEngine;
private string selectedPackagePathForInstall;
private bool runPreviewEnabled;
private bool runPreviewIsChecked;
private bool hideIronPAlerts;
Expand Down Expand Up @@ -221,7 +224,7 @@ public bool RunPreviewIsChecked
}

/// <summary>
/// LanguagesList property containt the list of all the languages listed in: https://wiki.autodesk.com/display/LOCGD/Dynamo+Languages
/// LanguagesList property contains the list of all the languages listed in: https://wiki.autodesk.com/display/LOCGD/Dynamo+Languages
/// </summary>
public ObservableCollection<string> LanguagesList
{
Expand All @@ -236,6 +239,49 @@ public ObservableCollection<string> LanguagesList
}
}

/// <summary>
/// PackagePathsForInstall contains the list of all package paths where
/// packages can be installed.
/// </summary>
public ObservableCollection<string> PackagePathsForInstall
{
get
{
if (packagePathsForInstall == null || !packagePathsForInstall.Any())
{
packagePathsForInstall = new ObservableCollection<string>();
packagePathsForInstall.AddRange(preferenceSettings.CustomPackageFolders.Where(
x => x != DynamoModel.StandardLibraryToken));
aparajit-pratap marked this conversation as resolved.
Show resolved Hide resolved
}
return packagePathsForInstall;
}
set
{
packagePathsForInstall = value;
RaisePropertyChanged(nameof(PackagePathsForInstall));
}
}

/// <summary>
/// Currently selected package path where new packages will be downloaded.
/// </summary>
public string SelectedPackagePathForInstall
{
get
{
return selectedPackagePathForInstall;
aparajit-pratap marked this conversation as resolved.
Show resolved Hide resolved
}
set
{
if (selectedPackagePathForInstall != value)
{
selectedPackagePathForInstall = value;
preferenceSettings.SelectedPackagePathForInstall = value;
RaisePropertyChanged(nameof(SelectedPackagePathForInstall));
}
}
}

/// <summary>
/// FontSizesList contains the list of sizes for fonts defined (the ones defined are Small, Medium, Large, Extra Large)
/// </summary>
Expand Down Expand Up @@ -417,11 +463,11 @@ public ObservableCollection<string> PythonEnginesList
{
get
{
return _pythonEngineList;
return pythonEngineList;
}
set
{
_pythonEngineList = value;
pythonEngineList = value;
RaisePropertyChanged(nameof(PythonEnginesList));
}
}
Expand Down Expand Up @@ -620,6 +666,8 @@ public PreferencesViewModel(DynamoViewModel dynamoViewModel)
SelectedPythonEngine = Res.DefaultPythonEngineNone :
SelectedPythonEngine = preferenceSettings.DefaultPythonEngine;

SelectedPackagePathForInstall = preferenceSettings.SelectedPackagePathForInstall;

string languages = Wpf.Properties.Resources.PreferencesWindowLanguages;
LanguagesList = new ObservableCollection<string>(languages.Split(','));
SelectedLanguage = languages.Split(',').First();
Expand Down Expand Up @@ -693,6 +741,9 @@ private void Model_PropertyChanged(object sender, PropertyChangedEventArgs e)
case nameof(SelectedNumberFormat):
description = Res.DynamoViewSettingMenuNumberFormat;
goto default;
case nameof(SelectedPackagePathForInstall):
// Do nothing for now
break;
case nameof(RunSettingsIsChecked):
description = Res.PreferencesViewRunSettingsLabel;
goto default;
Expand Down
12 changes: 9 additions & 3 deletions src/DynamoCoreWpf/Views/Menu/PreferencesView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@
<!--Package Manager Settings Tab-->
<TabItem Header="{x:Static p:Resources.PreferencesPackageManagerSettingsTab}"
Style="{StaticResource LeftTab}">
<!--This Grid contains the package mangager settings tab-->
<!--This Grid contains the package manager settings tab-->
<Grid x:Name="PackageManagerTab"
Margin="1"
HorizontalAlignment="Stretch">
Expand All @@ -711,14 +711,20 @@
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>

<!--This Grid row contains the Package Paths section-->
<!--This Grid row contains the Node and Package Paths section-->
QilongTang marked this conversation as resolved.
Show resolved Hide resolved
<Expander x:Name="PackagePathsExpander"
Grid.Row="0"
Style="{StaticResource MenuExpanderStyle}"
IsExpanded="{Binding PreferencesTabs[Features].ExpanderActive, Converter={StaticResource ExpandersBindingConverter}, ConverterParameter=PackagePathsExpander}"
Header="{x:Static p:Resources.PackagePathsExpanderName}">
<StackPanel Orientation="Vertical" Margin="0,6,0,0">
<Label>SOME CONTENT</Label>
<ComboBox Grid.Row="1"
Width="213"
HorizontalAlignment="Left"
ItemsSource="{Binding Path=PackagePathsForInstall}"
SelectedItem="{Binding Path=SelectedPackagePathForInstall}"
Style="{StaticResource NoBordersComboBoxStyle}">
</ComboBox>
</StackPanel>
</Expander>

Expand Down