Skip to content

Commit

Permalink
Remove old installed packages view (#11791)
Browse files Browse the repository at this point in the history
* update

* update

* update

* update

* Update InstalledPackagesControl.xaml

* Update icons and icon sizes.

* More tweaking..

* More tweaking.
Remove delete button.
Restore delete button in context menu.

* More tweaking

* MergeFixes

* Some more tweaks

* Add contest menu style

* update colors

* More context menu tweaking.

* One small tweak.

* add mark for uninstall label

* simplify control

* Update DynamoModern.xaml

* Change ListBox to ItemsControl

* More tweaks

* More tweaks

* Restore Scollbar

* Remove unused icon

* align content with header and remove border

* update

* update menu icon

* Remove old Installed packages view.

* Update InstalledPackagesControl.xaml.cs

* Fix Colors

* Move style

* Use FlatIconButtonStyle

* Update comment and use nameof()

* Fix merge error.

* Update comment.

* Fix tests

* Keep ManagePackage tracking

* Fix project file

* Fix command

* Update track implementation

* More command tweaks

Co-authored-by: pinzart <[email protected]>
Co-authored-by: pinzart90 <[email protected]>
  • Loading branch information
3 people authored Jul 1, 2021
1 parent ce29111 commit 7b74464
Show file tree
Hide file tree
Showing 13 changed files with 56 additions and 499 deletions.
10 changes: 1 addition & 9 deletions src/DynamoCoreWpf/Controls/InstalledPackagesControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,6 @@ private void MoreButton_OnClick(object sender, RoutedEventArgs e)
button.ContextMenu.DataContext = button.DataContext;
button.ContextMenu.IsOpen = true;
}

private void Expander_Expanded(object sender, RoutedEventArgs e)
{
Expander exp = (Expander)sender;
if (exp.DataContext is PackageViewModel pm)
{
pm.ToggleTypesVisibleInManagerCommand.Execute();
}
}
}
}

10 changes: 0 additions & 10 deletions src/DynamoCoreWpf/DynamoCoreWpf.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -362,9 +362,6 @@
<Compile Include="Views\Preview\InfoBubbleView.xaml.cs">
<DependentUpon>InfoBubbleView.xaml</DependentUpon>
</Compile>
<Compile Include="Views\PackageManager\InstalledPackagesView.xaml.cs">
<DependentUpon>InstalledPackagesView.xaml</DependentUpon>
</Compile>
<Compile Include="Views\Search\LibraryView.xaml.cs">
<DependentUpon>LibraryView.xaml</DependentUpon>
</Compile>
Expand Down Expand Up @@ -506,7 +503,6 @@
<None Include="App.config">
<SubType>Designer</SubType>
</None>
<None Include="packages.config" />
<None Include="UI\Fonts\OpenSans-Bold.ttf">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
Expand Down Expand Up @@ -1168,12 +1164,6 @@
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<ItemGroup>
<Page Include="Views\PackageManager\InstalledPackagesView.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<ItemGroup>
<Page Include="Views\Search\LibraryView.xaml">
<Generator>MSBuild:Compile</Generator>
Expand Down
27 changes: 0 additions & 27 deletions src/DynamoCoreWpf/Properties/Resources.Designer.cs

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

