Beispiel #1
0
    def __createMenu(self):
        file_menu = self.menuBar().addMenu("&File")
        file_menu.addAction("Close", self.close)
        self.__view_menu = self.menuBar().addMenu("&View")
        self.__help_menu = self.menuBar().addMenu("&Help")
        """:type: QMenu"""
        """ @rtype: list of QAction """
        show_about = self.__help_menu.addAction("About")
        show_about.setMenuRole(QAction.ApplicationSpecificRole)
        show_about.triggered.connect(self.__showAboutMessage)

        if sys.version_info.major >= 3:
            pm = ErtPluginManager()
            help_links = pm.get_help_links()
        else:
            with pkg_resources.resource_stream(
                    "ert_gui",
                    os.path.join("resources", "gui", "help",
                                 "help_links.yml")) as stream:
                help_links = yaml.safe_load(stream)

        for menu_label, link in help_links.items():
            help_link_item = self.__help_menu.addAction(menu_label)
            help_link_item.setMenuRole(QAction.ApplicationSpecificRole)
            help_link_item.triggered.connect(
                functools.partial(webbrowser.open, link))
Beispiel #2
0
 def test_plugin_manager_python_2(self):
     pm = ErtPluginManager()
     self.assertEqual(pm.get_installable_workflow_jobs(), None)
     self.assertEqual(pm.get_installable_jobs(), None)
     self.assertEqual(pm.get_flow_config_path(), None)
     self.assertEqual(pm.get_ecl100_config_path(), None)
     self.assertEqual(pm.get_ecl300_config_path(), None)
     self.assertEqual(pm.get_rms_config_path(), None)
     self.assertEqual(pm.get_help_links(), None)
     self.assertEqual(pm.get_site_config_content(), None)
Beispiel #3
0
    def test_with_plugins(self):
        pm = ErtPluginManager(
            plugins=[ert_shared.hook_implementations, dummy_plugins])
        self.assertDictEqual(
            {
                "GitHub page": "https://github.com/equinor/ert",
                "test": "test",
                "test2": "test",
            },
            pm.get_help_links(),
        )
        self.assertEqual("/dummy/path/flow_config.yml",
                         pm.get_flow_config_path())
        self.assertEqual("/dummy/path/rms_config.yml",
                         pm.get_rms_config_path())
        self.assertEqual("/dummy/path/ecl100_config.yml",
                         pm.get_ecl100_config_path())
        self.assertEqual("/dummy/path/ecl300_config.yml",
                         pm.get_ecl300_config_path())

        self.assertIn(("job1", "/dummy/path/job1"),
                      pm.get_installable_jobs().items())
        self.assertIn(("job2", "/dummy/path/job2"),
                      pm.get_installable_jobs().items())
        self.assertIn(
            ("wf_job1", "/dummy/path/wf_job1"),
            pm._get_config_workflow_jobs().items(),
        )
        self.assertIn(
            ("wf_job2", "/dummy/path/wf_job2"),
            pm._get_config_workflow_jobs().items(),
        )

        self.assertListEqual(
            [
                "-- Content below originated from ert (site_config_lines)",
                "JOB_SCRIPT job_dispatch.py",
                "QUEUE_OPTION LOCAL MAX_RUNNING 1",
                "ANALYSIS_LOAD RML_ENKF rml_enkf.{}".format(_lib_extension),
                "-- Content below originated from dummy (site_config_lines)",
                "JOB_SCRIPT job_dispatch_dummy.py",
                "QUEUE_OPTION LOCAL MAX_RUNNING 2",
            ],
            pm._site_config_lines(),
        )
Beispiel #4
0
    def __createMenu(self):
        file_menu = self.menuBar().addMenu("&File")
        file_menu.addAction("Close", self.close)
        self.__view_menu = self.menuBar().addMenu("&View")
        self.__help_menu = self.menuBar().addMenu("&Help")
        """:type: QMenu"""
        """ @rtype: list of QAction """
        show_about = self.__help_menu.addAction("About")
        show_about.setMenuRole(QAction.ApplicationSpecificRole)
        show_about.triggered.connect(self.__showAboutMessage)

        pm = ErtPluginManager()
        help_links = pm.get_help_links()

        for menu_label, link in help_links.items():
            help_link_item = self.__help_menu.addAction(menu_label)
            help_link_item.setMenuRole(QAction.ApplicationSpecificRole)
            help_link_item.triggered.connect(
                functools.partial(webbrowser.open, link))
Beispiel #5
0
    def test_no_plugins(self):
        pm = ErtPluginManager(plugins=[ert_shared.hook_implementations])
        self.assertDictEqual({"GitHub page": "https://github.com/equinor/ert"},
                             pm.get_help_links())
        self.assertIsNone(pm.get_flow_config_path())
        self.assertIsNone(pm.get_ecl100_config_path())
        self.assertIsNone(pm.get_ecl300_config_path())
        self.assertIsNone(pm.get_rms_config_path())

        self.assertLess(0, len(pm.get_installable_jobs()))
        self.assertLess(0, len(pm.get_installable_workflow_jobs()))

        self.assertListEqual(
            [
                "-- Content below originated from ert (site_config_lines)",
                "JOB_SCRIPT job_dispatch.py",
                "QUEUE_OPTION LOCAL MAX_RUNNING 1",
            ],
            pm._site_config_lines(),
        )