[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Accessibility theme for the graphical installer



Hi Denis,

On Saturday 09 September 2006 09:12, Denis Barbier wrote:
> With help from Eddy Petrişor, I copied the
> HighContrastLargePrintInverse theme (from gnome-accessibility-themes)
> into rootskel-gtk, you can find this package under
> people/barbier/rootskel-gtk in d-i subversion repository.
> This theme is currently enabled when the FRONTEND_BACKGROUND=dark boot
> argument is found.  Is it okay to put this stuff into trunk?
> Do people on d-accessibility have an opinion on this theme and font
> size?

Thanks for coming back to this. Theming for g-i was on the TODO list, but 
we had not yet really gotten around to it. I guess an accessibility theme 
is a great place to start.

I've checked your changes in rootskel-gtk and I think the implementation 
can be improved. I've not looked at how the theme looks, only at the 
technical side of it.

I think I have mentioned before that I would like to be able to set themes 
consistently with other parameters, i.e. using a debconf value like 
debian-installer/theme (with a shortcut for the boot prompt "theme=...") 
instead of FRONTEND_BACKGROUND or whatever.
I have now implemented this in rootskel and preseed (see attached 
patches). This works for both gtk and newt frontends.

I feel that for now it is OK to include the theme file(s) in rootskel-gtk; 
we may want to split them out later.

I don't really like that the theme file and theme name are different; IMO 
it would be better to have those the same (although we can script around 
that if there is a good reason for the current name).

I don't like just replacing the whole /etc/gtk-2.0/gtkrc file. GTK 
supports a gtk-theme-name parameter in that file and IMO we should use 
that. How that translates to a theme definition I don't know, but should 
be easy to find out.

Note that we already had some scripts (currently unused and not really 
tested yet) to support switching font and theme.
See rootskel-gtk/src/usr/bin/ for current versions. I've fixed them up a 
bit for basic support for your theme (see attached patches).

Setting the font as part of the theme is a bad idea as we want to be able 
to switch fonts for other reasons too. I have resolved this by increasing 
the font size for this theme in gtk-set-font (see patches).

Note that for gtk-set-font to work we need fc-list in the fontconfig udeb.

Cheers,
FJP

Index: rootskel/debian/templates-arch
===================================================================
--- rootskel/debian/templates-arch	(revision 40624)
+++ rootskel/debian/templates-arch	(working copy)
@@ -14,3 +14,7 @@
 Type: boolean
 Default: false
 Description: halt the machine
+
+Template: debian-installer/theme
+Type: string
+Description: theme to use for the (newt or gtk) frontend
Index: rootskel/src/lib/debian-installer.d/S65theme
===================================================================
--- rootskel/src/lib/debian-installer.d/S65theme	(revision 0)
+++ rootskel/src/lib/debian-installer.d/S65theme	(revision 0)
@@ -0,0 +1,12 @@
+theme="`debconf-get debian-installer/theme`"
+
+if [ "$theme" ]; then
+	case "$DEBIAN_FRONTEND" in
+	    newt)
+		export FRONTEND_BACKGROUND="$theme"
+		;;
+	    gtk)
+		gtk-set-theme "$theme" || true
+		;;
+	esac
+fi
Index: rootskel/src/lib/debian-installer.d/Makefile
===================================================================
--- rootskel/src/lib/debian-installer.d/Makefile	(revision 40624)
+++ rootskel/src/lib/debian-installer.d/Makefile	(working copy)
@@ -17,6 +17,7 @@
 files += \
 	S30term \
 	S60frontend \
+	S65theme \
 	S72menu-exit
 
 ifeq ($(DEB_HOST_ARCH_OS),linux)
Index: rootskel-gtk/src/usr/bin/gtk-set-font
===================================================================
--- rootskel-gtk/src/usr/bin/gtk-set-font	(revision 40624)
+++ rootskel-gtk/src/usr/bin/gtk-set-font	(working copy)
@@ -2,23 +2,28 @@
 
 set -e
 
+. /usr/share/debconf/confmodule
+
 [ "$DEBIAN_FRONTEND" = "gtk" ] || exit 0
 
-language="$1"
 CONFFILE="/etc/gtk-2.0/gtkrc"
-
-[ -n "$language" ] || exit 1
 [ -f "$CONFFILE" ] || exit 1
 
+if db_get debian-installer/language && [ "$RET" ]; then
+	language="$RET"
+else
+	language=en
+fi
+
 DEFAULT_FONT="DejaVu"
 # Default font size; good for 640x480 or 800x600 screens
-FONT_SIZE=11
+FONT_SIZE=9
 
 # Set the primary GTK font according to language
 case "$language" in
     ar|fa)
 	FONT_NAME="Nazli"
-	FONT_SIZE=14
+	FONT_SIZE=$(($FONT_SIZE + 2))
 	;;
     ja)
 	FONT_NAME="Sazanami Gothic"
@@ -34,12 +39,16 @@
 	;;
 esac
 
+if db_get debian-installer/theme && [ "$RET" = dark ]; then
+	# Theme for visually impaired; increase fontsize
+	FONT_SIZE=$(($FONT_SIZE + 7))
+fi
+
 # Fall back to default if font does not exist; default is assumed to exist
 if ! fc-list | grep -q "$FONT_NAME"; then
 	FONT_NAME=$DEFAULT_FONT
 fi
 
-cp $CONFFILE $CONFFILE.old
 sed -i "s/^gtk-font-name.*$/gtk-font-name = \"$FONT_NAME $FONT_SIZE\"/" $CONFFILE
 
 exit 0
Index: rootskel-gtk/src/usr/bin/gtk-set-theme
===================================================================
--- rootskel-gtk/src/usr/bin/gtk-set-theme	(revision 40624)
+++ rootskel-gtk/src/usr/bin/gtk-set-theme	(working copy)
@@ -13,12 +13,12 @@
 #TODO: test that theme actually exists
 
 if grep -q "^gtk-theme-name" $CONFFILE ; then
-	cp $CONFFILE $CONFFILE.old
-	sed "s/^gtk-theme-name.*$/gtk-theme-name = \"$THEME\"/" \
-		$CONFFILE.old >$CONFFILE
-	rm -f $CONFFILE.old
+	sed -i "s/^gtk-theme-name.*$/gtk-theme-name = \"$THEME\"/" $CONFFILE
 else
 	echo "gtk-theme-name = \"$THEME\"" >>$CONFFILE
 fi
 
+# For the accessibility theme the font size is increased
+gtk-set-font || true
+
 exit 0
Index: preseed/preseed_aliases
===================================================================
--- preseed/preseed_aliases	(revision 40624)
+++ preseed/preseed_aliases	(working copy)
@@ -10,3 +10,4 @@
 fb	debian-installer/framebuffer
 classes	auto-install/classes
 tasks	tasksel/first
+theme	debian-installer/theme

Attachment: pgpCD1VDZiQfM.pgp
Description: PGP signature


Reply to: