Salix Input Method Installer

If you have any suggestions or ideas about improving Salix, here's the place to post them.
Post Reply
User avatar
tsuren
Posts: 206
Joined: 7. Jun 2009, 17:32
Location: France

Salix Input Method Installer

Post by tsuren »

I have modified Salix codecs installer from gapan so that we can have something similar for the input method engine (i.e. Ibus and co). As lib sizes of dependencies and required dictionaries for CJK and other non-Latin languages are rather big, and as it is, strictly speaking, optional to those who need the functionality, I think this might provide a solution to keep the ISO size down.

You can find the package here.

Please test it, and let me your comments, and perhaps it is still not too late for the KDE edition.

Many thanks
'Tommorow is like today, just happens tomorrow.'
User avatar
Akuna
Salix Wizard
Posts: 1038
Joined: 14. Jun 2009, 12:25

Re: Salix Input Method Installer

Post by Akuna »

Excellent idea! :)
Image
What really matters is where you are going, not where you come from.
User avatar
tsuren
Posts: 206
Joined: 7. Jun 2009, 17:32
Location: France

Re: Salix Input Method Installer

Post by tsuren »

I need a little help here. I know i am rubbish at writing codes, but your help would be appreciated. Could anyone tell me what is wrong with the following codes?

Many thanks

Code: Select all

export TEXTDOMAIN="salix-input-method-installer"
export TEXTDOMAINDIR="/usr/share/locale"
. gettext.sh

PKGLIST=/usr/share/salix-input-method-installer/pkglist
ERRORFILE=/tmp/salix-input-method-installer-error

if [ ! $DISPLAY ]; then
	echo -e "`eval_gettext 'ERROR: salix-input-method-installer must be executed within a running X session.\n'`"
	exit 1
fi

if [ "$UID" != "0" ]; then
	echo "`eval_gettext 'ERROR: You need to be root to run this'`"
	exit 1
fi

if [ ! `which zenity` ]; then
	echo "`eval_gettext 'ERROR: zenity must be installed and in your PATH to run this'`"
	exit 1
fi

if [ ! `which slapt-get` ]; then
	echo "`eval_gettext 'ERROR: slapt-get must be installed and in your PATH to run this'`"
	exit 1
fi

rm -f $ERRORFILE

serverconnecterror()
{
	zenity --error \
	--title "`eval_gettext 'Error connecting to server'`" \
	--text "`eval_gettext 'There was an error connecting to at least one of the repositories.\n\nPlease check that you have a working internet connection and that the repository list in gslapt (or directly in /etc/slapt-get/slapt-getrc) is correctly set up.'`"
	touch $ERRORFILE
}

pkgdownloaderror()
{
	zenity --error \
	--title "`eval_gettext 'Error downloading packages'`" \
	--text "`eval_gettext 'There was an error downloading the required packages. Please make sure that your internet connection is working properly and try again'`"
	touch $ERRORFILE
}

updatepkgdatabase()
{
	echo 0
	slapt-get -u
	[ $? -eq 1 ] &&  serverconnecterror
	echo 100
}

leaving()
{
	zenity --question \
	--title "`eval_gettext 'Removing the Salix input method installer'`" \
	--window-icon=/usr/share/icons/hicolor/48x48/apps/salix-input-method-installer.png \
	--text "`eval_gettext 'Would you like to remove the Salix-input-method-installer from your system?'`"
	[ $? -eq 0 ] && /sbin/removepkg salix-input-method-installer
	[ $? -eq 1 ] && exit 0
}

installinputmethod()
{
		echo "haha"
	PKGN=`cat $PKGLIST|sed '/^$/d'|wc -l`
    INCREMENT=`python -c "print(100/$PKGN)"`
	BAR=0
	for i in `seq 1 $PKGN`; do
		slapt-get --no-dep -y -i `sed -n -e "${i}p" $PKGLIST` \
		1> /dev/null
		if [ $? -eq 1 ]; then
			pkgdownloaderror
			break
		fi
		let BAR+=$INCREMENT
		echo `python -c "print($BAR-1)"`
	done
	echo 100
}

zenity --question \
 --title "`eval_gettext 'Install multilingual input method engine?'`" \
 --window-icon=/usr/share/icons/hicolor/48x48/apps/salix-input-method-installer.png \
 --text "`eval_gettext 'An input method editor (IME) facilitates users to enter characters and symbols not found on their input devices. For instance, this allows the user of Latin keyboards to input Chinese, Japanese, Korean and other non-Latin characters. \n\nSalix-Input-Method-Installer installs Ibus as the IME for your Salix and all other necessary packages that you need for the IME to function properly. \n\nWould you like to install the input method editor?'`"