9 changes: 0 additions & 9 deletions src/DynamoCoreWpf/Properties/Resources.en-US.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1160,12 +1160,6 @@ Failed to publish file(s):
<data name="InstalledPackageViewContextMenuRemoveDeprecationTooltip" xml:space="preserve">
<value>Remove package deprecation. Only allowed if you're a current maintainer of the package.</value>
</data>
<data name="InstalledPackageViewContextMenuShowContent" xml:space="preserve">
<value>Show Contents</value>
</data>
<data name="InstalledPackageViewContextMenuShowContentTooltip" xml:space="preserve">
<value>See the types loaded by this package</value>
</data>
<data name="InstalledPackageViewContextMenuShowRootDir" xml:space="preserve">
<value>Show Root Directory</value>
</data>
Expand Down Expand Up @@ -1527,9 +1521,6 @@ Next assemblies were loaded several times:
<value>A problem occurred when trying to install the package. Dynamo is unable to obtain read/write access to
{0}</value>
</data>
<data name="PackageManagerWebSiteButton" xml:space="preserve">
<value>Package Manager Website</value>
</data>
<data name="PackageNameCannotContainTheseCharacters" xml:space="preserve">
<value>The name of the package cannot contain /,\, or *.</value>
<comment>ErrorString</comment>
Expand Down
9 changes: 0 additions & 9 deletions src/DynamoCoreWpf/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1153,12 +1153,6 @@ You will get a chance to save your work.</value>
<data name="InstalledPackageViewContextMenuRemoveDeprecationTooltip" xml:space="preserve">
<value>Remove package deprecation. Only allowed if you're a current maintainer of the package.</value>
</data>
<data name="InstalledPackageViewContextMenuShowContent" xml:space="preserve">
<value>Show Contents</value>
</data>
<data name="InstalledPackageViewContextMenuShowContentTooltip" xml:space="preserve">
<value>See the types loaded by this package</value>
</data>
<data name="InstalledPackageViewContextMenuShowRootDir" xml:space="preserve">
<value>Show Root Directory</value>
</data>
Expand Down Expand Up @@ -1237,9 +1231,6 @@ You will get a chance to save your work.</value>
<data name="PackageDownloadStateStarting" xml:space="preserve">
<value>Starting</value>
</data>
<data name="PackageManagerWebSiteButton" xml:space="preserve">
<value>Package Manager Website</value>
</data>
<data name="PackageSearchStateNoResult" xml:space="preserve">
<value>Search returned no results!</value>
</data>
Expand Down
13 changes: 2 additions & 11 deletions src/DynamoCoreWpf/ViewModels/PackageManager/PackageViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public bool HasAssemblies
get { return Model.LoadedAssemblies.Any(); }
}

[Obsolete("Do not use. This command will be removed. It does nothing.")]
public DelegateCommand ToggleTypesVisibleInManagerCommand { get; set; }
public DelegateCommand GetLatestVersionCommand { get; set; }
public DelegateCommand PublishNewPackageVersionCommand { get; set; }
Expand All @@ -62,7 +63,7 @@ public PackageViewModel(DynamoViewModel dynamoViewModel, Package model)
this.packageManagerClient = pmExtension.PackageManagerClient;
Model = model;

ToggleTypesVisibleInManagerCommand = new DelegateCommand(ToggleTypesVisibleInManager, CanToggleTypesVisibleInManager);
ToggleTypesVisibleInManagerCommand = new DelegateCommand(() => { }, () => true);
GetLatestVersionCommand = new DelegateCommand(GetLatestVersion, CanGetLatestVersion);
PublishNewPackageVersionCommand = new DelegateCommand(() => ExecuteWithTou(PublishNewPackageVersion), CanPublishNewPackageVersion);
PublishNewPackageCommand = new DelegateCommand(() => ExecuteWithTou(PublishNewPackage), CanPublishNewPackage);
Expand Down Expand Up @@ -266,15 +267,5 @@ private bool CanGetLatestVersion()
{
return false;
}

private void ToggleTypesVisibleInManager()
{
Model.TypesVisibleInManager = !Model.TypesVisibleInManager;
}

private bool CanToggleTypesVisibleInManager()
{
return true;
}
}
}
4 changes: 0 additions & 4 deletions src/DynamoCoreWpf/Views/Core/DynamoView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -603,10 +603,6 @@
Header="{x:Static p:Resources.DynamoViewPackageMenuSearchPackage}"
Command="{Binding Path=DataContext.ShowPackageManagerSearchCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type controls:DynamoView}}}"
Name="showPMSearch" />
<MenuItem Focusable="False"
Header="{x:Static p:Resources.DynamoViewPackageMenuManagePackage}"
Command="{Binding Path=DataContext.ShowInstalledPackagesCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type controls:DynamoView}}}"
Name="showPMInstalled" />
<MenuItem Focusable="False"
Header="{x:Static p:Resources.DynamoViewPackageMenuPublishPackage}"
Command="{Binding Path=DataContext.PublishNewPackageCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type controls:DynamoView}}}"
Expand Down
25 changes: 0 additions & 25 deletions src/DynamoCoreWpf/Views/Core/DynamoView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -929,7 +929,6 @@ private void DynamoView_Loaded(object sender, EventArgs e)
#region Package manager

dynamoViewModel.RequestPackagePublishDialog += DynamoViewModelRequestRequestPackageManagerPublish;
dynamoViewModel.RequestManagePackagesDialog += DynamoViewModelRequestShowInstalledPackages;
dynamoViewModel.RequestPackageManagerSearchDialog += DynamoViewModelRequestShowPackageManagerSearch;

#endregion
Expand Down Expand Up @@ -1153,29 +1152,6 @@ private void DynamoViewModelRequestShowPackageManagerSearch(object s, EventArgs
_pkgSearchVM.RefreshAndSearchAsync();
}

