Example #1
0
    def __init__(self, parent=None):
        self.parent = parent
        super(AboutWidget, self).__init__()
        self.setupUi(self)

        self.logo_geopublichealth.setPixmap(QPixmap(resource('icon-100.png')))
        self.logo_ird.setPixmap(QPixmap(resource('logo_ird.png')))
        self.logo_umr.setPixmap(QPixmap(resource('espace-dev.png')))
Example #2
0
    def __init__(self, parent=None):
        self.parent = parent
        super(AboutWidget, self).__init__()
        self.setupUi(self)

        self.logo_geopublichealth.setPixmap(QPixmap(resource('icon-100.png')))
        self.logo_ird.setPixmap(QPixmap(resource('logo_ird.png')))
        self.logo_umr.setPixmap(QPixmap(resource('espace-dev.png')))
Example #3
0
    def initGui(self):
        self.initProcessing()
        self.plugin_menu = self.iface.pluginMenu()

        # Main window
        icon = QIcon(resource('icon-32.png'))
        self.main_action = QAction(icon, 'GeoPublicHealth',
                                   self.iface.mainWindow())
        self.plugin_menu.addAction(self.main_action)
        # noinspection PyUnresolvedReferences
        self.main_action.triggered.connect(self.open_main_window)
        self.iface.addPluginToMenu("GeoPublicHealth", self.main_action)
Example #4
0
 def getIcon(self):
     return QIcon(resource('icon-32.png'))
    def __init__(self, parent=None):
        """Constructor."""
        QDialog.__init__(self)
        self.parent = parent
        self.setupUi(self)

        self.menu.clicked.connect(self.expand)
        self.menu.clicked.connect(self.display_content)

        self.tree_menu = [
            {
                'label': 'Import',
                'icon': resource('import.png'),
                'content': [
                    {
                        'label': 'Shapefile',
                        'icon': resource('shp.png'),
                        'content': {
                            'widget': OpenShapefileWidget(),
                            'help': help_open_shapefile()
                        }
                    }, {
                        'label': 'Raster',
                        'icon': resource('raster.png'),
                        'content': {
                            'widget': OpenRasterWidget(),
                            'help': help_open_raster()
                        }
                    }, {
                        'label': 'Table XLS/DBF',
                        'icon': resource('xls.png'),
                        'content': {
                            'widget': OpenXlsDbfFileWidget(),
                            'help': help_open_table()
                        }
                    }, {
                        'label': 'Table CSV',
                        'icon': resource('csv.png'),
                        'content': {
                            'widget': OpenCsv(),
                            'help': help_open_csv()
                        }
                    }, {
                        'label': 'XY to map',
                        'icon': resource('xy.png'),
                        'content': {
                            'widget': OpenCsv(),
                            'help': help_open_csv()
                        }
                    }
                ]
            }, {
                'label': 'Analyse',
                'icon': resource('gears.png'),
                'content': [
                    {
                        'label': 'Blur',
                        'icon': resource('blur.png'),
                        'content': [
                            {
                                'label': 'Blur',
                                'icon': resource('blur.png'),
                                'content': {
                                    'widget': BlurWidget(),
                                    'help': help_blur()
                                }
                            }, {
                                'label': 'Stats',
                                'icon': resource('sigma.png'),
                                'content': {
                                    'widget': StatsWidget(),
                                    'help': help_stats_blurring()
                                }
                            }
                        ]
                    }, {
                        'label': 'Autocorrelation',
                        'icon':resource('autocorrelation.png'),
                        'content': [
                            {
                                'label': 'Polygon layer only',
                                'icon': resource('autocorrelation.png'),
                                'content': {
                                    'widget': AutocorrelationDialog(),
                                    'help': help_autocorrelation()
                                }
                            }
                        ]
                    }, {
                        'label': 'Composite Index',
                        'icon': resource('composite_index.png'),
                        'content': [
                            {
                                'label': 'Polygon layer only',
                                'icon': resource('composite_index.png'),
                                'content': {
                                    'widget': CompositeIndexDialog(),
                                    'help': help_composite_index()
                                }
                            }
                        ]
                    }, {
                        'label': 'Incidence',
                        'icon': resource('incidence.png'),
                        'content': [
                            {
                                'label': 'Polygon layer only',
                                'icon': resource('incidence.png'),
                                'content': {
                                    'widget': IncidenceDialog(),
                                    'help': help_incidence()
                                }
                            }, {
                                'label': 'Case and aggregation layers',
                                'icon': resource('incidence.png'),
                                'content': {
                                    'widget': IncidencePointDialog(),
                                    'help': help_incidence_point()
                                }
                            }
                        ]
                    }, {
                        'label': 'Density',
                        'icon': resource('incidence.png'),
                        'content': [
                            {
                                'label': 'Polygon layer only',
                                'icon': resource('incidence.png'),
                                'content': {
                                    'widget': DensityDialog(),
                                    'help': help_density()
                                }
                            }, {
                                'label': 'Case and aggregation layers',
                                'icon': resource('incidence.png'),
                                'content': {
                                    'widget': DensityPointDialog(),
                                    'help': help_density_point()
                                }
                            }
                        ]
                    }
                ]
            },
            {
                'label': 'Export',
                'icon': resource('export.png'),
                'content': [
                    {
                        'label': 'Attribute table',
                        'icon': resource('csv.png'),
                        'content': {
                            'widget': CsvExport(),
                            'help': help_attribute_table()
                        }
                    },

                    {  # ajoute par Rachel Goree 30/05/2017
                        'label': 'KML',
                        'icon': resource('kml.png'),
                        'content': {
                            'widget': KmlExport(),
                            'help': help_export_kml()
                        }
                    }
                ]
            }
        ]

        self.stack.addWidget(AboutWidget())

        self.help_list = []

        # A category is import, process and export.
        for category_def in self.tree_menu:
            category_menu = QTreeWidgetItem(self.menu)
            category_menu.setIcon(0, QIcon(category_def['icon']))
            category_menu.setText(0, category_def['label'])

            # Sub item
            for sub_category_def in category_def['content']:
                menu_entry = QTreeWidgetItem(category_menu)
                menu_entry.setIcon(0, QIcon(sub_category_def['icon']))
                menu_entry.setText(0, sub_category_def['label'])

                # Add widget or add tab
                if isinstance(sub_category_def['content'], dict):
                    widget = sub_category_def['content']['widget']
                    self.stack.addWidget(widget)
                    self.help_list.append(sub_category_def['content']['help'])
                else:
                    tab = QTabWidget(self.stack)
                    tab.setIconSize(QSize(32, 32))
                    self.stack.addWidget(tab)

                    tab_help = []
                    tab_bar = sub_category_def['content']
                    for item in tab_bar:
                        label = item['label']
                        icon = QIcon(item['icon'])
                        widget = item['content']['widget']
                        help_widget = item['content']['help']
                        tab_help.append(help_widget)
                        tab.addTab(widget, icon, label)
                    self.help_list.append(tab_help)

        self.stack.setCurrentIndex(1)

        # https://github.com/Gustry/GeoPublicHealth/issues/20
        self.menu.setAttribute(Qt.WA_MacShowFocusRect, False)
