Commit 3c93f12c authored by Matt Harbison's avatar Matt Harbison
Browse files

qtcompat: fully qualify the QDialogButtonBox enums

These weren't caught with the script because of the local aliasing of the class
name.  These were fished out of the pile of changes made by the modified
replacement script described a few commits back, the class aliases eliminated,
and then the original replacement script re-run, with a few reversions of
`QLibraryInfo.LibraryPath` to keep PyQt5 compatibility.
parent 61168f1b28c8
......@@ -97,13 +97,12 @@ class BookmarkDialog(QDialog):
form.addRow(_('Activate:'), self.activateCheckBox)
## bottom buttons
BB = QDialogButtonBox
bbox = QDialogButtonBox()
self.addBtn = bbox.addButton(_('&Add'), BB.ActionRole)
self.renameBtn = bbox.addButton(_('Re&name'), BB.ActionRole)
self.removeBtn = bbox.addButton(_('&Remove'), BB.ActionRole)
self.moveBtn = bbox.addButton(_('&Move'), BB.ActionRole)
bbox.addButton(BB.Close)
self.addBtn = bbox.addButton(_('&Add'), QDialogButtonBox.ButtonRole.ActionRole)
self.renameBtn = bbox.addButton(_('Re&name'), QDialogButtonBox.ButtonRole.ActionRole)
self.removeBtn = bbox.addButton(_('&Remove'), QDialogButtonBox.ButtonRole.ActionRole)
self.moveBtn = bbox.addButton(_('&Move'), QDialogButtonBox.ButtonRole.ActionRole)
bbox.addButton(QDialogButtonBox.StandardButton.Close)
bbox.rejected.connect(self.reject)
form.addRow(bbox)
......
......@@ -96,11 +96,10 @@ class BranchOpDialog(QDialog):
newbranch.setChecked(True)
self.closebranch = closebranch
BB = QDialogButtonBox
bb = QDialogButtonBox(BB.Ok|BB.Cancel)
bb = QDialogButtonBox(QDialogButtonBox.StandardButton.Ok|QDialogButtonBox.StandardButton.Cancel)
bb.accepted.connect(self.accept)
bb.rejected.connect(self.reject)
bb.button(BB.Ok).setAutoDefault(True)
bb.button(QDialogButtonBox.StandardButton.Ok).setAutoDefault(True)
layout.addWidget(bb)
self.bb = bb
self.branchCombo = branchCombo
......
......@@ -96,13 +96,12 @@ class BugReport(QDialog):
layout.addWidget(self.download_url_lbl)
# dialog buttons
BB = QDialogButtonBox
bb = QDialogButtonBox(BB.Ok|BB.Save)
bb.button(BB.Ok).clicked.connect(self.accept)
bb.button(BB.Save).clicked.connect(self.save)
bb.button(BB.Ok).setDefault(True)
bb.addButton(_('Copy'), BB.HelpRole).clicked.connect(self.copyText)
bb.addButton(_('Quit'), BB.DestructiveRole).clicked.connect(qApp.quit)
bb = QDialogButtonBox(QDialogButtonBox.StandardButton.Ok|QDialogButtonBox.StandardButton.Save)
bb.button(QDialogButtonBox.StandardButton.Ok).clicked.connect(self.accept)
bb.button(QDialogButtonBox.StandardButton.Save).clicked.connect(self.save)
bb.button(QDialogButtonBox.StandardButton.Ok).setDefault(True)
bb.addButton(_('Copy'), QDialogButtonBox.ButtonRole.HelpRole).clicked.connect(self.copyText)
bb.addButton(_('Quit'), QDialogButtonBox.ButtonRole.DestructiveRole).clicked.connect(qApp.quit)
layout.addWidget(bb)
self.setWindowTitle(_('TortoiseHg Bug Report'))
......
......@@ -1423,8 +1423,7 @@ class DetailsDialog(QDialog):
hbox.addWidget(recursesave)
layout.addLayout(hbox)
BB = QDialogButtonBox
bb = QDialogButtonBox(BB.Ok|BB.Cancel)
bb = QDialogButtonBox(QDialogButtonBox.StandardButton.Ok|QDialogButtonBox.StandardButton.Cancel)
bb.accepted.connect(self.accept)
bb.rejected.connect(self.reject)
self.bb = bb
......@@ -1619,15 +1618,14 @@ class CommitDialog(QDialog):
commit.progress.connect(self.statusbar.progress)
commit.linkActivated.connect(self.linkActivated)
BB = QDialogButtonBox
bb = QDialogButtonBox(BB.Close|BB.Discard)
bb = QDialogButtonBox(QDialogButtonBox.StandardButton.Close|QDialogButtonBox.StandardButton.Discard)
bb.rejected.connect(self.reject)
bb.button(BB.Discard).setText('Undo')
bb.button(BB.Discard).clicked.connect(commit.rollback)
bb.button(BB.Close).setDefault(False)
bb.button(BB.Discard).setDefault(False)
bb.button(QDialogButtonBox.StandardButton.Discard).setText('Undo')
bb.button(QDialogButtonBox.StandardButton.Discard).clicked.connect(commit.rollback)
bb.button(QDialogButtonBox.StandardButton.Close).setDefault(False)
bb.button(QDialogButtonBox.StandardButton.Discard).setDefault(False)
self.commitButton = commit.commitSetupButton()
bb.addButton(self.commitButton, BB.AcceptRole)
bb.addButton(self.commitButton, QDialogButtonBox.ButtonRole.AcceptRole)
self.bb = bb
......@@ -1664,14 +1662,13 @@ class CommitDialog(QDialog):
@pyqtSlot()
def updateUndo(self):
# type: () -> None
BB = QDialogButtonBox
undomsg = self.commit.canUndo()
if undomsg:
self.bb.button(BB.Discard).setEnabled(True)
self.bb.button(BB.Discard).setToolTip(undomsg)
self.bb.button(QDialogButtonBox.StandardButton.Discard).setEnabled(True)
self.bb.button(QDialogButtonBox.StandardButton.Discard).setToolTip(undomsg)
else:
self.bb.button(BB.Discard).setEnabled(False)
self.bb.button(BB.Discard).setToolTip('')
self.bb.button(QDialogButtonBox.StandardButton.Discard).setEnabled(False)
self.bb.button(QDialogButtonBox.StandardButton.Discard).setToolTip('')
def refresh(self):
# type: () -> None
......
......@@ -146,9 +146,8 @@ class HgignoreDialog(QDialog):
ivbox.addWidget(lbl)
# layer 4 - dialog buttons
BB = QDialogButtonBox
bb = QDialogButtonBox(BB.Close)
bb.button(BB.Close).setAutoDefault(False)
bb = QDialogButtonBox(QDialogButtonBox.StandardButton.Close)
bb.button(QDialogButtonBox.StandardButton.Close).setAutoDefault(False)
bb.accepted.connect(self.accept)
bb.rejected.connect(self.reject)
vbox.addWidget(bb)
......
......@@ -979,8 +979,7 @@ class OptionsDialog(QDialog):
for cb in [self.forcecb, self.keepcb]:
cb.clicked.connect(self._resolveopts)
BB = QDialogButtonBox
bb = QDialogButtonBox(BB.Ok|BB.Cancel)
bb = QDialogButtonBox(QDialogButtonBox.StandardButton.Ok|QDialogButtonBox.StandardButton.Cancel)
bb.accepted.connect(self.accept)
bb.rejected.connect(self.reject)
self.bb = bb
......
......@@ -51,17 +51,16 @@ class PerforcePending(QDialog):
self.cslist = cslist.ChangesetList(repo)
layout.addWidget(self.cslist)
BB = QDialogButtonBox
bb = QDialogButtonBox(BB.Ok|BB.Cancel|BB.Discard)
bb = QDialogButtonBox(QDialogButtonBox.StandardButton.Ok|QDialogButtonBox.StandardButton.Cancel|QDialogButtonBox.StandardButton.Discard)
bb.rejected.connect(self.reject)
bb.button(BB.Discard).setText('Revert')
bb.button(BB.Discard).setAutoDefault(False)
bb.button(BB.Discard).clicked.connect(self.revert)
bb.button(BB.Discard).setEnabled(False)
bb.button(BB.Ok).setText('Submit')
bb.button(BB.Ok).setAutoDefault(True)
bb.button(BB.Ok).clicked.connect(self.submit)
bb.button(BB.Ok).setEnabled(False)
bb.button(QDialogButtonBox.StandardButton.Discard).setText('Revert')
bb.button(QDialogButtonBox.StandardButton.Discard).setAutoDefault(False)
bb.button(QDialogButtonBox.StandardButton.Discard).clicked.connect(self.revert)
bb.button(QDialogButtonBox.StandardButton.Discard).setEnabled(False)
bb.button(QDialogButtonBox.StandardButton.Ok).setText('Submit')
bb.button(QDialogButtonBox.StandardButton.Ok).setAutoDefault(True)
bb.button(QDialogButtonBox.StandardButton.Ok).clicked.connect(self.submit)
bb.button(QDialogButtonBox.StandardButton.Ok).setEnabled(False)
layout.addWidget(bb)
self.bb = bb
......
......@@ -90,8 +90,7 @@ class PurgeDialog(QDialog):
self.hgfilecb.setChecked(True)
toplayout.addWidget(self.hgfilecb)
BB = QDialogButtonBox
bb = QDialogButtonBox(BB.Ok|BB.Cancel)
bb = QDialogButtonBox(QDialogButtonBox.StandardButton.Ok|QDialogButtonBox.StandardButton.Cancel)
bb.accepted.connect(self.accept)
bb.rejected.connect(self.reject)
self.bb = bb
......
......@@ -41,8 +41,7 @@ class QDeleteDialog(QDialog):
self._keepchk = QCheckBox(_('Keep patch files'))
self.layout().addWidget(self._keepchk)
BB = QDialogButtonBox
bbox = QDialogButtonBox(BB.Ok|BB.Cancel)
bbox = QDialogButtonBox(QDialogButtonBox.StandardButton.Ok|QDialogButtonBox.StandardButton.Cancel)
bbox.accepted.connect(self.accept)
bbox.rejected.connect(self.reject)
self.layout().addWidget(bbox)
......
......@@ -112,8 +112,7 @@ class QFoldDialog(QDialog):
self.summ.setFocusPolicy(Qt.FocusPolicy.NoFocus)
self.layout().addWidget(self.summ)
BB = QDialogButtonBox
bbox = QDialogButtonBox(BB.Ok|BB.Cancel)
bbox = QDialogButtonBox(QDialogButtonBox.StandardButton.Ok|QDialogButtonBox.StandardButton.Cancel)
bbox.accepted.connect(self.accept)
bbox.rejected.connect(self.reject)
self.layout().addWidget(bbox)
......
......@@ -844,8 +844,7 @@ def fileEditor(filename, **opts):
dialog.addActions(searchbar.editorActions())
dialog.layout().addWidget(searchbar)
BB = QDialogButtonBox
bb = QDialogButtonBox(BB.Save|BB.Cancel)
bb = QDialogButtonBox(QDialogButtonBox.StandardButton.Save|QDialogButtonBox.StandardButton.Cancel)
bb.accepted.connect(dialog.accept)
bb.rejected.connect(dialog.reject)
dialog.layout().addWidget(bb)
......
......@@ -135,12 +135,11 @@ class QuickOpDialog(QDialog):
self.statusbar = cmdui.ThgStatusBar(self)
stwidget.showMessage.connect(self.statusbar.showMessage)
BB = QDialogButtonBox
bb = QDialogButtonBox(BB.Ok|BB.Close)
bb = QDialogButtonBox(QDialogButtonBox.StandardButton.Ok|QDialogButtonBox.StandardButton.Close)
bb.accepted.connect(self.accept)
bb.rejected.connect(self.reject)
bb.button(BB.Ok).setDefault(True)
bb.button(BB.Ok).setText(LABELS[command][1])
bb.button(QDialogButtonBox.StandardButton.Ok).setDefault(True)
bb.button(QDialogButtonBox.StandardButton.Ok).setText(LABELS[command][1])
hbox.addStretch()
hbox.addWidget(bb)
toplayout.addLayout(hbox)
......@@ -153,7 +152,7 @@ class QuickOpDialog(QDialog):
self.addLfilesButton = None
if self.addLfilesButton:
self.addLfilesButton.clicked.connect(self.addLfiles)
bb.addButton(self.addLfilesButton, BB.ActionRole)
bb.addButton(self.addLfilesButton, QDialogButtonBox.ButtonRole.ActionRole)
layout.addWidget(self.statusbar)
......
......@@ -108,12 +108,11 @@ class RejectsDialog(QDialog):
fileencoding.checkActionByName(self.textencgroup,
fileencoding.contentencoding(ui))
BB = QDialogButtonBox
bb = QDialogButtonBox(BB.Save|BB.Cancel)
bb = QDialogButtonBox(QDialogButtonBox.StandardButton.Save|QDialogButtonBox.StandardButton.Cancel)
bb.accepted.connect(self.accept)
bb.rejected.connect(self.reject)
layout.addWidget(bb)
self.saveButton = bb.button(BB.Save)
self.saveButton = bb.button(QDialogButtonBox.StandardButton.Save)
s = QSettings()
self.restoreGeometry(qtlib.readByteArray(s, 'rejects/geometry'))
......
......@@ -898,8 +898,7 @@ class ColumnSelectDialog(QDialog):
layout.addRow(_('Row height'), edit)
# dialog buttons
BB = QDialogButtonBox
bb = QDialogButtonBox(BB.Ok|BB.Cancel)
bb = QDialogButtonBox(QDialogButtonBox.StandardButton.Ok|QDialogButtonBox.StandardButton.Cancel)
bb.accepted.connect(self.accept)
bb.rejected.connect(self.reject)
layout.addWidget(bb)
......
......@@ -246,8 +246,7 @@ class ResolveDialog(QDialog):
self._cmdlog = cmdui.LogWidget(self)
self.layout().addWidget(self._cmdlog)
BB = QDialogButtonBox
bbox = QDialogButtonBox(BB.Close)
bbox = QDialogButtonBox(QDialogButtonBox.StandardButton.Close)
bbox.rejected.connect(self.reject)
self.layout().addWidget(bbox)
self.bbox = bbox
......
......@@ -60,8 +60,7 @@ class RevertDialog(QDialog):
self.allchk = QCheckBox(_('Revert all files to this revision'))
self.layout().addWidget(self.allchk)
BB = QDialogButtonBox
bbox = QDialogButtonBox(BB.Ok|BB.Cancel)
bbox = QDialogButtonBox(QDialogButtonBox.StandardButton.Ok|QDialogButtonBox.StandardButton.Cancel)
bbox.accepted.connect(self.accept)
bbox.rejected.connect(self.reject)
self.layout().addWidget(bbox)
......
......@@ -1385,8 +1385,7 @@ class SettingsDialog(QDialog):
% repoagent.shortName())
rtab.restartRequested.connect(self._pushRestartRequest)
BB = QDialogButtonBox
bb = QDialogButtonBox(BB.Ok|BB.Cancel)
bb = QDialogButtonBox(QDialogButtonBox.StandardButton.Ok|QDialogButtonBox.StandardButton.Cancel)
bb.accepted.connect(self.accept)
bb.rejected.connect(self.reject)
layout.addWidget(bb)
......
......@@ -208,13 +208,12 @@ class ShellConfigWindow(QDialog):
iconslayout.addWidget(w)
# dialog buttons
BB = QDialogButtonBox
bb = QDialogButtonBox(BB.Ok|BB.Cancel|BB.Apply)
self.apply_button = bb.button(BB.Apply)
bb = QDialogButtonBox(QDialogButtonBox.StandardButton.Ok|QDialogButtonBox.StandardButton.Cancel|QDialogButtonBox.StandardButton.Apply)
self.apply_button = bb.button(QDialogButtonBox.StandardButton.Apply)
bb.accepted.connect(self.accept)
bb.rejected.connect(self.reject)
bb.button(BB.Apply).clicked.connect(self.apply)
bb.button(BB.Ok).setDefault(True)
bb.button(QDialogButtonBox.StandardButton.Apply).clicked.connect(self.apply)
bb.button(QDialogButtonBox.StandardButton.Ok).setDefault(True)
layout.addWidget(bb)
self.setLayout(layout)
......
......@@ -99,10 +99,9 @@ class SignDialog(QDialog):
optbox.addWidget(self.customTextLineEdit)
## bottom buttons
BB = QDialogButtonBox
bbox = QDialogButtonBox()
self.signBtn = bbox.addButton(_('&Sign'), BB.ActionRole)
bbox.addButton(BB.Close)
self.signBtn = bbox.addButton(_('&Sign'), QDialogButtonBox.ButtonRole.ActionRole)
bbox.addButton(QDialogButtonBox.StandardButton.Close)
bbox.rejected.connect(self.reject)
form.addRow(bbox)
......
......@@ -1168,8 +1168,7 @@ class PostPullDialog(QDialog):
cfglabel.linkActivated.connect(self.linkactivated)
layout.addWidget(cfglabel)
BB = QDialogButtonBox
bb = QDialogButtonBox(BB.Save|BB.Cancel)
bb = QDialogButtonBox(QDialogButtonBox.StandardButton.Save|QDialogButtonBox.StandardButton.Cancel)
bb.accepted.connect(self.accept)
bb.rejected.connect(self.reject)
......@@ -1267,11 +1266,10 @@ class SaveDialog(QDialog):
% hglib.tounicode(alias))
self.layout().addRow(self.updatesubpaths)
BB = QDialogButtonBox
bb = QDialogButtonBox(BB.Save|BB.Cancel)
bb = QDialogButtonBox(QDialogButtonBox.StandardButton.Save|QDialogButtonBox.StandardButton.Cancel)
bb.accepted.connect(self.accept)
bb.rejected.connect(self.reject)
bb.button(BB.Save).setAutoDefault(True)
bb.button(QDialogButtonBox.StandardButton.Save).setAutoDefault(True)
self.bb = bb
self.layout().addRow(bb)
......@@ -1503,8 +1501,7 @@ are expanded in the filename.'''))
form.addRow(_('User Certificate Chain'),
_addBrowseButton(e, self._browseClientCert))
BB = QDialogButtonBox
bb = QDialogButtonBox(BB.Help|BB.Save|BB.Cancel)
bb = QDialogButtonBox(QDialogButtonBox.StandardButton.Help|QDialogButtonBox.StandardButton.Save|QDialogButtonBox.StandardButton.Cancel)
bb.rejected.connect(self.reject)
bb.accepted.connect(self.accept)
bb.helpRequested.connect(self.keyringHelp)
......@@ -1756,8 +1753,7 @@ class OptionsDialog(QDialog):
self.branchle.setText(hglib.tounicode(opts['branch']))
form.addRow(lbl, self.branchle)
BB = QDialogButtonBox
bb = QDialogButtonBox(BB.Save|BB.Cancel)
bb = QDialogButtonBox(QDialogButtonBox.StandardButton.Save|QDialogButtonBox.StandardButton.Cancel)
bb.accepted.connect(self.accept)
bb.rejected.connect(self.reject)
self.bb = bb
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment