コード例 #1
0
	def cargar_clientes(self, clientes=None):
		if clientes is None:
			clientes = controller3.obtener_clientes()
		
		self.model = QtGui.QStandardItemModel(len(clientes), 6)
		self.model.setHorizontalHeaderItem(0, QtGui.QStandardItem(u"Rut"))
		self.model.setHorizontalHeaderItem(1, QtGui.QStandardItem(u"Nombres"))
		self.model.setHorizontalHeaderItem(2, QtGui.QStandardItem(u"Apellidos"))
		self.model.setHorizontalHeaderItem(3, QtGui.QStandardItem(u"Correo"))
		self.model.setHorizontalHeaderItem(4, QtGui.QStandardItem(u"CantidadVentas"))
		self.model.setHorizontalHeaderItem(5, QtGui.QStandardItem(u"Total"))
		r = 0
		for row in clientes:
			index = self.model.index(r, 0, QtCore.QModelIndex()); 
			self.model.setData(index, row['Rut'])
			index = self.model.index(r, 1, QtCore.QModelIndex()); 
			self.model.setData(index, row['Nombres'])
			index = self.model.index(r, 2, QtCore.QModelIndex()); 
			self.model.setData(index, row['Apellidos'])
			index = self.model.index(r, 3, QtCore.QModelIndex()); 
			self.model.setData(index, row['Correo'])
			index = self.model.index(r, 4, QtCore.QModelIndex()); 
			self.model.setData(index, row['CantidadVentas'])
			index = self.model.index(r, 5, QtCore.QModelIndex()); 
			self.model.setData(index, row['total'])
			r = r+1
		self.ui.tableView.setModel(self.model)
		self.ui.tableView.setColumnWidth(0, 150)
		self.ui.tableView.setColumnWidth(1, 270)
		self.ui.tableView.setColumnWidth(2, 150)
		self.ui.tableView.setColumnWidth(3, 150)
		self.ui.tableView.setColumnWidth(4, 150)
		self.ui.tableView.setColumnWidth(5, 150)
コード例 #2
0
    def cargar_cli(self):
		clientes = controller3.obtener_clientes()
		for cliente in clientes:
			self.ui.comboBox_2.addItem(cliente["rut"], cliente["Rut"])