Example #6
0
    def __init__(self, parent=None):
        """Constructor."""
        QDialog.__init__(self)
        self.parent = parent
        self.setupUi(self)

        self.menu.clicked.connect(self.expand)
        self.menu.clicked.connect(self.display_content)

        self.tree_menu = [
            {
                'label':
                'Import',
                'icon':
                resource('import.png'),
                'content': [{
                    'label': 'Shapefile',
                    'icon': resource('shp.png'),
                    'content': {
                        'widget': OpenShapefileWidget(),
                        'help': help_open_shapefile()
                    }
                }, {
                    'label': 'Raster',
                    'icon': resource('raster.png'),
                    'content': {
                        'widget': OpenRasterWidget(),
                        'help': help_open_raster()
                    }
                }, {
                    'label': 'Table XLS/DBF',
                    'icon': resource('xls.png'),
                    'content': {
                        'widget': OpenXlsDbfFileWidget(),
                        'help': help_open_table()
                    }
                }, {
                    'label': 'Table CSV',
                    'icon': resource('csv.png'),
                    'content': {
                        'widget': OpenCsv(),
                        'help': help_open_csv()
                    }
                }, {
                    'label': 'XY to map',
                    'icon': resource('xy.png'),
                    'content': {
                        'widget': OpenCsv(),
                        'help': help_open_csv()
                    }
                }]
            },
            {
                'label':
                'Analyse',
                'icon':
                resource('gears.png'),
                'content': [{
                    'label':
                    'Blur',
                    'icon':
                    resource('blur.png'),
                    'content': [{
                        'label': 'Blur',
                        'icon': resource('blur.png'),
                        'content': {
                            'widget': BlurWidget(),
                            'help': help_blur()
                        }
                    }, {
                        'label': 'Stats',
                        'icon': resource('sigma.png'),
                        'content': {
                            'widget': StatsWidget(),
                            'help': help_stats_blurring()
                        }
                    }]
                }, {
                    'label':
                    'Autocorrelation',
                    'icon':
                    resource('autocorrelation.png'),
                    'content': [{
                        'label': 'Polygon layer only',
                        'icon': resource('autocorrelation.png'),
                        'content': {
                            'widget': AutocorrelationDialog(),
                            'help': help_autocorrelation()
                        }
                    }]
                }, {
                    'label':
                    'Composite Index',
                    'icon':
                    resource('composite_index.png'),
                    'content': [{
                        'label': 'Polygon layer only',
                        'icon': resource('composite_index.png'),
                        'content': {
                            'widget': CompositeIndexDialog(),
                            'help': help_composite_index()
                        }
                    }]
                }, {
                    'label':
                    'Incidence',
                    'icon':
                    resource('incidence.png'),
                    'content': [{
                        'label': 'Polygon layer only',
                        'icon': resource('incidence.png'),
                        'content': {
                            'widget': IncidenceDialog(),
                            'help': help_incidence()
                        }
                    }, {
                        'label': 'Case and aggregation layers',
                        'icon': resource('incidence.png'),
                        'content': {
                            'widget': IncidencePointDialog(),
                            'help': help_incidence_point()
                        }
                    }]
                }, {
                    'label':
                    'Density',
                    'icon':
                    resource('incidence.png'),
                    'content': [{
                        'label': 'Polygon layer only',
                        'icon': resource('incidence.png'),
                        'content': {
                            'widget': DensityDialog(),
                            'help': help_density()
                        }
                    }, {
                        'label': 'Case and aggregation layers',
                        'icon': resource('incidence.png'),
                        'content': {
                            'widget': DensityPointDialog(),
                            'help': help_density_point()
                        }
                    }]
                }]
            },
            {
                'label':
                'Export',
                'icon':
                resource('export.png'),
                'content': [
                    {
                        'label': 'Attribute table',
                        'icon': resource('csv.png'),
                        'content': {
                            'widget': CsvExport(),
                            'help': help_attribute_table()
                        }
                    },
                    {  # ajoute par Rachel Goree 30/05/2017
                        'label': 'KML',
                        'icon': resource('kml.png'),
                        'content': {
                            'widget': KmlExport(),
                            'help': help_export_kml()
                        }
                    }
                ]
            }
        ]

        self.stack.addWidget(AboutWidget())

        self.help_list = []

        # A category is import, process and export.
        for category_def in self.tree_menu:
            category_menu = QTreeWidgetItem(self.menu)
            category_menu.setIcon(0, QIcon(category_def['icon']))
            category_menu.setText(0, category_def['label'])

            # Sub item
            for sub_category_def in category_def['content']:
                menu_entry = QTreeWidgetItem(category_menu)
                menu_entry.setIcon(0, QIcon(sub_category_def['icon']))
                menu_entry.setText(0, sub_category_def['label'])

                # Add widget or add tab
                if isinstance(sub_category_def['content'], dict):
                    widget = sub_category_def['content']['widget']
                    self.stack.addWidget(widget)
                    self.help_list.append(sub_category_def['content']['help'])
                else:
                    tab = QTabWidget(self.stack)
                    tab.setIconSize(QSize(32, 32))
                    self.stack.addWidget(tab)

                    tab_help = []
                    tab_bar = sub_category_def['content']
                    for item in tab_bar:
                        label = item['label']
                        icon = QIcon(item['icon'])
                        widget = item['content']['widget']
                        help_widget = item['content']['help']
                        tab_help.append(help_widget)
                        tab.addTab(widget, icon, label)
                    self.help_list.append(tab_help)

        self.stack.setCurrentIndex(1)

        # https://github.com/Gustry/GeoPublicHealth/issues/20
        self.menu.setAttribute(Qt.WA_MacShowFocusRect, False)
Example #7
0
 def icon(self):
     return QIcon(resource('blur.png'))