def count_handle2():
    obslned = OrderedDict(
        (('spatial_replication_level_2', 'transect'),
         ('spatial_replication_level_3', ''), ('spatial_replication_level_4',
                                               ''), ('structured_type_1', ''),
         ('structured_type_2', ''), ('structured_type_3', ''),
         ('treatment_type_1', ''), ('treatment_type_2', ''),
         ('treatment_type_3', ''), ('unitobs', 'count')))

    obsckbox = OrderedDict(
        (('spatial_replication_level_2', True), ('spatial_replication_level_3',
                                                 False),
         ('spatial_replication_level_4', False), ('structured_type_1', False),
         ('structured_type_2', False), ('structured_type_3', False),
         ('treatment_type_1', False), ('treatment_type_2', False),
         ('treatment_type_3', False), ('unitobs', True)))
    available = [
        x for x, y in zip(list(obslned.keys()), list(obsckbox.values()))
        if y is True
    ]

    countini = ini.InputHandler(name='rawinfo',
                                tablename='count_table',
                                lnedentry=extract(obslned, available),
                                checks=obsckbox)

    return countini
def count_userinput():
    obslned = OrderedDict((
        ('spatial_replication_level_2', 'transect'),
        ('spatial_replication_level_3', ''),
        ('spatial_replication_level_4', ''),
        ('structure', ''),
        ('unitobs', 'count'),
        ('trt_label', '')
    ))
    
    obsckbox = OrderedDict((
        ('spatial_replication_level_2', False),
        ('spatial_replication_level_3', True),
        ('spatial_replication_level_4', True),
        ('structure', True),
        ('unitobs', False),
        ('trt_label', True)
    ))
    available = [
        x for x,y in zip(
            list(obslned.keys()), list(
                obsckbox.values()))
        if y is False
    ]

    countini = InputHandler(
        name='countinfo',
        tablename='count_table',
        lnedentry=extract(obslned, available),
        checks=obsckbox)

    return countini
def taxa_handle2():
    taxalned = OrderedDict(
        (('sppcode', ''), ('kingdom', ''), ('subkingdom', ''),
         ('infrakingdom', ''), ('superdivision', ''), ('divsion', ''),
         ('subdivision', ''), ('superphylum', ''), ('phylum', ''),
         ('subphylum', ''), ('clss', ''), ('subclass', ''), ('ordr', ''),
         ('family', ''), ('genus', 'genus'), ('species', 'species')))

    taxackbox = OrderedDict(
        (('sppcode', False), ('kingdom', False), ('subkingdom', False),
         ('infrakingdom', False), ('superdivision', False), ('divsion', False),
         ('subdivision', False), ('superphylum', False), ('phylum', False),
         ('subphylum', False), ('clss', False), ('subclass', False),
         ('ordr', False), ('family', False), ('genus', True), ('species',
                                                               True)))

    taxacreate = {'taxacreate': False}

    available = [
        x for x, y in zip(list(taxalned.keys()), list(taxackbox.values()))
        if y is True
    ]

    taxaini = ini.InputHandler(name='taxainfo',
                               tablename='taxa_table',
                               lnedentry=extract(taxalned, available),
                               checks=taxacreate)
    return taxaini
def taxa_user_input():
    taxalned = OrderedDict((
        ('sppcode', ''),
        ('kingdom', ''),
        ('subkingdom', ''),
        ('infrakingdom', ''),
        ('superdivision', ''),
        ('divsion', ''),
        ('subdivision', ''),
        ('superphylum', ''),
        ('phylum', ''),
        ('subphylum', ''),
        ('clss', ''),
        ('subclass', ''),
        ('ordr', ''),
        ('family', ''),
        ('genus', 'genus'),
        ('species', 'species')
    ))

    taxackbox = OrderedDict((
        ('sppcode', False),
        ('kingdom', False),
        ('subkingdom', False),
        ('infrakingdom', False),
        ('superdivision', False),
        ('divsion', False),
        ('subdivision', False),
        ('superphylum', False),
        ('phylum', False),
        ('subphylum', False),
        ('clss', False),
        ('subclass', False),
        ('ordr', False),
        ('family', False),
        ('genus', True),
        ('species', True)
    ))

    taxacreate = {
        'taxacreate': False
    }
    
    available = [
        x for x,y in zip(
            list(taxalned.keys()), list(
                taxackbox.values()))
        if y is True
    ]
    
    taxaini = InputHandler(
        name='taxainfo',
        tablename='taxa_table',
        lnedentry= extract(taxalned, available),
        checks=taxacreate)
    return taxaini
