Skip to content

Commit

Permalink
Merge branch 'dev' into explorer-plugin-add-context-menu-hotkey
Browse files Browse the repository at this point in the history
  • Loading branch information
jjw24 authored Jun 10, 2024
2 parents d7a11ae + 2ac2c9c commit 2519422
Show file tree
Hide file tree
Showing 8 changed files with 162 additions and 110 deletions.
75 changes: 75 additions & 0 deletions .cm/gitstream.cm
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# -*- mode: yaml -*-
# This example configuration for provides basic automations to get started with gitStream.
# View the gitStream quickstart for more examples: https://docs.gitstream.cm/examples/
manifest:
version: 1.0


automations:
# Add a label that indicates how many minutes it will take to review the PR.
estimated_time_to_review:
if:
- true
run:
- action: add-label@v1
args:
label: "{{ calc.etr }} min review"
color: {{ colors.red if (calc.etr >= 20) else ( colors.yellow if (calc.etr >= 5) else colors.green ) }}
# Post a comment that lists the best experts for the files that were modified.
explain_code_experts:
if:
- true
run:
- action: explain-code-experts@v1
args:
gt: 10
# Post a comment that indicates what percentage of the PR is new code.
percent_new_code:
if:
- true
run:
- action: add-comment@v1
args:
comment: |
This PR is {{ changes.ratio }}% new code.
# Post a comment that request changes for a PR that contains a TODO statement.
review_todo_comments:
if:
- {{ source.diff.files | matchDiffLines(regex=r/^[+].*(TODO)|(todo)/) | some }}
run:
- action: request-changes@v1
args:
comment: |
This PR contains a TODO statement. Please check to see if they should be removed.
# Post a comment that request a before and after screenshot
request_screenshot:
# Triggered for PRs that lack an image file or link to an image in the PR description
if:
- {{ not (has.screenshot_link or has.image_uploaded) }}
run:
- action: add-comment@v1
args:
comment: |
Be a legend :trophy: by adding a before and after screenshot of the changes you made, especially if they are around UI/UX.
# +----------------------------------------------------------------------------+
# | Custom Expressions |
# | https://docs.gitstream.cm/how-it-works/#custom-expressions |
# +----------------------------------------------------------------------------+

calc:
etr: {{ branch | estimatedReviewTime }}

colors:
red: 'b60205'
yellow: 'fbca04'
green: '0e8a16'

changes:
# Sum all the lines added/edited in the PR
additions: {{ branch.diff.files_metadata | map(attr='additions') | sum }}
# Sum all the line removed in the PR
deletions: {{ branch.diff.files_metadata | map(attr='deletions') | sum }}
# Calculate the ratio of new code
ratio: {{ (changes.additions / (changes.additions + changes.deletions)) * 100 | round(2) }}
49 changes: 49 additions & 0 deletions .github/workflows/gitstream.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Code generated by gitStream GitHub app - DO NOT EDIT

name: gitStream workflow automation
run-name: |
/:\ gitStream: PR #${{ fromJSON(fromJSON(github.event.inputs.client_payload)).pullRequestNumber }} from ${{ github.event.inputs.full_repository }}
on:
workflow_dispatch:
inputs:
client_payload:
description: The Client payload
required: true
full_repository:
description: the repository name include the owner in `owner/repo_name` format
required: true
head_ref:
description: the head sha
required: true
base_ref:
description: the base ref
required: true
installation_id:
description: the installation id
required: false
resolver_url:
description: the resolver url to pass results to
required: true
resolver_token:
description: Optional resolver token for resolver service
required: false
default: ''

jobs:
gitStream:
timeout-minutes: 5
runs-on: ubuntu-latest
name: gitStream workflow automation
steps:
- name: Evaluate Rules
uses: linear-b/gitstream-github-action@v2
id: rules-engine
with:
full_repository: ${{ github.event.inputs.full_repository }}
head_ref: ${{ github.event.inputs.head_ref }}
base_ref: ${{ github.event.inputs.base_ref }}
client_payload: ${{ github.event.inputs.client_payload }}
installation_id: ${{ github.event.inputs.installation_id }}
resolver_url: ${{ github.event.inputs.resolver_url }}
resolver_token: ${{ github.event.inputs.resolver_token }}
78 changes: 30 additions & 48 deletions Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ namespace Flow.Launcher.SettingPages.ViewModels;

public partial class SettingsPaneThemeViewModel : BaseModel
{
private const string DefaultFont = "Segoe UI";
public Settings Settings { get; }

public static string LinkHowToCreateTheme => @"https://flowlauncher.com/docs/#/how-to-create-a-theme";
Expand Down Expand Up @@ -82,6 +83,7 @@ public double QueryBoxFontSize
get => Settings.QueryBoxFontSize;
set => Settings.QueryBoxFontSize = value;
}

