Skip to content
This repository was archived by the owner on Nov 27, 2024. It is now read-only.

Commit 5ad13e2

Browse files
committed
Removed IsEnabled UI flag and its superseded by Install/Uninstall
1 parent db29200 commit 5ad13e2

11 files changed

+38
-101
lines changed

OnnxStack.UI/Dialogs/UpdateModelDialog.xaml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,10 @@
2222
<GroupBox Header="Settings">
2323
<StackPanel Margin="5" >
2424

25-
<DockPanel >
26-
<CheckBox DockPanel.Dock="Right" Content="IsEnabled" IsChecked="{Binding UpdateModelSet.IsEnabled}" Margin="5,18,0,0"/>
27-
<StackPanel Margin="0,0,4,0">
28-
<TextBlock Text="Name" />
29-
<TextBox Text="{Binding UpdateModelSet.Name}" />
30-
</StackPanel>
31-
</DockPanel>
25+
<StackPanel Margin="0,0,4,0">
26+
<TextBlock Text="Name" />
27+
<TextBox Text="{Binding UpdateModelSet.Name}" />
28+
</StackPanel>
3229

3330
<UniformGrid Columns="3" Margin="0,5,0,0">
3431

@@ -47,7 +44,7 @@
4744
</StackPanel>
4845
</UniformGrid>
4946

50-
<UniformGrid Margin="0,5,0,0">
47+
<UniformGrid Margin="0,5,0,0">
5148
<CheckBox IsChecked="{Binding UpdateModelSet.EnableTextToImage}" Content="Text To Image" VerticalAlignment="Center" Margin="0,4,0,0"/>
5249
<CheckBox IsChecked="{Binding UpdateModelSet.EnableImageToImage}" Content="Image To Image" VerticalAlignment="Center" Margin="0,4,0,0"/>
5350
<CheckBox IsChecked="{Binding UpdateModelSet.EnableImageInpaintLegacy}" Content="Image Inpaint Legacy" VerticalAlignment="Center" Margin="0,4,0,0"/>

