Exemplo n.º 1
0
	def trigger_property (self, property):
		if property == "status":
			self._change_mode ()
		elif property == "full_letter":
			self._full_width_letter [self._mode] = not self._full_width_letter [self._mode]
			self._refresh_properties ()
		elif property == "full_punct":
			self._full_width_punct [self._mode] = not self._full_width_punct [self._mode]
			self._refresh_properties ()
		elif property == "shuangpin":
			PinYinEngine._shuangpin = not PinYinEngine._shuangpin
			self.reset ()
			if PinYinEngine._shuangpin:
				self._py_parser = PYParser.ShuangPinParser (PinYinEngine._shuangpin_schema)
			else:
				self._py_parser = PYParser.PinYinParser ()
			self._user_input.set_parser (self._py_parser)
			self._config.write ("/IMEngine/Python/PinYin/ShuangPin", PinYinEngine._shuangpin)
			self._refresh_properties ()
		elif property == "gbk":
			PinYinEngine._gbk = not PinYinEngine._gbk
			self.reset ()
			self._config.write ("/IMEngine/Python/PinYin/SupportGBK", PinYinEngine._gbk)
			self._refresh_properties ()

		elif property == "setup":
			self.start_helper ("eebeecd7-cb22-48f4-8ced-70e42dad1a79")

		IMEngine.trigger_property (self, property)
Exemplo n.º 2
0
	def lookup_table_page_down (self):
		if self._lookup_table.page_down ():
			self.update_lookup_table (self._lookup_table)
			return True
		
		IMEngine.lookup_table_page_down (self)
		return True
Exemplo n.º 3
0
	def __init__ (self, factory, config, encoding, id):
		IMEngine.__init__ (self, factory, config, encoding, id)
		self._config = config
		self._lookup_table = scim.LookupTable (PinYinEngine._page_size)
		self._lookup_table.fix_page_size (True)
		
		self._py_parser = PYParser.PinYinParser ()
		self._user_input = UserInput (self._py_parser)
		
		# 0 = english input mode
		# 1 = chinese input mode
		self._mode = 1
		self._full_width_letter = [False, False]
		self._full_width_punct = [False, True]
		self._full_width_punct[1] = config.read ("/IMEngine/Python/PinYin/FullWidthPunct", True)

		self._committed_phrases = PhraseList ()
		self._preedit_phrases = PhraseList ()
		self.reset ()

		self._status_property = Property ("status", "")
		self._letter_property = Property ("full_letter", "")
		self._punct_property = Property ("full_punct", "")
		# self._shuangpin_property = Property ("shuangpin", "")
		# self._gbk_property = Property ("gbk", "")
		self._setup_property = Property ("setup", "", "/usr/share/scim/icons/setup.png", _("Setup"))
	def __init__ (self, factory, config, encoding, id):
		IMEngine.__init__ (self, factory, config, encoding, id)
		self._config = config
		self._preedit_string = u""
		self._cursor = 0
		self.keys = []
		self.keyCount = []
		self.oldkey = None
Exemplo n.º 5
0
	def commit_string (self, string = None):
		if string == None:
			string = self._preedit_string
		self._preedit_string = u""
		self._candidates = []
		self._cursor = 0
		IMEngine.commit_string (self, string)
		self.update ()
	def commit_string (self, string1 = None):
		string = self._preedit_string
		self._preedit_string = u""
		self._cursor = 0
		IMEngine.commit_string (self, string)
		self.update ()
		self.keys = []
		self.keyCount = []
		self.oldkey = 0
Exemplo n.º 7
0
	def __init__ (self, factory, config, db, encoding, id):
		IMEngine.__init__ (self, factory, config, encoding, id)
		self._config = config
		self._lookup_table = scim.LookupTable (9)
		self._preedit_string = u""
		self._db = db
		self._cursor = 0
		self._candidates = []
		self._always_show_candidates = config.read ("/IMEngine/Python/EnglishWriter/AlwaysShowCandidates", False)
		self._commit_space = config.read ("/IMEngine/Python/EnglishWriter/CommitSpace", True)
Exemplo n.º 8
0
	def focus_in (self):
		self._init_properties ()
		if PinYinEngine._shuangpin:
			self._py_parser = PYParser.ShuangPinParser (PinYinEngine._shuangpin_schema)
		else:
			self._py_parser = PYParser.PinYinParser ()
		self._user_input.set_parser (self._py_parser)
		self._user_input.set_gbk (PinYinEngine._gbk)
		self._user_input.set_auto_correct (PinYinEngine._auto_correct)
		IMEngine.focus_in (self)
		self._update ()
Exemplo n.º 9
0
	def commit_string (self, string):
		self._temp_english_mode = False
		self._i_mode = False
		self._candidates = []
		self._english_candidates = []
		self._cursor = 0
		self._user_input.clear ()
		self._preedit_string = u""
		self._committed_phrases.clear ()
		self._committed_special_phrase = u""
		IMEngine.commit_string (self, string)
		self._prev_char = string[-1]
		self._update ()
Exemplo n.º 10
0
	def reset (self):
		self._temp_english_mode = False
		self._i_mode = False
		self._user_input.clear ()
		self._committed_phrases.clear ()
		self._committed_special_phrase = u""
		self._preedit_string = u""
		self._special_candidates = []
		self._candidates = []
		self._english_candidates = []
		self._cursor = 0
		self._double_quotation_state = False
		self._single_quotation_state = False
		self._prev_key = None
		self._prev_char = None
		self._update ()
		IMEngine.reset (self)
	def update_client_capabilities (self, cap):
		IMEngine.update_client_capabilities (self, cap)
	def process_helper_event (self, helper_uuid, trans):
		IMEngine.process_helper_event (self, helper_uuid, trans)
	def trigger_property (self, property):
		IMEngine.trigger_property (self, property)
	def focus_out (self):
		self.reset ()
		IMEngine.focus_out (self)
	def focus_in (self):
		IMEngine.focus_in (self)
		self.update ()
	def reset (self):
		#self._preedit_string = u"RESET"
		self.oldkey = 0
		self._cursor = 0
		self.update ()
		IMEngine.reset (self)
	def select_candidate (self, index):
		IMEngine.select_candidate (self, index)
	def move_preedit_caret (self, pos):
		IMEngine.move_preedit_caret (self, pos)
Exemplo n.º 19
0
	def reset (self):
		self._preedit_string = u""
		self._candidates = []
		self._cursor = 0
		self.update ()
		IMEngine.reset (self)
Exemplo n.º 20
0
	def update_lookup_table_page_size (self, page_size):
		IMEngine.update_lookup_table_page_size (self, page_size)