Example #1
0
    def tabUpdate(self):

        # Lden check
        settings = on_Settings.getAllSettings()

        day = False
        eve = False
        nig = False

        if self.sources_pts_layer_checkBox.isChecked(
        ) or self.sources_roads_layer_checkBox.isChecked():

            if settings['period_pts_day'] == 'True' or settings[
                    'period_roads_day'] == 'True':
                day = True
            if settings['period_pts_eve'] == 'True' or settings[
                    'period_roads_eve'] == 'True':
                eve = True
            if settings['period_pts_nig'] == 'True' or settings[
                    'period_roads_nig'] == 'True':
                nig = True

        if day == True or eve == True or nig == True:
            self.L_den_checkBox.setEnabled(True)
        else:
            self.L_den_checkBox.setChecked(False)
            self.L_den_checkBox.setEnabled(False)

        self.den_checkBox_update()

        # label
        if self.rays_layer_checkBox.isChecked(
        ) or self.diff_rays_layer_checkBox.isChecked():
            self.label_calculate.setText(
                self.tr('Calculate levels and draw rays'))
        else:
            self.label_calculate.setText(self.tr('Calculate levels'))
Example #2
0
    def reload_settings(self):

        try:
            settings = on_Settings.getAllSettings()  
            
            if settings['period_pts_gen'] == "True":
                self.POWER_P_L_gen_checkBox.setChecked(1)
            if settings['period_pts_day'] == "True":
                self.POWER_P_L_day_checkBox.setChecked(1)
            if settings['period_pts_eve'] == "True":
                self.POWER_P_L_eve_checkBox.setChecked(1)
            if settings['period_pts_nig'] == "True":
                self.POWER_P_L_nig_checkBox.setChecked(1)
    
            for key in self.POWER_P_emission_comboBoxes_dict.keys():
                if settings[key] is not None:
                    idx = self.POWER_P_emission_comboBoxes_dict[key].findText(settings[key])
                    self.POWER_P_emission_comboBoxes_dict[key].setCurrentIndex(idx)        
        
            self.source_checkBox_update()

        except:
            
            QMessageBox.information(self, self.tr("opeNoise - Calculate Noise Levels"), self.tr("Sorry, but somethigs wrong in import last settings."))
Example #3
0
    def accept(self):

        if self.check() == False:
            return

        if self.CRS_check() == False:
            return

        self.calculate_pushButton.setEnabled(False)
        self.label_time_start.setText('')
        self.label_time_end.setText('')
        self.label_time_duration.setText('')

        self.log_start()
        self.time_start = datetime.now()
        print '###################################################'

        self.write_settings()

        settings = on_Settings.getAllSettings()

        try:
            on_CalculateNoiseLevels.run(settings, self.progress_bars)
            run = 1
        except:
            error = traceback.format_exc()
            log_errors.write(error)
            run = 0

        self.time_end = datetime.now()

        if run == 1:
            log_errors.write(self.tr("No errors.") + "\n\n")

            self.label_time_start.setText(
                self.tr("Start: ") + ' ' +
                self.time_start.strftime("%a %d/%b/%Y %H:%M:%S"))
            self.label_time_end.setText(
                self.tr("End: ") + ' ' +
                self.time_end.strftime("%a %d/%b/%Y %H:%M:%S"))
            self.label_time_duration.setText(
                self.tr("Duration: ") + ' ' + str(self.duration()))

            result_string = self.tr("Levels calculated with success.") + "\n\n" +\
                            self.tr("Start: ") + self.time_start.strftime("%a %d/%b/%Y %H:%M:%S") + "\n" +\
                            self.tr("End: ") + self.time_end.strftime("%a %d/%b/%Y %H:%M:%S") + "\n"+\
                            self.tr("Duration: ") + str(self.duration())
            QMessageBox.information(
                self, self.tr("opeNoise - Calculate Noise Levels"),
                result_string)

        else:

            result_string = self.tr("Sorry, process not complete.") + "\n\n" +\
                            self.tr("View the log file to understand the problem:") + "\n" +\
                            str(log_errors_path_name) + "\n\n" +\
                            self.tr("Start: ") + self.time_start.strftime("%a %d/%b/%Y %H:%M:%S.%f") + "\n" +\
                            self.tr("End: ") + self.time_end.strftime("%a %d/%b/%Y %H:%M:%S.%f") + "\n"+\
                            self.tr("Duration: ") + str(self.duration())
            QMessageBox.information(
                self, self.tr("opeNoise - Calculate Noise Levels"),
                self.tr(result_string))

        print self.duration()
        print '###################################################'
        print '\n'
        self.log_end()

        self.calculate_pushButton.setEnabled(True)
