Exemplo n.º 1
0
 def costumForm(self):  #14
     widx = self.dictMain['fldDlgDict'][self.idx]['sizeForm'][0]
     hidx = self.dictMain['fldDlgDict'][self.idx]['sizeForm'][1]
     lstSizeCol = self.dictMain['fldDlgDict'][self.idx]['sizeCol']
     QT_tblViewUtility.resizeForm(formToResize=self, Wx=widx, Hx=hidx)
     QT_tblViewUtility.setViewCustom(tblView=self.TVMain,
                                     lstSizeCol=lstSizeCol)
Exemplo n.º 2
0
 def setTView(self):
     for idx, val in enumerate(self.dictTblView ['lstquer']):
         View= self.dictTblView ['lstView'][idx]
         Size= self.dictTblView ['size'][idx]
         Hide= self.dictTblView ['toHide'][idx]
         model = mixedModel.setQueryModel(query= val) 
         QT_tblViewUtility.setViewCustom(tblView= View, lstSizeCol=Size)
         QT_tblViewUtility.setModelInView(tblView= View, ViewModel = model, toHide=Hide) 
Exemplo n.º 3
0
 def setModel(self):
     tblName = 'prc_relatorios'
     fldToMap = [self.LECod, self.LENome, self.PTEDescricao]
     fldSize = [50, 150,150]
     bOK, model = mixedModel.setViewModel(tblName= tblName, filtro='parametros = False')
     if bOK:
         QT_tblViewUtility.setModelInView(tblView= self.TVReports, ViewModel=model)
         QT_tblViewUtility.setViewCustom(tblView= self.TVReports, lstSizeCol=fldSize)
         mixedModel.withWidgets.setMapper(self, model=model, fldToMap= fldToMap)
Exemplo n.º 4
0
    def setTheView(self):
        quer = self.dictFields['quer']
        toHide = self.dictFields['fldToHide']
        toSize = self.dictFields['sizeCol']
        modelOut = mixedModel.setQueryModel(query=quer)

        QT_tblViewUtility.setModelInView(tblView=self.TV,
                                         ViewModel=modelOut,
                                         toHide=toHide)
        QT_tblViewUtility.setViewCustom(tblView=self.TV, lstSizeCol=toSize)
Exemplo n.º 5
0
 def getModelClicked(self, mIdx=None):
     '''
     Metodo para Guardar o model clicked.
     '''
     bOK, idx = self.getSenderIdx(dictIdx=self.DictSenderIdx)
     if bOK:
         lstOut = QT_tblViewUtility.getClickedLstVal(indexModel=mIdx)
         self.DictGridLay['lstLastClicked'][idx] = lstOut
     return bOK
Exemplo n.º 6
0
    def setModelView(self):
        for idx, val in enumerate(self.dictView['filtro']):
            filtro = val.format(id=self.LEN_Sequencial.text())
            bOK, model = mixedModel.setViewModel(
                tblName=self.dictView['tblName'][idx],
                filtro=filtro,
                lstVal2Rel=self.dictView['MainDict'][idx]['val2Rel'],
                lstRelTblName=self.dictView['MainDict'][idx]['relTblName'],
                lstNewNames=self.dictView['MainDict'][idx]['newNames'])

            if bOK:
                lstSizeCol = self.dictView['MainDict'][idx]['sizeCol']
                tblView = self.dictView['tblView'][idx]
                toHide = self.dictView['MainDict'][idx]['toHide']
                QT_tblViewUtility.setModelInView(tblView=tblView,
                                                 ViewModel=model,
                                                 toHide=toHide)
                QT_tblViewUtility.setViewCustom(tblView=tblView,
                                                lstSizeCol=lstSizeCol)
Exemplo n.º 7
0
 def getClicked(self, mIdx):
     '''
     Metodo que retorna um tupla com o elemento selecionado e a linha selecionada.
     args:
         mIdx= modelIndex
     '''
     clickedRowVal, ClickdedRow = QT_tblViewUtility.getClicked(
         indexModel=mIdx)
     self.lstClicked = clickedRowVal, ClickdedRow
     return clickedRowVal, ClickdedRow
Exemplo n.º 8
0
    def setModel(self, filtro=None):  #6
        '''
        Metodo para configurar o modelo que sera usado para relaizar a visualizacao de dados
        Args:
            filtro: sera passado, quando se usar o bottao pesquisar
        '''
        tblName = self.dictMain["tblName"][self.idx]
        lstVal2Rel = self.dictMain['fldDlgDict'][self.idx]['val2Rel']
        lstRelTblName = self.dictMain['fldDlgDict'][self.idx]['fldRelTblMain']
        lstNewNames = self.dictMain['fldDlgDict'][self.idx]['headerTitle']
        bOK, model = wrapModel.setViewModel(tblName=tblName,
                                            filtro=filtro,
                                            lstVal2Rel=lstVal2Rel,
                                            lstRelTblName=lstRelTblName,
                                            lstNewNames=lstNewNames)

        self.deleg = CustomItemDelegates.CustomItemDelegate()
        lstToHide = self.dictMain['fldDlgDict'][self.idx]['lstToHide']
        QT_tblViewUtility.setModelInView(tblView=self.TVMain,
                                         ViewModel=model,
                                         toHide=lstToHide)
        self.TVMain.setItemDelegate(self.deleg)
        return (bOK, model)
