Ejemplo n.º 1
0
 def _mnemonic_correct(self):
     text = self._mnemonic_var.get()
     if len(text) == 0:
         return True
     if text[0:2] == "0x":
         try:
             return 0 <= int(text, 16) <= 255
         except ValueError:
             return False
     else:
         valid_mnemonics = mnemonics.values()
         return text in valid_mnemonics
Ejemplo n.º 2
0
	def _mnemonic_correct(self):
		text = self._mnemonic_var.get()
		if len(text) == 0:
			return True
		if text[0:2] == "0x":
			try:
				return 0 <= int(text, 16) <= 255
			except ValueError:
				return False
		else:
			valid_mnemonics = mnemonics.values()
			return text in valid_mnemonics
Ejemplo n.º 3
0
 def _on_mnemonic_changed(self, *unused):
     if not self._mnemonic_correct:
         self._['e_mnemonic'].config(bg=self._wrong_bgcolor)
     else:
         self._['e_mnemonic'].config(bg=self._correct_bgcolor)
         self._mnemonic = self._mnemonic_var.get()
     if len(self._mnemonic_var.get()) == 0:
         self._hints = []
     else:
         self._hints = list(
             filter(lambda x: x.startswith(self._mnemonic_var.get()),
                    mnemonics.values()))
     self._['l_hints'].config(text=" ".join(self._hints))
     if self._mnemonic_correct:
         self._notify()
Ejemplo n.º 4
0
	def _on_mnemonic_changed(self, *unused):
		if not self._mnemonic_correct:
			self._['e_mnemonic'].config(bg = self._wrong_bgcolor)
		else:
			self._['e_mnemonic'].config(bg = self._correct_bgcolor)
			self._mnemonic = self._mnemonic_var.get()
		if len(self._mnemonic_var.get()) == 0:
			self._hints = []
		else:
			self._hints = list(filter(
					lambda x: x.startswith(self._mnemonic_var.get()),
					mnemonics.values())
			)
		self._['l_hints'].config(text = " ".join(self._hints))
		if self._mnemonic_correct:
			self._notify()