public double ResultItemFontSize
{
get => Settings.ResultItemFontSize;
Expand All @@ -97,30 +99,9 @@ public double ResultSubItemFontSize
private List<Theme.ThemeData> _themes;
public List<Theme.ThemeData> Themes => _themes ??= ThemeManager.Instance.LoadAvailableThemes();

public class ColorSchemeData : DropdownDataGeneric<ColorSchemes> { }

public class ColorScheme
{
public string Display { get; set; }
public ColorSchemes Value { get; set; }
}

public List<ColorScheme> ColorSchemes
{
get
{
List<ColorScheme> modes = new List<ColorScheme>();
var enums = (ColorSchemes[])Enum.GetValues(typeof(ColorSchemes));
foreach (var e in enums)
{
var key = $"ColorScheme{e}";
var display = InternationalizationManager.Instance.GetTranslation(key);
var m = new ColorScheme { Display = display, Value = e, };
modes.Add(m);
}

return modes;
}
}
public List<ColorSchemeData> ColorSchemes { get; } = DropdownDataGeneric<ColorSchemes>.GetValues<ColorSchemeData>("ColorScheme");

public List<string> TimeFormatList { get; } = new()
{
Expand Down Expand Up @@ -167,11 +148,13 @@ public string DateFormat
}

public IEnumerable<int> MaxResultsRange => Enumerable.Range(2, 16);

public bool KeepMaxResults
{
get => Settings.KeepMaxResults;
set => Settings.KeepMaxResults = value;
}

public string ClockText => DateTime.Now.ToString(TimeFormat, CultureInfo.CurrentCulture);

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

public class AnimationSpeed
{
public string Display { get; set; }
public AnimationSpeeds Value { get; set; }
}
public class AnimationSpeedData : DropdownDataGeneric<AnimationSpeeds> { }
public List<AnimationSpeedData> AnimationSpeeds { get; } = DropdownDataGeneric<AnimationSpeeds>.GetValues<AnimationSpeedData>("AnimationSpeed");

public List<AnimationSpeed> AnimationSpeeds
{
get
{
List<AnimationSpeed> speeds = new List<AnimationSpeed>();
var enums = (AnimationSpeeds[])Enum.GetValues(typeof(AnimationSpeeds));
foreach (var e in enums)
{
var key = $"AnimationSpeed{e}";
var display = InternationalizationManager.Instance.GetTranslation(key);
var m = new AnimationSpeed { Display = display, Value = e, };
speeds.Add(m);
}

return speeds;
}
}
public bool UseSound
{
get => Settings.UseSound;
Expand Down Expand Up @@ -329,7 +292,7 @@ public FontFamily SelectedQueryBoxFont
return fontExists switch
{
true => new FontFamily(Settings.QueryBoxFont),
_ => new FontFamily("Segoe UI")
_ => new FontFamily(DefaultFont)
};
}
set
Expand Down Expand Up @@ -373,7 +336,7 @@ public FontFamily SelectedResultFont
return fontExists switch
{
true => new FontFamily(Settings.ResultFont),
_ => new FontFamily("Segoe UI")
_ => new FontFamily(DefaultFont)
};
}
set
Expand Down Expand Up @@ -418,7 +381,7 @@ public FontFamily SelectedResultSubFont
}
else
{
var font = new FontFamily("Segoe UI");
var font = new FontFamily(DefaultFont);
return font;
}
}
Expand Down Expand Up @@ -449,6 +412,7 @@ public FamilyTypeface SelectedResultSubFontFaces
ThemeManager.Instance.ChangeTheme(Settings.Theme);
}
}

public string ThemeImage => Constant.QueryTextBoxIconImagePath;

[RelayCommand]
Expand All @@ -473,4 +437,22 @@ public SettingsPaneThemeViewModel(Settings settings)
Settings = settings;
}

