本文整理汇总了Python中safe.utilities.resources.html_header函数的典型用法代码示例。如果您正苦于以下问题:Python html_header函数的具体用法?Python html_header怎么用?Python html_header使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了html_header函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: show_info
def show_info(self):
"""Show usage text to the user."""
header = html_header()
footer = html_footer()
string = header
heading = m.Heading(self.tr('Shakemap Grid Importer'), **INFO_STYLE)
body = self.tr(
'This tool will convert an earthquake \'shakemap\' that is in '
'grid xml format to a GeoTIFF file. The imported file can be used '
'in InaSAFE as an input for impact functions that require and '
'earthquake layer. To use this tool effectively:'
)
tips = m.BulletedList()
tips.add(self.tr(
'Select a grid.xml for the input layer.'))
tips.add(self.tr(
'Choose where to write the output layer to.'
))
tips.add(self.tr(
'Choose the interpolation algorithm that should be used when '
'converting the xml grid to a raster. If unsure keep the default.'
))
tips.add(self.tr(
'If you want to obtain shake data you can get it for free from '
'the USGS shakemap site: '
'http://earthquake.usgs.gov/earthquakes/shakemap/list.php?y=2013'))
message = m.Message()
message.add(heading)
message.add(body)
message.add(tips)
string += message.to_html()
string += footer
self.webView.setHtml(string)
示例2: show_info
def show_info(self):
"""Show usage info to the user."""
# Read the header and footer html snippets
header = html_header()
footer = html_footer()
string = header
heading = m.Heading(self.tr('User Extents Tool'), **INFO_STYLE)
body = self.tr(
'This tool allows you to specify exactly which geographical '
'region should be used for your analysis. You can either '
'enter the coordinates directly into the input boxes below '
'(using the same CRS as the canvas is currently set to), or '
'you can interactively select the area by using the \'select '
'on map\' button - which will temporarily hide this window and '
'allow you to drag a rectangle on the map. After you have '
'finished dragging the rectangle, this window will reappear. '
'If you enable the \'Toggle scenario outlines\' tool on the '
'InaSAFE toolbar, your user defined extent will be shown on '
'the map as a blue rectangle. Please note that when running '
'your analysis, the effective analysis extent will be the '
'intersection of the hazard extent, exposure extent and user '
'extent - thus the entire user extent area may not be used for '
'analysis.'
)
message = m.Message()
message.add(heading)
message.add(body)
string += message.to_html()
string += footer
self.web_view.setHtml(string)
示例3: show_current_metadata
def show_current_metadata(self):
"""Show metadata of the current selected layer."""
LOGGER.debug('Showing layer: ' + self.layer.name())
keywords = KeywordIO(self.layer)
content_html = keywords.to_message().to_html()
full_html = html_header() + content_html + html_footer()
self.metadata_preview_web_view.setHtml(full_html)
示例4: show_info
def show_info(self):
"""Show usage info to the user."""
# Read the header and footer html snippets
header = html_header()
footer = html_footer()
string = header
heading = m.Heading(self.tr('OSM Downloader'), **INFO_STYLE)
body = self.tr(
'This tool will fetch building (\'structure\') or road ('
'\'highway\') data from the OpenStreetMap project for you. '
'The downloaded data will have InaSAFE keywords defined and a '
'default QGIS style applied. To use this tool effectively:'
)
tips = m.BulletedList()
tips.add(self.tr(
'Your current extent, when opening this window, will be used to '
'determine the area for which you want data to be retrieved.'
'You can interactively select the area by using the '
'\'select on map\' button - which will temporarily hide this '
'window and allow you to drag a rectangle on the map. After you '
'have finished dragging the rectangle, this window will '
'reappear.'))
tips.add(self.tr(
'Check the output directory is correct. Note that the saved '
'dataset will be called either roads.shp or buildings.shp (and '
'associated files).'
))
tips.add(self.tr(
'By default simple file names will be used (e.g. roads.shp, '
'buildings.shp). If you wish you can specify a prefix to '
'add in front of this default name. For example using a prefix '
'of \'padang-\' will cause the downloaded files to be saved as '
'\'padang-roads.shp\' and \'padang-buildings.shp\'. Note that '
'the only allowed prefix characters are A-Z, a-z, 0-9 and the '
'characters \'-\' and \'_\'. You can leave this blank if you '
'prefer.'
))
tips.add(self.tr(
'If a dataset already exists in the output directory it will be '
'overwritten.'
))
tips.add(self.tr(
'This tool requires a working internet connection and fetching '
'buildings or roads will consume your bandwidth.'))
tips.add(m.Link(
'http://www.openstreetmap.org/copyright',
text=self.tr(
'Downloaded data is copyright OpenStreetMap contributors'
' (click for more info).')
))
message = m.Message()
message.add(heading)
message.add(body)
message.add(tips)
string += message.to_html()
string += footer
self.web_view.setHtml(string)
示例5: test_html_header
def test_html_header(self):
"""Test that we can get the html header.
.. versionadded:: 3.0
"""
header = html_header()
self.assertTrue(
'bootstrap' in header,
'bootstrap not in ' + header)
示例6: show_messages
def show_messages(self):
"""Show all messages."""
if isinstance(self.static_message, MessageElement):
# Handle sent Message instance
string = html_header()
if self.static_message is not None:
string += self.static_message.to_html()
# Keep track of the last ID we had so we can scroll to it
self.last_id = 0
for message in self.dynamic_messages:
if message.element_id is None:
self.last_id += 1
message.element_id = str(self.last_id)
html = message.to_html(in_div_flag=True)
if html is not None:
string += html
string += html_footer()
elif (isinstance(self.static_message, str) or
isinstance(self.static_message, unicode)):
# Handle sent text directly
string = self.static_message
elif not self.static_message:
# handle dynamic message
# Handle sent Message instance
string = html_header()
# Keep track of the last ID we had so we can scroll to it
self.last_id = 0
for message in self.dynamic_messages:
if message.element_id is None:
self.last_id += 1
message.element_id = str(self.last_id)
html = message.to_html(in_div_flag=True)
if html is not None:
string += html
string += html_footer()
# Set HTML
self.load_html(HTML_STR_MODE, string)
示例7: show_help
def show_help(self):
"""Show usage info to the user."""
# Read the header and footer html snippets
self.main_stacked_widget.setCurrentIndex(0)
header = html_header()
footer = html_footer()
message = metadata_converter_help()
string = header
string += message.to_html()
string += footer
self.help_web_view.setHtml(string)
示例8: save_log_to_html
def save_log_to_html(self):
"""Helper to write the log out as an html file."""
html = html_header()
html += (
'<img src="file:///%s/img/logos/inasafe-logo-url.png" '
'title="InaSAFE Logo" alt="InaSAFE Logo" />' % resources_path())
html += ('<h5 class="info"><i class="icon-info-sign icon-white"></i> '
'%s</h5>' % self.tr('Analysis log'))
for item in self.dynamic_messages_log:
html += "%s\n" % item.to_html()
html += html_footer()
if self.log_path is not None:
html_to_file(html, self.log_path)
else:
msg = self.tr('log_path is not set')
raise InvalidParameterError(msg)
示例9: show_info
def show_info(self):
"""Show usage info to the user."""
# Read the header and footer html snippets
header = html_header()
footer = html_footer()
string = header
heading = m.Heading(self.tr('Impact Layer Merge Tool'), **INFO_STYLE)
body = self.tr(
'This tool will merge the outputs from two impact maps for the '
'same area. The maps must be created using the same aggregation '
'areas and same hazard. To use:'
)
tips = m.BulletedList()
tips.add(self.tr(
'Run an impact assessment for an area using aggregation. e.g.'
'Flood Impact on Buildings aggregated by municipal boundaries.'))
tips.add(self.tr(
'Run a second impact assessment for the same area using the same '
'aggregation. e.g. Flood Impact on People aggregated by '
'municipal boundaries.'))
tips.add(self.tr(
'Open this tool and select each impact layer from the pick lists '
'provided below.'))
tips.add(self.tr(
'Select the aggregation layer that was used to generate the '
'first and second impact layer.'))
tips.add(self.tr(
'Select an output directory.'))
tips.add(self.tr(
'Check "Use customized report template" checkbox and select the '
'report template file if you want to use your own template. Note '
'that all the map composer components that are needed must be '
'fulfilled.'))
tips.add(self.tr(
'Click OK to generate the per aggregation area combined '
'summaries.'))
message = m.Message()
message.add(heading)
message.add(body)
message.add(tips)
string += message.to_html()
string += footer
self.web_view.setHtml(string)
示例10: show_help
def show_help(self):
"""Show usage info to the user.
.. versionadded: 3.3
"""
# Read the header and footer html snippets
self.main_stacked_widget.setCurrentIndex(0)
header = html_header()
footer = html_footer()
string = header
message = peta_jakarta_help()
string += message.to_html()
string += footer
self.help_web_view.setHtml(string)
示例11: show_messages
def show_messages(self):
"""Show all messages."""
string = html_header()
if self.static_message is not None:
string += self.static_message.to_html()
# Keep track of the last ID we had so we can scroll to it
self.last_id = 0
for message in self.dynamic_messages:
if message.element_id is None:
self.last_id += 1
message.element_id = str(self.last_id)
html = message.to_html(in_div_flag=True)
if html is not None:
string += html
string += html_footer()
# Set HTML
self.load_html(HTML_STR_MODE, string)
示例12: update_warning
def update_warning(self):
"""Update warning message and enable/disable Ok button."""
if len(self.warning_text) == 0:
self.button_box.button(QDialogButtonBox.Ok).setEnabled(True)
return
header = html_header()
footer = html_footer()
string = header
heading = m.Heading(self.tr('Shakemap Grid Importer'), **INFO_STYLE)
tips = m.BulletedList()
self.button_box.button(QDialogButtonBox.Ok).setEnabled(False)
message = m.Message()
message.add(heading)
for warning in self.warning_text:
tips.add(warning)
message.add(tips)
string += message.to_html()
string += footer
self.info_web_view.setHtml(string)
示例13: __init__
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('InaSAFE %s Help' % get_version()))
self.parent = parent
header = html_header()
footer = html_footer()
string = header
message = dock_help()
string += message.to_html()
string += footer
self.help_web_view.setHtml(string)
示例14: show_help
def show_help(self, wizard_step):
"""Set wizard step and show the help text."""
self.wizard_step = wizard_step
header = html_header()
footer = html_footer()
content = header
message = self.wizard_step.help()
content += message.to_html()
content += footer
self.help_web_view.setHtml(content)
# Store buttons' state
self.next_button_state = self.parent.pbnNext.isEnabled()
self.back_button_state = self.parent.pbnBack.isEnabled()
# Disable those buttons
self.parent.pbnNext.setEnabled(False)
self.parent.pbnBack.setEnabled(False)
示例15: show_info
def show_info(self):
"""Show basic usage instructions."""
header = html_header()
footer = html_footer()
string = header
heading = m.Heading(self.tr('Minimum Needs Calculator'), **INFO_STYLE)
body = self.tr(
'This tool will calculated minimum needs for evacuated people. To '
'use this tool effectively:'
)
tips = m.BulletedList()
tips.add(self.tr(
'Load a polygon layer in QGIS. Typically the layer will '
'represent administrative districts where people have gone to an '
'evacuation center.'))
tips.add(self.tr(
'Ensure that the layer has an INTEGER attribute for the number of '
'displaced people associated with each feature.'
))
tips.add(self.tr(
'Use the pick lists below to select the layer and the population '
'field and then press \'OK\'.'
))
tips.add(self.tr(
'A new layer will be added to QGIS after the calculation is '
'complete. The layer will contain the minimum needs per district '
'/ administrative boundary.'))
message = m.Message()
message.add(heading)
message.add(body)
message.add(tips)
string += message.to_html()
string += footer
self.webView.setHtml(string)