Example #4
0
    def reload_settings(self):

        settings = on_Settings.getAllSettings()

        if len(QgsMapLayerRegistry.instance().mapLayers().values()) > 0:
            self.populateLayersReceiver()
            self.populateLayersSourcePts()
            self.populateLayersSourceRoads()

        try:
            # receivers
            idx = self.receivers_layer_comboBox.findText(
                settings['receivers_name'])
            self.receivers_layer_comboBox.setCurrentIndex(idx)

            # sources
            if settings['implementation_pts'] is not None:
                self.sources_pts_layer_checkBox.setEnabled(True)
                self.sources_pts_layer_checkBox.setChecked(True)
                idx = self.sources_pts_layer_comboBox.findText(
                    settings['sources_pts_name'])
                self.sources_pts_layer_comboBox.setCurrentIndex(idx)
            else:
                self.sources_pts_layer_checkBox.setChecked(False)

            if settings['implementation_roads'] is not None:
                self.sources_roads_layer_checkBox.setEnabled(True)
                self.sources_roads_layer_checkBox.setChecked(True)
                idx = self.sources_roads_layer_comboBox.findText(
                    settings['sources_roads_name'])
                self.sources_roads_layer_comboBox.setCurrentIndex(idx)
            else:
                self.sources_roads_layer_checkBox.setChecked(False)

            self.sources_checkBox_update()

            # buildings
            if settings['buildings_path'] is not None:
                self.buildings_layer_checkBox.setChecked(1)
                self.buildings_layer_comboBox.setEnabled(True)
                self.buildings_layer_label.setEnabled(True)
                idx = self.buildings_layer_comboBox.findText(
                    settings['buildings_name'])
                self.buildings_layer_comboBox.setCurrentIndex(idx)

            # research ray
            idx = self.research_ray_comboBox.findText(settings['research_ray'])
            self.research_ray_comboBox.setCurrentIndex(idx)
            # temperature
            idx = self.temperature_comboBox.findText(settings['temperature'])
            self.temperature_comboBox.setCurrentIndex(idx)
            # humidity
            idx = self.humidity_comboBox.findText(settings['humidity'])
            self.humidity_comboBox.setCurrentIndex(idx)

            if settings['period_den'] == "True":
                self.L_den_checkBox.setChecked(1)
                self.L_den_checkBox.setEnabled(True)
                self.L_day_hours_spinBox.setValue(int(settings['day_hours']))
                self.L_eve_hours_spinBox.setValue(int(settings['eve_hours']))
                self.L_nig_hours_spinBox.setValue(int(settings['nig_hours']))
                self.L_day_penalty_spinBox.setValue(
                    int(settings['day_penalty']))
                self.L_eve_penalty_spinBox.setValue(
                    int(settings['eve_penalty']))
                self.L_nig_penalty_spinBox.setValue(
                    int(settings['nig_penalty']))

            # rays
            if settings['rays_path'] is not None:
                self.rays_layer_checkBox.setChecked(1)
                self.rays_layer_lineEdit.setText(settings['rays_path'])
            else:
                self.rays_layer_checkBox.setChecked(0)
                self.rays_layer_lineEdit.clear()

            if settings['diff_rays_path'] is not None:
                self.diff_rays_layer_checkBox.setChecked(1)
                self.diff_rays_layer_lineEdit.setText(
                    settings['diff_rays_path'])
            else:
                self.diff_rays_layer_checkBox.setChecked(0)
                self.diff_rays_layer_lineEdit.clear()

        except:
            QMessageBox.information(
                self, self.tr("opeNoise - Calculate Noise Levels"),
                self.tr("Sorry, but somethigs wrong in import last settings."))
