From 490f92bbf0bfc7742991d70dfd9330a8c76f9aa9 Mon Sep 17 00:00:00 2001 From: Don Okuda Date: Wed, 11 Oct 2017 15:45:18 -0700 Subject: [PATCH 01/17] Remove header in Initialize Repository view --- .../Editor/GitHub.Unity/UI/InitProjectView.cs | 30 ------------------- 1 file changed, 30 deletions(-) diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs index c8ee372a3..1d244d660 100644 --- a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs +++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs @@ -12,7 +12,6 @@ namespace GitHub.Unity [Serializable] class InitProjectView : Subview { - private const string NoRepoTitle = "No Git repository found for this project"; private const string NoRepoDescription = "Initialize a Git repository to track changes and collaborate with others."; [SerializeField] private bool isBusy; @@ -32,35 +31,6 @@ public override void OnRepositoryChanged(IRepository oldRepository) public override void OnGUI() { - var headerRect = EditorGUILayout.BeginHorizontal(Styles.HeaderBoxStyle); - { - GUILayout.Space(5); - GUILayout.BeginVertical(GUILayout.Width(16)); - { - GUILayout.Space(5); - - var iconRect = GUILayoutUtility.GetRect(new GUIContent(Styles.BigLogo), GUIStyle.none, GUILayout.Height(20), GUILayout.Width(20)); - iconRect.y = headerRect.center.y - (iconRect.height / 2); - GUI.DrawTexture(iconRect, Styles.BigLogo, ScaleMode.ScaleToFit); - - GUILayout.Space(5); - } - GUILayout.EndVertical(); - - GUILayout.Space(5); - - GUILayout.BeginVertical(); - { - var headerContent = new GUIContent(NoRepoTitle); - var headerTitleRect = GUILayoutUtility.GetRect(headerContent, Styles.HeaderTitleStyle); - headerTitleRect.y = headerRect.center.y - (headerTitleRect.height / 2); - - GUI.Label(headerTitleRect, headerContent, Styles.HeaderTitleStyle); - } - GUILayout.EndVertical(); - } - EditorGUILayout.EndHorizontal(); - GUILayout.BeginVertical(Styles.GenericBoxStyle); { GUILayout.FlexibleSpace(); From 49ef1b1921414ff92c78c746f664da371e40cea3 Mon Sep 17 00:00:00 2001 From: Don Okuda Date: Thu, 12 Oct 2017 13:34:47 -0700 Subject: [PATCH 02/17] Update text for initialize repo view --- src/GitHub.Api/Localization.resx | 58 +++++++++---------- .../Assets/Editor/GitHub.Unity/Misc/Styles.cs | 16 +++++ .../Editor/GitHub.Unity/UI/InitProjectView.cs | 5 +- 3 files changed, 47 insertions(+), 32 deletions(-) diff --git a/src/GitHub.Api/Localization.resx b/src/GitHub.Api/Localization.resx index 6768713f9..ba8fc9667 100644 --- a/src/GitHub.Api/Localization.resx +++ b/src/GitHub.Api/Localization.resx @@ -1,17 +1,17 @@  - @@ -286,7 +286,7 @@ Branch pushed - Initialize repository + Initialize a git repository for this project Switch branch @@ -294,4 +294,4 @@ Could not switch to branch {0} - \ No newline at end of file + diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/Misc/Styles.cs b/src/UnityExtension/Assets/Editor/GitHub.Unity/Misc/Styles.cs index a4c57790a..c3d1c1013 100644 --- a/src/UnityExtension/Assets/Editor/GitHub.Unity/Misc/Styles.cs +++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/Misc/Styles.cs @@ -70,6 +70,7 @@ class Styles commitFileAreaStyle, commitButtonStyle, textFieldStyle, + boldCenteredLabel, centeredLabel, commitDescriptionFieldStyle, toggleMixedStyle, @@ -543,6 +544,21 @@ public static GUIStyle CenteredLabel } } + public static GUIStyle BoldCenteredLabel + { + get + { + if (boldCenteredLabel == null) + { + boldCenteredLabel = new GUIStyle(EditorStyles.boldLabel); + boldCenteredLabel.name = "BoldCenteredLabelStyle"; + boldCenteredLabel.alignment = TextAnchor.MiddleCenter; + } + return boldCenteredLabel; + } + } + + public static GUIStyle CommitDescriptionFieldStyle { get diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs index 1d244d660..0a784756a 100644 --- a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs +++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs @@ -12,7 +12,7 @@ namespace GitHub.Unity [Serializable] class InitProjectView : Subview { - private const string NoRepoDescription = "Initialize a Git repository to track changes and collaborate with others."; + private const string NoRepoTitle = "To begin using GitHub, initialize a git repository"; [SerializeField] private bool isBusy; [SerializeField] private bool isPublished; @@ -35,7 +35,7 @@ public override void OnGUI() { GUILayout.FlexibleSpace(); - GUILayout.Label(NoRepoDescription, Styles.CenteredLabel); + GUILayout.Label(NoRepoTitle, Styles.BoldCenteredLabel); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); @@ -51,7 +51,6 @@ public override void OnGUI() } } EditorGUI.EndDisabledGroup(); - GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); From 88b767e7ffaf38a2276a09573f89c1b364bb2436 Mon Sep 17 00:00:00 2001 From: Don Okuda Date: Thu, 12 Oct 2017 13:34:57 -0700 Subject: [PATCH 03/17] Add a place for errors --- .../Assets/Editor/GitHub.Unity/UI/InitProjectView.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs index 0a784756a..a0e865077 100644 --- a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs +++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs @@ -54,6 +54,12 @@ public override void OnGUI() GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); + GUILayout.BeginHorizontal(); + GUILayout.FlexibleSpace(); + GUILayout.Label("There was an error initializing a repository.", Styles.ErrorLabel); + GUILayout.FlexibleSpace(); + GUILayout.EndHorizontal(); + GUILayout.FlexibleSpace(); } GUILayout.EndVertical(); From ac8bd7b1bf09e19c97b85d8e9b06a6fc13c20b97 Mon Sep 17 00:00:00 2001 From: Don Okuda Date: Fri, 13 Oct 2017 15:47:06 -0700 Subject: [PATCH 04/17] yay an image! --- .../Assets/Editor/GitHub.Unity/GitHub.Unity.csproj | 6 ++++-- .../IconsAndLogos/empty-state-init.png | 3 +++ .../IconsAndLogos/empty-state-init@2x.png | 3 +++ .../Assets/Editor/GitHub.Unity/Misc/Styles.cs | 14 ++++++++++++++ .../Editor/GitHub.Unity/UI/InitProjectView.cs | 2 ++ .../Assets/Editor/GitHub.Unity/UI/Window.cs | 2 +- 6 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 src/UnityExtension/Assets/Editor/GitHub.Unity/IconsAndLogos/empty-state-init.png create mode 100644 src/UnityExtension/Assets/Editor/GitHub.Unity/IconsAndLogos/empty-state-init@2x.png diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/GitHub.Unity.csproj b/src/UnityExtension/Assets/Editor/GitHub.Unity/GitHub.Unity.csproj index d2ecc2a53..8eae0402c 100644 --- a/src/UnityExtension/Assets/Editor/GitHub.Unity/GitHub.Unity.csproj +++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/GitHub.Unity.csproj @@ -149,6 +149,8 @@ + + @@ -203,7 +205,7 @@ - - \ No newline at end of file + diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/IconsAndLogos/empty-state-init.png b/src/UnityExtension/Assets/Editor/GitHub.Unity/IconsAndLogos/empty-state-init.png new file mode 100644 index 000000000..09389a7dc --- /dev/null +++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/IconsAndLogos/empty-state-init.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ee3c66f73cbb96d92aef34f0ef7eb9e615db83fa83b810cbc2c4eea825bd1e4c +size 5571 diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/IconsAndLogos/empty-state-init@2x.png b/src/UnityExtension/Assets/Editor/GitHub.Unity/IconsAndLogos/empty-state-init@2x.png new file mode 100644 index 000000000..c73d5222f --- /dev/null +++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/IconsAndLogos/empty-state-init@2x.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ea0086690444613755947b3bc2b25390f860a362126c4a92d222da9c65ed4790 +size 14242 diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/Misc/Styles.cs b/src/UnityExtension/Assets/Editor/GitHub.Unity/Misc/Styles.cs index c3d1c1013..66fbf1fef 100644 --- a/src/UnityExtension/Assets/Editor/GitHub.Unity/Misc/Styles.cs +++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/Misc/Styles.cs @@ -96,6 +96,7 @@ class Styles localCommitIcon, repoIcon, lockIcon, + emptyStateInit, dropdownListIcon; private static Color timelineBarColor; @@ -803,6 +804,19 @@ public static Texture2D LockIcon } } + public static Texture2D EmptyStateInit + { + get + { + if (emptyStateInit == null) + { + emptyStateInit = Utility.GetIcon("empty-state-init.png", "empty-state-init@2x.png"); + } + return emptyStateInit; + } + + } + public static Texture2D DropdownListIcon { get diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs index a0e865077..6acba776a 100644 --- a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs +++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs @@ -35,6 +35,8 @@ public override void OnGUI() { GUILayout.FlexibleSpace(); + GUILayout.Label(Styles.EmptyStateInit); + GUILayout.Label(NoRepoTitle, Styles.BoldCenteredLabel); GUILayout.BeginHorizontal(); diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/Window.cs b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/Window.cs index cf9da47f6..f0e5b4c51 100644 --- a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/Window.cs +++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/Window.cs @@ -284,7 +284,7 @@ private void DoToolbarGUI() changeTab = activeTab; EditorGUI.BeginChangeCheck(); { - if (HasRepository) + if (!HasRepository) { changeTab = TabButton(SubTab.Changes, ChangesTitle, changeTab); changeTab = TabButton(SubTab.History, HistoryTitle, changeTab); From ae1ccde71337f5b0b3fc484a5dd6b10b02debd9f Mon Sep 17 00:00:00 2001 From: Don Okuda Date: Fri, 13 Oct 2017 16:07:45 -0700 Subject: [PATCH 05/17] Set a max height as well --- .../Assets/Editor/GitHub.Unity/UI/InitProjectView.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs index 6acba776a..95611b7e9 100644 --- a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs +++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs @@ -35,7 +35,13 @@ public override void OnGUI() { GUILayout.FlexibleSpace(); - GUILayout.Label(Styles.EmptyStateInit); + GUILayout.BeginHorizontal(); + { + GUILayout.FlexibleSpace(); + GUILayout.Label(Styles.EmptyStateInit, GUILayout.MaxWidth(265), GUILayout.MaxHeight(136)); + GUILayout.FlexibleSpace(); + } + GUILayout.EndHorizontal(); GUILayout.Label(NoRepoTitle, Styles.BoldCenteredLabel); From a4e965b2bef4cc7532d5c3140b2f47c4e6377855 Mon Sep 17 00:00:00 2001 From: Don Okuda Date: Fri, 13 Oct 2017 16:16:01 -0700 Subject: [PATCH 06/17] halp --- .../Assets/Editor/GitHub.Unity/UI/InitProjectView.cs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs index 95611b7e9..0e96f3803 100644 --- a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs +++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs @@ -62,11 +62,7 @@ public override void OnGUI() GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); - GUILayout.BeginHorizontal(); - GUILayout.FlexibleSpace(); - GUILayout.Label("There was an error initializing a repository.", Styles.ErrorLabel); - GUILayout.FlexibleSpace(); - GUILayout.EndHorizontal(); + EditorGUILayout.HelpBox("There was an error initializing a repository.", MessageType.Error); GUILayout.FlexibleSpace(); } From c9d20157beda249e279c6c2f3b93ef06c371df75 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Mon, 16 Oct 2017 17:47:53 -0400 Subject: [PATCH 07/17] Undoing change made for ui testing --- src/UnityExtension/Assets/Editor/GitHub.Unity/UI/Window.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/Window.cs b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/Window.cs index f0e5b4c51..cf9da47f6 100644 --- a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/Window.cs +++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/Window.cs @@ -284,7 +284,7 @@ private void DoToolbarGUI() changeTab = activeTab; EditorGUI.BeginChangeCheck(); { - if (!HasRepository) + if (HasRepository) { changeTab = TabButton(SubTab.Changes, ChangesTitle, changeTab); changeTab = TabButton(SubTab.History, HistoryTitle, changeTab); From 7b7b3e95c46214dcd90d8306a10c88260c883399 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Tue, 24 Oct 2017 18:16:36 -0400 Subject: [PATCH 08/17] Fix needed after merge --- .../Assets/Editor/GitHub.Unity/UI/InitProjectView.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs index 8f5e331f9..0adb17dc7 100644 --- a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs +++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs @@ -8,7 +8,6 @@ namespace GitHub.Unity class InitProjectView : Subview { private const string NoRepoTitle = "To begin using GitHub, initialize a git repository"; - private const string NoRepoTitle = "No Git repository found for this project"; private const string NoRepoDescription = "Initialize a Git repository to track changes and collaborate with others."; private const string NoUserOrEmailError = "Name and Email must be configured in Settings"; From b339b340d868ee2bee6bee3635911136c12cf302 Mon Sep 17 00:00:00 2001 From: Don Okuda Date: Wed, 25 Oct 2017 11:53:35 -0700 Subject: [PATCH 09/17] Adjust some spacing for empty state --- .../Assets/Editor/GitHub.Unity/UI/InitProjectView.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs index 0adb17dc7..1d6b00b2f 100644 --- a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs +++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs @@ -10,7 +10,7 @@ class InitProjectView : Subview private const string NoRepoTitle = "To begin using GitHub, initialize a git repository"; private const string NoRepoDescription = "Initialize a Git repository to track changes and collaborate with others."; private const string NoUserOrEmailError = "Name and Email must be configured in Settings"; - + [SerializeField] private UserSettingsView userSettingsView = new UserSettingsView(); [SerializeField] private GitPathView gitPathView = new GitPathView(); @@ -52,9 +52,7 @@ public override void OnGUI() GUILayout.BeginVertical(Styles.GenericBoxStyle); { GUILayout.FlexibleSpace(); - - gitPathView.OnGUI(); - userSettingsView.OnGUI(); + GUILayout.Space(-140); GUILayout.BeginHorizontal(); { @@ -65,6 +63,7 @@ public override void OnGUI() GUILayout.EndHorizontal(); GUILayout.Label(NoRepoTitle, Styles.BoldCenteredLabel); + EditorGUILayout.Space(); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); @@ -84,6 +83,7 @@ public override void OnGUI() GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); + EditorGUILayout.Space(); EditorGUILayout.HelpBox("There was an error initializing a repository.", MessageType.Error); GUILayout.FlexibleSpace(); From 41b9d4e72e0e51ab4b2e389fb74020303a90dc69 Mon Sep 17 00:00:00 2001 From: Don Okuda Date: Wed, 25 Oct 2017 15:48:29 -0700 Subject: [PATCH 10/17] More space adjustments --- .../Assets/Editor/GitHub.Unity/UI/InitProjectView.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs index 1d6b00b2f..2db87b024 100644 --- a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs +++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs @@ -63,7 +63,7 @@ public override void OnGUI() GUILayout.EndHorizontal(); GUILayout.Label(NoRepoTitle, Styles.BoldCenteredLabel); - EditorGUILayout.Space(); + GUILayout.Space(4); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); From 6819d7f4100a535642d602e14bfac2f3326b3413 Mon Sep 17 00:00:00 2001 From: Don Okuda Date: Wed, 25 Oct 2017 16:51:37 -0700 Subject: [PATCH 11/17] Try out a different kind of error message --- .../Assets/Editor/GitHub.Unity/UI/InitProjectView.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs index 2db87b024..401721e72 100644 --- a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs +++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs @@ -84,7 +84,10 @@ public override void OnGUI() GUILayout.EndHorizontal(); EditorGUILayout.Space(); - EditorGUILayout.HelpBox("There was an error initializing a repository.", MessageType.Error); + EditorGUILayout.HelpBox( + "Name and email not set in git. Go into the settings tab and enter the missing information", + MessageType.Error + ); GUILayout.FlexibleSpace(); } From 87ec22da617f750c03470836d3486a565651ffd8 Mon Sep 17 00:00:00 2001 From: Don Okuda Date: Wed, 25 Oct 2017 20:29:25 -0700 Subject: [PATCH 12/17] Center text --- src/UnityExtension/Assets/Editor/GitHub.Unity/Misc/Styles.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/Misc/Styles.cs b/src/UnityExtension/Assets/Editor/GitHub.Unity/Misc/Styles.cs index b3af92b6e..5580f1065 100644 --- a/src/UnityExtension/Assets/Editor/GitHub.Unity/Misc/Styles.cs +++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/Misc/Styles.cs @@ -567,6 +567,7 @@ public static GUIStyle BoldCenteredLabel boldCenteredLabel = new GUIStyle(EditorStyles.boldLabel); boldCenteredLabel.name = "BoldCenteredLabelStyle"; boldCenteredLabel.alignment = TextAnchor.MiddleCenter; + boldCenteredLabel.wordWrap = true; } return boldCenteredLabel; } From 76a11f7458e5ca397bc7f4e55b6a071ffda14bc8 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Tue, 7 Nov 2017 12:19:08 -0500 Subject: [PATCH 13/17] Removing UserSettingsView and GitPathView from InitProjectView --- .../Editor/GitHub.Unity/UI/InitProjectView.cs | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs index 401721e72..94412db71 100644 --- a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs +++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs @@ -11,9 +11,6 @@ class InitProjectView : Subview private const string NoRepoDescription = "Initialize a Git repository to track changes and collaborate with others."; private const string NoUserOrEmailError = "Name and Email must be configured in Settings"; - [SerializeField] private UserSettingsView userSettingsView = new UserSettingsView(); - [SerializeField] private GitPathView gitPathView = new GitPathView(); - [NonSerialized] private bool isBusy; [NonSerialized] private string errorMessage; @@ -24,9 +21,6 @@ public override void InitializeView(IView parent) { base.InitializeView(parent); - userSettingsView.InitializeView(this); - gitPathView.InitializeView(this); - if (!string.IsNullOrEmpty(Environment.GitExecutablePath)) { CheckForUser(); @@ -36,17 +30,9 @@ public override void InitializeView(IView parent) public override void OnEnable() { base.OnEnable(); - gitPathView.OnEnable(); userDataHasChanged = Environment.GitExecutablePath != null; } - public override void OnDataUpdate() - { - base.OnDataUpdate(); - userSettingsView.OnDataUpdate(); - gitPathView.OnDataUpdate(); - } - public override void OnGUI() { GUILayout.BeginVertical(Styles.GenericBoxStyle); @@ -124,7 +110,7 @@ private void CheckForUser() public override bool IsBusy { - get { return isBusy || userSettingsView.IsBusy || gitPathView.IsBusy; } + get { return isBusy; } } } } From fbd8f994d8fafb6b6f2e123ceb55e49838156b22 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Tue, 7 Nov 2017 12:24:24 -0500 Subject: [PATCH 14/17] Hiding error is user data is present --- .../Assets/Editor/GitHub.Unity/UI/InitProjectView.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs index 94412db71..b31712b92 100644 --- a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs +++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs @@ -69,11 +69,13 @@ public override void OnGUI() GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); - EditorGUILayout.Space(); - EditorGUILayout.HelpBox( - "Name and email not set in git. Go into the settings tab and enter the missing information", - MessageType.Error - ); + if (!isUserDataPresent) + { + EditorGUILayout.Space(); + EditorGUILayout.HelpBox( + "Name and email not set in git. Go into the settings tab and enter the missing information", + MessageType.Error); + } GUILayout.FlexibleSpace(); } From 812f97454537733b0fa91c832210d8905c301314 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Tue, 7 Nov 2017 12:26:55 -0500 Subject: [PATCH 15/17] Formatting some code --- .../Editor/GitHub.Unity/UI/InitProjectView.cs | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs index b31712b92..1763e7485 100644 --- a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs +++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs @@ -52,21 +52,23 @@ public override void OnGUI() GUILayout.Space(4); GUILayout.BeginHorizontal(); - GUILayout.FlexibleSpace(); - - EditorGUI.BeginDisabledGroup(IsBusy || !isUserDataPresent); { - if (GUILayout.Button(Localization.InitializeRepositoryButtonText, "Button")) + GUILayout.FlexibleSpace(); + + EditorGUI.BeginDisabledGroup(IsBusy || !isUserDataPresent); { - isBusy = true; - Manager.InitializeRepository() - .FinallyInUI(() => isBusy = false) - .Start(); + if (GUILayout.Button(Localization.InitializeRepositoryButtonText, "Button")) + { + isBusy = true; + Manager.InitializeRepository() + .FinallyInUI(() => isBusy = false) + .Start(); + } } - } - EditorGUI.EndDisabledGroup(); + EditorGUI.EndDisabledGroup(); - GUILayout.FlexibleSpace(); + GUILayout.FlexibleSpace(); + } GUILayout.EndHorizontal(); if (!isUserDataPresent) From 99ab5428e313ac6d4e419e0f09dc0ac772ae5819 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Tue, 7 Nov 2017 12:32:12 -0500 Subject: [PATCH 16/17] Cleaning up messages --- .../Assets/Editor/GitHub.Unity/UI/InitProjectView.cs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs index 1763e7485..39de2f269 100644 --- a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs +++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs @@ -8,12 +8,10 @@ namespace GitHub.Unity class InitProjectView : Subview { private const string NoRepoTitle = "To begin using GitHub, initialize a git repository"; - private const string NoRepoDescription = "Initialize a Git repository to track changes and collaborate with others."; - private const string NoUserOrEmailError = "Name and Email must be configured in Settings"; + private const string NoUserOrEmailError = "Name and email not set in git. Go into the settings tab and enter the missing information"; [NonSerialized] private bool isBusy; - [NonSerialized] private string errorMessage; [NonSerialized] private bool isUserDataPresent; [NonSerialized] private bool userDataHasChanged; @@ -74,9 +72,7 @@ public override void OnGUI() if (!isUserDataPresent) { EditorGUILayout.Space(); - EditorGUILayout.HelpBox( - "Name and email not set in git. Go into the settings tab and enter the missing information", - MessageType.Error); + EditorGUILayout.HelpBox(NoUserOrEmailError, MessageType.Error); } GUILayout.FlexibleSpace(); @@ -101,10 +97,8 @@ private void CheckForUser() var username = strings[0]; var email = strings[1]; - isBusy = false; isUserDataPresent = success && !String.IsNullOrEmpty(username) && !String.IsNullOrEmpty(email); - errorMessage = isUserDataPresent ? null : NoUserOrEmailError; Logger.Trace("Finally: {0}", isUserDataPresent); From 39eb5dac1b73cac0744b78ae3facb0ca746c6489 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Tue, 7 Nov 2017 12:49:42 -0500 Subject: [PATCH 17/17] Changing how InitProjectView updates itself --- .../Editor/GitHub.Unity/UI/InitProjectView.cs | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs index 39de2f269..fa87e3454 100644 --- a/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs +++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs @@ -11,20 +11,10 @@ class InitProjectView : Subview private const string NoUserOrEmailError = "Name and email not set in git. Go into the settings tab and enter the missing information"; [NonSerialized] private bool isBusy; - [NonSerialized] private bool isUserDataPresent; + [NonSerialized] private bool hasCompletedInitialCheck; [NonSerialized] private bool userDataHasChanged; - public override void InitializeView(IView parent) - { - base.InitializeView(parent); - - if (!string.IsNullOrEmpty(Environment.GitExecutablePath)) - { - CheckForUser(); - } - } - public override void OnEnable() { base.OnEnable(); @@ -69,7 +59,7 @@ public override void OnGUI() } GUILayout.EndHorizontal(); - if (!isUserDataPresent) + if (hasCompletedInitialCheck && !isUserDataPresent) { EditorGUILayout.Space(); EditorGUILayout.HelpBox(NoUserOrEmailError, MessageType.Error); @@ -80,6 +70,12 @@ public override void OnGUI() GUILayout.EndVertical(); } + public override void OnDataUpdate() + { + base.OnDataUpdate(); + MaybeUpdateData(); + } + private void MaybeUpdateData() { if (userDataHasChanged) @@ -91,6 +87,13 @@ private void MaybeUpdateData() private void CheckForUser() { + if (string.IsNullOrEmpty(Environment.GitExecutablePath)) + { + Logger.Warning("No git exec cannot check for user"); + return; + } + + Logger.Trace("Checking for user"); isBusy = true; GitClient.GetConfigUserAndEmail().FinallyInUI((success, ex, strings) => { @@ -99,8 +102,9 @@ private void CheckForUser() isBusy = false; isUserDataPresent = success && !String.IsNullOrEmpty(username) && !String.IsNullOrEmpty(email); + hasCompletedInitialCheck = true; - Logger.Trace("Finally: {0}", isUserDataPresent); + Logger.Trace("User Present: {0}", isUserDataPresent); Redraw(); }).Start();