Example #1
0
    def create_pop_up(self):
        focus = self.issues_table.listbox.focus
        if not focus:
            return None

        sut = focus.data['sut']
        sut_section = 'sut.' + sut
        if sut not in self.trackers:
            self.trackers[sut] = init_tracker(self.config, sut_section,
                                              self.issues_table.db)

        self.get_pop_up_parameters = super(ReportButton,
                                           self).get_pop_up_parameters
        issue_details = self.issues_table.db.find_issue_by_id(
            focus.data['_id'])
        if isinstance(self.trackers[sut], BugzillaReport):
            popup_cls = BugzillaReportDialog
        elif isinstance(self.trackers[sut], GithubReport):
            popup_cls = GithubReportDialog
        else:
            # If there is no reporter interface for the given tracker
            # then we only display the formatted issue.
            popup_cls = FormattedIssueDialog

        pop_up = popup_cls(issue=issue_details, tracker=self.trackers[sut])
        connect_signal(pop_up, 'close', lambda button: self.close_pop_up())
        return pop_up
Example #2
0
    def create_pop_up(self):
        focus = self.issues_table.listbox.focus
        if not focus:
            return None

        sut = focus.data['sut']
        sut_section = 'sut.' + sut
        if sut not in self.trackers:
            self.trackers[sut] = init_tracker(self.config, sut_section)

        issue_details = self.issues_table.db.find_issue_by_id(
            focus.data['_id'])
        try:
            popup_cls = eval(self.trackers[sut].__class__.__name__ + 'Dialog')
        except:
            # If there is no reporter interface for the given tracker
            # then we only display the formatted issue.
            popup_cls = FormattedIssueDialog

        pop_up = popup_cls(issue=issue_details,
                           tracker=self.trackers[sut],
                           db=self.issues_table.db)
        connect_signal(pop_up, 'close',
                       lambda button: self.update_entry(focus.data['_id']))
        return pop_up
Example #3
0
 def copy_selected(self):
     if self.issues_table.selection:
         sut = self.issues_table.selection.data['sut']
         sut_section = 'sut.' + sut
         if sut not in self.trackers:
             self.trackers[sut] = init_tracker(self.config, sut_section,
                                               self.db)
         pyperclip.copy(self.trackers[sut].format_issue(
             self.db.find_issue_by_id(
                 self.issues_table.selection.data['_id'])))
Example #4
0
    def open_custom_pop_up(self, event_type):
        focus = self.issues_table.listbox.focus
        if not focus:
            return None

        sut = focus.data['sut']
        sut_section = 'sut.' + sut
        if sut not in self.trackers:
            self.trackers[sut] = init_tracker(self.config, sut_section,
                                              self.issues_table.db)

        if event_type == 'report':
            if not self.trackers[sut].logged_in:
                self.popup_type = 'small'
                pop_up = LoginDialog()

                width, height = 70, 20
                cols, rows = get_terminal_size()
                # Override fullscreen parameters.
                self.get_pop_up_parameters = lambda: dict(
                    left=max(cols // 2 - width // 2, 1),
                    top=max(rows // 2 - height // 2, 1),
                    overlay_width=width,
                    overlay_height=height)
                connect_signal(
                    pop_up, 'login', lambda btn, username, pwd: self.login(
                        btn, self.trackers[sut], username, pwd))
                connect_signal(pop_up, 'close',
                               lambda btn: self.close_pop_up())
            else:
                self.popup_type = 'full'
                self.get_pop_up_parameters = super(ReportButton,
                                                   self).get_pop_up_parameters
                issue_details = self.issues_table.db.find_issue_by_id(
                    focus.data['_id'])
                if isinstance(self.trackers[sut], BugzillaReport):
                    pop_up = BugzillaReportDialog(issue=issue_details,
                                                  tracker=self.trackers[sut])
                elif isinstance(self.trackers[sut], GithubReport):
                    pop_up = GithubReportDialog(issue=issue_details,
                                                tracker=self.trackers[sut])
                else:
                    # If there is no reporter interface for the given tracker
                    # then we only display the formatted issue.
                    pop_up = FormattedIssueDialog(issue=issue_details,
                                                  tracker=self.trackers[sut])
                connect_signal(pop_up, 'close',
                               lambda button: self.close_pop_up())
        elif event_type == 'login_fail':
            self.popup_type = 'small'
            pop_up = LoginFailedDialog()
            connect_signal(pop_up, 'close', lambda button: self.close_pop_up())

        self.pop_up = pop_up
        self.open_pop_up()
Example #5
0
 def copy_selected(self, test_bytes=False):
     if self.issues_table.selection:
         issue = self.db.find_issue_by_id(self.issues_table.selection.data['_id'])
         if test_bytes:
             pyperclip.copy(str(issue['test']))
         else:
             sut = self.issues_table.selection.data['sut']
             sut_section = 'sut.' + sut
             if sut not in self.trackers:
                 self.trackers[sut] = init_tracker(self.config, sut_section)
             pyperclip.copy(self.trackers[sut].format_issue(issue))
Example #6
0
 def copy_selected(self):
     # FIXME: why not:
     # issue = self.issues_table.selection.data
     # sut = issue['sut']
     if self.issues_table.selection:
         sut = self.issues_table.listbox.focus.data['sut']
         sut_section = 'sut.' + sut
         if sut not in self.trackers:
             self.trackers[sut] = init_tracker(self.config, sut_section,
                                               self.db)
         pyperclip.copy(self.trackers[sut].format_issue(
             self.db.find_issue_by_id(
                 self.issues_table.selection.data['_id'])))
Example #7
0
    def create_pop_up(self):
        focus = self.issues_table.listbox.focus
        if not focus:
            return None

        sut = focus.data['sut']
        sut_section = 'sut.' + sut
        if sut not in self.trackers:
            self.trackers[sut] = init_tracker(self.config, sut_section)
        pop_up = FormattedIssueDialog(
            issue=self.issues_table.db.find_issue_by_id(focus.data['_id']),
            tracker=self.trackers[sut])

        connect_signal(pop_up, 'close', lambda button: self.close_pop_up())
        return pop_up