Skip to content

Commit 2519422

Browse files
authored
Merge branch 'dev' into explorer-plugin-add-context-menu-hotkey
2 parents d7a11ae + 2ac2c9c commit 2519422

File tree

8 files changed

+162
-110
lines changed

8 files changed

+162
-110
lines changed

.cm/gitstream.cm

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# -*- mode: yaml -*-
2+
# This example configuration for provides basic automations to get started with gitStream.
3+
# View the gitStream quickstart for more examples: https://docs.gitstream.cm/examples/
4+
manifest:
5+
version: 1.0
6+
7+
8+
automations:
9+
# Add a label that indicates how many minutes it will take to review the PR.
10+
estimated_time_to_review:
11+
if:
12+
- true
13+
run:
14+
- action: add-label@v1
15+
args:
16+
label: "{{ calc.etr }} min review"
17+
color: {{ colors.red if (calc.etr >= 20) else ( colors.yellow if (calc.etr >= 5) else colors.green ) }}
18+
# Post a comment that lists the best experts for the files that were modified.
19+
explain_code_experts:
20+
if:
21+
- true
22+
run:
23+
- action: explain-code-experts@v1
24+
args:
25+
gt: 10
26+
# Post a comment that indicates what percentage of the PR is new code.
27+
percent_new_code:
28+
if:
29+
- true
30+
run:
31+
- action: add-comment@v1
32+
args:
33+
comment: |
34+
This PR is {{ changes.ratio }}% new code.
35+
# Post a comment that request changes for a PR that contains a TODO statement.
36+
review_todo_comments:
37+
if:
38+
- {{ source.diff.files | matchDiffLines(regex=r/^[+].*(TODO)|(todo)/) | some }}
39+
run:
40+
- action: request-changes@v1
41+
args:
42+
comment: |
43+
This PR contains a TODO statement. Please check to see if they should be removed.
44+
# Post a comment that request a before and after screenshot
45+
request_screenshot:
46+
# Triggered for PRs that lack an image file or link to an image in the PR description
47+
if:
48+
- {{ not (has.screenshot_link or has.image_uploaded) }}
49+
run:
50+
- action: add-comment@v1
51+
args:
52+
comment: |
53+
Be a legend :trophy: by adding a before and after screenshot of the changes you made, especially if they are around UI/UX.
54+
55+
56+
# +----------------------------------------------------------------------------+
57+
# | Custom Expressions |
58+
# | https://docs.gitstream.cm/how-it-works/#custom-expressions |
59+
# +----------------------------------------------------------------------------+
60+
61+
calc:
62+
etr: {{ branch | estimatedReviewTime }}
63+
64+
colors:
65+
red: 'b60205'
66+
yellow: 'fbca04'
67+
green: '0e8a16'
68+
69+
changes:
70+
# Sum all the lines added/edited in the PR
71+
additions: {{ branch.diff.files_metadata | map(attr='additions') | sum }}
72+
# Sum all the line removed in the PR
73+
deletions: {{ branch.diff.files_metadata | map(attr='deletions') | sum }}
74+
# Calculate the ratio of new code
75+
ratio: {{ (changes.additions / (changes.additions + changes.deletions)) * 100 | round(2) }}

.github/workflows/gitstream.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Code generated by gitStream GitHub app - DO NOT EDIT
2+
3+
name: gitStream workflow automation
4+
run-name: |
5+
/:\ gitStream: PR #${{ fromJSON(fromJSON(github.event.inputs.client_payload)).pullRequestNumber }} from ${{ github.event.inputs.full_repository }}
6+
7+
on:
8+
workflow_dispatch:
9+
inputs:
10+
client_payload:
11+
description: The Client payload
12+
required: true
13+
full_repository:
14+
description: the repository name include the owner in `owner/repo_name` format
15+
required: true
16+
head_ref:
17+
description: the head sha
18+
required: true
19+
base_ref:
20+
description: the base ref
21+
required: true
22+
installation_id:
23+
description: the installation id
24+
required: false
25+
resolver_url:
26+
description: the resolver url to pass results to
27+
required: true
28+
resolver_token:
29+
description: Optional resolver token for resolver service
30+
required: false
31+
default: ''
32+
33+
jobs:
34+
gitStream:
35+
timeout-minutes: 5
36+
runs-on: ubuntu-latest
37+
name: gitStream workflow automation
38+
steps:
39+
- name: Evaluate Rules
40+
uses: linear-b/gitstream-github-action@v2
41+
id: rules-engine
42+
with:
43+
full_repository: ${{ github.event.inputs.full_repository }}
44+
head_ref: ${{ github.event.inputs.head_ref }}
45+
base_ref: ${{ github.event.inputs.base_ref }}
46+
client_payload: ${{ github.event.inputs.client_payload }}
47+
installation_id: ${{ github.event.inputs.installation_id }}
48+
resolver_url: ${{ github.event.inputs.resolver_url }}
49+
resolver_token: ${{ github.event.inputs.resolver_token }}

Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs

Lines changed: 30 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ namespace Flow.Launcher.SettingPages.ViewModels;
2222

2323
public partial class SettingsPaneThemeViewModel : BaseModel
2424
{
25+
private const string DefaultFont = "Segoe UI";
2526
public Settings Settings { get; }
2627

2728
public static string LinkHowToCreateTheme => @"https://flowlauncher.com/docs/#/how-to-create-a-theme";
@@ -82,6 +83,7 @@ public double QueryBoxFontSize
8283
get => Settings.QueryBoxFontSize;
8384
set => Settings.QueryBoxFontSize = value;
8485
}
86+
8587
public double ResultItemFontSize
8688
{
8789
get => Settings.ResultItemFontSize;
@@ -97,30 +99,9 @@ public double ResultSubItemFontSize
9799
private List<Theme.ThemeData> _themes;
98100
public List<Theme.ThemeData> Themes => _themes ??= ThemeManager.Instance.LoadAvailableThemes();
99101

102+
public class ColorSchemeData : DropdownDataGeneric<ColorSchemes> { }
100103

101-
public class ColorScheme
102-
{
103-
public string Display { get; set; }
104-
public ColorSchemes Value { get; set; }
105-
}
106-
107-
public List<ColorScheme> ColorSchemes
108-
{
109-
get
110-
{
111-
List<ColorScheme> modes = new List<ColorScheme>();
112-
var enums = (ColorSchemes[])Enum.GetValues(typeof(ColorSchemes));
113-
foreach (var e in enums)
114-
{
115-
var key = $"ColorScheme{e}";
116-
var display = InternationalizationManager.Instance.GetTranslation(key);
117-
var m = new ColorScheme { Display = display, Value = e, };
118-
modes.Add(m);
119-
}
120-
121-
return modes;
122-
}
123-
}
104+
public List<ColorSchemeData> ColorSchemes { get; } = DropdownDataGeneric<ColorSchemes>.GetValues<ColorSchemeData>("ColorScheme");
124105

125106
public List<string> TimeFormatList { get; } = new()
126107
{
@@ -167,11 +148,13 @@ public string DateFormat
167148
}
168149

169150
public IEnumerable<int> MaxResultsRange => Enumerable.Range(2, 16);
151+
170152
public bool KeepMaxResults
171153
{
172154
get => Settings.KeepMaxResults;
173155
set => Settings.KeepMaxResults = value;
174156
}
157+
175158
public string ClockText => DateTime.Now.ToString(TimeFormat, CultureInfo.CurrentCulture);
176159

177160
public string DateText => DateTime.Now.ToString(DateFormat, CultureInfo.CurrentCulture);
@@ -188,29 +171,9 @@ public bool UseAnimation
188171
set => Settings.UseAnimation = value;
189172
}
190173

191-
public class AnimationSpeed
192-
{
193-
public string Display { get; set; }
194-
public AnimationSpeeds Value { get; set; }
195-
}
174+
public class AnimationSpeedData : DropdownDataGeneric<AnimationSpeeds> { }
175+
public List<AnimationSpeedData> AnimationSpeeds { get; } = DropdownDataGeneric<AnimationSpeeds>.GetValues<AnimationSpeedData>("AnimationSpeed");
196176