Exemplo n.º 9
0
 def setModelInView(self, tblView=None):
     '''
     Metodo de configuracao do modelo, este metodo cria o modelo que sera usado, para-se 
     vizualizar os dados, nos POPIN'S.
     o modelo apois serem Criado, Costumizamos os Headers e o tamanho.
     Args:
         tblView= Nome do TableView
     '''
     lstVal2Rel = self.dictFields['fldRelName']
     lstRelTblName = self.dictFields['fldRelTblMain']
     lstNewNames = self.dictFields['HeaderNames']
     bOK, self.model = mModel.setViewModel(tblName=self.tblName,
                                           filtro=self.filtro,
                                           lstVal2Rel=lstVal2Rel,
                                           lstRelTblName=lstRelTblName,
                                           lstNewNames=lstNewNames)
     if bOK:
         toHide = self.dictFields['fldToHide']
         lstSizeCol = self.dictFields['sizeCol']
         QT_tblViewUtility.setModelInView(tblView=tblView,
                                          ViewModel=self.model,
                                          toHide=toHide)
         QT_tblViewUtility.setViewCustom(tblView=tblView,
                                         lstSizeCol=lstSizeCol)
Exemplo n.º 10
0
 def onTableClick(self, mIdx):
     _,idx = QT_tblViewUtility.getClicked(indexModel= mIdx)
     mixedModel.withWidgets.setMapperToIdx(self, idx= idx)
Exemplo n.º 11
0
 def clickedField(self, mdx):
     lstOut = QT_tblViewUtility.getClickedLstVal(indexModel=mdx)
     self.clickedVal = lstOut
Exemplo n.º 12
0
 def setModel(self):
     QT_tblViewUtility.setModelInView(tblView=self.TView,
                                      ViewModel=self.model)
     QT_tblViewUtility.setViewCustom(tblView=self.TView, lstSizeCol=[300])
