Skip to content

Conversation

@Mrcubix
Copy link
Contributor

@Mrcubix Mrcubix commented Jan 10, 2025

Fixes #3671
Also fixes the same issue with Profiles (They are just Settings files)

Needs testing.

Steps to reproduce :

  1. Duplicate your current settings file
  2. Write anything that isn't a valid output mode in Path for the active output mode
  3. Try loading that setting file in.

@Mrcubix
Copy link
Contributor Author

Mrcubix commented Jan 10, 2025

One issue with this, only once you restart, the interface will be empty,
(because the current output mode target object is missing in the loaded assemblies)

Should i null or do something with the output otherwise?

@Mrcubix
Copy link
Contributor Author

Mrcubix commented Jan 10, 2025

maybe this could do

diff --git a/OpenTabletDriver.UX/Controls/Output/OutputModeEditor.cs b/OpenTabletDriver.UX/Controls/Output/OutputModeEditor.cs
index 3cf617db..847e328a 100644
--- a/OpenTabletDriver.UX/Controls/Output/OutputModeEditor.cs
+++ b/OpenTabletDriver.UX/Controls/Output/OutputModeEditor.cs
@@ -69,6 +69,7 @@ namespace OpenTabletDriver.UX.Controls.Output
         {
             ProfileChanged?.Invoke(this, new EventArgs());
             UpdateTablet();
+            UpdateOutputMode(Profile?.OutputMode);
         }

         public BindableBinding<OutputModeEditor, Profile> ProfileBinding
@@ -89,6 +90,7 @@ namespace OpenTabletDriver.UX.Controls.Output
         private AbsoluteModeEditor absoluteModeEditor = new AbsoluteModeEditor();
         private RelativeModeEditor relativeModeEditor = new RelativeModeEditor();
         private TypeDropDown<IOutputMode> outputModeSelector = new TypeDropDown<IOutputMode> { Width = 300 };
+        private Label outputModeUnsupported = new Label { Text = "No supported output mode selected.", TextAlignment = TextAlignment.Center, VerticalAlignment = VerticalAlignment.Center };

         public void SetTabletSize(TabletReference tablet)
         {
@@ -128,6 +130,8 @@ namespace OpenTabletDriver.UX.Controls.Output
                 editorContainer.Content = absoluteModeEditor;
             else if (showRelative)
                 editorContainer.Content = relativeModeEditor;
+            else
+                editorContainer.Content = outputModeUnsupported;
         }
     }
 }

InfinityGhost
InfinityGhost previously approved these changes Jan 10, 2025
@InfinityGhost
Copy link
Member

maybe this could do

diff --git a/OpenTabletDriver.UX/Controls/Output/OutputModeEditor.cs b/OpenTabletDriver.UX/Controls/Output/OutputModeEditor.cs
index 3cf617db..847e328a 100644
--- a/OpenTabletDriver.UX/Controls/Output/OutputModeEditor.cs
+++ b/OpenTabletDriver.UX/Controls/Output/OutputModeEditor.cs
@@ -69,6 +69,7 @@ namespace OpenTabletDriver.UX.Controls.Output
         {
             ProfileChanged?.Invoke(this, new EventArgs());
             UpdateTablet();
+            UpdateOutputMode(Profile?.OutputMode);
         }

         public BindableBinding<OutputModeEditor, Profile> ProfileBinding
@@ -89,6 +90,7 @@ namespace OpenTabletDriver.UX.Controls.Output
         private AbsoluteModeEditor absoluteModeEditor = new AbsoluteModeEditor();
         private RelativeModeEditor relativeModeEditor = new RelativeModeEditor();
         private TypeDropDown<IOutputMode> outputModeSelector = new TypeDropDown<IOutputMode> { Width = 300 };
+        private Label outputModeUnsupported = new Label { Text = "No supported output mode selected.", TextAlignment = TextAlignment.Center, VerticalAlignment = VerticalAlignment.Center };

         public void SetTabletSize(TabletReference tablet)
         {
@@ -128,6 +130,8 @@ namespace OpenTabletDriver.UX.Controls.Output
                 editorContainer.Content = absoluteModeEditor;
             else if (showRelative)
                 editorContainer.Content = relativeModeEditor;
+            else
+                editorContainer.Content = outputModeUnsupported;
         }
     }
 }

Apply this and we can roll with that.

@Mrcubix
Copy link
Contributor Author

Mrcubix commented Jan 10, 2025

Applied, will get some rest now before my sense force me to

@InfinityGhost InfinityGhost merged commit 765009c into OpenTabletDriver:0.6.x Jan 10, 2025
8 checks passed
@InfinityGhost InfinityGhost added bug Something isn't working gui Affects driver GUI labels Jan 10, 2025
@Mrcubix Mrcubix deleted the Missing-OutputMode-Settings-Load-Fix branch January 16, 2025 19:45
@gonX gonX added this to the v0.6.5.1 milestone Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working gui Affects driver GUI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants