예제 #1
0
 def setModelToComboBoxes(self):
     list_of_comboBoxes = [self.categoriaComboBox, self.acontecimentoComboBox]
     table_names = ['tbl_categorias', 'tbl_acontecimento']
     list_of_names = ['nome', 'nome']
     
     for index in range(len(list_of_comboBoxes)):
         mixedModel.setModel4CombBox(tblName = table_names[index], lstNames = list_of_names[index], widg = list_of_comboBoxes[index], namePos = 0)
예제 #2
0
 def setModelCB(self):
     relVal = self.dictSql['fld'][3]
     wdg = self.dictSql['wdg'][3]
     relTblName = self.dictSql['tblName'][3]
     mixedModel.setModel4CombBox(tblName=relTblName,
                                 lstNames=relVal,
                                 widg=wdg)
예제 #3
0
    def setComboxGrupo(self):  #5
        '''
        Metodo para configurar e atribuir um modelo a combox.
        Todo processo e feito no modulo.setModel4ComBox
        Args:
            tblName= Nome da tabela
            lstNames= Nome das colunas, sempre sao 2 (id, Nomes) porque nos queremos quer o combox mostre o id das colunas
            widg=  O object widget (combox)
            condName= caso tenhe alguma condicao aqui vamos passar o nome (id)
            condVal= a qui o valor ('XPT')
            condQuot= e aqui sera se sera quoted ou nao (True e false)
        '''
        bOK = False
        try:
            tblName = self.dictMain['fldDlgDict'][self.idx]['condTbl']
            lstNames = self.dictMain['fldDlgDict'][self.idx]['condCol']
            widg = self.CBGrupo
            condName = self.dictMain['fldDlgDict'][self.idx]['condName']
            condVal = self.dictMain['fldDlgDict'][self.idx]['condVal']
            condQuot = self.dictMain['fldDlgDict'][self.idx]['condToQuote']
            wrapModel.setModel4CombBox(tblName=tblName,
                                       lstNames=lstNames,
                                       widg=widg,
                                       condName=condName,
                                       condVal=condVal,
                                       condQuot=condQuot)
            bOK = True
            return bOK

        except KeyError as ky:
            QT_msg.error(txt='Error Elemento nao encontrado', verbTxt=str(ky))
            return bOK
 def setModelInCombox(self):
     for idx, val in enumerate(self.dictSql['lstRelTblMain']):
         tblName = val
         lstNames = self.dictSql['lstRelName'][idx]
         widg = self.dictSql['lstRelWidg'][idx]
         condName = self.dictSql['lstCond'][idx]
         condVal = self.dictSql['lstCondVal'][idx]
         condQuot = self.dictSql['lstToQuote'][idx]
         mixedModel.setModel4CombBox(tblName=tblName,
                                     lstNames=lstNames,
                                     widg=widg,
                                     condName=condName,
                                     condVal=condVal,
                                     condQuot=condQuot)
예제 #5
0
    def setDB(self):
        self.dbConnection = con_.con_1()
        query = '''select id_gado, data_acontecimento, descricao
                    from tbl_log
                    where
                    id_acontecimento = 2; 
        '''
        list_of_newNames = ['ID Gado', 'Data da Morte', 'Descricao']

        self.model = mx.setQueryModel(query=query,
                                      lstNewNames=list_of_newNames)
        self.tableView.setModel(self.model)
        self.tableView.setSelectionMode(QAbstractItemView.SingleSelection)
        self.tableView.setSelectionBehavior(QAbstractItemView.SelectRows)

        mx.setModel4CombBox(tblName='tbl_log',
                            lstNames='id_gado',
                            widg=self.idComboBox,
                            namePos=0)
예제 #6
0
 def setModelToWidget(self):
     """ Setting a model to the id_gado widget """
     mixedModel.setModel4CombBox(tblName='tbl_gado',
                                 lstNames='id',
                                 widg=self.idRetiradosComboBox,
                                 namePos=0)