Ejemplo 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)
Ejemplo 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) 
Ejemplo 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)
Ejemplo 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)
Ejemplo n.º 5
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)
Ejemplo n.º 6
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)
Ejemplo n.º 7
0
 def setModel(self):
     QT_tblViewUtility.setModelInView(tblView=self.TView,
                                      ViewModel=self.model)
     QT_tblViewUtility.setViewCustom(tblView=self.TView, lstSizeCol=[300])
Ejemplo n.º 8
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)