def taxa_handle2():
    taxalned = OrderedDict(
        (
            ("sppcode", ""),
            ("kingdom", ""),
            ("subkingdom", ""),
            ("infrakingdom", ""),
            ("superdivision", ""),
            ("divsion", ""),
            ("subdivision", ""),
            ("superphylum", ""),
            ("phylum", ""),
            ("subphylum", ""),
            ("clss", ""),
            ("subclass", ""),
            ("ordr", ""),
            ("family", ""),
            ("genus", "genus"),
            ("species", "species"),
        )
    )

    taxackbox = OrderedDict(
        (
            ("sppcode", False),
            ("kingdom", False),
            ("subkingdom", False),
            ("infrakingdom", False),
            ("superdivision", False),
            ("divsion", False),
            ("subdivision", False),
            ("superphylum", False),
            ("phylum", False),
            ("subphylum", False),
            ("clss", False),
            ("subclass", False),
            ("ordr", False),
            ("family", False),
            ("genus", True),
            ("species", True),
        )
    )

    taxacreate = {"taxacreate": False}

    available = [x for x, y in zip(list(taxalned.keys()), list(taxackbox.values())) if y is True]

    taxaini = ini.InputHandler(
        name="taxainfo", tablename="taxa_table", lnedentry=extract(taxalned, available), checks=taxacreate
    )
    return taxaini
        def submit_change(self):
            sender = self.sender()

            self.obslned = OrderedDict((

            ))

            self.obsckbox = OrderedDict((

            ))

            available = [
                x for x,y in zip(
                    list(self.obslned.keys()), list(
                        self.obsckbox.values()))
                if y is False
            ]

            rawini = ini.InputHandler(
                name='rawinfo',
                tablename='rawtable',
                lnedentry= hlp.extract(self.obslned, available),
                checks=self.obsckbox)

            self.facade.input_register(rawini)
            self.facade.create_log_record('rawtable')
            self._log = self.facade._tablelog['rawtable']
            
            try:
                self.rawdirector = self.facade.make_table('rawinfo')
                assert self.rawdirector._availdf is not None

            except Exception as e:
                print(str(e))
                self._log.debug(str(e))
                self.error.showMessage(
                    'Column(s) not identified')
                raise AttributeError('Column(s) not identified')


            self.obstable = self.rawdirector._availdf.copy()
            self.obsmodel = self.viewEdit(self.obstable)
            if sender is self.btnPreview:
                self.preview.tabviewPreview.setModel(self.obsmodel)
                self.preview.show()
            elif sender is self.btnSaveClose:
                hlp.write_column_to_log(
                    self.obslned, self._log, 'rawtable')                
                self.close()
Exemplo n.º 7
0
        def submit_change(self):
            sender = self.sender()

            self.obslned = OrderedDict(())

            self.obsckbox = OrderedDict(())

            available = [
                x for x, y in zip(list(self.obslned.keys()),
                                  list(self.obsckbox.values())) if y is False
            ]

            rawini = ini.InputHandler(name='rawinfo',
                                      tablename='rawtable',
                                      lnedentry=hlp.extract(
                                          self.obslned, available),
                                      checks=self.obsckbox)

            self.facade.input_register(rawini)
            self.facade.create_log_record('rawtable')
            self._log = self.facade._tablelog['rawtable']

            try:
                self.rawdirector = self.facade.make_table('rawinfo')
                assert self.rawdirector._availdf is not None

            except Exception as e:
                print(str(e))
                self._log.debug(str(e))
                self.error.showMessage('Column(s) not identified')
                raise AttributeError('Column(s) not identified')

            self.obstable = self.rawdirector._availdf.copy()
            self.obsmodel = self.viewEdit(self.obstable)
            if sender is self.btnPreview:
                self.preview.tabviewPreview.setModel(self.obsmodel)
                self.preview.show()
            elif sender is self.btnSaveClose:
                hlp.write_column_to_log(self.obslned, self._log, 'rawtable')
                self.close()
