def set_org_disclaimer(self): """Auto-connect slot activated when org disclaimer checkbox is toggled. """ is_checked = self.custom_org_disclaimer_checkbox.isChecked() if is_checked: # Show previous organisation disclaimer org_disclaimer = self.settings.value( 'inasafe/reportDisclaimer', disclaimer(), type=str) else: # Set the organisation disclaimer to the default one org_disclaimer = disclaimer() self.txtDisclaimer.setPlainText(org_disclaimer) self.txtDisclaimer.setEnabled(is_checked)
def __init__(self, parent=None): """Constructor for the dialog. :param parent: Parent widget of this dialog :type parent: QWidget """ QtGui.QDialog.__init__(self, parent) self.setupUi(self) self.setWindowTitle(self.tr('About InaSAFE %s' % get_version())) self.parent = parent # Set Limitations Text limitations_text = '' for index, limitation in enumerate(limitations()): limitations_text += '%s. %s \n' % (index + 1, limitation) self.limitations_text.setFontPointSize(11) self.limitations_text.setText(limitations_text) # Set Disclaimer Text self.disclaimer_text.setFontPointSize(11) self.disclaimer_text.setText(disclaimer()) # Set Attributions text image_credits_text = '' for index, limitation in enumerate(self.attributions()): image_credits_text += '%s. %s \n' % (index + 1, limitation) self.image_credits_text.setFontPointSize(11) self.image_credits_text.setText(image_credits_text) supporters_path = resources_path('img', 'logos', 'supporters.png') pixmap = QtGui.QPixmap(supporters_path) self.supporters_label.setPixmap(pixmap)
def test_setup_dialog(self): """Test Setup Options Dialog.""" dialog = OptionsDialog( parent=PARENT, iface=IFACE, qsetting='InaSAFETest') self.assertIsNotNone(dialog) # Check default values self.assertEqual( dialog.cbxVisibleLayersOnly.isChecked(), inasafe_default_settings['visibleLayersOnlyFlag']) self.assertEqual( dialog.cbxSetLayerNameFromTitle.isChecked(), inasafe_default_settings['set_layer_from_title_flag']) self.assertEqual( dialog.cbxZoomToImpact.isChecked(), inasafe_default_settings['setZoomToImpactFlag']) self.assertEqual( dialog.cbxHideExposure.isChecked(), inasafe_default_settings['setHideExposureFlag']) self.assertEqual( dialog.cbxUseSelectedFeaturesOnly.isChecked(), inasafe_default_settings['useSelectedFeaturesOnly']) self.assertEqual( dialog.leKeywordCachePath.text(), inasafe_default_settings['keywordCachePath']) self.assertEqual( dialog.template_warning_checkbox.isChecked(), inasafe_default_settings['template_warning_verbose']) self.assertEqual( dialog.organisation_on_dock_checkbox.isChecked(), inasafe_default_settings['showOrganisationLogoInDockFlag']) self.assertEqual( dialog.cbxDevMode.isChecked(), inasafe_default_settings['developer_mode']) self.assertEqual( dialog.leNorthArrowPath.text(), default_north_arrow_path()) self.assertEqual( dialog.leOrganisationLogoPath.text(), supporters_logo_path()) self.assertEqual(dialog.leReportTemplatePath.text(), '') self.assertEqual(dialog.txtDisclaimer.toPlainText(), disclaimer()) self.assertEqual( dialog.leUserDirectoryPath.text(), temp_dir('impacts')) self.assertEqual( dialog.iso19115_organization_le.text(), inasafe_default_settings['ISO19115_ORGANIZATION']) self.assertEqual( dialog.iso19115_url_le.text(), inasafe_default_settings['ISO19115_URL']) self.assertEqual( dialog.iso19115_email_le.text(), inasafe_default_settings['ISO19115_EMAIL']) self.assertEqual( dialog.iso19115_title_le.text(), inasafe_default_settings['ISO19115_TITLE']) self.assertEqual( dialog.iso19115_license_le.text(), inasafe_default_settings['ISO19115_LICENSE'])
def test_setup_dialog(self): """Test Setup Options Dialog.""" dialog = OptionsDialog( parent=PARENT, iface=IFACE, qsetting=INASAFE_TEST) self.assertIsNotNone(dialog) # Check default values self.assertEqual( dialog.cbxVisibleLayersOnly.isChecked(), inasafe_default_settings['visibleLayersOnlyFlag']) self.assertEqual( dialog.cbxSetLayerNameFromTitle.isChecked(), inasafe_default_settings['set_layer_from_title_flag']) self.assertEqual( dialog.cbxZoomToImpact.isChecked(), inasafe_default_settings['setZoomToImpactFlag']) self.assertEqual( dialog.cbxHideExposure.isChecked(), inasafe_default_settings['setHideExposureFlag']) self.assertEqual( dialog.cbxUseSelectedFeaturesOnly.isChecked(), inasafe_default_settings['useSelectedFeaturesOnly']) self.assertEqual( dialog.leKeywordCachePath.text(), inasafe_default_settings['keywordCachePath']) self.assertEqual( dialog.template_warning_checkbox.isChecked(), inasafe_default_settings['template_warning_verbose']) self.assertEqual( dialog.organisation_on_dock_checkbox.isChecked(), inasafe_default_settings['showOrganisationLogoInDockFlag']) self.assertEqual( dialog.cbxDevMode.isChecked(), inasafe_default_settings['developer_mode']) self.assertEqual( dialog.leNorthArrowPath.text(), default_north_arrow_path()) self.assertEqual( dialog.organisation_logo_path_line_edit.text(), supporters_logo_path()) self.assertEqual(dialog.leReportTemplatePath.text(), '') self.assertEqual(dialog.txtDisclaimer.toPlainText(), disclaimer()) self.assertEqual( dialog.leUserDirectoryPath.text(), temp_dir('impacts')) self.assertEqual( dialog.organisation_line_edit.text(), inasafe_default_settings['ISO19115_ORGANIZATION']) self.assertEqual( dialog.website_line_edit.text(), inasafe_default_settings['ISO19115_URL']) self.assertEqual( dialog.email_line_edit.text(), inasafe_default_settings['ISO19115_EMAIL']) self.assertEqual( dialog.license_line_edit.text(), inasafe_default_settings['ISO19115_LICENSE'])
def __init__(self): """Create InaSAFE Report context.""" self._black_inasafe_logo = black_inasafe_logo_path() self._white_inasafe_logo = white_inasafe_logo_path() # User can change this path in preferences self._organisation_logo = supporters_logo_path() self._supporters_logo = supporters_logo_path() self._north_arrow = default_north_arrow_path() self._disclaimer = disclaimer()
def disclaimer(self, text): """Set text that will be used as disclaimer in reports. :param text: Disclaimer text :type text: str """ if not isinstance(text, basestring): self._disclaimer = disclaimer() else: self._disclaimer = text
def getting_started_message(): """Generate a message for initial application state. :returns: Information for the user on how to get started. :rtype: safe.messaging.Message """ message = m.Message() message.add(LOGO_ELEMENT) message.add(m.Heading(tr('Getting started'), **INFO_STYLE)) notes = m.Paragraph( tr( 'These are the minimum steps you need to follow in order ' 'to use InaSAFE:')) message.add(notes) basics_list = m.NumberedList() basics_list.add(m.Paragraph( tr('Add at least one '), m.ImportantText(tr('hazard'), **KEYWORD_STYLE), tr(' layer (e.g. earthquake MMI) to QGIS.'))) basics_list.add(m.Paragraph( tr('Add at least one '), m.ImportantText(tr('exposure'), **KEYWORD_STYLE), tr(' layer (e.g. structures) to QGIS.'))) basics_list.add(m.Paragraph( tr( 'Make sure you have defined keywords for your hazard and ' 'exposure layers. You can do this using the ' 'keywords creation wizard '), m.Image( 'file:///%s/img/icons/show-keyword-wizard.svg' % (resources_path()), **SMALL_ICON_STYLE), tr(' in the toolbar.'))) basics_list.add(m.Paragraph( tr('Click on the '), m.ImportantText(tr('Run'), **KEYWORD_STYLE), tr(' button below.'))) message.add(basics_list) message.add(m.Heading(tr('Limitations'), **WARNING_STYLE)) caveat_list = m.NumberedList() for limitation in limitations(): caveat_list.add(limitation) message.add(caveat_list) message.add(m.Heading(tr('Disclaimer'), **WARNING_STYLE)) message.add(m.Paragraph(disclaimer())) return message
'set_layer_from_title_flag': True, 'setZoomToImpactFlag': True, 'set_show_only_impact_on_report': False, 'print_atlas_report': False, 'setHideExposureFlag': False, 'useSelectedFeaturesOnly': True, 'useSentry': False, 'template_warning_verbose': True, 'showOrganisationLogoInDockFlag': False, 'developer_mode': False, 'generate_report': True, 'memory_profile': False, 'ISO19115_ORGANIZATION': 'InaSAFE.org', 'ISO19115_URL': 'http://inasafe.org', 'ISO19115_EMAIL': '*****@*****.**', 'ISO19115_LICENSE': 'Free use with accreditation', 'currency': idr['key'], 'keywordCachePath': join( QgsApplication.qgisSettingsDirPath(), 'inasafe', 'metadata.db'), # Make sure first to not have cyclic import 'organisation_logo_path': supporters_logo_path(), 'north_arrow_path': default_north_arrow_path(), # 'defaultUserDirectory': '', # 'reportTemplatePath': '', 'reportDisclaimer': disclaimer() }
def impact_attribution(keywords, inasafe_flag=False): """Make a little table for attribution of data sources used in impact. :param keywords: A keywords dict for an impact layer. :type keywords: dict :param inasafe_flag: bool - whether to show a little InaSAFE promotional text in the attribution output. Defaults to False. :returns: An html snippet containing attribution information for the impact layer. If no keywords are present or no appropriate keywords are present, None is returned. :rtype: safe.messaging.Message """ if keywords is None: return None join_words = ' - %s ' % tr('sourced from') analysis_details = tr('Analysis details') hazard_details = tr('Hazard details') hazard_title_keywords = 'hazard_title' hazard_source_keywords = 'hazard_source' exposure_details = tr('Exposure details') exposure_title_keywords = 'exposure_title' exposure_source_keyword = 'exposure_source' if hazard_title_keywords in keywords: hazard_title = tr(keywords[hazard_title_keywords]) else: hazard_title = tr('Hazard layer') if hazard_source_keywords in keywords: hazard_source = tr(keywords[hazard_source_keywords]) else: hazard_source = tr('an unknown source') if exposure_title_keywords in keywords: exposure_title = keywords[exposure_title_keywords] else: exposure_title = tr('Exposure layer') if exposure_source_keyword in keywords: exposure_source = keywords[exposure_source_keyword] else: exposure_source = tr('an unknown source') report = m.Message() report.add(m.Heading(analysis_details, **INFO_STYLE)) report.add(hazard_details) report.add(m.Paragraph(hazard_title, join_words, hazard_source)) report.add(exposure_details) report.add(m.Paragraph(exposure_title, join_words, exposure_source)) if inasafe_flag: report.add(m.Heading(tr('Software notes'), **INFO_STYLE)) # noinspection PyUnresolvedReferences inasafe_phrase = tr( 'This report was created using InaSAFE version %s. Visit ' 'http://inasafe.org to get your free copy of this software! %s' ) % (get_version(), disclaimer()) report.add(m.Paragraph(m.Text(inasafe_phrase))) return report
def restore_state(self): """Reinstate the options based on the user's stored session info.""" # Restore boolean setting as check box. for key, check_box in list(self.boolean_settings.items()): self.restore_boolean_setting(key, check_box) # Restore text setting as line edit. for key, line_edit in list(self.text_settings.items()): self.restore_text_setting(key, line_edit) # User Directory user_directory_path = setting( key='defaultUserDirectory', default=temp_dir('impacts'), expected_type=str, qsettings=self.settings) custom_user_directory_flag = ( user_directory_path != temp_dir('impacts')) self.custom_UseUserDirectory_checkbox.setChecked( custom_user_directory_flag) self.splitter_user_directory.setEnabled(custom_user_directory_flag) self.leUserDirectoryPath.setText(user_directory_path) # Currency # Populate the currency list for currency in currencies: self.currency_combo_box.addItem(currency['name'], currency['key']) # Then make selected the default one. default_currency = setting('currency', expected_type=str) keys = [currency['key'] for currency in currencies] if default_currency not in keys: default_currency = currencies[0]['key'] index = self.currency_combo_box.findData(default_currency) self.currency_combo_box.setCurrentIndex(index) # Earthquake function. # Populate the combobox first. for model in EARTHQUAKE_FUNCTIONS: self.earthquake_function.addItem(model['name'], model['key']) # Then make selected the default one. default_earthquake_function = setting( 'earthquake_function', expected_type=str) keys = [model['key'] for model in EARTHQUAKE_FUNCTIONS] if default_earthquake_function not in keys: default_earthquake_function = EARTHQUAKE_FUNCTIONS[0]['key'] index = self.earthquake_function.findData(default_earthquake_function) self.earthquake_function.setCurrentIndex(index) self.update_earthquake_info() # Restore North Arrow Image Path north_arrow_path = setting( key='north_arrow_path', default=default_north_arrow_path(), expected_type=str, qsettings=self.settings) custom_north_arrow_flag = ( north_arrow_path != default_north_arrow_path()) self.custom_north_arrow_checkbox.setChecked(custom_north_arrow_flag) self.splitter_north_arrow.setEnabled(custom_north_arrow_flag) self.leNorthArrowPath.setText(north_arrow_path) # Restore Report Template Directory Path report_template_directory = setting( key='reportTemplatePath', default='', expected_type=str, qsettings=self.settings) custom_templates_dir_flag = (report_template_directory != '') self.custom_templates_dir_checkbox.setChecked( custom_templates_dir_flag) self.leReportTemplatePath.setText(report_template_directory) # Restore Disclaimer org_disclaimer = setting( key='reportDisclaimer', default=disclaimer(), expected_type=str, qsettings=self.settings) custom_org_disclaimer_flag = (org_disclaimer != disclaimer()) self.custom_org_disclaimer_checkbox.setChecked( custom_org_disclaimer_flag) self.txtDisclaimer.setPlainText(org_disclaimer) # Restore Organisation Logo Path org_logo_path = setting( key='organisation_logo_path', default=supporters_logo_path(), expected_type=str, qsettings=self.settings) # Check if the path is default one or not custom_org_logo_flag = org_logo_path != supporters_logo_path() self.organisation_logo_path_line_edit.setText(org_logo_path) self.custom_organisation_logo_check_box.setChecked( custom_org_logo_flag) self.organisation_logo_path_line_edit.setEnabled( custom_org_logo_flag) self.open_organisation_logo_path_button.setEnabled( custom_org_logo_flag) # Manually call here self.update_logo_preview() # Restore InaSAFE default values self.restore_default_values_page() # Restore Population Parameter self.restore_population_parameters(global_default=False)
def restore_state(self): """Reinstate the options based on the user's stored session info.""" # Restore boolean setting as check box. for key, check_box in self.boolean_settings.items(): self.restore_boolean_setting(key, check_box) # Restore text setting as line edit. for key, line_edit in self.text_settings.items(): self.restore_text_setting(key, line_edit) # Restore Organisation Logo Path org_logo_path = self.settings.value( 'inasafe/organisation_logo_path', supporters_logo_path(), type=str) custom_org_logo_flag = ( org_logo_path != supporters_logo_path()) self.custom_org_logo_checkbox.setChecked(custom_org_logo_flag) self.leOrganisationLogoPath.setText(org_logo_path) # User Directory user_directory_path = self.settings.value( 'inasafe/defaultUserDirectory', temp_dir('impacts'), type=str) custom_user_directory_flag = ( user_directory_path != temp_dir('impacts')) self.custom_UseUserDirectory_checkbox.setChecked( custom_user_directory_flag) self.splitter_user_directory.setEnabled(custom_user_directory_flag) self.leUserDirectoryPath.setText(user_directory_path) # Earthquake function. # Populate the combobox first. for model in EARTHQUAKE_FUNCTIONS: self.earthquake_function.addItem(model['name'], model['key']) # Then make selected the default one. default_earthquake_function = setting( 'earthquake_function', expected_type=str) keys = [model['key'] for model in EARTHQUAKE_FUNCTIONS] if default_earthquake_function not in keys: default_earthquake_function = EARTHQUAKE_FUNCTIONS[0]['key'] index = self.earthquake_function.findData(default_earthquake_function) self.earthquake_function.setCurrentIndex(index) # Restore North Arrow Image Path north_arrow_path = self.settings.value( 'inasafe/north_arrow_path', default_north_arrow_path(), type=str) custom_north_arrow_flag = ( north_arrow_path != default_north_arrow_path()) self.custom_north_arrow_checkbox.setChecked(custom_north_arrow_flag) self.leNorthArrowPath.setText(north_arrow_path) # Restore Report Template Directory Path report_template_dir = self.settings.value( 'inasafe/reportTemplatePath', '', type=str) custom_templates_dir_flag = (report_template_dir != '') self.custom_templates_dir_checkbox.setChecked( custom_templates_dir_flag) self.leReportTemplatePath.setText(report_template_dir) # Restore Disclaimer org_disclaimer = self.settings.value( 'inasafe/reportDisclaimer', disclaimer(), type=str) custom_org_disclaimer_flag = (org_disclaimer != disclaimer()) self.custom_org_disclaimer_checkbox.setChecked( custom_org_disclaimer_flag) self.txtDisclaimer.setPlainText(org_disclaimer) # Restore InaSAFE default values self.restore_default_values_page()
def impact_attribution(keywords, inasafe_flag=False): """Make a little table for attribution of data sources used in impact. :param keywords: A keywords dict for an impact layer. :type keywords: dict :param inasafe_flag: bool - whether to show a little InaSAFE promotional text in the attribution output. Defaults to False. :returns: An html snippet containing attribution information for the impact layer. If no keywords are present or no appropriate keywords are present, None is returned. :rtype: safe.messaging.Message """ if keywords is None: return None join_words = ' - %s ' % tr('sourced from') analysis_details = tr('Analysis details') hazard_details = tr('Hazard details') hazard_title_keywords = 'hazard_title' hazard_source_keywords = 'hazard_source' exposure_details = tr('Exposure details') exposure_title_keywords = 'exposure_title' exposure_source_keyword = 'exposure_source' if hazard_title_keywords in keywords: hazard_title = tr(keywords[hazard_title_keywords]) else: hazard_title = tr('Hazard layer') if hazard_source_keywords in keywords: hazard_source = tr(keywords[hazard_source_keywords]) else: hazard_source = tr('an unknown source') if exposure_title_keywords in keywords: exposure_title = keywords[exposure_title_keywords] else: exposure_title = tr('Exposure layer') if exposure_source_keyword in keywords: exposure_source = keywords[exposure_source_keyword] else: exposure_source = tr('an unknown source') report = m.Message() report.add(m.Heading(analysis_details, **INFO_STYLE)) report.add(hazard_details) report.add(m.Paragraph( hazard_title, join_words, hazard_source)) report.add(exposure_details) report.add(m.Paragraph( exposure_title, join_words, exposure_source)) if inasafe_flag: report.add(m.Heading(tr('Software notes'), **INFO_STYLE)) # noinspection PyUnresolvedReferences inasafe_phrase = tr( 'This report was created using InaSAFE version %s. Visit ' 'http://inasafe.org to get your free copy of this software! %s' ) % (get_version(), disclaimer()) report.add(m.Paragraph(m.Text(inasafe_phrase))) return report
def restore_state(self): """Reinstate the options based on the user's stored session info.""" # Restore boolean setting as check box. for key, check_box in list(self.boolean_settings.items()): self.restore_boolean_setting(key, check_box) # Restore text setting as line edit. for key, line_edit in list(self.text_settings.items()): self.restore_text_setting(key, line_edit) # User Directory user_directory_path = setting(key='defaultUserDirectory', default=temp_dir('impacts'), expected_type=str, qsettings=self.settings) custom_user_directory_flag = (user_directory_path != temp_dir('impacts')) self.custom_UseUserDirectory_checkbox.setChecked( custom_user_directory_flag) self.splitter_user_directory.setEnabled(custom_user_directory_flag) self.leUserDirectoryPath.setText(user_directory_path) # Currency # Populate the currency list for currency in currencies: self.currency_combo_box.addItem(currency['name'], currency['key']) # Then make selected the default one. default_currency = setting('currency', expected_type=str) keys = [currency['key'] for currency in currencies] if default_currency not in keys: default_currency = currencies[0]['key'] index = self.currency_combo_box.findData(default_currency) self.currency_combo_box.setCurrentIndex(index) # Earthquake function. # Populate the combobox first. for model in EARTHQUAKE_FUNCTIONS: self.earthquake_function.addItem(model['name'], model['key']) # Then make selected the default one. default_earthquake_function = setting('earthquake_function', expected_type=str) keys = [model['key'] for model in EARTHQUAKE_FUNCTIONS] if default_earthquake_function not in keys: default_earthquake_function = EARTHQUAKE_FUNCTIONS[0]['key'] index = self.earthquake_function.findData(default_earthquake_function) self.earthquake_function.setCurrentIndex(index) self.update_earthquake_info() # Restore North Arrow Image Path north_arrow_path = setting(key='north_arrow_path', default=default_north_arrow_path(), expected_type=str, qsettings=self.settings) custom_north_arrow_flag = (north_arrow_path != default_north_arrow_path()) self.custom_north_arrow_checkbox.setChecked(custom_north_arrow_flag) self.splitter_north_arrow.setEnabled(custom_north_arrow_flag) self.leNorthArrowPath.setText(north_arrow_path) # Restore Report Template Directory Path report_template_directory = setting(key='reportTemplatePath', default='', expected_type=str, qsettings=self.settings) custom_templates_dir_flag = (report_template_directory != '') self.custom_templates_dir_checkbox.setChecked( custom_templates_dir_flag) self.leReportTemplatePath.setText(report_template_directory) # Restore Disclaimer org_disclaimer = setting(key='reportDisclaimer', default=disclaimer(), expected_type=str, qsettings=self.settings) custom_org_disclaimer_flag = (org_disclaimer != disclaimer()) self.custom_org_disclaimer_checkbox.setChecked( custom_org_disclaimer_flag) self.txtDisclaimer.setPlainText(org_disclaimer) # Restore Organisation Logo Path org_logo_path = setting(key='organisation_logo_path', default=supporters_logo_path(), expected_type=str, qsettings=self.settings) # Check if the path is default one or not custom_org_logo_flag = org_logo_path != supporters_logo_path() self.organisation_logo_path_line_edit.setText(org_logo_path) self.custom_organisation_logo_check_box.setChecked( custom_org_logo_flag) self.organisation_logo_path_line_edit.setEnabled(custom_org_logo_flag) self.open_organisation_logo_path_button.setEnabled( custom_org_logo_flag) # Manually call here self.update_logo_preview() # Restore InaSAFE default values self.restore_default_values_page() # Restore Population Parameter self.restore_population_parameters(global_default=False)
"""Text elements""" legend_title_header = { 'id': 'legend-title', 'string_format': tr('Legend') } disclaimer_title_header = { 'id': 'disclaimer-title', 'string_format': tr('Disclaimer') } disclaimer_text = { 'id': 'disclaimer', 'string_format': disclaimer() } information_title_header = { 'id': 'information-title', 'string_format': tr('Analysis Information') } time_title_header = { 'id': 'time-title', 'string_format': tr('Time') } caution_title_header = { 'id': 'caution-title', 'string_format': tr('Note')
'setHideExposureFlag': False, 'useSelectedFeaturesOnly': True, 'useSentry': False, 'template_warning_verbose': True, 'showOrganisationLogoInDockFlag': False, 'developer_mode': False, 'generate_report': True, 'memory_profile': False, 'ISO19115_ORGANIZATION': 'InaSAFE.org', 'ISO19115_URL': 'http://inasafe.org', 'ISO19115_EMAIL': '*****@*****.**', 'ISO19115_LICENSE': 'Free use with accreditation', # Welcome message 'always_show_welcome_message': True, 'previous_version': '0.0.0', # It will be set in plugin, no need to worry 'currency': idr['key'], 'keywordCachePath': join( QgsApplication.qgisSettingsDirPath(), 'inasafe', 'metadata.db'), # Make sure first to not have cyclic import 'organisation_logo_path': supporters_logo_path(), 'north_arrow_path': default_north_arrow_path(), # 'defaultUserDirectory': '', # 'reportTemplatePath': '', 'reportDisclaimer': disclaimer() }
from safe.utilities.i18n import tr __copyright__ = "Copyright 2016, The InaSAFE Project" __license__ = "GPL version 3" __email__ = "*****@*****.**" __revision__ = 'b23129f2662693c46e2e338a5cd2238761c004c1' """Text elements""" legend_title_header = {'id': 'legend-title', 'string_format': tr('Legend')} disclaimer_title_header = { 'id': 'disclaimer-title', 'string_format': tr('Disclaimer') } disclaimer_text = {'id': 'disclaimer', 'string_format': disclaimer()} information_title_header = { 'id': 'information-title', 'string_format': tr('Analysis Information') } time_title_header = {'id': 'time-title', 'string_format': tr('Time')} caution_title_header = {'id': 'caution-title', 'string_format': tr('Note')} caution_text = { 'id': 'caution-text', 'string_format': tr('This assessment is a guide - we strongly recommend that '
False, 'ISO19115_ORGANIZATION': 'InaSAFE.org', 'ISO19115_URL': 'http://inasafe.org', 'ISO19115_EMAIL': '*****@*****.**', 'ISO19115_LICENSE': 'Free use with accreditation', # Welcome message 'always_show_welcome_message': True, 'previous_version': '0.0.0', # It will be set in plugin, no need to worry 'currency': idr['key'], 'keywordCachePath': join(QgsApplication.qgisSettingsDirPath(), 'inasafe', 'metadata.db'), # Make sure first to not have cyclic import 'organisation_logo_path': supporters_logo_path(), 'north_arrow_path': default_north_arrow_path(), # 'defaultUserDirectory': '', # 'reportTemplatePath': '', 'reportDisclaimer': disclaimer() }
def restore_state(self): """Reinstate the options based on the user's stored session info.""" # Restore boolean setting as check box. for key, check_box in self.boolean_settings.items(): self.restore_boolean_setting(key, check_box) # Restore text setting as line edit. for key, line_edit in self.text_settings.items(): self.restore_text_setting(key, line_edit) # Restore Organisation Logo Path org_logo_path = self.settings.value('inasafe/organisation_logo_path', supporters_logo_path(), type=str) custom_org_logo_flag = (org_logo_path != supporters_logo_path()) self.custom_org_logo_checkbox.setChecked(custom_org_logo_flag) self.leOrganisationLogoPath.setText(org_logo_path) # User Directory user_directory_path = self.settings.value( 'inasafe/defaultUserDirectory', temp_dir('impacts'), type=str) custom_user_directory_flag = (user_directory_path != temp_dir('impacts')) self.custom_UseUserDirectory_checkbox.setChecked( custom_user_directory_flag) self.splitter_user_directory.setEnabled(custom_user_directory_flag) self.leUserDirectoryPath.setText(user_directory_path) # Earthquake function. # Populate the combobox first. for model in EARTHQUAKE_FUNCTIONS: self.earthquake_function.addItem(model['name'], model['key']) # Then make selected the default one. default_earthquake_function = setting('earthquake_function', expected_type=str) keys = [model['key'] for model in EARTHQUAKE_FUNCTIONS] if default_earthquake_function not in keys: default_earthquake_function = EARTHQUAKE_FUNCTIONS[0]['key'] index = self.earthquake_function.findData(default_earthquake_function) self.earthquake_function.setCurrentIndex(index) # Restore North Arrow Image Path north_arrow_path = self.settings.value('inasafe/north_arrow_path', default_north_arrow_path(), type=str) custom_north_arrow_flag = (north_arrow_path != default_north_arrow_path()) self.custom_north_arrow_checkbox.setChecked(custom_north_arrow_flag) self.leNorthArrowPath.setText(north_arrow_path) # Restore Report Template Directory Path report_template_dir = self.settings.value('inasafe/reportTemplatePath', '', type=str) custom_templates_dir_flag = (report_template_dir != '') self.custom_templates_dir_checkbox.setChecked( custom_templates_dir_flag) self.leReportTemplatePath.setText(report_template_dir) # Restore Disclaimer org_disclaimer = self.settings.value('inasafe/reportDisclaimer', disclaimer(), type=str) custom_org_disclaimer_flag = (org_disclaimer != disclaimer()) self.custom_org_disclaimer_checkbox.setChecked( custom_org_disclaimer_flag) self.txtDisclaimer.setPlainText(org_disclaimer) # Restore InaSAFE default values self.restore_default_values_page()