本文整理汇总了Python中safe.defaults.default_north_arrow_path函数的典型用法代码示例。如果您正苦于以下问题:Python default_north_arrow_path函数的具体用法?Python default_north_arrow_path怎么用?Python default_north_arrow_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了default_north_arrow_path函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: set_north_arrow
def set_north_arrow(self):
"""Auto-connect slot activated when north arrow checkbox is toggled."""
settings = QtCore.QSettings()
if self.custom_north_arrow_checkbox.isChecked():
# Show previous north arrow path
path = settings.value(
'inasafe/north_arrow_path',
default_north_arrow_path(),
type=str)
else:
# Set the north arrow line edit to default one
path = default_north_arrow_path()
self.leNorthArrowPath.setText(path)
开发者ID:dynaryu,项目名称:inasafe,代码行数:14,代码来源:options_dialog.py
示例2: __init__
def __init__(self, iface, template, layer):
"""Constructor for the Composition Report class.
:param iface: Reference to the QGIS iface object.
:type iface: QgsAppInterface
:param template: The QGIS template path.
:type template: str
"""
LOGGER.debug('InaSAFE Impact Report class initialised')
self._iface = iface
self._template = template
self._layer = layer
self._extent = self._iface.mapCanvas().extent()
self._page_dpi = 300.0
self._safe_logo = resources_path(
'img', 'logos', 'inasafe-logo-url.svg')
self._organisation_logo = default_organisation_logo_path()
self._north_arrow = default_north_arrow_path()
self._disclaimer = disclaimer()
# For QGIS < 2.4 compatibility
# QgsMapSettings is added in 2.4
if qgis_version() < 20400:
map_settings = self._iface.mapCanvas().mapRenderer()
else:
map_settings = self._iface.mapCanvas().mapSettings()
self._template_composition = TemplateComposition(
template_path=self.template,
map_settings=map_settings)
self._keyword_io = KeywordIO()
开发者ID:NyakudyaA,项目名称:inasafe,代码行数:32,代码来源:impact_report.py
示例3: set_north_arrow
def set_north_arrow(self):
"""Auto-connect slot activated when north arrow checkbox is toggled."""
is_checked = self.custom_north_arrow_checkbox.isChecked()
if is_checked:
# Show previous north arrow path
path = setting(
key='north_arrow_path',
default=default_north_arrow_path(),
expected_type=str,
qsettings=self.settings)
else:
# Set the north arrow line edit to default one
path = default_north_arrow_path()
self.leNorthArrowPath.setText(path)
self.splitter_north_arrow.setEnabled(is_checked)
开发者ID:inasafe,项目名称:inasafe,代码行数:16,代码来源:options_dialog.py
示例4: __init__
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()
开发者ID:timlinux,项目名称:inasafe,代码行数:9,代码来源:impact_report.py
示例5: test_setup_dialog
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'])
开发者ID:inasafe,项目名称:inasafe,代码行数:57,代码来源:test_options_dialog.py
示例6: north_arrow
def north_arrow(self, north_arrow_path):
"""Set image that will be used as north arrow in reports.
:param north_arrow_path: Path to the north arrow image.
:type north_arrow_path: str
"""
if isinstance(north_arrow_path, str) and os.path.exists(north_arrow_path):
self._north_arrow = north_arrow_path
else:
self._north_arrow = default_north_arrow_path()
开发者ID:ekaakurniawan,项目名称:jaksafe,代码行数:10,代码来源:impact_report.py
示例7: restore_state
def restore_state(self):
"""Reinstate the options based on the user's stored session info.
"""
settings = QtCore.QSettings()
# flag = settings.value(
# 'inasafe/useThreadingFlag', False)
# hack set use thread to false see #557
flag = False
self.cbxUseThread.setChecked(flag)
flag = bool(settings.value(
'inasafe/visibleLayersOnlyFlag', True, type=bool))
self.cbxVisibleLayersOnly.setChecked(flag)
flag = bool(settings.value(
'inasafe/set_layer_from_title_flag', True, type=bool))
self.cbxSetLayerNameFromTitle.setChecked(flag)
flag = bool(settings.value(
'inasafe/setZoomToImpactFlag', True, type=bool))
self.cbxZoomToImpact.setChecked(flag)
# whether exposure layer should be hidden after model completes
flag = bool(settings.value(
'inasafe/setHideExposureFlag', False, type=bool))
self.cbxHideExposure.setChecked(flag)
flag = bool(settings.value(
'inasafe/clip_hard', False, type=bool))
self.cbxClipHard.setChecked(flag)
flag = bool(settings.value(
'inasafe/useSentry', False, type=bool))
self.cbxUseSentry.setChecked(flag)
flag = bool(settings.value(
'inasafe/show_intermediate_layers', False, type=bool))
self.cbxShowPostprocessingLayers.setChecked(flag)
ratio = self.defaults['FEMALE_RATIO']
self.dsbFemaleRatioDefault.setValue(ratio)
path = settings.value(
'inasafe/keywordCachePath',
self.keyword_io.default_keyword_db_path(), type=str)
self.leKeywordCachePath.setText(path)
flag = bool(settings.value(
'inasafe/template_warning_verbose', True, type=bool))
self.template_warning_checkbox.setChecked(flag)
# Restore Organisation Logo Path
org_logo_path = 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_path = 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)
# Restore Show Organisation Logo in Dock Flag
flag = bool(settings.value(
'inasafe/showOrganisationLogoInDockFlag', False, type=bool))
self.organisation_on_dock_checkbox.setChecked(flag)
# Restore North Arrow Image Path
north_arrow_path = 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 = 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 = 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)
#.........这里部分代码省略.........
开发者ID:dynaryu,项目名称:inasafe,代码行数:101,代码来源:options_dialog.py
示例8: restore_state
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()
开发者ID:ismailsunni,项目名称:inasafe,代码行数:71,代码来源:options_dialog.py
示例9: restore_state
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)
#.........这里部分代码省略.........
开发者ID:inasafe,项目名称:inasafe,代码行数:101,代码来源:options_dialog.py
示例10: test_default_north_arrow_path
def test_default_north_arrow_path(self):
"""Verify the call to default north arrow path works."""
# Check if it exists
path = QFile(default_north_arrow_path())
self.assertTrue(QFile.exists(path))
开发者ID:inasafe,项目名称:inasafe,代码行数:5,代码来源:test_defaults.py
示例11: join
'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': '[email protected]',
'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()
}
开发者ID:inasafe,项目名称:inasafe,代码行数:30,代码来源:default_settings.py
注:本文中的safe.defaults.default_north_arrow_path函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论