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 = None self.template = template self._layer = layer self._extent = self._iface.mapCanvas().extent() self._page_dpi = 300.0 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() # 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()
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._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() # 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()
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 test_white_inasafe_logo_path(self): """Verify the call to default InaSAFE logo path works. """ # Check if it exists logo_path = QFile(white_inasafe_logo_path()) self.assertTrue(QFile.exists(logo_path))
def __init__(self, parent=None, iface=None): """Constructor for dialog. :param parent: Optional widget to use as parent :type parent: QWidget :param iface: An instance of QGisInterface :type iface: QGisInterface """ QDialog.__init__(self, parent) self.parent = parent self.setupUi(self) self.setWindowTitle(self.tr('InaSAFE Impact Layer Merge Tool')) self.iface = iface self.keyword_io = KeywordIO() # Template Path for composer self.template_path = resources_path( 'qgis-composer-templates', 'merged_report.qpt') # Safe Logo Path self.safe_logo_path = white_inasafe_logo_path() # Organisation Logo Path - defaults to supporters logo, will be # updated to user defined organisation logo path in read_settings in # user has specified a custom logo. self.organisation_logo_path = supporters_logo_path() # Disclaimer text self.disclaimer = disclaimer() # The output directory self.out_dir = None # Stored information from first impact layer self.first_impact = { 'layer': None, 'map_title': None, 'hazard_title': None, 'exposure_title': None, 'postprocessing_report': None, } # Stored information from second impact layer self.second_impact = { 'layer': None, 'map_title': None, 'hazard_title': None, 'exposure_title': None, 'postprocessing_report': None, } # Stored information from aggregation layer self.aggregation = { 'layer': None, 'aggregation_attribute': None } # Available aggregation layer self.available_aggregation = [] # The summary report, contains report for each aggregation area self.summary_report = OrderedDict() # The html reports and its file path self.html_reports = OrderedDict() # A boolean flag whether to merge entire area or aggregated self.entire_area_mode = False # Get the global settings and override some variable if exist self.read_settings() # Get all current project layers for combo box self.get_project_layers() # Set up things for context help self.help_button = self.button_box.button(QtGui.QDialogButtonBox.Help) # Allow toggling the help button self.help_button.setCheckable(True) self.help_button.toggled.connect(self.help_toggled) self.main_stacked_widget.setCurrentIndex(1) # Show usage info self.restore_state()
time_title_header, caution_title_header, caution_text, source_title_header, analysis_title_header, version_title_header, reference_title_header, unknown_source_text, aggregation_not_used_text, crs_text] """Image elements""" white_inasafe_logo_path = { 'id': 'inasafe-logo-white', 'path': white_inasafe_logo_path() } black_inasafe_logo_path = { 'id': 'inasafe-logo-black', 'path': black_inasafe_logo_path() } inasafe_north_arrow_path = { 'id': 'north-arrow-logo', 'path': setting('north_arrow_path'), 'setting_key': 'north_arrow_path' } inasafe_organisation_logo_path = { 'id': 'organisation-logo',
def __init__(self, parent=None, iface=None): """Constructor for dialog. :param parent: Optional widget to use as parent :type parent: QWidget :param iface: An instance of QGisInterface :type iface: QGisInterface """ QDialog.__init__(self, parent) self.parent = parent self.setupUi(self) self.setWindowTitle(self.tr('InaSAFE Impact Layer Merge Tool')) self.iface = iface self.keyword_io = KeywordIO() # Template Path for composer self.template_path = resources_path('qgis-composer-templates', 'merged_report.qpt') # Safe Logo Path self.safe_logo_path = white_inasafe_logo_path() # Organisation Logo Path - defaults to supporters logo, will be # updated to user defined organisation logo path in read_settings in # user has specified a custom logo. self.organisation_logo_path = supporters_logo_path() # Disclaimer text self.disclaimer = disclaimer() # The output directory self.out_dir = None # Stored information from first impact layer self.first_impact = { 'layer': None, 'map_title': None, 'hazard_title': None, 'exposure_title': None, 'postprocessing_report': None, } # Stored information from second impact layer self.second_impact = { 'layer': None, 'map_title': None, 'hazard_title': None, 'exposure_title': None, 'postprocessing_report': None, } # Stored information from aggregation layer self.aggregation = {'layer': None, 'aggregation_attribute': None} # Available aggregation layer self.available_aggregation = [] # The summary report, contains report for each aggregation area self.summary_report = OrderedDict() # The html reports and its file path self.html_reports = OrderedDict() # A boolean flag whether to merge entire area or aggregated self.entire_area_mode = False # Get the global settings and override some variable if exist self.read_settings() # Get all current project layers for combo box self.get_project_layers() # Set up things for context help self.help_button = self.button_box.button(QtGui.QDialogButtonBox.Help) # Allow toggling the help button self.help_button.setCheckable(True) self.help_button.toggled.connect(self.help_toggled) self.main_stacked_widget.setCurrentIndex(1) # Show usage info self.restore_state()
def test_white_inasafe_logo_path(self): """Verify the call to default InaSAFE logo path works.""" # Check if it exists logo_path = QFile(white_inasafe_logo_path()) self.assertTrue(QFile.exists(logo_path))
time_title_header, caution_title_header, caution_text, source_title_header, analysis_title_header, version_title_header, reference_title_header, unknown_source_text, aggregation_not_used_text, crs_text] """Image elements""" white_inasafe_logo_path = { 'id': 'inasafe-logo-white', 'path': white_inasafe_logo_path() } black_inasafe_logo_path = { 'id': 'inasafe-logo-black', 'path': black_inasafe_logo_path() } inasafe_north_arrow_path = { 'id': 'north-arrow-logo', 'path': default_north_arrow_path() } inasafe_organisation_logo_path = { 'id': 'organisation-logo', # We default to the supporters logo, but an org can change to their logo