'What happens when the user clicks the open report button.
A dialog will present itself with a combobox to select a plugin.
Then a file chooser to select a report. The report will be processed
with the selected plugin.'

def on_open_report_button(self, action, param):

    def select_plugin():
        'Creates    a    simple    dialog    with    a    combo    box    to    select    a    plugin'
        plugins_id = [_id for _id in self.plugin_manager.getPlugins()]
        plugins_id = sorted(plugins_id, key=(lambda s: s.lower()))
        dialog = Gtk.Dialog('Select    plugin', self.window, 0)
        combo_box = Gtk.ComboBoxText()
        combo_box.set_wrap_width(3)
        for plugin_id in plugins_id:
            combo_box.append_text(plugin_id)
        combo_box.show()
        dialog.vbox.pack_start(combo_box, False, True, 10)
        dialog.add_button('Cancel', Gtk.ResponseType.DELETE_EVENT)
        dialog.add_button('OK', Gtk.ResponseType.ACCEPT)
        response = dialog.run()
        selected = combo_box.get_active_text()
        dialog.destroy()
        return (response, selected)
    def on_file_selected(plugin_id, report):
        'Send    the    plugin_id    and    the    report    file    to    be    processed'
        self.report_manager.sendReportToPluginById(plugin_id, report)
    (plugin_response, plugin_id) = select_plugin()
    while ((plugin_response == Gtk.ResponseType.ACCEPT) and (plugin_id is None)):
        errorDialog(self.window, 'Please    select    a    plugin    to    parse    your    report!')
        (plugin_response, plugin_id) = select_plugin()
    else:
        if (plugin_response == Gtk.ResponseType.ACCEPT):
            dialog = Gtk.FileChooserDialog(title='Import    a    report', parent=self.window, action=Gtk.FileChooserAction.OPEN, buttons=('Open', Gtk.ResponseType.ACCEPT, 'Cancel', Gtk.ResponseType.CANCEL))
            dialog.set_modal(True)
            res = dialog.run()
            if (res == Gtk.ResponseType.ACCEPT):
                on_file_selected(plugin_id, dialog.get_filename())
            dialog.destroy()