[RelayCommand]
public void Reset()
{
SelectedQueryBoxFont = new FontFamily(DefaultFont);
SelectedQueryBoxFontFaces = new FamilyTypeface { Stretch = FontStretches.Normal, Weight = FontWeights.Normal, Style = FontStyles.Normal };
QueryBoxFontSize = 20;

SelectedResultFont = new FontFamily(DefaultFont);
SelectedResultFontFaces = new FamilyTypeface { Stretch = FontStretches.Normal, Weight = FontWeights.Normal, Style = FontStyles.Normal };
ResultItemFontSize = 16;

SelectedResultSubFont = new FontFamily(DefaultFont);
SelectedResultSubFontFaces = new FamilyTypeface { Stretch = FontStretches.Normal, Weight = FontWeights.Normal, Style = FontStyles.Normal };
ResultSubItemFontSize = 13;

WindowHeightSize = 42;
ItemHeightSize = 58;
}
}
2 changes: 1 addition & 1 deletion Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
Title="{DynamicResource AlwaysPreview}"
Margin="0 14 0 0"
Icon="&#xe8a1;"
Sub="{DynamicResource AlwaysPreviewToolTip}">
Sub="{Binding AlwaysPreviewToolTip}">
<ui:ToggleSwitch
IsOn="{Binding Settings.AlwaysPreview}"
OffContent="{DynamicResource disable}"
Expand Down
3 changes: 1 addition & 2 deletions Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,8 @@
<Button
Margin="8"
HorizontalAlignment="Stretch"
Click="Reset_Click"
Command="{Binding ResetCommand}"
Content="{DynamicResource resetCustomize}" />

</StackPanel>
</ScrollViewer>
</Border>
Expand Down
48 changes: 0 additions & 48 deletions Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,52 +30,4 @@ private void Selector_OnSelectionChanged(object sender, SelectionChangedEventArg
{
_viewModel.UpdateColorScheme();
}

private void Reset_Click(object sender, RoutedEventArgs e)
{
/*The FamilyTypeface should initialize all of its various properties.*/
FamilyTypeface targetTypeface = new FamilyTypeface { Stretch = FontStretches.Normal, Weight = FontWeights.Normal, Style = FontStyles.Normal };

QueryBoxFontSize.Value = 20;
QueryBoxFontComboBox.SelectedIndex = SearchFontIndex("Segoe UI", QueryBoxFontComboBox);
QueryBoxFontStyleComboBox.SelectedIndex = SearchFontStyleIndex(targetTypeface, QueryBoxFontStyleComboBox);

ResultItemFontComboBox.SelectedIndex = SearchFontIndex("Segoe UI", ResultItemFontComboBox);
ResultItemFontStyleComboBox.SelectedIndex = SearchFontStyleIndex(targetTypeface, ResultItemFontStyleComboBox);
ResultItemFontSize.Value = 16;

ResultSubItemFontComboBox.SelectedIndex = SearchFontIndex("Segoe UI", ResultSubItemFontComboBox);
ResultSubItemFontStyleComboBox.SelectedIndex = SearchFontStyleIndex(targetTypeface, ResultSubItemFontStyleComboBox);
ResultSubItemFontSize.Value = 13;

WindowHeightValue.Value = 42;
ItemHeightValue.Value = 58;
}

private int SearchFontIndex(string targetFont, ComboBox combo)
{
for (int i = 0; i < combo.Items.Count; i++)
{
if (combo.Items[i]?.ToString() == targetFont)
{
return i;
}
}
return 0;
}

private int SearchFontStyleIndex(FamilyTypeface targetTypeface, ComboBox combo)
{
for (int i = 0; i < combo.Items.Count; i++)
{
if (combo.Items[i] is FamilyTypeface typefaceItem &&
typefaceItem.Stretch == targetTypeface.Stretch &&
typefaceItem.Weight == targetTypeface.Weight &&
typefaceItem.Style == targetTypeface.Style)
{
return i;
}
}
return 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,21 @@
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">
<Grid Margin="70,15,0,15">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="400" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid Margin="70 15 18 15">
<Grid.ColumnDefinitions />
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<CheckBox
Grid.Column="0"
Grid.Row="0"
Padding="8,0,0,0"
Padding="8 0 0 0"
Content="{DynamicResource plugin_pluginsmanager_plugin_settings_unknown_source}"
IsChecked="{Binding WarnFromUnknownSource}" />
<CheckBox
Grid.Column="0"
Grid.Row="1"
Margin="0,20,0,0"
Padding="8,0,0,0"
Margin="0 10 0 0"
Padding="8 0 0 0"
Content="{DynamicResource plugin_pluginsmanager_plugin_settings_auto_restart}"
IsChecked="{Binding AutoRestartAfterChanging}" />
</Grid>
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ deploy:
- provider: NuGet
artifact: Plugin nupkg
api_key:
secure: Uho7u3gk4RHzyWGgqgXZuOeI55NbqHLQ9tXahL7xmE4av2oiSldrNiyGgy/0AQYw
secure: sCSd5JWgdzJWDa9kpqECut5ACPKZqcoxKU8ERKC00k7VIjig3/+nFV5zzTcGb0w3
on:
APPVEYOR_REPO_TAG: true

Expand Down

0 comments on commit 2519422

Please sign in to comment.