Exemplo n.º 13
0
 def buldingTheQuery(self):
     startQuery = """SELECT tbl1.id, date(data_amostragem) as "Data da Amostra", tbl2.nome as "Centro", tbl3.nome as "Registador",
                     hora_inicioamo, hor_fimamo, tbl4.nome as "Dia da Semana", tbl5.nome as "Forca do Vento", tbl6.nome as "Nivel da Mare", 
                     tbl7.nome as "Direcao do Vento", hora_vento, tbl8.nome as "Tipo de Mare", altura_preamar, hora_preamar, altura_baimar, 
                     hora_baixamar, tbl9.nome as "Fase da Lua", tbl10.nome as "Nebulosidade", hora_nebulosidade, actividade_pesq, 
                     total_artes_amos, total_artes_act, total_artes_n_activas, total_artes_prov_outo_cent, observacoes
                     FROM public.t_saidas as tbl1
                     left join ref_geometric as tbl2
                     on tbl1.id_centro = tbl2.id and tbl2.id_tiplocal = 'CTP'
                     left join ref_registador as tbl3
                     on tbl1.id_registrador = tbl3.id
                     left join ref_diasemana as tbl4
                     on tbl1.id_diasemana = tbl4.id  
                     left join ref_table as tbl5
                     on tbl1.id_forcavento = tbl5.id and tbl5.id_grupo = 'FCV'
                     left join ref_table as tbl6
                     on tbl1.id_estadomare = tbl6.id and tbl6.id_grupo = 'NVM'
                     left join ref_table as tbl7 
                     on tbl1.id_direccao = tbl7.id and tbl7.id_grupo = 'DDV'
                     left join ref_table as tbl8
                     on tbl1.id_tipomare = tbl8.id and tbl8.id_grupo = 'TPM'
                     left join ref_table as tbl9
                     on tbl1.id_faselua = tbl9.id and tbl9.id_grupo = 'FLD'
                     left join ref_table as tbl10
                     on tbl1.id_nebulosidade = tbl10.id and tbl10.id_grupo = 'NBL' """#BigQuery and start Where
     #
     #
     if self.CBProvincia.currentIndex() != 0:
         startQuery += " where "
         if self.CBDistrito.currentIndex() != 0:
             if self.CBPosto.currentIndex() != 0:
                 if self.CBCentroPesca.currentIndex() != 0:
                     ctp = mixedModel.getDataCombox(widg=self.CBCentroPesca)
                     startQuery += "tbl1.id_centro in (select tbl1.id from ref_geometric as tbl1 where tbl1.id = '{ctp}')".format(
                         ctp=ctp)
                 else:
                     psd = mixedModel.getDataCombox(widg=self.CBPosto)
                     startQuery += """ tbl1.id_centro in (select tbl1.id from ref_geometric as tbl1 
                                         inner join ref_geometric as tbl2
                                         on tbl1.id_parent = tbl2.id
                                         where tbl2.id like '{psd}') """.format(
                         psd=psd)
             else:
                 dst = mixedModel.getDataCombox(widg=self.CBDistrito)
                 startQuery += """ tbl1.id_centro in (select tbl1.id from ref_geometric as tbl1 
                                         inner join ref_geometric as tbl2
                                         on tbl1.id_parent = tbl2.id
                                         inner join ref_geometric as tbl3 
                                         on tbl2.id_parent = tbl3.id
                                         where tbl3.id like '{dst}') """.format(
                     dst=dst)
         else:
             prv = mixedModel.getDataCombox(widg=self.CBProvincia)
             startQuery += """ tbl1.id_centro in (select tbl1.id from ref_geometric as tbl1 
                                         inner join ref_geometric as tbl2
                                         on tbl1.id_parent = tbl2.id
                                         inner join ref_geometric as tbl3 
                                         on tbl2.id_parent = tbl3.id
                                         inner join ref_geometric as tbl4
                                         on tbl3.id_parent = tbl4.id
                                         where tbl4.id like '{prv}') """.format(
                 prv=prv)
     #
     #
     if self.GBData.isChecked():
         if self.CBProvincia.currentIndex(
         ):  #!= 0 or self.CBRegistador.currentIndex() != 0 or self.CBDiaSemana.currentIndex() != 0 or self.CBActividadePesqueria.currentIndex() != 0:
             startQuery += ' and '
         else:
             startQuery += " where "
         inicio = rscForm.getText(widg=self.DEInicio)
         fim = rscForm.getText(widg=self.DEFim)
         startQuery += "data_amostragem  between '{inicio}' and '{fim}' ".format(
             inicio=inicio, fim=fim)
     #
     #
     if self.CBRegistador.currentIndex() != 0:
         if self.CBProvincia.currentIndex() != 0 or self.GBData.isChecked(
         ):  #or self.CBDiaSemana.currentIndex() != 0 or self.CBActividadePesqueria.currentIndex() != 0:
             startQuery += ' and '
         else:
             startQuery += " where "
         rgt = mixedModel.getDataCombox(widg=self.CBRegistador)
         startQuery += "tbl3.id = '{rgt}' ".format(rgt=rgt)
     #
     #
     if self.CBDiaSemana.currentIndex() != 0:
         if self.CBProvincia.currentIndex() != 0 or self.GBData.isChecked(
         ) or self.CBRegistador.currentIndex(
         ) != 0:  # or self.CBActividadePesqueria.currentIndex() != 0:
             startQuery += ' and '
         else:
             startQuery += " where "
         dsm = mixedModel.getDataCombox(widg=self.CBDiaSemana)
         startQuery += "tbl4.id = '{dsm}' ".format(dsm=dsm)
     #
     #
     if self.CBActividadePesqueria.currentIndex() != 0:
         if self.CBProvincia.currentIndex() != 0 or self.GBData.isChecked(
         ) or self.CBRegistador.currentIndex(
         ) != 0 or self.CBDiaSemana.currentIndex() != 0:
             startQuery += ' and '
         else:
             startQuery += " where "
         quer = mixedModel.getDataCombox(widg=self.CBActividadePesqueria)
         startQuery += quer
     #
     #
     try:
         if self.endQuery != " ":
             startQuery += "order by "
             startQuery += self.endQuery
     except AttributeError:
         startQuery += " order by data_amostragem "
     lstName = self.dictSaidas['newNames']
     model = mixedModel.setQueryModel(query=startQuery, lstNewNames=lstName)
     toHide = self.dictSaidas['toHide']
     lstSizeCol = self.dictSaidas['sizeCol']
     QT_tblViewUtility.setModelInView(tblView=self.TVSaidas,
                                      ViewModel=model,
                                      toHide=toHide)
     QT_tblViewUtility.setViewCustom(tblView=self.TVSaidas,
                                     lstSizeCol=lstSizeCol)
Exemplo n.º 14
0
 def updatedLastClicked(self, mdIx=None):
     self.parent().parent().getModelClicked(mIdx=mdIx)
     lstOut = QT_tblViewUtility.getClickedLstVal(indexModel=mdIx)
     self.parent().parent().lstLastClicked = lstOut