197-
public List<AnimationSpeed> AnimationSpeeds
198-
{
199-
get
200-
{
201-
List<AnimationSpeed> speeds = new List<AnimationSpeed>();
202-
var enums = (AnimationSpeeds[])Enum.GetValues(typeof(AnimationSpeeds));
203-
foreach (var e in enums)
204-
{
205-
var key = $"AnimationSpeed{e}";
206-
var display = InternationalizationManager.Instance.GetTranslation(key);
207-
var m = new AnimationSpeed { Display = display, Value = e, };
208-
speeds.Add(m);
209-
}
210-
211-
return speeds;
212-
}
213-
}
214177
public bool UseSound
215178
{
216179
get => Settings.UseSound;
@@ -329,7 +292,7 @@ public FontFamily SelectedQueryBoxFont
329292
return fontExists switch
330293
{
331294
true => new FontFamily(Settings.QueryBoxFont),
332-
_ => new FontFamily("Segoe UI")
295+
_ => new FontFamily(DefaultFont)
333296
};
334297
}
335298
set
@@ -373,7 +336,7 @@ public FontFamily SelectedResultFont
373336
return fontExists switch
374337
{
375338
true => new FontFamily(Settings.ResultFont),
376-
_ => new FontFamily("Segoe UI")
339+
_ => new FontFamily(DefaultFont)
377340
};
378341
}
379342
set
@@ -418,7 +381,7 @@ public FontFamily SelectedResultSubFont
418381
}
419382
else
420383
{
421-
var font = new FontFamily("Segoe UI");
384+
var font = new FontFamily(DefaultFont);
422385
return font;
423386
}
424387
}
@@ -449,6 +412,7 @@ public FamilyTypeface SelectedResultSubFontFaces
449412
ThemeManager.Instance.ChangeTheme(Settings.Theme);
450413
}
451414
}
415+
452416
public string ThemeImage => Constant.QueryTextBoxIconImagePath;
453417

454418
[RelayCommand]
@@ -473,4 +437,22 @@ public SettingsPaneThemeViewModel(Settings settings)
473437
Settings = settings;
474438
}
475439

440+
[RelayCommand]
441+
public void Reset()
442+
{
443+
SelectedQueryBoxFont = new FontFamily(DefaultFont);
444+
SelectedQueryBoxFontFaces = new FamilyTypeface { Stretch = FontStretches.Normal, Weight = FontWeights.Normal, Style = FontStyles.Normal };
445+
QueryBoxFontSize = 20;
446+
447+
SelectedResultFont = new FontFamily(DefaultFont);
448+
SelectedResultFontFaces = new FamilyTypeface { Stretch = FontStretches.Normal, Weight = FontWeights.Normal, Style = FontStyles.Normal };
449+
ResultItemFontSize = 16;
450+
451+
SelectedResultSubFont = new FontFamily(DefaultFont);
452+
SelectedResultSubFontFaces = new FamilyTypeface { Stretch = FontStretches.Normal, Weight = FontWeights.Normal, Style = FontStyles.Normal };
453+
ResultSubItemFontSize = 13;
454+
455+
WindowHeightSize = 42;
456+
ItemHeightSize = 58;
457+
}
476458
}

Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@
137137
Title="{DynamicResource AlwaysPreview}"
138138
Margin="0 14 0 0"
139139
Icon="&#xe8a1;"
140-
Sub="{DynamicResource AlwaysPreviewToolTip}">
140+
Sub="{Binding AlwaysPreviewToolTip}">
141141
<ui:ToggleSwitch
142142
IsOn="{Binding Settings.AlwaysPreview}"
143143
OffContent="{DynamicResource disable}"

Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,9 +255,8 @@
255255
<Button
256256
Margin="8"
257257
HorizontalAlignment="Stretch"
258-
Click="Reset_Click"
258+
Command="{Binding ResetCommand}"
259259
Content="{DynamicResource resetCustomize}" />
260-
261260
</StackPanel>
262261
</ScrollViewer>
263262
</Border>

Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml.cs

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -30,52 +30,4 @@ private void Selector_OnSelectionChanged(object sender, SelectionChangedEventArg
3030
{
3131
_viewModel.UpdateColorScheme();
3232
}
33-
34-
private void Reset_Click(object sender, RoutedEventArgs e)
35-
{
36-
/*The FamilyTypeface should initialize all of its various properties.*/
37-
FamilyTypeface targetTypeface = new FamilyTypeface { Stretch = FontStretches.Normal, Weight = FontWeights.Normal, Style = FontStyles.Normal };
38-
39-
QueryBoxFontSize.Value = 20;
40-
QueryBoxFontComboBox.SelectedIndex = SearchFontIndex("Segoe UI", QueryBoxFontComboBox);
41-
QueryBoxFontStyleComboBox.SelectedIndex = SearchFontStyleIndex(targetTypeface, QueryBoxFontStyleComboBox);
42-
43-
ResultItemFontComboBox.SelectedIndex = SearchFontIndex("Segoe UI", ResultItemFontComboBox);
44-
ResultItemFontStyleComboBox.SelectedIndex = SearchFontStyleIndex(targetTypeface, ResultItemFontStyleComboBox);
45-
ResultItemFontSize.Value = 16;
46-
47-
ResultSubItemFontComboBox.SelectedIndex = SearchFontIndex("Segoe UI", ResultSubItemFontComboBox);
48-
ResultSubItemFontStyleComboBox.SelectedIndex = SearchFontStyleIndex(targetTypeface, ResultSubItemFontStyleComboBox);
49-
ResultSubItemFontSize.Value = 13;
50-
51-
WindowHeightValue.Value = 42;
52-
ItemHeightValue.Value = 58;
53-
}
54-
55-
private int SearchFontIndex(string targetFont, ComboBox combo)
56-
{
57-
for (int i = 0; i < combo.Items.Count; i++)
58-
{
59-
if (combo.Items[i]?.ToString() == targetFont)
60-
{
61-
return i;
62-
}
63-
}
64-
return 0;
65-
}
66-
67-
private int SearchFontStyleIndex(FamilyTypeface targetTypeface, ComboBox combo)
68-
{
69-
for (int i = 0; i < combo.Items.Count; i++)
70-
{
71-
if (combo.Items[i] is FamilyTypeface typefaceItem &&
72-
typefaceItem.Stretch == targetTypeface.Stretch &&
73-
typefaceItem.Weight == targetTypeface.Weight &&
74-
typefaceItem.Style == targetTypeface.Style)
75-
{
76-
return i;
77-
}
78-
}
79-
return 0;
80-
}
8133
}