def taxahandle():
    taxalned = OrderedDict((
        ('sppcode', ''),
        ('kingdom', ''),
        ('phylum', 'TAXON_PHYLUM'),
        ('class', 'TAXON_CLASS'),
        ('order', 'TAXON_ORDER'),
        ('family', 'TAXON_FAMILY'),
        ('genus', 'TAXON_GENUS'),
        ('species', 'TAXON_SPECIES') 
    ))

    taxackbox = OrderedDict((
        ('sppcode', False),
        ('kingdom', False),
        ('phylum', True),
        ('class', True),
        ('order', True),
        ('family', True),
        ('genus', True),
        ('species', True) 
    ))

    taxacreate = {
        'taxacreate': False
    }
    
    available = [
        x for x,y in zip(
            list(taxalned.keys()), list(
                taxackbox.values()))
        if y is True
    ]
    
    taxaini = ini.InputHandler(
        name='taxainput',
        tablename='taxatable',
        lnedentry= hlp.extract(taxalned, available),
        checks=taxacreate)
    return taxaini
def count_handle2():
    obslned = OrderedDict(
        (
            ("spatial_replication_level_2", "transect"),
            ("spatial_replication_level_3", ""),
            ("spatial_replication_level_4", ""),
            ("structured_type_1", ""),
            ("structured_type_2", ""),
            ("structured_type_3", ""),
            ("treatment_type_1", ""),
            ("treatment_type_2", ""),
            ("treatment_type_3", ""),
            ("unitobs", "count"),
        )
    )

    obsckbox = OrderedDict(
        (
            ("spatial_replication_level_2", True),
            ("spatial_replication_level_3", False),
            ("spatial_replication_level_4", False),
            ("structured_type_1", False),
            ("structured_type_2", False),
            ("structured_type_3", False),
            ("treatment_type_1", False),
            ("treatment_type_2", False),
            ("treatment_type_3", False),
            ("unitobs", True),
        )
    )
    available = [x for x, y in zip(list(obslned.keys()), list(obsckbox.values())) if y is True]

    countini = ini.InputHandler(
        name="rawinfo", tablename="count_table", lnedentry=extract(obslned, available), checks=obsckbox
    )

    return countini
Exemplo n.º 10
0
def taxahandle():
    taxalned = OrderedDict(
        (('sppcode', ''), ('kingdom', ''), ('phylum', 'TAXON_PHYLUM'),
         ('class', 'TAXON_CLASS'), ('order', 'TAXON_ORDER'), ('family',
                                                              'TAXON_FAMILY'),
         ('genus', 'TAXON_GENUS'), ('species', 'TAXON_SPECIES')))

    taxackbox = OrderedDict(
        (('sppcode', False), ('kingdom', False), ('phylum', True),
         ('class', True), ('order', True), ('family', True), ('genus', True),
         ('species', True)))

    taxacreate = {'taxacreate': False}

    available = [
        x for x, y in zip(list(taxalned.keys()), list(taxackbox.values()))
        if y is True
    ]

    taxaini = ini.InputHandler(name='taxainput',
                               tablename='taxatable',
                               lnedentry=hlp.extract(taxalned, available),
                               checks=taxacreate)
    return taxaini
Exemplo n.º 11
0
    def submit_change(self):
        sender = self.sender()
        self.obslned = OrderedDict(
            (('spatial_replication_level_2',
              self.lnedRep2.text()), ('spatial_replication_level_3',
                                      self.lnedRep3.text()),
             ('spatial_replication_level_4',
              self.lnedRep4.text()), ('spatial_replication_level_5',
                                      self.lnedRep5.text()),
             ('structure_type_1',
              self.lnedStructure1.text()), ('structure_type_2',
                                            self.lnedStructure2.text()),
             ('structure_type_3',
              self.lnedStructure3.text()), ('structure_type_4',
                                            self.lnedStructure4.text()),
             ('treatment_type_1',
              self.lnedTreatment1.text()), ('treatment_type_2',
                                            self.lnedTreatment2.text()),
             ('treatment_type_3',
              self.lnedTreatment3.text()), ('unitobs', self.lnedRaw.text())))

        self.obsckbox = OrderedDict(
            (('spatial_replication_level_2',
              self.ckRep2.isChecked()), ('spatial_replication_level_3',
                                         self.ckRep3.isChecked()),
             ('spatial_replication_level_4',
              self.ckRep4.isChecked()), ('spatial_replication_level_5',
                                         self.ckRep5.isChecked()),
             ('structure_type_1',
              self.ckStructure1.isChecked()), ('structure_type_2',
                                               self.ckStructure2.isChecked()),
             ('structure_type_3',
              self.ckStructure3.isChecked()), ('structure_type_4',
                                               self.ckStructure4.isChecked()),
             ('treatment_type_1',
              self.ckTreatment1.isChecked()), ('treatment_type_2',
                                               self.ckTreatment2.isChecked()),
             ('treatment_type_3', self.ckTreatment3.isChecked()), ('unitobs',
                                                                   True)))
        self.table = {
            'count_table': self.rbtnCount.isChecked(),
            'biomass_table': self.rbtnBiomass.isChecked(),
            'density_table': self.rbtnDensity.isChecked(),
            'percent_cover_table': self.rbtnPercentcover.isChecked(),
            'individual_table': self.rbtnIndividual.isChecked()
        }
        available = [
            x for x, y in zip(list(self.obslned.keys()),
                              list(self.obsckbox.values())) if y is True
        ]
        try:
            self.tablename = [
                x for x, y in zip(list(self.table.keys()),
                                  list(self.table.values())) if y is True
            ][0]
        except Exception as e:
            print(str(e))
            self.error.showMessage('Select data type')

        rawini = ini.InputHandler(name='rawinfo',
                                  tablename=self.tablename,
                                  lnedentry=hlp.extract(
                                      self.obslned, available),
                                  checks=self.obsckbox)

        self.facade.input_register(rawini)
        self.facade.create_log_record(self.tablename)
        self._log = self.facade._tablelog[self.tablename]

        try:
            self.rawdirector = self.facade.make_table('rawinfo')
            print('obs table build: ', self.rawdirector)
            assert self.rawdirector._availdf is not None

        except Exception as e:
            print(str(e))
            self._log.debug(str(e))
            self.error.showMessage('Column(s) not identified')
            raise AttributeError('Column(s) not identified: ' + str(e))

        self.obstable = self.rawdirector._availdf.copy()
        self.obsmodel = self.viewEdit(self.obstable)
        if sender is self.btnPreview:
            self.preview.tabviewPreview.setModel(self.obsmodel)
            self.preview.show()
        elif sender is self.btnSaveClose:
            self.facade.push_tables[self.tablename] = self.obstable
            hlp.write_column_to_log(self.obslned, self._log, self.tablename)
            self.close()
        def submit_change(self):
            sender = self.sender()
            self.obslned = OrderedDict((
                ('spatial_replication_level_2', self.lnedRep2.text()),
                ('spatial_replication_level_3', self.lnedRep3.text()),
                ('spatial_replication_level_4', self.lnedRep4.text()),
                ('spatial_replication_level_5', self.lnedRep5.text()),
                ('structured_type_1', self.lnedStructure1.text()),
                ('structured_type_2', self.lnedStructure2.text()),
                ('structured_type_3', self.lnedStructure3.text()),
                ('treatment_type_1', self.lnedTreatment1.text()),
                ('treatment_type_2', self.lnedTreatment2.text()),
                ('treatment_type_3', self.lnedTreatment3.text()),
                ('unitobs', self.lnedRaw.text())
            ))

            self.obsckbox = OrderedDict((
                ('spatial_replication_level_2', self.ckRep2.isChecked()),
                ('spatial_replication_level_3', self.ckRep3.isChecked()),
                ('spatial_replication_level_4', self.ckRep4.isChecked()),
                ('spatial_replication_level_5', self.ckRep5.isChecked()),
                ('structured_type_1', self.ckStructure1.isChecked()),
                ('structured_type_2', self.ckStructure2.isChecked()),
                ('structured_type_3', self.ckStructure3.isChecked()),
                ('treatment_type_1', self.ckTreatment1.isChecked()),
                ('treatment_type_2', self.ckTreatment2.isChecked()),
                ('treatment_type_3', self.ckTreatment3.isChecked()),
                ('unitobs', True)
            ))
            self.table = {
                'count_table': self.rbtnCount.isChecked(),
                'biomass_table': self.rbtnBiomass.isChecked(),
                'density_table': self.rbtnDensity.isChecked(),
                'percent_cover_table': self.rbtnPercentcover.isChecked(),
                'individual_table': self.rbtnIndividual.isChecked() 
            }
            available = [
                x for x,y in zip(
                    list(self.obslned.keys()), list(
                        self.obsckbox.values()))
                if y is True
            ]
            try:
                self.tablename = [
                    x for x, y in
                    zip(list(self.table.keys()), list(self.table.values()))
                    if y is True
                ][0]
            except Exception as e:
                print(str(e))
                self.error.showMessage('Select data type')
            rawini = ini.InputHandler(
                name='rawinfo',
                tablename= self.tablename,
                lnedentry= hlp.extract(self.obslned, available),
                checks=self.obsckbox)

            self.facade.input_register(rawini)
            self.facade.create_log_record(self.tablename)
            self._log = self.facade._tablelog[self.tablename]

            try:
                self.rawdirector = self.facade.make_table('rawinfo')
                print('obs table build: ', self.rawdirector)
                assert self.rawdirector._availdf is not None

            except Exception as e:
                print(str(e))
                self._log.debug(str(e))
                self.error.showMessage(
                    'Column(s) not identified')
                raise AttributeError(
                    'Column(s) not identified: ' + str(e))

            self.obstable = self.rawdirector._availdf.copy()
            self.obsmodel = self.viewEdit(
                self.obstable)
            if sender is self.btnPreview:
                self.preview.tabviewPreview.setModel(self.obsmodel)
                self.preview.show()
            elif sender is self.btnSaveClose:
                self.facade.push_tables[self.tablename] = self.obstable
                hlp.write_column_to_log(
                    self.obslned, self._log, self.tablename)                
                self.close()
        def submit_change(self):
            '''
            Method to take user input for the taxa
            dialog box, pass the information to the user facade,
            create the taxa table, and then rename colums
            as necessary.
            '''
            sender = self.sender()
            self.taxalned = OrderedDict((
                ('common_name', self.lnedCommonname.text().strip()),
                ('sppcode', self.lnedSppCode.text().strip()),
                ('kingdom', self.lnedKingdom.text().strip()),
                ('subkingdom', self.lnedSubkingdom.text().strip()),
                ('infrakingdom', self.lnedInfrakingdom.text().strip()),
                ('superdivision', self.lnedSuperdivision.text().strip()),
                ('division', self.lnedDivision.text().strip()),
                ('subsubdivision', self.lnedSubdivision.text().strip()),
                ('superphylum', self.lnedSuperphylum.text().strip()),
                ('phylum', self.lnedPhylum.text().strip()),
                ('subphylum', self.lnedSubphylum.text().strip()),
                ('clss', self.lnedClass.text().strip()),
                ('subclass', self.lnedSubclass.text().strip()),
                ('ordr', self.lnedOrder.text().strip()),
                ('family', self.lnedFamily.text().strip()),
                ('genus', self.lnedGenus.text().strip()),
                ('species', self.lnedSpp.text().strip())
            ))

            self.taxackbox = OrderedDict((
                ('common_name', self.ckCommonname.isChecked()),
                ('sppcode', self.ckSppCode.isChecked()),
                ('kingdom', self.ckKingdom.isChecked()),
                ('subkingdom', self.ckSubkingdom.isChecked()),
                ('infrakingdom', self.ckInfrakingdom.isChecked()),
                ('superdivision', self.ckSuperdivision.isChecked()),
                ('division', self.ckDivision.isChecked()),
                ('subsubdivision', self.ckSubdivision.isChecked()),
                ('superphylum', self.ckSuperphylum.isChecked()),
                ('phylum', self.ckPhylum.isChecked()),
                ('subphylum', self.ckSubphylum.isChecked()),
                ('clss', self.ckClass.isChecked()),
                ('subclass', self.ckSubclass.isChecked()),
                ('ordr', self.ckOrder.isChecked()),
                ('family', self.ckFamily.isChecked()),
                ('genus', self.ckGenus.isChecked()),
                ('species', self.ckSpp.isChecked())
            ))

            # NEED TO IMPLEMNT METHODS TO CREATE COLUMNS FROM
            # USER INPUT (should be easy) !!!!!!!!!
            self.taxacreate = {
                'taxacreate': self.ckCreateTaxa.isChecked()
            }
            
            self.available = [
                x for x,y in zip(
                    list(self.taxalned.keys()), list(
                        self.taxackbox.values()))
                if y is True
            ]
            
            self.taxaini = ini.InputHandler(
                name='taxainfo',
                tablename='taxa_table',
                lnedentry=hlp.extract(self.taxalned, self.available),
                checks=self.taxacreate
            )
            self.facade.input_register(self.taxaini)
            self.facade.create_log_record('taxa_table')
            self._log = self.facade._tablelog['taxa_table']

            try:
                print('about to make taxa table')
                self.taxadirector = self.facade.make_table(
                    'taxainfo')
                assert self.taxadirector._availdf is not None

            except Exception as e:
                print(str(e))
                self._log.debug(str(e))
                self.error.showMessage(
                    'Column(s) not identified')
                raise AttributeError(
                    'Column(s) not identified: ' + str(e))

            self.taxa_table = self.taxadirector._availdf.copy()
            self.taxamodel = self.viewEdit(self.taxa_table)
            
            if sender is self.btnTaxasubmit:
                self.preview.tabviewPreview.setModel(self.taxamodel)
                self.preview.show()
            elif sender is self.btnSaveClose:
                # Convert to strings and strip -- not using, screws up
                # matching down the line
                #self.taxa_table = self.taxa_table.applymap(str)
                #self.taxa_table = self.taxa_table.applymap(lambda x: x.strip())

                self.facade.push_tables['taxa_table'] = self.taxa_table
                hlp.write_column_to_log(
                    self.taxalned, self._log, 'taxa_table')
                self.saved = True
                self.close()
Exemplo n.º 14
0
     ('structured_type_1', ''), ('structured_type_2', ''),
     ('structured_type_3', ''), ('treatment_type_1', ''),
     ('treatment_type_2', ''), ('treatment_type_3', ''), ('unitobs', 'count')))
obsckbox = OrderedDict(
    (('spatial_replication_level_2',
      True), ('spatial_replication_level_3',
              True), ('spatial_replication_level_4', False),
     ('spatial_replication_level_5', False), ('structured_type_1', False),
     ('structured_type_2', False), ('structured_type_3', False),
     ('treatment_type_1', False), ('treatment_type_2', False),
     ('treatment_type_3', False), ('unitobs', True)))
available = [
    x for x, y in zip(list(obslned.keys()), list(obsckbox.values()))
    if y is True
]
obslned_extracted = hlp.extract(obslned, available)
study_site_label = 'site'
obs_columns_in_data = [x[1] for x in list(obslned_extracted.items())]
obs_columns_in_push_table = [x[0] for x in list(obslned_extracted.items())]
spatial_index = [
    i for i, item in enumerate(obs_columns_in_push_table) if 'spatial' in item
]
spatial_label = [study_site_label]
spatial_key = ['spatial_replication_level_1_label']
for i in range(len(spatial_index)):
    spatial_key.append(obs_columns_in_push_table[i] + '_label')
    spatial_label.append(obs_columns_in_data[i])

