def check_input_methods(self):
        """ check if the selected langauge has input method support
            and set checkbutton_enable_input_methods accordingly
        """
        if not self.imSwitch.available():
            return
        # get the current first item in the user LANGUAGE list,
        # but with country code added if not already present
        loc = language2locale(self.userEnvLanguage)
        code = re.split("[.@]", loc)[0]

        combo = self.combobox_input_method
        # cell = combo.get_child().get_cell_renderers()[0]
        # FIXME: use something else than a hardcoded value here
        # cell.set_property("wrap-width",300)
        # cell.set_property("wrap-mode",Pango.WRAP_WORD)
        model = combo.get_model()
        model.clear()

        # find the default
        currentIM = self.imSwitch.getInputMethodForLocale(code)
        if currentIM in (None, "default"):
            currentIM = "none"
        # print "Current IM: "+currentIM

        # find out about the other options
        for (i, IM) in enumerate(self.imSwitch.getAvailableInputMethods()):
            iter = model.append()
            name = _("none") if IM == "none" else IM
            model.set_value(iter, IM_CHOICE, IM)
            model.set_value(iter, IM_NAME, name)
            if IM == currentIM:
                combo.set_active(i)
Example #2
0
    def check_input_methods(self):
        """ check if the selected langauge has input method support
            and set checkbutton_enable_input_methods accordingly
        """
        if not self.imSwitch.available():
            return
        # get the current first item in the user LANGUAGE list,
        # but with country code added if not already present
        loc = language2locale(self.userEnvLanguage)
        code = re.split('[.@]', loc)[0]

        combo = self.combobox_input_method
        #cell = combo.get_child().get_cell_renderers()[0]
        # FIXME: use something else than a hardcoded value here
        #cell.set_property("wrap-width",300)
        #cell.set_property("wrap-mode",Pango.WRAP_WORD)
        model = combo.get_model()
        model.clear()

        # find the default
        currentIM = self.imSwitch.getInputMethodForLocale(code)
        if currentIM in (None, 'default'):
            currentIM = 'none'
        #print "Current IM: "+currentIM

        # find out about the other options
        for (i, IM) in enumerate(self.imSwitch.getAvailableInputMethods()):
            iter = model.append()
            name = _('none') if IM == 'none' else IM
            model.set_value(iter, IM_CHOICE, IM)
            model.set_value(iter, IM_NAME, name)
            if IM == currentIM:
                combo.set_active(i)
    def on_combobox_input_method_changed(self, widget):
        loc = language2locale(self.userEnvLanguage)
        code = re.split("[.@]", loc)[0]

        combo = self.combobox_input_method
        model = combo.get_model()
        if combo.get_active() < 0:
            return
        (IM_choice, IM_name) = model[combo.get_active()]
        # print "IM: "+IM_choice+"\t"+code
        self.imSwitch.setInputMethodForLocale(IM_choice, code)
Example #4
0
    def on_combobox_input_method_changed(self, widget):
        loc = language2locale(self.userEnvLanguage)
        code = re.split('[.@]', loc)[0]

        combo = self.combobox_input_method
        model = combo.get_model()
        if combo.get_active() < 0:
            return
        (IM_choice, IM_name) = model[combo.get_active()]
        #print "IM: "+IM_choice+"\t"+code
        self.imSwitch.setInputMethodForLocale(IM_choice, code)