def alterar(self, widget = None): if not(self.admin): funcoesGenericas.mostrarAviso(self.winListaFuncinario, "Só administradores tem essa permissão!!") else: login = ModeloDatagrid.ModeloDataGrid().getValor(self.tvListaFuncionario, 0) janela = winAlterarSenha.AlterarSenha(login, self.admin) janela.mostrarJanela()
def pesquisa(self, button=None): if (self.txtPesquisa.get_text() != '' or (self.inicio)): servicos = BancoDados().select("servico", " nome, descricao", " ") self.ListaParaAdicionar = [] if servicos != (): i = 0 while i < len(servicos): texto = str(self.txtPesquisa.get_text()) texto = texto.upper() nomes = str(servicos[i][0]) nomes = nomes.upper() descricoes = str(servicos[i][1]) descricoes = descricoes.upper() if (self.rbNome.get_active() and (texto in nomes)) or (self.rbDescricao.get_active() and (texto in descricoes)): self.ListaParaAdicionar.append( [servicos[i][0], servicos[i][1]]) i += 1 self.atualizar() else: self.atualizar() funcoesGenericas.mostrarAviso( self.winListaServico, "Não foi encontrado nenhum resultado para pesquisa escolhida!!!" ) else: funcoesGenericas.mostrarAviso(self.winListaServico, "Digite algo no campo pesquisa!")
def pesquisa(self, button = None): if(self.txtPesquisa.get_text() != '' or (self.inicio)): pesquisa = self.txtPesquisa.get_text() if self.rbLogin.get_active(): filtro = 'login' elif self.rbDocumento.get_active(): filtro = 'documento' elif self.rbNomeFuncionario.get_active(): filtro = 'nome' if self.inicio: funcionarios = BancoDados().select("funcionario", " login, nome, tipo_documento, documento, cargo, email", " ") else: funcionarios = BancoDados().select("funcionario", " login, nome, tipo_documento, documento, cargo, email", "where "+ filtro + " = '" + pesquisa +"' ") self.ListaParaAdicionar = [] if funcionarios != (): i = 0 while i < len(funcionarios): self.ListaParaAdicionar.append([funcionarios[i][0], funcionarios[i][1],funcionarios[i][2]+' - '+ funcionarios[i][3],funcionarios[i][4], funcionarios[i][5]]) i += 1 self.atualizar() else: self.atualizar() funcoesGenericas.mostrarAviso(self.winListaFuncinario, "Não foi encontrado nenhum resultado para pesquisa escolhida!!!") else: funcoesGenericas.mostrarAviso(self.winListaFuncinario, "Digite algo no campo pesquisa!")
def pesquisa(self, button = None): if(self.txtPesquisa.get_text() != '' or (self.inicio)): pesquisa = self.txtPesquisa.get_text() if self.rbEmail.get_active(): filtro = 'email' elif self.rbDocumento.get_active(): filtro = 'documento' elif self.rbNomeCliente.get_active(): filtro = 'cliente.nome' if self.inicio: clientes = BancoDados().select("cliente", " nome, tipo_documento, documento, ddd, telefone1, endereco, email", " ") else: clientes = BancoDados().select("cliente", " nome, tipo_documento, documento, ddd, telefone1, endereco, email", "where "+ filtro + " = '" + pesquisa +"' ") self.ListaParaAdicionar = [] if clientes != (): i = 0 while i < len(clientes): self.ListaParaAdicionar.append([clientes[i][0], clientes[i][1]+ ' - ' +clientes[i][2], '('+clientes[i][3]+')'+' '+clientes[i][4][:3]+'-'+clientes[i][4][4:], clientes[i][5], clientes[i][6]]) i += 1 self.atualizar() else: self.atualizar() funcoesGenericas.mostrarAviso(self.winListaCliente, "Não foi encontrado nenhum resultado para pesquisa escolhida!!!") else: funcoesGenericas.mostrarAviso(self.winListaCliente, "Digite algo no campo pesquisa!")
def alterar(self, widget=None): if not (self.admin): funcoesGenericas.mostrarAviso( self.winListaFuncinario, "Só administradores tem essa permissão!!") else: login = ModeloDatagrid.ModeloDataGrid().getValor( self.tvListaFuncionario, 0) janela = winAlterarSenha.AlterarSenha(login, self.admin) janela.mostrarJanela()
def alterar(self, widget = None): if(self.txtLogin.get_text() == ''): funcoesGenericas.mostrarAviso(self.winLogin, "Favor preencha apenas o login!") else: try: login = BancoDados().select("funcionario", "login", "where login = '******'")[0][0] a = winAlterarSenha.AlterarSenha(str(login)) a.mostrarJanela() except: funcoesGenericas.mostrarAviso(self.winLogin,"Login inexistente")
def __conectar(self): """metodo que conecta ao BD""" if self.__conectado: return True try: self.__con = MySQLdb.connect(self.__servidor, self.__usuario, self.__senha) self.__con.select_db(self.__db) self.__cursor = self.__con.cursor() self.__conectado = True except: funcoesGenericas.mostrarAviso(None,"Erro ao conectar com o Banco de Dados") return False
def __conectar(self): """metodo que conecta ao BD""" if self.__conectado: return True try: self.__con = MySQLdb.connect(self.__servidor, self.__usuario, self.__senha) self.__con.select_db(self.__db) self.__cursor = self.__con.cursor() self.__conectado = True except: funcoesGenericas.mostrarAviso( None, "Erro ao conectar com o Banco de Dados") return False
def alterar(self, widget=None): if (self.txtLogin.get_text() == ''): funcoesGenericas.mostrarAviso(self.winLogin, "Favor preencha apenas o login!") else: try: login = BancoDados().select( "funcionario", "login", "where login = '******'")[0][0] a = winAlterarSenha.AlterarSenha(str(login)) a.mostrarJanela() except: funcoesGenericas.mostrarAviso(self.winLogin, "Login inexistente")
def gerarOS(self, widget = None): dictOS = {"obs":"Não foi alterada", "cliente_id": 1, "funcionario_id": 1, #"scaner":blob, "pasta":"0 - 0", "alterada": 0 } criar = BancoDados().inserir("os", dictOS) if criar != None: numeroOS = BancoDados().select("os", "count(*)", ' ') funcoesGenericas.mostrarAviso(self.winMenu, "O número da OS é: "+ str(numeroOS[0][0])) else: funcoesGenericas.mostrarAviso(self.winMenu, "Erro ao gerar a Ordem de Serviço.")
def adicionarServicoNaLista(self, widget = None): jaTem = False servicoEscolhido = self.pegarValorComboBox(self.cbxServicos) descricao = BancoDados().select(" servico ", " descricao, nome ", " where nome = '"+ servicoEscolhido + "'")[0][0] j = 0 while j in range(len(self.ListaParaAdicionar)): if servicoEscolhido == self.ListaParaAdicionar[j][0]: funcoesGenericas.mostrarAviso(self.winGuardarOS,"Serviço já escolhido."+ " Favor selecionar outro!") jaTem = True break j+=1 if not(jaTem): self.ListaParaAdicionar.append([servicoEscolhido,descricao]) self.atualizar()
def verificaDocumento(self, widget = None): eIgual = False numeracaoDocumentos = BancoDados().select(' cliente ', ' documento, nome ', ' ') i = 0 posicao = None while i < len(numeracaoDocumentos): if numeracaoDocumentos[i][0] == self.txtCPFCNPJ.get_text(): eIgual = True posicao = i i = len(numeracaoDocumentos) i+=1 if eIgual: self.lblNomeCliente.set_text(numeracaoDocumentos[posicao][1]) else: funcoesGenericas.mostrarAviso(self.winGuardarOS, 'Numero de Documento inválido!!') self.lblNomeCliente.set_text(self.textelbl)
def adicionarServicoNaLista(self, widget=None): jaTem = False servicoEscolhido = self.pegarValorComboBox(self.cbxServicos) descricao = BancoDados().select( " servico ", " descricao, nome ", " where nome = '" + servicoEscolhido + "'")[0][0] j = 0 while j in range(len(self.ListaParaAdicionar)): if servicoEscolhido == self.ListaParaAdicionar[j][0]: funcoesGenericas.mostrarAviso( self.winGuardarOS, "Serviço já escolhido." + " Favor selecionar outro!") jaTem = True break j += 1 if not (jaTem): self.ListaParaAdicionar.append([servicoEscolhido, descricao]) self.atualizar()
def verificaDocumento(self, widget=None): eIgual = False numeracaoDocumentos = BancoDados().select(' cliente ', ' documento, nome ', ' ') i = 0 posicao = None while i < len(numeracaoDocumentos): if numeracaoDocumentos[i][0] == self.txtCPFCNPJ.get_text(): eIgual = True posicao = i i = len(numeracaoDocumentos) i += 1 if eIgual: self.lblNomeCliente.set_text(numeracaoDocumentos[posicao][1]) else: funcoesGenericas.mostrarAviso(self.winGuardarOS, 'Numero de Documento inválido!!') self.lblNomeCliente.set_text(self.textelbl)
def alterar(self, widget = None): try: senha = BancoDados().select("funcionario","senha" , "where login = '******'")[0][0] if(senha == self.txtSenhaAntiga.get_text() or self.admin): if(self.txtNovaSenha.get_text() == self.txtRNovaSenha.get_text()): a = BancoDados().update("funcionario", {"senha":self.txtNovaSenha.get_text()}, {"login":self.login}) if(a != None): self.txtNovaSenha.set_text('') self.txtRNovaSenha.set_text('') self.txtSenhaAntiga.set_text('') funcoesGenericas.mostrarAviso(self.winAlterarSenha,"Senha alterada com sucesso!") else: funcoesGenericas.mostrarAviso(self.winAlterarSenha,"Erro ao alterar senha!!") else: funcoesGenericas.mostrarAviso(self.winAlterarSenha, "Campo Nova senha Diferente do campo Repetir Nova Senha") else: funcoesGenericas.mostrarAviso(self.winAlterarSenha,"Senha incorreta") except: funcoesGenericas.mostrarAviso(self.winAlterarSenha,"Login não existe")
def cadastrar(self,widget = None): """Funcao atrelada ao botao de cadastro""" if self.txtNome.get_text() == "" or self.txtDocumento.get_text() == "" or self.txtTelefone.get_text() == "" : funcoesGenericas.mostrarAviso(self.janelaPrincipal, "Erro, um ou mais campos obrigatorios nao foram preenchidos") else: if self.txtDocumento.get_text().isdigit() and self.txtTelefone.get_text().isdigit() and (self.txtNumero.get_text() == "" or self.txtNumero.get_text().isdigit()): if self.persistirCadastro(widget): funcoesGenericas.mostrarAviso(self.janelaPrincipal,"Cadastro realizado com sucesso!") self.limpar(0) else: funcoesGenericas.mostrarAviso(self.janelaPrincipal,"Erro!!") else: funcoesGenericas.mostrarAviso(self.janelaPrincipal,"Algum campo que deveria conter apenas numero contem letras. Favor corrigir")
def cadastrar(self, widget=None): if not(self.txtNomeServico.get_text() == '' or self.txtDescricao.get_buffer().get_text(self.txtDescricao.get_buffer().\ get_start_iter(), self.txtDescricao.get_buffer().\ get_end_iter()) == ''): dict = {"nome" : self.txtNomeServico.get_text(), "descricao" : self.txtDescricao.get_buffer().get_text(self.txtDescricao.get_buffer().\ get_start_iter(), self.txtDescricao.get_buffer().\ get_end_iter()) } con = BancoDados() if con.inserir("servico", dict) != None: funcoesGenericas.mostrarAviso( self.wincadastrarServico, "Serviço cadastrado com sucesso!") self.limpar() else: funcoesGenericas.mostrarAviso( self.wincadastrarServico, "Não foi possivel cadastrar o serviço.") else: funcoesGenericas.mostrarAviso(self.wincadastrarServico, 'Favor preencher todos os campos!')
def pesquisa(self, button=None): if (self.txtPesquisa.get_text() != '' or (self.inicio)): pesquisa = self.txtPesquisa.get_text() if self.rbLogin.get_active(): filtro = 'login' elif self.rbDocumento.get_active(): filtro = 'documento' elif self.rbNomeFuncionario.get_active(): filtro = 'nome' if self.inicio: funcionarios = BancoDados().select( "funcionario", " login, nome, tipo_documento, documento, cargo, email", " ") else: funcionarios = BancoDados().select( "funcionario", " login, nome, tipo_documento, documento, cargo, email", "where " + filtro + " = '" + pesquisa + "' ") self.ListaParaAdicionar = [] if funcionarios != (): i = 0 while i < len(funcionarios): self.ListaParaAdicionar.append([ funcionarios[i][0], funcionarios[i][1], funcionarios[i][2] + ' - ' + funcionarios[i][3], funcionarios[i][4], funcionarios[i][5] ]) i += 1 self.atualizar() else: self.atualizar() funcoesGenericas.mostrarAviso( self.winListaFuncinario, "Não foi encontrado nenhum resultado para pesquisa escolhida!!!" ) else: funcoesGenericas.mostrarAviso(self.winListaFuncinario, "Digite algo no campo pesquisa!")
def pesquisa(self, button = None): if(self.txtPesquisa.get_text() != ''): if self.rbOS.get_active(): filtro = 'os.id' elif self.rbDocumento.get_active(): filtro = 'cliente.documento' elif self.rbNomeCliente.get_active(): filtro = 'cliente.nome' self.ListaParaAdicionar = [] OS = BancoDados().select("os, cliente", " os.id, os.pasta, cliente.documento, cliente.tipo_documento" + ", cliente.nome ", "where cliente_id = cliente.id and "+ filtro + " = '" + self.txtPesquisa.get_text()+"' ") if OS != (): i = 0 while i < len(OS): self.ListaParaAdicionar.append([str(OS[i][0]),OS[i][1],OS[i][2]+' - '+OS[i][3], OS[i][4]]) i += 1 self.atualizar() else: self.atualizar() funcoesGenericas.mostrarAviso(self.winListaOS, "Não foi encontrado nenhum resultado para pesquisa escolhida!!!") else: funcoesGenericas.mostrarAviso(self.winListaOS, "Digite algo no campo pesquisa!")
def pesquisa(self, button = None): if(self.txtPesquisa.get_text() != '' or (self.inicio)): servicos = BancoDados().select("servico", " nome, descricao", " ") self.ListaParaAdicionar = [] if servicos != (): i = 0 while i < len(servicos): texto = str(self.txtPesquisa.get_text()) texto = texto.upper() nomes = str(servicos[i][0]) nomes = nomes.upper() descricoes = str(servicos[i][1]) descricoes = descricoes.upper() if(self.rbNome.get_active() and (texto in nomes)) or (self.rbDescricao.get_active() and (texto in descricoes)): self.ListaParaAdicionar.append([servicos[i][0], servicos[i][1]]) i += 1 self.atualizar() else: self.atualizar() funcoesGenericas.mostrarAviso(self.winListaServico, "Não foi encontrado nenhum resultado para pesquisa escolhida!!!") else: funcoesGenericas.mostrarAviso(self.winListaServico, "Digite algo no campo pesquisa!")
def guardarOS(self, widget = None): '''Armazena no banco a relação OS e serviço''' try: valor = BancoDados().select("os", "id, alterada", "where id ='"+self.txtNumeroOS.get_text()+"'") existe = False print (valor) m = 0 while m < len(valor): print valor[m][0] if(valor[m][0] == int(self.txtNumeroOS.get_text()) and valor[m][1] != 1): existe = True m+=1 if existe and self.lblNomeCliente.get_text() != 'Sem Cliente Selecionado' and \ self.txtCPFCNPJ != '' and self.txtPasta != '' and self.pegarValorComboBox(self.cbxNomeCliente)!=\ None and self.btfSelecionarArquivo.get_file() != None: local = self.copiarImagem() k = 0 idFuncinario = BancoDados().select("funcionario", "id", "where nome = '"+ self.pegarValorComboBox(self.cbxNomeCliente)+"'")[0][0] idCliente = BancoDados().select("cliente", "id", "where nome = '"+self.lblNomeCliente.get_text()+"'")[0][0] dict = {"obs":self.txtvObs.get_buffer().get_text(self.txtvObs.get_buffer().\ get_start_iter(),self.txtvObs.get_buffer().get_end_iter()), "cliente_id":idCliente, "funcionario_id": idFuncinario, "scaner":local, "pasta":self.txtPasta.get_text(), "alterada": 1 } dict2 = {"id":self.txtNumeroOS.get_text()} alteracao = BancoDados().update("os", dict, dict2) if(alteracao != None): while k in range(len(self.ListaParaAdicionar)): id = BancoDados().select("servico", "id", "where nome = '"+self.ListaParaAdicionar[k][0] +"'")[0][0] if BancoDados().inserir('os_servico', { "servico_id" : str(id), "os_id":self.txtNumeroOS.get_text() }) == None: print 'Erro servico None' k += 1 print self.txtNumeroOS.get_text() print 'id = '+str(id) else: funcoesGenericas.mostrarAviso(self.winGuardarOS, "O número da OS não existe") self.limpar() else: funcoesGenericas.mostrarAviso(self.winGuardarOS,"Possiveis problemas:\n"+ "1- O número da OS não existe;\n"+ "2- Não preencheu todos os Campos;\n"+ "3- Não escolheu nenhum serviço;\n"+ "4- A ordem de serviço já foi guardada. Caso deseje alterar "+ "vá no menu e selecione alterar OS\n"+ "5- Não escolheu nenhum funcionário;\n"+ "6- A cópida da OS não foi selecionada.") except: funcoesGenericas.mostrarAviso(self.winGuardarOS, "Erro ao copiar imagem!!!!\n"+ "Verifique se o endereço da imagem possui caracter especial,"+ "caso contenha coloque em um local onde o endereço resultante"+ "não possua caracter especial.")
def cadastrar(self, widget = None): if not(self.txtNomeServico.get_text() == '' or self.txtDescricao.get_buffer().get_text(self.txtDescricao.get_buffer().\ get_start_iter(), self.txtDescricao.get_buffer().\ get_end_iter()) == ''): dict = {"nome" : self.txtNomeServico.get_text(), "descricao" : self.txtDescricao.get_buffer().get_text(self.txtDescricao.get_buffer().\ get_start_iter(), self.txtDescricao.get_buffer().\ get_end_iter()) } con = BancoDados() if con.inserir("servico",dict) != None: funcoesGenericas.mostrarAviso(self.wincadastrarServico, "Serviço cadastrado com sucesso!") self.limpar() else: funcoesGenericas.mostrarAviso(self.wincadastrarServico, "Não foi possivel cadastrar o serviço.") else: funcoesGenericas.mostrarAviso(self.wincadastrarServico, 'Favor preencher todos os campos!')
def logar(self, widget = None): con = BancoDados() try: admin = False login = self.txtLogin.get_text() if (self.txtSenha.get_text() == con.select("funcionario", "login, senha, administrador", "where login = '******'")[0][1]): funcoesGenericas.mostrarAviso(self.winLogin, 'Entrando no sistema...') self.sair() admin = con.select("funcionario", "login, administrador", "where login = '******'")[0][1] print int(admin) if int(admin) == 1: admin = True janela = winMenu.menu(admin) janela.iniciarJanela() else: funcoesGenericas.mostrarAviso(self.winLogin, 'Login ou senha estão errados!') except: funcoesGenericas.mostrarAviso(self.winLogin, 'Login ou senha estão errados!')
def logar(self, widget=None): con = BancoDados() try: admin = False login = self.txtLogin.get_text() if (self.txtSenha.get_text() == con.select( "funcionario", "login, senha, administrador", "where login = '******'")[0][1]): funcoesGenericas.mostrarAviso(self.winLogin, 'Entrando no sistema...') self.sair() admin = con.select("funcionario", "login, administrador", "where login = '******'")[0][1] print int(admin) if int(admin) == 1: admin = True janela = winMenu.menu(admin) janela.iniciarJanela() else: funcoesGenericas.mostrarAviso(self.winLogin, 'Login ou senha estão errados!') except: funcoesGenericas.mostrarAviso(self.winLogin, 'Login ou senha estão errados!')
def __init__(self): self.fechar = False '''Arquivo''' self.arquivo = gtk.glade.XML('winGuardarOS.glade') '''Janela''' self.winGuardarOS = self.arquivo.get_widget('winGuardarOS') color = gtk.gdk.color_parse('white') self.winGuardarOS.modify_bg(gtk.STATE_NORMAL, color) self.btfSelecionarArquivo = self.arquivo.get_widget('btfSelecionarArquivo') '''Text Box''' self.txtNumeroOS = self.arquivo.get_widget('txtNumeroOS') self.txtPasta = self.arquivo.get_widget('txtPasta') self.txtCPFCNPJ = self.arquivo.get_widget('txtCPFCNPJ') '''Text View''' self.txtvObs = self.arquivo.get_widget('txtvObs') '''Combobox e suas configurações''' self.cbxNomeCliente = self.arquivo.get_widget('cbxNomeCliente') self.storeClientes= gtk.ListStore(gobject.TYPE_STRING) try: self.clientes = BancoDados().select('funcionario', 'nome', ' ') i = 0 while i < len(self.clientes): self.storeClientes.append([self.clientes[i][0]]) i+=1 self.inserirComboBox(self.storeClientes, self.cbxNomeCliente) if(len(self.clientes) < 1): funcoesGenericas.mostrarAviso(self.winGuardarOS, 'Provavelmente nenhum funcionário'+ ' foi cadastrado!'+'\nFavor cadastrar um!') self.fechar = True except: funcoesGenericas.mostrarAviso(self.winGuardarOS,'Provavelmente nenhum funcionário foi'+ ' cadastrado!'+'\nFavor cadastrar um!') self.fechar = True self.cbxServicos = self.arquivo.get_widget('cbxServicos') self.storeServicos = gtk.ListStore(gobject.TYPE_STRING) try: self.servicos = BancoDados().select('servico', 'nome', ' ') i = 0 while i < len(self.servicos): self.storeServicos.append([self.servicos[i][0]]) i+=1 self.inserirComboBox(self.storeServicos, self.cbxServicos) if(len(self.clientes) < 1): funcoesGenericas.mostrarAviso(self.winGuardarOS, 'Nenhum serviço cadastrado!'+ '\nFavor cadastrar pelo menos um serviço') self.fechar = True except: funcoesGenericas.mostrarAviso(self.winGuardarOS,'Nenhum serviço cadastrado!'+ '\nFavor cadastrar pelo menos um serviço') self.fechar = True '''Botões''' self.btVerifica = self.arquivo.get_widget('btVerifica') self.btInserirServico = self.arquivo.get_widget('btInserirServico') self.btRemoverServico = self.arquivo.get_widget('btRemoverServico') self.btGravarOS = self.arquivo.get_widget('btGravarOS') self.btLimpar = self.arquivo.get_widget('btLimpar') '''Label''' self.lblNomeCliente = self.arquivo.get_widget('lblNomeCliente') self.textelbl = self.lblNomeCliente.get_text() '''Instanciando um objeto para usar a classe ModeloDatagrid''' self.dataGrid = ModeloDatagrid.ModeloDataGrid() '''Iniciando o treeView''' self.inicio = True self.iniciarTreeview() self.excluir = False self.servicoSelecionado = 0
def guardarOS(self, widget=None): '''Armazena no banco a relação OS e serviço''' try: valor = BancoDados().select( "os", "id, alterada", "where id ='" + self.txtNumeroOS.get_text() + "'") existe = False print(valor) m = 0 while m < len(valor): print valor[m][0] if (valor[m][0] == int(self.txtNumeroOS.get_text()) and valor[m][1] != 1): existe = True m += 1 if existe and self.lblNomeCliente.get_text() != 'Sem Cliente Selecionado' and \ self.txtCPFCNPJ != '' and self.txtPasta != '' and self.pegarValorComboBox(self.cbxNomeCliente)!=\ None and self.btfSelecionarArquivo.get_file() != None: local = self.copiarImagem() k = 0 idFuncinario = BancoDados().select( "funcionario", "id", "where nome = '" + self.pegarValorComboBox(self.cbxNomeCliente) + "'")[0][0] idCliente = BancoDados().select( "cliente", "id", "where nome = '" + self.lblNomeCliente.get_text() + "'")[0][0] dict = {"obs":self.txtvObs.get_buffer().get_text(self.txtvObs.get_buffer().\ get_start_iter(),self.txtvObs.get_buffer().get_end_iter()), "cliente_id":idCliente, "funcionario_id": idFuncinario, "scaner":local, "pasta":self.txtPasta.get_text(), "alterada": 1 } dict2 = {"id": self.txtNumeroOS.get_text()} alteracao = BancoDados().update("os", dict, dict2) if (alteracao != None): while k in range(len(self.ListaParaAdicionar)): id = BancoDados().select( "servico", "id", "where nome = '" + self.ListaParaAdicionar[k][0] + "'")[0][0] if BancoDados().inserir( 'os_servico', { "servico_id": str(id), "os_id": self.txtNumeroOS.get_text() }) == None: print 'Erro servico None' k += 1 print self.txtNumeroOS.get_text() print 'id = ' + str(id) else: funcoesGenericas.mostrarAviso(self.winGuardarOS, "O número da OS não existe") self.limpar() else: funcoesGenericas.mostrarAviso( self.winGuardarOS, "Possiveis problemas:\n" + "1- O número da OS não existe;\n" + "2- Não preencheu todos os Campos;\n" + "3- Não escolheu nenhum serviço;\n" + "4- A ordem de serviço já foi guardada. Caso deseje alterar " + "vá no menu e selecione alterar OS\n" + "5- Não escolheu nenhum funcionário;\n" + "6- A cópida da OS não foi selecionada.") except: funcoesGenericas.mostrarAviso( self.winGuardarOS, "Erro ao copiar imagem!!!!\n" + "Verifique se o endereço da imagem possui caracter especial," + "caso contenha coloque em um local onde o endereço resultante" + "não possua caracter especial.")
#-*-coding:utf-8-*- ''' Created on 12/01/2011 @author: diogo IMPORTANTE: Necessario arquivos .glade na mesma pasta ''' import pygtk import gobject pygtk.require("2.0") import gtk, gtk.glade import funcoesGenericas import CadastrarFunionario import winLogin from bd import BancoDados a = BancoDados().select("funcionario", "count(*)", '') if int(a[0][0]) == 0: funcoesGenericas.mostrarAviso(None, "Primeiro acesso, favor cadastrar um funcionário como administrador!!") janela = CadastrarFunionario.CadastroFuncionario(True) janela.iniciarJanela() janela = winLogin.Logar() janela.exibirTela() else: janela = winLogin.Logar() janela.exibirTela()
def __init__(self): self.fechar = False '''Arquivo''' self.arquivo = gtk.glade.XML('winGuardarOS.glade') '''Janela''' self.winGuardarOS = self.arquivo.get_widget('winGuardarOS') color = gtk.gdk.color_parse('white') self.winGuardarOS.modify_bg(gtk.STATE_NORMAL, color) self.btfSelecionarArquivo = self.arquivo.get_widget( 'btfSelecionarArquivo') '''Text Box''' self.txtNumeroOS = self.arquivo.get_widget('txtNumeroOS') self.txtPasta = self.arquivo.get_widget('txtPasta') self.txtCPFCNPJ = self.arquivo.get_widget('txtCPFCNPJ') '''Text View''' self.txtvObs = self.arquivo.get_widget('txtvObs') '''Combobox e suas configurações''' self.cbxNomeCliente = self.arquivo.get_widget('cbxNomeCliente') self.storeClientes = gtk.ListStore(gobject.TYPE_STRING) try: self.clientes = BancoDados().select('funcionario', 'nome', ' ') i = 0 while i < len(self.clientes): self.storeClientes.append([self.clientes[i][0]]) i += 1 self.inserirComboBox(self.storeClientes, self.cbxNomeCliente) if (len(self.clientes) < 1): funcoesGenericas.mostrarAviso( self.winGuardarOS, 'Provavelmente nenhum funcionário' + ' foi cadastrado!' + '\nFavor cadastrar um!') self.fechar = True except: funcoesGenericas.mostrarAviso( self.winGuardarOS, 'Provavelmente nenhum funcionário foi' + ' cadastrado!' + '\nFavor cadastrar um!') self.fechar = True self.cbxServicos = self.arquivo.get_widget('cbxServicos') self.storeServicos = gtk.ListStore(gobject.TYPE_STRING) try: self.servicos = BancoDados().select('servico', 'nome', ' ') i = 0 while i < len(self.servicos): self.storeServicos.append([self.servicos[i][0]]) i += 1 self.inserirComboBox(self.storeServicos, self.cbxServicos) if (len(self.clientes) < 1): funcoesGenericas.mostrarAviso( self.winGuardarOS, 'Nenhum serviço cadastrado!' + '\nFavor cadastrar pelo menos um serviço') self.fechar = True except: funcoesGenericas.mostrarAviso( self.winGuardarOS, 'Nenhum serviço cadastrado!' + '\nFavor cadastrar pelo menos um serviço') self.fechar = True '''Botões''' self.btVerifica = self.arquivo.get_widget('btVerifica') self.btInserirServico = self.arquivo.get_widget('btInserirServico') self.btRemoverServico = self.arquivo.get_widget('btRemoverServico') self.btGravarOS = self.arquivo.get_widget('btGravarOS') self.btLimpar = self.arquivo.get_widget('btLimpar') '''Label''' self.lblNomeCliente = self.arquivo.get_widget('lblNomeCliente') self.textelbl = self.lblNomeCliente.get_text() '''Instanciando um objeto para usar a classe ModeloDatagrid''' self.dataGrid = ModeloDatagrid.ModeloDataGrid() '''Iniciando o treeView''' self.inicio = True self.iniciarTreeview() self.excluir = False self.servicoSelecionado = 0
#-*-coding:utf-8-*- ''' Created on 12/01/2011 @author: diogo IMPORTANTE: Necessario arquivos .glade na mesma pasta ''' import pygtk import gobject pygtk.require("2.0") import gtk, gtk.glade import funcoesGenericas import CadastrarFunionario import winLogin from bd import BancoDados a = BancoDados().select("funcionario", "count(*)", '') if int(a[0][0]) == 0: funcoesGenericas.mostrarAviso( None, "Primeiro acesso, favor cadastrar um funcionário como administrador!!") janela = CadastrarFunionario.CadastroFuncionario(True) janela.iniciarJanela() janela = winLogin.Logar() janela.exibirTela() else: janela = winLogin.Logar() janela.exibirTela()
def cadastrarFuncionario(self, widget = None): if self.administrador: janela = CadastrarFunionario.CadastroFuncionario() janela.iniciarJanela() else: funcoesGenericas.mostrarAviso(self.winMenu, "Só administradores podem cadastrar funcionários!!!")