[[ ! $? -eq 0 ]] && leaving

updatepkgdatabase 2> /dev/null | zenity --progress \
 --text "`eval_gettext 'Receiving package information...'`" \
 --title "`eval_gettext 'System preparation'`" \
 --pulsate --percentage 0 --auto-close --auto-kill
[ -f $ERRORFILE ] && exit 1

 choice="$(zenity --list --height=210 --checklist --multiple\
 --title "`eval_gettext 'Input Method Language Selection'`" \
 --window-icon=/usr/share/icons/hicolor/48x48/apps/salix-input-method-installer.png \
 --text "`eval_gettext 'Select a language for which you would like to install the input method editor.'`" \
 --column="Selection" --column="Characters" --column="Description" \
 C "Chinese" "Installs ibus and ibus-pinyin" \
 J "Japanese" "Installs ibus and anthy" \
 K "Korean" "Installs ibus, ibus-hangul and libhangul" \
 O "Others" "Installs m17n and lib-m17n" )"

arr=$(echo $choice | tr "|" "\n")

 for Lchoice in $arr; do
	case "$Lchoice" in
          "Chinese" )
			echo "installing Chinese"
			PKGLIST=/usr/share/salix-input-method-installer/pkglistO
			echo "$PKGLIST"
          ;;
          "Japanese" )
			echo "installing Japanese"
			PKGLIST=/usr/share/salix-input-method-installer/pkglistJ
          ;;
          "Korean" )
			echo "installing Korean"
			PKGLIST=/usr/share/salix-input-method-installer/pkglistK
          ;;
          "Others" )
			echo "installing others"
			PKGLIST=/usr/share/salix-input-method-installer/pkglistO
          ;;
          *)
		exit 0
          ;;
        esac
echo "$PKGLIST"

installinputmethod 2> /dev/null | zenity --progress \
--text "`eval_gettext 'Downloading and installing packages...'`" \
--title "`eval_gettext 'Package installation'`" \
--percentage 0 --auto-close --auto-kill
[ -f $ERRORFILE ] && exit 1
 
	done 
      
##PKGLIST=/usr/share/salix-input-method-installer/
			
zenity --question \
 --title "`eval_gettext 'Done!'`" \
 --window-icon=/usr/share/icons/hicolor/48x48/apps/salix-input-method-installer.png \
 --text "`eval_gettext 'input-method installation was succesfully completed.\n\nWould you like to remove the Salix-input-method-installer from your system?'`"
[ $? -eq 0 ] && /sbin/removepkg salix-input-method-installer
'Tommorow is like today, just happens tomorrow.'
User avatar
mimosa
Salix Warrior
Posts: 3311
Joined: 25. May 2010, 17:02
Contact:

Re: Salix Input Method Installer

Post by mimosa »

Appears to complete successfully in 13.37 Ratpoison, though it doesn't give me any options except to delete itself after it's finished. I'm not sure where it's put anything - not in Ratpoison's menu, as far as I can see. Anyway, I suppose all the stuff was here already - somewhere or other. The main point is, it didn't crash, and exited just like the codecs installer.
User avatar
tsuren
Posts: 206
Joined: 7. Jun 2009, 17:32
Location: France

Re: Salix Input Method Installer

Post by tsuren »

I am working on giving more options. (see the codes above) Just it is still not working properly! Yet...
'Tommorow is like today, just happens tomorrow.'
User avatar
tsuren
Posts: 206
Joined: 7. Jun 2009, 17:32
Location: France

Re: Salix Input Method Installer

Post by tsuren »

OK. The script is fixed now. And it is running fine.

You can find the new version here!

Here are some screenshots:

Image

Image

Image

I am thinking of replacing anthy with mozc in the future.
'Tommorow is like today, just happens tomorrow.'
djemos
Salix Warrior
Posts: 1464
Joined: 29. Dec 2009, 13:45
Location: Greece

Re: Salix Input Method Installer

Post by djemos »

tsuren wrote:Please test it, and let me your comments, and perhaps it is still not too late for the KDE edition.
Many thanks
tsuren, i have build a new KDE 32 bit cd with pyxdg,ibus-qt,icu which is 671 MB. So there is no problem with KDE.
If i understood well what you mean saying " and perhaps it is still not too late for the KDE edition"

:-)
Post Reply