Пример #1
0
 def closeEvent(self, event):
     self._save_or_wipe_commit_data()
     qbzr_config = get_qbzr_config()
     qbzr_config.set_option(self._window_name + "_show_nonversioned",
                            self.show_nonversioned_checkbox.isChecked())
     qbzr_config.save()  # do I need this or is .saveSize() enough?
     return SubProcessDialog.closeEvent(self, event)
Пример #2
0
 def _saveSize(self, config):
     SubProcessDialog._saveSize(self, config)
     self._saveSplitterSizes(config, self.splitter)
Пример #3
0
 def show(self):
     SubProcessDialog.show(self)
     QtCore.QTimer.singleShot(1, self.initial_load)
Пример #4
0
 def on_failed(self, error):
     SubProcessDialog.on_failed(self, error)
     error = str(error)
     if error in self.not_uptodate_errors:
         self.not_uptodate_label.setText(self.not_uptodate_errors[error])
         self.not_uptodate_info.show()
Пример #5
0
 def reject(self):
     self._save_or_wipe_commit_data()
     return SubProcessDialog.reject(self)
Пример #6
0
 def exec_(self):
     QtCore.QTimer.singleShot(1, self.load)
     return SubProcessDialog.exec_(self)
Пример #7
0
 def show(self):
     # we show the bare form as soon as possible.
     SubProcessDialog.show(self)
     QtCore.QTimer.singleShot(1, self.load)
Пример #8
0
    def __init__(self,
                 tree,
                 selected_list,
                 dialog=True,
                 parent=None,
                 local=None,
                 message=None,
                 ui_mode=True,
                 backup=True):
        self.tree = tree
        self.has_pending_merges = len(tree.get_parent_ids()) > 1
        self.initial_selected_list = selected_list

        SubProcessDialog.__init__(self,
                                  gettext("Revert"),
                                  name="revert",
                                  default_size=(400, 400),
                                  ui_mode=ui_mode,
                                  dialog=dialog,
                                  parent=parent,
                                  hide_progress=True)

        self.throbber = ThrobberWidget(self)

        # Display the list of changed files
        self.file_groupbox = QtGui.QGroupBox(
            gettext("Select changes to revert"), self)

        self.filelist = TreeWidget(self.file_groupbox)
        self.filelist.throbber = self.throbber
        self.filelist.tree_model.set_select_all_kind('versioned')

        def filter_context_menu():
            TreeWidget.filter_context_menu(self.filelist)
            self.filelist.action_add.setVisible(False)
            self.filelist.action_revert.setVisible(False)

        self.filelist.filter_context_menu = filter_context_menu

        self.selectall_checkbox = SelectAllCheckBox(self.filelist,
                                                    self.file_groupbox)
        self.selectall_checkbox.setEnabled(True)

        self.no_backup_checkbox = QtGui.QCheckBox(
            gettext('Do not save backups of reverted files'))
        if not backup:
            self.no_backup_checkbox.setCheckState(QtCore.Qt.Checked)
        self.no_backup_checkbox.setEnabled(True)

        filesbox = QtGui.QVBoxLayout(self.file_groupbox)
        filesbox.addWidget(self.filelist)
        filesbox.addWidget(self.selectall_checkbox)
        filesbox.addWidget(self.no_backup_checkbox)

        if self.has_pending_merges:
            self.file_groupbox.setCheckable(True)
            self.merges_groupbox = QtGui.QGroupBox(
                gettext("Forget pending merges"))
            self.merges_groupbox.setCheckable(True)
            # This keeps track of what the merges_groupbox was before the
            # select all changes it, so that it can put it back to the state
            # it was.
            self.merges_base_checked = True
            self.pending_merges = PendingMergesList(self.processEvents,
                                                    self.throbber, self)
            merges_box = QtGui.QVBoxLayout(self.merges_groupbox)
            merges_box.addWidget(self.pending_merges)

            self.connect(self.selectall_checkbox,
                         QtCore.SIGNAL("stateChanged(int)"),
                         self.selectall_state_changed)
            self.connect(self.merges_groupbox, QtCore.SIGNAL("clicked(bool)"),
                         self.merges_clicked)
            self.connect(self.file_groupbox, QtCore.SIGNAL("clicked(bool)"),
                         self.file_groupbox_clicked)
            self.connect(
                self.filelist.tree_model,
                QtCore.SIGNAL("dataChanged(QModelIndex, QModelIndex)"),
                self.filelist_data_changed)

        # groupbox gets disabled as we are executing.
        QtCore.QObject.connect(self, QtCore.SIGNAL("disableUi(bool)"),
                               self.file_groupbox,
                               QtCore.SLOT("setDisabled(bool)"))

        self.splitter = QtGui.QSplitter(QtCore.Qt.Vertical)
        self.splitter.addWidget(self.file_groupbox)
        if self.has_pending_merges:
            self.splitter.addWidget(self.merges_groupbox)

        self.splitter.addWidget(self.make_default_status_box())
        self.splitter.setStretchFactor(0, 10)
        self.restoreSplitterSizes([150, 150])

        layout = QtGui.QVBoxLayout(self)
        layout.addWidget(self.throbber)
        layout.addWidget(self.splitter)

        # Diff button to view changes in files selected to revert
        self.diffbuttons = DiffButtons(self)
        self.diffbuttons.setToolTip(
            gettext("View changes in files selected to revert"))
        self.connect(self.diffbuttons, QtCore.SIGNAL("triggered(QString)"),
                     self.show_diff_for_checked)
        hbox = QtGui.QHBoxLayout()
        hbox.addWidget(self.diffbuttons)
        hbox.addWidget(self.buttonbox)
        layout.addLayout(hbox)
        self.throbber.show()