OnnxStack.UI/Dialogs/UpdateModelDialog.xaml.cs

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public UpdateModelSetViewModel UpdateModelSet
5555
get { return _updateModelSet; }
5656
set { _updateModelSet = value; NotifyPropertyChanged(); }
5757
}
58-
58+
5959
public string ValidationError
6060
{
6161
get { return _validationError; }
@@ -166,7 +166,6 @@ public void NotifyPropertyChanged([CallerMemberName] string property = "")
166166
public class UpdateModelSetViewModel : INotifyPropertyChanged
167167
{
168168
private string _name;
169-
private bool _isEnabled;
170169
private int _deviceId;
171170
private int _interOpNumThreads;
172171
private int _intraOpNumThreads;
@@ -194,12 +193,6 @@ public string Name
194193
set { _name = value; NotifyPropertyChanged(); }
195194
}
196195

197-
public bool IsEnabled
198-
{
199-
get { return _isEnabled; }
200-
set { _isEnabled = value; NotifyPropertyChanged(); }
201-
}
202-
203196
public int PadTokenId
204197
{
205198
get { return _padTokenId; }
@@ -360,8 +353,6 @@ public static UpdateModelSetViewModel FromModelSet(StableDiffusionModelSet model
360353
TokenizerLength = modelset.TokenizerLength,
361354
TokenizerLimit = modelset.TokenizerLimit,
362355
TokenizerType = modelset.TokenizerType,
363-
IsEnabled = modelset.IsEnabled,
364-
365356
ModelFiles = new ObservableCollection<ModelFileViewModel>(modelset.ModelConfigurations.Select(c => new ModelFileViewModel
366357
{
367358
Type = c.Type,
@@ -386,9 +377,8 @@ public static StableDiffusionModelSet ToModelSet(UpdateModelSetViewModel modelse
386377
{
387378
return new StableDiffusionModelSet
388379
{
389-
380+
IsEnabled = true,
390381
Name = modelset.Name,
391-
IsEnabled = modelset.IsEnabled,
392382
PipelineType = modelset.PipelineType,
393383
ModelType = modelset.ModelType,
394384
SampleSize = modelset.SampleSize,
@@ -407,9 +397,6 @@ public static StableDiffusionModelSet ToModelSet(UpdateModelSetViewModel modelse
407397
TokenizerLimit = modelset.TokenizerLimit,
408398
TokenizerLength = modelset.TokenizerLength,
409399
Tokenizer2Length = modelset.Tokenizer2Length,
410-
411-
412-
413400
ModelConfigurations = new List<OnnxModelConfig>(modelset.ModelFiles.Select(x => new OnnxModelConfig
414401
{
415402
Type = x.Type,

OnnxStack.UI/Dialogs/UpdateModelSettingsDialog.xaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
</Border.Style>
3737
</Border>
3838
</StackPanel>
39-
<CheckBox DockPanel.Dock="Right" Content="IsEnabled" IsChecked="{Binding UpdateModelSet.IsEnabled}" Margin="5,18,0,0"/>
4039
<StackPanel Margin="0,0,4,0" >
4140
<TextBlock Text="Name" />
4241
<TextBox Text="{Binding UpdateModelSet.Name}" />

OnnxStack.UI/Dialogs/UpdateUpscaleModelDialog.xaml

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,22 +42,16 @@
4242
<GroupBox Header="Settings" Margin="5,0" >
4343
<StackPanel Margin="5" >
4444

45-
<DockPanel>
46-
<CheckBox DockPanel.Dock="Right" Content="IsEnabled" IsChecked="{Binding UpdateModelSet.IsEnabled}" Margin="10,24,0,0" />
47-
<StackPanel Margin="0,5,0,0">
48-
<TextBlock Text="Model Name"/>
49-
<TextBox Text="{Binding UpdateModelSet.Name, UpdateSourceTrigger=PropertyChanged}" />
50-
</StackPanel>
51-
</DockPanel>
52-
53-
45+
<StackPanel Margin="0,5,0,0">
46+
<TextBlock Text="Model Name"/>
47+
<TextBox Text="{Binding UpdateModelSet.Name, UpdateSourceTrigger=PropertyChanged}" />
48+
</StackPanel>
5449

5550
<StackPanel Margin="0,10,0,0">
5651
<TextBlock Text="Model File"/>
5752
<userControls:FilePickerTextBox FileName="{Binding UpdateModelSet.ModelFiles[0].OnnxModelPath, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Filter="Onnx files (*.onnx)|*.onnx" DefaultExt="onnx" />
5853
</StackPanel>
5954

60-
6155
<UniformGrid Columns="3" Margin="0,10,0,0">
6256
<StackPanel>
6357
<TextBlock Text="Sample Size" />
@@ -77,7 +71,7 @@
7771
</StackPanel>
7872
</GroupBox>
7973

80-
74+
8175

8276
<GroupBox Header="Performance" Margin="5,10,5,0" >
8377
<UniformGrid Columns="2" Margin="5">

OnnxStack.UI/Dialogs/UpdateUpscaleModelDialog.xaml.cs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ private bool Validate()
103103

104104
private Task Save()
105105
{
106-
106+
107107
if (!Validate())
108108
return Task.CompletedTask;
109109

@@ -178,7 +178,6 @@ public void NotifyPropertyChanged([CallerMemberName] string property = "")
178178
public class UpdateUpscaleModelSetViewModel : INotifyPropertyChanged
179179
{
180180
private string _name;
181-
private bool _isEnabled;
182181
private int _deviceId;
183182
private int _interOpNumThreads;
184183
private int _intraOpNumThreads;
@@ -195,12 +194,6 @@ public string Name
195194
set { _name = value; NotifyPropertyChanged(); }
196195
}
197196

198-
public bool IsEnabled
199-
{
200-
get { return _isEnabled; }
201-
set { _isEnabled = value; NotifyPropertyChanged(); }
202-
}
203-
204197
public int Channels
205198
{
206199
get { return _channels; }
@@ -263,7 +256,6 @@ public static UpdateUpscaleModelSetViewModel FromModelSet(UpscaleModelSet models
263256
SampleSize = modelset.SampleSize,
264257
ScaleFactor = modelset.ScaleFactor,
265258
Channels = modelset.Channels,
266-
IsEnabled = modelset.IsEnabled,
267259

268260
DeviceId = modelset.DeviceId,
269261
ExecutionMode = modelset.ExecutionMode,
@@ -293,8 +285,8 @@ public static UpscaleModelSet ToModelSet(UpdateUpscaleModelSetViewModel modelset
293285
{
294286
return new UpscaleModelSet
295287
{
288+
IsEnabled = true,
296289
Name = modelset.Name,
297-
IsEnabled = modelset.IsEnabled,
298290
SampleSize = modelset.SampleSize,
299291
ScaleFactor = modelset.ScaleFactor,
300292
Channels = modelset.Channels,

OnnxStack.UI/Dialogs/UpdateUpscaleModelSettingsDialog.xaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
</Border.Style>
3737
</Border>
3838
</StackPanel>
39-
<CheckBox DockPanel.Dock="Right" Content="IsEnabled" IsChecked="{Binding UpdateModelSet.IsEnabled}" Margin="5,18,0,0"/>
4039
<StackPanel Margin="0,0,4,0" >
4140
<TextBlock Text="Name" />
4241
<TextBox Text="{Binding UpdateModelSet.Name}" />

OnnxStack.UI/Models/StableDiffusionModelSetViewModel.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ public class StableDiffusionModelSetViewModel : INotifyPropertyChanged
1010
private string _name;
1111
private bool _isLoaded;
1212
private bool _isLoading;
13-
private bool _isEnabled;
1413

1514
public string Name
1615
{
@@ -32,11 +31,6 @@ public bool IsLoading
3231
set { _isLoading = value; NotifyPropertyChanged(); }
3332
}
3433

35-
public bool IsEnabled
36-
{
37-
get { return _isEnabled; }
38-
set { _isEnabled = value; NotifyPropertyChanged(); }
39-
}
4034
public StableDiffusionModelSet ModelSet { get; set; }
4135

4236
#region INotifyPropertyChanged

OnnxStack.UI/Models/UpscaleModelSetViewModel.cs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ public class UpscaleModelSetViewModel : INotifyPropertyChanged
1010
private string _name;
1111
private bool _isLoaded;
1212
private bool _isLoading;
13-
private bool _isEnabled;
1413

1514
public string Name
1615
{
@@ -31,13 +30,7 @@ public bool IsLoading
3130
get { return _isLoading; }
3231
set { _isLoading = value; NotifyPropertyChanged(); }
3332
}
34-
35-
public bool IsEnabled
36-
{
37-
get { return _isEnabled; }
38-
set { _isEnabled = value; NotifyPropertyChanged(); }
39-
}
40-
33+
4134
public UpscaleModelSet ModelSet { get; set; }
4235

4336
#region INotifyPropertyChanged

OnnxStack.UI/UserControls/ModelPickerControl.xaml

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -49,30 +49,17 @@
4949
<TextBlock Text="Unload"/>
5050
</Button>
5151
</StackPanel>
52-
<ComboBox
53-
DisplayMemberPath="Name"
54-
ItemsSource="{Binding UISettings.StableDiffusionModelSets}"
55-
SelectedItem="{Binding SelectedModel}"
56-
IsEnabled="{Binding SelectedModel.IsLoading, FallbackValue=True, TargetNullValue=True, Converter={StaticResource InverseBoolConverter}}" >
57-
58-
<ComboBox.ItemContainerStyle>
59-
<Style TargetType="{x:Type ComboBoxItem}" BasedOn="{StaticResource {x:Type ComboBoxItem}}">
60-
<Setter Property="Visibility" Value="Collapsed" />
61-
<Style.Triggers>
62-
<DataTrigger Binding="{Binding IsEnabled}" Value="True">
63-
<Setter Property="Visibility">
64-
<Setter.Value>
65-
<MultiBinding Converter="{StaticResource DiffuserVisibilityConverter}">
66-
<Binding Path="ModelSet.Diffusers"/>
67-
<Binding Path="SupportedDiffusers" ElementName="UI" />
68-
</MultiBinding>
69-
</Setter.Value>
70-
</Setter>
71-
</DataTrigger>
72-
</Style.Triggers>
73-
</Style>
74-
</ComboBox.ItemContainerStyle>
75-
</ComboBox>
52+
<Grid>
53+
<ComboBox
54+
DisplayMemberPath="Name"
55+
ItemsSource="{Binding UISettings.StableDiffusionModelSets}"
56+
SelectedItem="{Binding SelectedModel}"
57+
IsEnabled="{Binding SelectedModel.IsLoading, FallbackValue=True, TargetNullValue=True, Converter={StaticResource InverseBoolConverter}}" >
58+
</ComboBox>
59+
<TextBlock Text="-- Select Model --" Visibility="{Binding SelectedModel, Converter={StaticResource InverseNullVisibilityConverter}}" IsHitTestVisible="False" Margin="3,2" FontStyle="Italic" Opacity=".7" />
60+
</Grid>
61+
62+
7663
</DockPanel>
7764
</DockPanel>
7865

OnnxStack.UI/UserControls/UpscalePickerControl.xaml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,17 @@
4949
<TextBlock Text="Unload"/>
5050
</Button>
5151
</StackPanel>
52-
<ComboBox
53-
DisplayMemberPath="Name"
54-
ItemsSource="{Binding UISettings.UpscaleModelSets}"
55-
SelectedItem="{Binding SelectedModel}"
56-
IsEnabled="{Binding SelectedModel.IsLoading, FallbackValue=True, TargetNullValue=True, Converter={StaticResource InverseBoolConverter}}" >
57-
58-
59-
</ComboBox>
52+
53+
<Grid>
54+
<ComboBox
55+
DisplayMemberPath="Name"
56+
ItemsSource="{Binding UISettings.UpscaleModelSets}"
57+
SelectedItem="{Binding SelectedModel}"
58+
IsEnabled="{Binding SelectedModel.IsLoading, FallbackValue=True, TargetNullValue=True, Converter={StaticResource InverseBoolConverter}}" >
59+
</ComboBox>
60+
<TextBlock Text="-- Select Model --" Visibility="{Binding SelectedModel, Converter={StaticResource InverseNullVisibilityConverter}}" IsHitTestVisible="False" Margin="3,2" FontStyle="Italic" Opacity=".7" />
61+
</Grid>
62+
6063
</DockPanel>
6164
</DockPanel>
6265

0 commit comments

Comments
 (0)