private InstalledPackagesView _installedPkgsView;

private void DynamoViewModelRequestShowInstalledPackages(object s, EventArgs e)
{
var cmd = Analytics.TrackCommandEvent("ManagePackage");
if (_installedPkgsView == null)
{
var pmExtension = dynamoViewModel.Model.GetPackageManagerExtension();
_installedPkgsView = new InstalledPackagesView(new InstalledPackagesViewModel(dynamoViewModel,
pmExtension.PackageLoader))
{
Owner = this,
WindowStartupLocation = WindowStartupLocation.CenterOwner
};

_installedPkgsView.Closed += (sender, args) => { _installedPkgsView = null; cmd.Dispose(); };
_installedPkgsView.Show();

if (_installedPkgsView.IsLoaded && IsLoaded) _installedPkgsView.Owner = this;
}
_installedPkgsView.Focus();
}

private void ClipBoard_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
dynamoViewModel.CopyCommand.RaiseCanExecuteChanged();
Expand Down Expand Up @@ -1531,7 +1507,6 @@ private void WindowClosed(object sender, EventArgs e)

//PACKAGE MANAGER
dynamoViewModel.RequestPackagePublishDialog -= DynamoViewModelRequestRequestPackageManagerPublish;
dynamoViewModel.RequestManagePackagesDialog -= DynamoViewModelRequestShowInstalledPackages;
dynamoViewModel.RequestPackageManagerSearchDialog -= DynamoViewModelRequestShowPackageManagerSearch;

//FUNCTION NAME PROMPT
Expand Down
12 changes: 7 additions & 5 deletions src/DynamoCoreWpf/Views/Menu/PreferencesView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -744,11 +744,13 @@
</Expander>

<!--This Grid row contains the Installed Packages section-->
<Expander x:Name="InstalledPackagesExpander"
Style="{StaticResource MenuExpanderStyle}"
IsExpanded="{Binding PreferencesTabs[Features].ExpanderActive, Converter={StaticResource ExpandersBindingConverter}, ConverterParameter=InstalledPackagesExpander}"
Grid.Row="1"
Header="{x:Static p:Resources.InstalledPackageViewTitle}">
<Expander x:Name="InstalledPackagesExpander"
Expanded="InstalledPackagesExpander_OnExpanded"
Collapsed="InstalledPackagesExpander_OnCollapsed"
Style="{StaticResource MenuExpanderStyle}"
IsExpanded="{Binding PreferencesTabs[Features].ExpanderActive, Converter={StaticResource ExpandersBindingConverter}, ConverterParameter=InstalledPackagesExpander}"
Grid.Row="1"
Header="{x:Static p:Resources.InstalledPackageViewTitle}">
<StackPanel
Orientation="Vertical" Margin="0,6,0,0">
<wpfControls:InstalledPackagesControl Height="Auto"/>
Expand Down
21 changes: 21 additions & 0 deletions src/DynamoCoreWpf/Views/Menu/PreferencesView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ public partial class PreferencesView : Window
private readonly PreferencesViewModel viewModel;
private readonly DynamoViewModel dynViewModel;

// Used for tracking the manage package command event
// This is not a command any more but we keep it
// around in a compatible way for now
private IDisposable managePackageCommandEvent;

/// <summary>
/// Constructor of Preferences View
/// </summary>
Expand Down Expand Up @@ -82,6 +87,7 @@ private void InitRadioButtonsDescription()
/// <param name="e"></param>
private void CloseButton_Click(object sender, RoutedEventArgs e)
{
managePackageCommandEvent?.Dispose();
Dynamo.Logging.Analytics.TrackEvent(
Actions.Close,
Categories.Preferences);
Expand Down Expand Up @@ -250,5 +256,20 @@ private void ReloadCPython_Click(object sender, RoutedEventArgs e)
dynViewModel.Model.OnRequestPythonReset("CPython3");
}

private void InstalledPackagesExpander_OnExpanded(object sender, RoutedEventArgs e)
{
if (e.OriginalSource == e.Source)
{
managePackageCommandEvent = Analytics.TrackCommandEvent("ManagePackage");
}
}

private void InstalledPackagesExpander_OnCollapsed(object sender, RoutedEventArgs e)
{
if (e.OriginalSource == e.Source)
{
managePackageCommandEvent?.Dispose();
}
}
}
}
Loading

0 comments on commit 7b74464

Please sign in to comment.