Plugins/Flow.Launcher.Plugin.PluginsManager/Views/PluginsManagerSettings.xaml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,21 @@
77
d:DesignHeight="450"
88
d:DesignWidth="800"
99
mc:Ignorable="d">
10-
<Grid Margin="70,15,0,15">
11-
<Grid.ColumnDefinitions>
12-
<ColumnDefinition Width="400" />
13-
<ColumnDefinition Width="*" />
14-
</Grid.ColumnDefinitions>
10+
<Grid Margin="70 15 18 15">
11+
<Grid.ColumnDefinitions />
1512
<Grid.RowDefinitions>
1613
<RowDefinition Height="auto" />
1714
<RowDefinition Height="auto" />
1815
</Grid.RowDefinitions>
1916
<CheckBox
20-
Grid.Column="0"
2117
Grid.Row="0"
22-
Padding="8,0,0,0"
18+
Padding="8 0 0 0"
2319
Content="{DynamicResource plugin_pluginsmanager_plugin_settings_unknown_source}"
2420
IsChecked="{Binding WarnFromUnknownSource}" />
2521
<CheckBox
26-
Grid.Column="0"
2722
Grid.Row="1"
28-
Margin="0,20,0,0"
29-
Padding="8,0,0,0"
23+
Margin="0 10 0 0"
24+
Padding="8 0 0 0"
3025
Content="{DynamicResource plugin_pluginsmanager_plugin_settings_auto_restart}"
3126
IsChecked="{Binding AutoRestartAfterChanging}" />
3227
</Grid>

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ deploy:
5151
- provider: NuGet
5252
artifact: Plugin nupkg
5353
api_key:
54-
secure: Uho7u3gk4RHzyWGgqgXZuOeI55NbqHLQ9tXahL7xmE4av2oiSldrNiyGgy/0AQYw
54+
secure: sCSd5JWgdzJWDa9kpqECut5ACPKZqcoxKU8ERKC00k7VIjig3/+nFV5zzTcGb0w3
5555
on:
5656
APPVEYOR_REPO_TAG: true
5757

0 commit comments

Comments
 (0)