Example #1
0
	def testEncode(self):
		"""
		This method tests :func:`foundations.strings.encode` definition.
		"""

		self.assertIsInstance(strings.encode("myData"), unicode)
		self.assertIsInstance(strings.encode(0), unicode)
		self.assertIsInstance(strings.encode(None), unicode)
		self.assertIsInstance(strings.encode(True), unicode)
Example #2
0
	def getValue(self, attribute, section, encode=False):
		"""
		This method returns requested attribute value.

		Usage::

			>>> content = ["[Section A]\\n", "; Comment.\\n", "Attribute 1 = \\"Value A\\"\\n", "\\n", \
"[Section B]\\n", "Attribute 2 = \\"Value B\\"\\n"]
			>>> sectionsFileParser = SectionsFileParser()
			>>> sectionsFileParser.content = content
			>>> sectionsFileParser.parse()
			True
			>>> sectionsFileParser.getValue("Attribute 1", "Section A")
			Value A

		:param attribute: Attribute name. ( String )
		:param section: Section containing the searched attribute. ( String )
		:param encode: Encode value to unicode. ( Boolean )
		:return: Attribute value. ( String )
		"""

		if not self.__sections:
			return

		if self.attributeExists(attribute, section):
			if attribute in self.__sections[section]:
				value = self.__sections[section][attribute]
			elif namespace.setNamespace(section, attribute) in self.__sections[section]:
				value = self.__sections[section][namespace.setNamespace(section, attribute)]
			LOGGER.debug("> Attribute: '{0}', value: '{1}'.".format(attribute, value))
			value = encode and strings.encode(value) or value
			return value
Example #3
0
	def __Search_lineEdit__textChanged(self, text):
		"""
		This method is triggered when **Search_lineEdit** Widget text changes.

		:param text: Current text value. ( QString )
		"""

		self.setInterfaces(strings.encode(text))
Example #4
0
	def __triggerInterface(self, name):
		"""
		This method triggers the Interface with given name execution.
		
		:param name: Interface name. ( String )
		"""
		
		pattern = RuntimeGlobals.popupPattern = name
		interface = self.getInterface(strings.encode("^{0}$".format(pattern)))
		if not interface:
			return

		self.executeInterface(interface)
		self.close()