Esempio n. 1
0
    def test___filter_jobs___One_ignored___Return_non_ignored_jobs(self):

        non_ignored = JobModel(Job('eric', JobStatus.FAILING), False)
        ignored = JobModel(Job('terry', JobStatus.FAILING), True)

        jobs_filter = IgnoreJobsFilter()
        result = jobs_filter.filter_jobs([non_ignored, ignored])

        self.assertEqual([non_ignored], result)
Esempio n. 2
0
    def test___filter_jobs___Nothing_ignored___Return_unmodified_list(self):

        job_models = [JobModel(Job('eric', JobStatus.FAILING), False),
                      JobModel(Job('terry', JobStatus.FAILING), False)]

        jobs_filter = IgnoreJobsFilter()
        result = jobs_filter.filter_jobs(job_models)

        self.assertEqual(job_models, result)
Esempio n. 3
0
    def __init__(self, parent, media_files, show_controls_action,
                 show_jenkins_action, quit_action, jobs_model):

        self._show_controls_action = show_controls_action
        self._show_jenkins_action = show_jenkins_action

        self._tray_menu = QtGui.QMenu(parent)
        self._tray_menu.addAction(show_controls_action)
        self._tray_menu.addAction(show_jenkins_action)
        self._tray_menu.addAction(quit_action)

        self._tray_icon = QtGui.QSystemTrayIcon(parent)
        self._tray_icon.setContextMenu(self._tray_menu)
        self._tray_icon.messageClicked.connect(self._on_message_clicked)
        self._tray_icon.activated.connect(self._on_activated)

        tray_icon_view = gui.status.TrayIconView(self._tray_icon)
        tray_icon_view_adapter = gui.status.TrayIconViewAdapter(
            tray_icon_view, media_files)
        status_view = gui.status.MultiView([
            tray_icon_view_adapter,
            gui.status.SoundView(parent, media_files)
        ])
        self.status_model = StatusModel(jobs_model, IgnoreJobsFilter())
        self.status_presenter = StatusPresenter(self.status_model, status_view)
        status_view.set_status(JobStatus.UNKNOWN, None)

        self._tray_icon.show()