update_dict = {}
for i, item in enumerate(spatial_key):
    update_dict[item] = spatial_label[i]
Exemplo n.º 15
0
    def submit_change(self):
        '''
        Method to take user input for the taxa
        dialog box, pass the information to the user facade,
        create the taxa table, and then rename colums
        as necessary.
        '''
        sender = self.sender()
        self.taxalned = OrderedDict(
            (('common_name', self.lnedCommonname.text().strip()),
             ('sppcode', self.lnedSppCode.text().strip()),
             ('kingdom', self.lnedKingdom.text().strip()),
             ('subkingdom', self.lnedSubkingdom.text().strip()),
             ('infrakingdom', self.lnedInfrakingdom.text().strip()),
             ('superdivision', self.lnedSuperdivision.text().strip()),
             ('division', self.lnedDivision.text().strip()),
             ('subdivision', self.lnedSubdivision.text().strip()),
             ('superphylum', self.lnedSuperphylum.text().strip()),
             ('phylum', self.lnedPhylum.text().strip()),
             ('subphylum', self.lnedSubphylum.text().strip()),
             ('clss', self.lnedClass.text().strip()),
             ('subclass', self.lnedSubclass.text().strip()),
             ('ordr',
              self.lnedOrder.text().strip()), ('family',
                                               self.lnedFamily.text().strip()),
             ('genus',
              self.lnedGenus.text().strip()), ('species',
                                               self.lnedSpp.text().strip())))

        self.taxackbox = OrderedDict(
            (('common_name',
              self.ckCommonname.isChecked()), ('sppcode',
                                               self.ckSppCode.isChecked()),
             ('kingdom',
              self.ckKingdom.isChecked()), ('subkingdom',
                                            self.ckSubkingdom.isChecked()),
             ('infrakingdom', self.ckInfrakingdom.isChecked()),
             ('superdivision', self.ckSuperdivision.isChecked()),
             ('division',
              self.ckDivision.isChecked()), ('subdivision',
                                             self.ckSubdivision.isChecked()),
             ('superphylum', self.ckSuperphylum.isChecked()),
             ('phylum',
              self.ckPhylum.isChecked()), ('subphylum',
                                           self.ckSubphylum.isChecked()),
             ('clss', self.ckClass.isChecked()), ('subclass',
                                                  self.ckSubclass.isChecked()),
             ('ordr', self.ckOrder.isChecked()), ('family',
                                                  self.ckFamily.isChecked()),
             ('genus', self.ckGenus.isChecked()), ('species',
                                                   self.ckSpp.isChecked())))

        # NEED TO IMPLEMNT METHODS TO CREATE COLUMNS FROM
        # USER INPUT (should be easy) !!!!!!!!!
        self.taxacreate = {'taxacreate': self.ckCreateTaxa.isChecked()}

        self.available = [
            x for x, y in zip(list(self.taxalned.keys()),
                              list(self.taxackbox.values())) if y is True
        ]

        self.taxaini = ini.InputHandler(name='taxainfo',
                                        tablename='taxa_table',
                                        lnedentry=hlp.extract(
                                            self.taxalned, self.available),
                                        checks=self.taxacreate)
        self.facade.input_register(self.taxaini)
        self.facade.create_log_record('taxa_table')
        self._log = self.facade._tablelog['taxa_table']

        try:
            print('about to make taxa table')
            self.taxadirector = self.facade.make_table('taxainfo')
            assert self.taxadirector._availdf is not None

        except Exception as e:
            print(str(e))
            self._log.debug(str(e))
            self.error.showMessage('Column(s) not identified')
            raise AttributeError('Column(s) not identified: ' + str(e))

        self.taxa_table = self.taxadirector._availdf.copy()
        self.taxamodel = self.viewEdit(self.taxa_table)

        if sender is self.btnTaxasubmit:
            self.preview.tabviewPreview.setModel(self.taxamodel)
            self.preview.show()
        elif sender is self.btnSaveClose:
            # Convert to strings and strip
            #self.taxa_table = self.taxa_table.applymap(str)
            #self.taxa_table = self.taxa_table.applymap(lambda x: x.strip())

            self.facade.push_tables['taxa_table'] = self.taxa_table
            hlp.write_column_to_log(self.taxalned, self._log, 'taxa_table')
            self.saved = True
            self.close()
Exemplo n.º 16
0
        entered_taxacolumns = [x for x in taxalned.values() if x != '']
        data_columns = facade._data.columns.values.tolist()

        taxacreate = {
            'taxacreate':
            True if any(x in data_columns
                        for x in entered_taxacolumns) == False else True
        }
        available = [
            x for x, y in zip(list(taxalned.keys()), list(taxackbox.values()))
            if y is True
        ]
        taxainput = ini.InputHandler(name='taxainfo',
                                     tablename='taxa_table',
                                     lnedentry=hlp.extract(
                                         taxalned, available),
                                     checks=taxacreate)
        facade.input_register(taxainput)

        taxa_director = facade.make_table('taxainfo')

        taxatable = taxa_director._availdf
        taxatable.fillna('NA', inplace=True)
        taxatable = taxatable.applymap(str)
        facade.push_tables['taxa_table'] = taxatable

        # -------------------
        # Create TIME HANDLE
        # ------------------

        user_timeinputs = dict(