Skip to content

Commit ccba3a8

Browse files
committed
Moved generate button to its own tool
1 parent 2e367ce commit ccba3a8

File tree

2 files changed

+110
-90
lines changed

2 files changed

+110
-90
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning 2.0](https://semver.org/spec/v2
2323
- Added "unet" shared model folder for ComfyUI
2424
### Changed
2525
- The "Download Failed" message for model downloads is now persistent until dismissed
26+
- Separated the Generate button from the prompt control in Inference so it can be moved like other controls
2627
### Fixed
2728
- Fixed "The version of the native libSkiaSharp library (88.1) is incompatible with this version of SkiaSharp." error for Linux users
2829
- Fixed download links for IPAdapters in the HuggingFace model browser

StabilityMatrix.Avalonia/Views/Inference/InferenceTextToImageView.axaml

Lines changed: 109 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -57,100 +57,119 @@
5757

5858
<ProportionalDockSplitter x:Name="Splitter1" Id="Splitter1" />
5959

60-
<!-- Prompt Pane -->
61-
<ToolDock
62-
x:Name="PromptPane"
63-
Alignment="Left"
64-
Id="PromptPane"
65-
Proportion="0.25">
66-
<Tool
67-
x:Name="PromptTool"
68-
Title="Prompt"
69-
x:DataType="Tool"
70-
Id="PromptTool"
71-
CanClose="False">
72-
73-
<!-- Prompt and buttons -->
74-
<Grid
75-
Opacity="1"
76-
x:CompileBindings="False"
77-
DataContext="{Binding ElementName=Dock, Path=DataContext}"
78-
RowDefinitions="*,Auto">
79-
<!-- Prompt card -->
80-
<controls:PromptCard
81-
VerticalAlignment="Top"
82-
DataContext="{Binding PromptCardViewModel}" />
83-
84-
<!-- Generate Buttons -->
85-
<StackPanel Grid.Row="1" Margin="0,6,0,0">
86-
<controls:Card Padding="8">
87-
<Grid
88-
HorizontalAlignment="Center"
89-
ColumnDefinitions="Auto,*,Auto"
90-
RowDefinitions="Auto,*">
91-
<Grid.Styles>
92-
<Style Selector="Button">
93-
<Setter Property="MinHeight" Value="32"/>
94-
</Style>
95-
</Grid.Styles>
96-
<Button
97-
Grid.Row="1"
98-
Margin="4,0"
99-
Padding="12,8"
100-
HorizontalAlignment="Left"
101-
icons:Attached.Icon="fa-solid fa-magnifying-glass-plus"
102-
Classes="transparent"
103-
Command="{Binding GenerateImageCommand}"
104-
CommandParameter="{x:Static modelsInference:GenerateFlags.HiresFixAndUseCurrentSeed}"
105-
ToolTip.Tip="Generate with Hires Scaling" />
60+
<ProportionalDock x:Name="PromptLayout"
61+
Id="PromptLayout"
62+
Orientation="Vertical">
63+
<!-- Prompt Pane -->
64+
<ToolDock
65+
x:Name="PromptPane"
66+
Alignment="Left"
67+
Id="PromptPane"
68+
Proportion="0.9">
69+
<Tool
70+
x:Name="PromptTool"
71+
Title="Prompt"
72+
x:DataType="Tool"
73+
Id="PromptTool"
74+
CanClose="False">
10675

107-
<!-- Main Generate Button -->
108-
<Button
109-
x:Name="GenerateButton"
110-
Grid.Row="1"
111-
Grid.Column="1"
112-
Width="130"
113-
HorizontalAlignment="Stretch"
114-
Classes="accent"
115-
Command="{Binding GenerateImageCommand}"
116-
ToolTip.Tip="{Binding $self.HotKey}"
117-
HotKey="Ctrl+Enter"
118-
CommandParameter="{x:Static modelsInference:GenerateFlags.None}"
119-
IsVisible="{Binding !GenerateImageCommand.CanBeCanceled}">
120-
<Panel>
121-
<TextBlock IsVisible="{Binding #GenerateButton.IsEnabled}" Text="Generate Image" />
122-
<controls:ProgressRing IsIndeterminate="True" IsVisible="{Binding !#GenerateButton.IsEnabled}" />
123-
</Panel>
124-
</Button>
125-
<!-- Cancel Button -->
126-
<Button
127-
x:Name="CancelButton"
128-
Grid.Row="1"
129-
Grid.Column="1"
130-
Width="130"
131-
HorizontalAlignment="Stretch"
132-
icons:Attached.Icon="fa-solid fa-stop"
133-
Command="{Binding GenerateImageCancelCommand}"
134-
IsVisible="{Binding GenerateImageCommand.CanBeCanceled}" />
76+
<!-- Prompt and buttons -->
77+
<Grid
78+
Opacity="1"
79+
x:CompileBindings="False"
80+
DataContext="{Binding ElementName=Dock, Path=DataContext}"
81+
RowDefinitions="*,Auto">
82+
<!-- Prompt card -->
83+
<controls:PromptCard
84+
VerticalAlignment="Stretch"
85+
DataContext="{Binding PromptCardViewModel}" />
86+
</Grid>
87+
</Tool>
88+
</ToolDock>
89+
90+
<!-- Generate Dock -->
91+
<ToolDock
92+
x:Name="GeneratePane"
93+
Alignment="Left"
94+
Id="PromptPane"
95+
Proportion="0.1">
96+
<Tool x:Name="GenerateTool"
97+
Title="Generate"
98+
x:DataType="Tool"
99+
Id="GenerateTool"
100+
CanClose="False">
101+
<!-- Generate Buttons -->
102+
103+
<controls:Card DataContext="{Binding ElementName=Dock, Path=DataContext}"
104+
x:CompileBindings="False"
105+
Margin="0,6,0,0" Padding="8">
106+
<Grid
107+
HorizontalAlignment="Center"
108+
ColumnDefinitions="Auto,*,Auto"
109+
RowDefinitions="Auto,*">
110+
<Grid.Styles>
111+
<Style Selector="Button">
112+
<Setter Property="MinHeight" Value="32" />
113+
</Style>
114+
</Grid.Styles>
115+
<Button
116+
Grid.Row="1"
117+
Margin="4,0"
118+
Padding="12,8"
119+
HorizontalAlignment="Left"
120+
icons:Attached.Icon="fa-solid fa-magnifying-glass-plus"
121+
Classes="transparent"
122+
Command="{Binding GenerateImageCommand}"
123+
CommandParameter="{x:Static modelsInference:GenerateFlags.HiresFixAndUseCurrentSeed}"
124+
ToolTip.Tip="Generate with Hires Scaling" />
135125

136-
<Button
137-
Grid.Row="1"
138-
Grid.Column="2"
139-
Margin="4,0"
140-
Padding="12,8"
141-
HorizontalAlignment="Left"
142-
icons:Attached.Icon="fa-solid fa-repeat"
143-
Classes="transparent"
144-
Command="{Binding GenerateImageCommand}"
145-
CommandParameter="{x:Static modelsInference:GenerateFlags.UseCurrentSeed}"
146-
ToolTip.Tip="Generate with current seed" />
147-
</Grid>
148-
</controls:Card>
149-
</StackPanel>
150-
</Grid>
126+
<!-- Main Generate Button -->
127+
<Button
128+
x:Name="GenerateButton"
129+
Grid.Row="1"
130+
Grid.Column="1"
131+
Width="130"
132+
HorizontalAlignment="Stretch"
133+
Classes="accent"
134+
Command="{Binding GenerateImageCommand}"
135+
ToolTip.Tip="{Binding $self.HotKey}"
136+
HotKey="Ctrl+Enter"
137+
CommandParameter="{x:Static modelsInference:GenerateFlags.None}"
138+
IsVisible="{Binding !GenerateImageCommand.CanBeCanceled}">
139+
<Panel>
140+
<TextBlock IsVisible="{Binding #GenerateButton.IsEnabled}"
141+
Text="Generate Image" />
142+
<controls:ProgressRing IsIndeterminate="True"
143+
IsVisible="{Binding !#GenerateButton.IsEnabled}" />
144+
</Panel>
145+
</Button>
146+
<!-- Cancel Button -->
147+
<Button
148+
x:Name="CancelButton"
149+
Grid.Row="1"
150+
Grid.Column="1"
151+
Width="130"
152+
HorizontalAlignment="Stretch"
153+
icons:Attached.Icon="fa-solid fa-stop"
154+
Command="{Binding GenerateImageCancelCommand}"
155+
IsVisible="{Binding GenerateImageCommand.CanBeCanceled}" />
151156

157+
<Button
158+
Grid.Row="1"
159+
Grid.Column="2"
160+
Margin="4,0"
161+
Padding="12,8"
162+
HorizontalAlignment="Left"
163+
icons:Attached.Icon="fa-solid fa-repeat"
164+
Classes="transparent"
165+
Command="{Binding GenerateImageCommand}"
166+
CommandParameter="{x:Static modelsInference:GenerateFlags.UseCurrentSeed}"
167+
ToolTip.Tip="Generate with current seed" />
168+
</Grid>
169+
</controls:Card>
152170
</Tool>
153-
</ToolDock>
171+
</ToolDock>
172+
</ProportionalDock>
154173

155174
<ProportionalDockSplitter x:Name="Splitter2" Id="Splitter2" />
156175

0 commit comments

Comments
 (0)