Example #5
0
    def reload_settings(self):

        try:
            settings = on_Settings.getAllSettings()

            if settings['implementation_roads'] == 'POWER_R':
                self.POWER_R_radioButton.setChecked(1)

                if settings['period_roads_gen'] == "True":
                    self.POWER_R_L_gen_checkBox.setChecked(1)
                if settings['period_roads_day'] == "True":
                    self.POWER_R_L_day_checkBox.setChecked(1)
                if settings['period_roads_eve'] == "True":
                    self.POWER_R_L_eve_checkBox.setChecked(1)
                if settings['period_roads_nig'] == "True":
                    self.POWER_R_L_nig_checkBox.setChecked(1)

                for key in self.POWER_R_emission_comboBoxes_dict.keys():
                    if settings[key] is not None:
                        idx = self.POWER_R_emission_comboBoxes_dict[
                            key].findText(settings[key])
                        self.POWER_R_emission_comboBoxes_dict[
                            key].setCurrentIndex(idx)

            if settings['implementation_roads'] == 'NMPB':
                self.NMPB_radioButton.setChecked(1)

                if settings['period_roads_gen'] == "True":
                    self.NMPB_L_gen_checkBox.setChecked(1)
                if settings['period_roads_day'] == "True":
                    self.NMPB_L_day_checkBox.setChecked(1)
                if settings['period_roads_eve'] == "True":
                    self.NMPB_L_eve_checkBox.setChecked(1)
                if settings['period_roads_nig'] == "True":
                    self.NMPB_L_nig_checkBox.setChecked(1)

                for key in self.NMPB_emission_comboBoxes_dict.keys():
                    if settings[key] is not None:
                        idx = self.NMPB_emission_comboBoxes_dict[key].findText(
                            settings[key])
                        self.NMPB_emission_comboBoxes_dict[
                            key].setCurrentIndex(idx)

                        if key.find('_l_') > -1:
                            self.NMPB_l_checkBox.setChecked(1)
                        if key.find('_h_') > -1:
                            self.NMPB_h_checkBox.setChecked(1)

            if settings['implementation_roads'] == 'CNOSSOS':
                self.CNOSSOS_radioButton.setChecked(1)

                if settings['period_roads_gen'] == "True":
                    self.CNOSSOS_L_gen_checkBox.setChecked(1)
                if settings['period_roads_day'] == "True":
                    self.CNOSSOS_L_day_checkBox.setChecked(1)
                if settings['period_roads_eve'] == "True":
                    self.CNOSSOS_L_eve_checkBox.setChecked(1)
                if settings['period_roads_nig'] == "True":
                    self.CNOSSOS_L_nig_checkBox.setChecked(1)

                for key in self.CNOSSOS_emission_comboBoxes_dict.keys():
                    if settings[key] is not None:
                        idx = self.CNOSSOS_emission_comboBoxes_dict[
                            key].findText(settings[key])
                        self.CNOSSOS_emission_comboBoxes_dict[
                            key].setCurrentIndex(idx)

                        if key.find('_1_') > -1:
                            self.CNOSSOS_1_checkBox.setChecked(1)
                        if key.find('_2_') > -1:
                            self.CNOSSOS_2_checkBox.setChecked(1)
                        if key.find('_3_') > -1:
                            self.CNOSSOS_3_checkBox.setChecked(1)
                        if key.find('_4a_') > -1:
                            self.CNOSSOS_4a_checkBox.setChecked(1)
                        if key.find('_4b_') > -1:
                            self.CNOSSOS_4b_checkBox.setChecked(1)

            self.source_checkBox_update()

        except:
            QMessageBox.information(
                self, self.tr("opeNoise - Calculate Noise Levels"),
                self.tr("Sorry, but somethigs wrong in import last settings."))