[gbrainy] Support for colorblind users
- From: Jordi Mas <jmas src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gbrainy] Support for colorblind users
- Date: Wed, 16 Dec 2009 20:48:20 +0000 (UTC)
commit a88c93890bbfccc77380bf23b08b9a2efbff3f50
Author: Jordi Mas <jmas softcatala org>
Date: Wed Dec 16 21:48:52 2009 +0100
Support for colorblind users
src/Clients/Classical/Dialogs/PreferencesDialog.cs | 5 +-
src/Clients/Classical/gbrainy.cs | 4 +-
src/Clients/Classical/gbrainy.glade | 59 ++++++++++++++++++++
src/Core/Main/Game.cs | 5 +-
src/Core/Main/GameManager.cs | 3 +
src/Core/Main/Preferences.cs | 8 ++-
src/Games/Logic/PuzzleExtraCircle.cs | 4 +
src/Games/Logic/PuzzleLargerShape.cs | 4 +
src/Games/Memory/MemoryColouredFigures.cs | 4 +
src/Games/Memory/MemoryColouredText.cs | 4 +
src/Games/Memory/MemoryCountDots.cs | 4 +
11 files changed, 96 insertions(+), 8 deletions(-)
---
diff --git a/src/Clients/Classical/Dialogs/PreferencesDialog.cs b/src/Clients/Classical/Dialogs/PreferencesDialog.cs
index 121e79a..59db70a 100644
--- a/src/Clients/Classical/Dialogs/PreferencesDialog.cs
+++ b/src/Clients/Classical/Dialogs/PreferencesDialog.cs
@@ -32,6 +32,7 @@ namespace gbrainy.Clients.Classical
[Glade.Widget] Gtk.SpinButton maxstoredspinbutton;
[Glade.Widget] Gtk.SpinButton minplayedspinbutton;
[Glade.Widget] Gtk.CheckButton prefcheckbutton;
+ [Glade.Widget] Gtk.CheckButton colorblindcheckbutton;
[Glade.Widget] Gtk.RadioButton rb_easy;
[Glade.Widget] Gtk.RadioButton rb_medium;
[Glade.Widget] Gtk.RadioButton rb_master;
@@ -45,6 +46,7 @@ namespace gbrainy.Clients.Classical
prefcheckbutton.Active = Preferences.GetBoolValue (Preferences.MemQuestionWarnKey);
maxstoredspinbutton.Value = Preferences.GetIntValue (Preferences.MaxStoredGamesKey);
minplayedspinbutton.Value = Preferences.GetIntValue (Preferences.MinPlayedGamesKey);
+ colorblindcheckbutton.Active = Preferences.GetBoolValue (Preferences.ColorBlindKey);
switch ((Game.Difficulty) Preferences.GetIntValue (Preferences.DifficultyKey)) {
case Game.Difficulty.Easy:
@@ -57,7 +59,6 @@ namespace gbrainy.Clients.Classical
rb_master.Active = rb_master.HasFocus = true;
break;
}
-
}
private Game.Difficulty Difficulty {
@@ -72,7 +73,6 @@ namespace gbrainy.Clients.Classical
}
}
-
private void OnCleanHistory (object sender, EventArgs args)
{
history.Clean ();
@@ -85,6 +85,7 @@ namespace gbrainy.Clients.Classical
Preferences.SetIntValue (Preferences.DifficultyKey, (int) Difficulty);
Preferences.SetIntValue (Preferences.MaxStoredGamesKey, (int) maxstoredspinbutton.Value);
Preferences.SetIntValue (Preferences.MinPlayedGamesKey, (int) minplayedspinbutton.Value);
+ Preferences.SetBoolValue (Preferences.ColorBlindKey, colorblindcheckbutton.Active);
Preferences.Save ();
}
}
diff --git a/src/Clients/Classical/gbrainy.cs b/src/Clients/Classical/gbrainy.cs
index 013856e..e2ef3f5 100644
--- a/src/Clients/Classical/gbrainy.cs
+++ b/src/Clients/Classical/gbrainy.cs
@@ -114,7 +114,7 @@ namespace gbrainy.Clients.Classical
app_window.IconName = "gbrainy";
app_window.ShowAll ();
- if (Preferences.GetBoolValue (Preferences.Toolbar) == false || low_res == true)
+ if (Preferences.GetBoolValue (Preferences.ToolbarKey) == false || low_res == true)
toolbar_menuitem.Active = false;
ActiveInputControls (false);
@@ -510,7 +510,7 @@ namespace gbrainy.Clients.Classical
requisition = toolbar.SizeRequest ();
app_window.GetSize (out width, out height);
toolbar.Visible = !toolbar.Visible;
- Preferences.SetBoolValue (Preferences.Toolbar, toolbar.Visible);
+ Preferences.SetBoolValue (Preferences.ToolbarKey, toolbar.Visible);
Preferences.Save ();
app_window.Resize (width, height - requisition.Height);
}
diff --git a/src/Clients/Classical/gbrainy.glade b/src/Clients/Classical/gbrainy.glade
index efe7778..17432eb 100644
--- a/src/Clients/Classical/gbrainy.glade
+++ b/src/Clients/Classical/gbrainy.glade
@@ -879,6 +879,63 @@
</packing>
</child>
+<child>
+ <widget class="GtkVBox" id="vbox13">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkLabel" id="label33">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"><b>General Settings</b></property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="xpad">5</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkCheckButton" id="colorblindcheckbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Skip games that use colors (friendly to colorblind users)</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
<child>
<widget class="GtkVBox" id="vbox11">
<property name="visible">True</property>
@@ -1308,6 +1365,8 @@
<property name="fill">True</property>
</packing>
</child>
+
+
</widget>
</child>
</widget>
diff --git a/src/Core/Main/Game.cs b/src/Core/Main/Game.cs
index faac839..d43b606 100644
--- a/src/Core/Main/Game.cs
+++ b/src/Core/Main/Game.cs
@@ -103,7 +103,6 @@ namespace gbrainy.Core.Main
get { return synchronize; }
}
-
// Stores how difficult the game is
public virtual Difficulty GameDifficulty {
get {
@@ -158,6 +157,10 @@ namespace gbrainy.Core.Main
get { return true;}
}
+ public virtual bool UsesColors {
+ get { return false;}
+ }
+
public virtual double DrawAreaX {
get {return 0.1;}
}
diff --git a/src/Core/Main/GameManager.cs b/src/Core/Main/GameManager.cs
index 17716b1..d4497f5 100644
--- a/src/Core/Main/GameManager.cs
+++ b/src/Core/Main/GameManager.cs
@@ -396,6 +396,9 @@ namespace gbrainy.Core.Main
if (puzzle.IsPlayable == false)
continue;
+
+ if ((Preferences.GetBoolValue (Preferences.ColorBlindKey) == true) && puzzle.UsesColors == true)
+ continue;
Analogies analogy = puzzle as Analogies;
if (analogy != null && analogy.IsExhausted == true)
diff --git a/src/Core/Main/Preferences.cs b/src/Core/Main/Preferences.cs
index b4e981d..9972827 100644
--- a/src/Core/Main/Preferences.cs
+++ b/src/Core/Main/Preferences.cs
@@ -35,8 +35,9 @@ namespace gbrainy.Core.Main
public const string MemQuestionTimeKey = "MemQuestionTime";
public const string DifficultyKey = "Difficulty";
public const string MinPlayedGamesKey = "MinPlayedGames";
- public const string MaxStoredGamesKey = "MaxStoredGamesKey";
- public const string Toolbar = "Toolbar";
+ public const string MaxStoredGamesKey = "MaxStoredGames";
+ public const string ToolbarKey = "Toolbar";
+ public const string ColorBlindKey = "ColorBlind";
const string element_item = "item";
const string element_key = "key";
@@ -160,7 +161,8 @@ namespace gbrainy.Core.Main
properties.Add (DifficultyKey, ((int)(Game.Difficulty.Medium)).ToString ());
properties.Add (MinPlayedGamesKey, "5");
properties.Add (MaxStoredGamesKey, "20");
- properties.Add (Toolbar, true.ToString ());
+ properties.Add (ToolbarKey, true.ToString ());
+ properties.Add (ColorBlindKey, false.ToString ());
}
static void Load ()
diff --git a/src/Games/Logic/PuzzleExtraCircle.cs b/src/Games/Logic/PuzzleExtraCircle.cs
index ed6d1d4..c4859a8 100644
--- a/src/Games/Logic/PuzzleExtraCircle.cs
+++ b/src/Games/Logic/PuzzleExtraCircle.cs
@@ -42,6 +42,10 @@ namespace gbrainy.Games.Logic
get {return Catalog.GetString ("Extra circle");}
}
+ public override bool UsesColors {
+ get { return true;}
+ }
+
public override string Question {
get {return String.Format (
Catalog.GetString ("Which circle does not belong to the group? It is not a sequence of elements. Answer {0}, {1}, {2} or {3}."),
diff --git a/src/Games/Logic/PuzzleLargerShape.cs b/src/Games/Logic/PuzzleLargerShape.cs
index 85bddd8..b171beb 100644
--- a/src/Games/Logic/PuzzleLargerShape.cs
+++ b/src/Games/Logic/PuzzleLargerShape.cs
@@ -113,6 +113,10 @@ namespace gbrainy.Games.Logic
get {return Catalog.GetString ("Larger shape");}
}
+ public override bool UsesColors {
+ get { return true;}
+ }
+
public override string Question {
get {return String.Format (
Catalog.GetString ("Which larger shape can you make combining the first two figures? Answer {0}, {1}, {2} or {3}."),
diff --git a/src/Games/Memory/MemoryColouredFigures.cs b/src/Games/Memory/MemoryColouredFigures.cs
index bc73c8c..ef1beb7 100644
--- a/src/Games/Memory/MemoryColouredFigures.cs
+++ b/src/Games/Memory/MemoryColouredFigures.cs
@@ -51,6 +51,10 @@ namespace gbrainy.Games.Memory
get {return Catalog.GetString ("Colored figures");}
}
+ public override bool UsesColors {
+ get { return true;}
+ }
+
public override string MemoryQuestion {
get { return String.Format (
Catalog.GetString ("Which of these figures was previously shown? Answer {0}, {1}, {2} or {3}."),
diff --git a/src/Games/Memory/MemoryColouredText.cs b/src/Games/Memory/MemoryColouredText.cs
index 1212993..af7efcf 100644
--- a/src/Games/Memory/MemoryColouredText.cs
+++ b/src/Games/Memory/MemoryColouredText.cs
@@ -36,6 +36,10 @@ namespace gbrainy.Games.Memory
get {return Catalog.GetString ("Colored text");}
}
+ public override bool UsesColors {
+ get { return true;}
+ }
+
public override string MemoryQuestion {
get {
return String.Format (Catalog.GetString ("What was the color of the text that said '{0}'?"), question_colorname);}
diff --git a/src/Games/Memory/MemoryCountDots.cs b/src/Games/Memory/MemoryCountDots.cs
index 2f002e6..4602053 100644
--- a/src/Games/Memory/MemoryCountDots.cs
+++ b/src/Games/Memory/MemoryCountDots.cs
@@ -42,6 +42,10 @@ namespace gbrainy.Games.Memory
get {return Catalog.GetString ("Counting dots");}
}
+ public override bool UsesColors {
+ get { return true;}
+ }
+
public override string MemoryQuestion {
get {
return String.Format (
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]