Exemplo n.º 1
0
	def load(self):

		self.tree.model().removeRows(0, self.tree.model().rowCount())
		rootNode = self.tree.invisibleRootItem()
		root_path = settings.api_define_path()
		rootDir = QtCore.QDir(root_path)
		self.paths = []
		self.walk_dir(rootDir, '', rootNode)
Exemplo n.º 2
0
	def load_file(self):
		_path = settings.api_define_path()
		_path.cd(self.path)
		file_path= _path.absoluteFilePath(self.function_file)
		#print file_path
		string = app.utils.get_file_contents(file_path)
		#print string
		#print "LOAD", file_name
		data = yaml.load(str(string))
		self.dic = data

		self.txtFunction.setText(data['function'])
		#self.txtLib.setText(data['lib'])
		self.txtSection.setText(data['section'])
		self.txtSyntax.setText(data['syntax'])
		self.txtSummary.setText(data['summary'])
		if 'return' in data:
			if data['return'] != '':
				self.txtReturn.setText(data['return'])
				self.txtReturn.setEnabled(True)
				self.chkReturn.setChecked(True)
			else:
				self.txtReturn.setText("")
				self.txtReturn.setEnabled(False)
				self.chkReturn.setChecked(False)
		if 'parameters_type' in data and data['parameters_type'] == 'variable':
			self.radioVariable.setChecked(True)
		else:
			self.radioFixed.setChecked(True)
		self.txtDescription.setPlainText(data['description'])
		self.txtExample.setPlainText(data['example'])


		#print "all=", data['parameters']
		for dic in data['parameters']:
			#print ki #ki, data['parameters'][ki]
			#print dic.keys(), dic.values()
			treeItem = QtGui.QTreeWidgetItem()
			treeItem.setFlags(QtCore.Qt.ItemIsEditable | QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
			treeItem.setText(0, dic.keys()[0])
			treeItem.setText(1, dic.values()[0])
			self.tree.addTopLevelItem(treeItem)
		self.set_syntax_string()
Exemplo n.º 3
0
	def load_file(self):
		_path = settings.api_define_path()
		_path.cd(self.path)
		file_path= _path.absoluteFilePath(self.function_file)
		#print file_path
		string = app.utils.get_file_contents(file_path)
		#print string
		#print "LOAD", file_name
		data = yaml.load(str(string))
		self.dic = data

		self.txtFunction.setText(data['function'])
		#self.txtLib.setText(data['lib'])
		self.txtSection.setText(data['section'])
		#self.txtSyntax.setText(data['syntax'])
		self.txtSummary.setText(data['summary'])
		if 'return' in data:
			if data['return'] != '':
				self.txtReturn.setText(data['return'])
				self.txtReturn.setEnabled(True)
				self.chkReturn.setChecked(True)
			else:
				self.txtReturn.setText("")
				self.txtReturn.setEnabled(False)
				self.chkReturn.setChecked(False)
		if 'parameters_type' in data and data['parameters_type'] == 'variable':
			self.radioVariable.setChecked(True)
		else:
			self.radioFixed.setChecked(True)
		self.txtDescription.setPlainText(data['description'])
		self.txtExample.setPlainText(data['example'])


		#print "all=", data['parameters']
		for dic in data['parameters']:
			#print ki #ki, data['parameters'][ki]
			#print dic.keys(), dic.values()
			treeItem = QtGui.QTreeWidgetItem()
			treeItem.setFlags(QtCore.Qt.ItemIsEditable | QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
			treeItem.setText(0, dic.keys()[0])
			treeItem.setText(1, dic.values()[0])
			self.tree.addTopLevelItem(treeItem)