Пример #1
0
    def diff_action(self):
        profile = self.profile()

        window = DiffDialog(self.archiveTable)
        self._toggle_all_buttons(True)
        window.setParent(self, QtCore.Qt.Sheet)
        self._window = window  # for testing
        window.show()

        if window.exec_():
            if window.selected_archives:
                self.selected_archives = window.selected_archives
            archive_cell_newer = self.archiveTable.item(
                self.selected_archives[0], 4)
            archive_cell_older = self.archiveTable.item(
                self.selected_archives[1], 4)
            if archive_cell_older and archive_cell_newer:
                archive_name_newer = archive_cell_newer.text()
                archive_name_older = archive_cell_older.text()

                params = BorgDiffThread.prepare(profile, archive_name_older,
                                                archive_name_newer)
                params['archive_name_newer'] = archive_name_newer
                params['archive_name_older'] = archive_name_older

                if params['ok']:
                    self._toggle_all_buttons(False)
                    thread = BorgDiffThread(params['cmd'],
                                            params,
                                            parent=self.app)
                    thread.updated.connect(self.mountErrors.setText)
                    thread.result.connect(self.list_diff_result)
                    thread.start()
                else:
                    self._set_status(params['message'])
Пример #2
0
    def diff_action(self):
        def process_result():
            if window.selected_archives:
                self.selected_archives = window.selected_archives
            archive_cell_newer = self.archiveTable.item(
                self.selected_archives[0], 4)
            archive_cell_older = self.archiveTable.item(
                self.selected_archives[1], 4)
            if archive_cell_older and archive_cell_newer:
                archive_name_newer = archive_cell_newer.text()
                archive_name_older = archive_cell_older.text()

                params = BorgDiffJob.prepare(profile, archive_name_older,
                                             archive_name_newer)

                if params['ok']:
                    self._toggle_all_buttons(False)
                    job = BorgDiffJob(params['cmd'], params,
                                      self.profile().repo.id)
                    job.updated.connect(self.mountErrors.setText)
                    job.result.connect(self.list_diff_result)
                    self.app.jobs_manager.add_job(job)
                else:
                    self._set_status(params['message'])

        profile = self.profile()

        window = DiffDialog(self.archiveTable)
        self._toggle_all_buttons(True)
        window.setParent(self, QtCore.Qt.Sheet)
        self._window = window  # for testing
        window.show()
        window.accepted.connect(process_result)