eric6/Plugins/VcsPlugins/vcsMercurial/GpgExtension/HgGpgSignaturesDialog.py

changeset 8143
2c730d5fd177
parent 7970
c4ee8a81584c
child 8151
8c1445825e7b
equal deleted inserted replaced
8141:27f636beebad 8143:2c730d5fd177
28 @param vcs reference to the vcs object 28 @param vcs reference to the vcs object
29 @param parent reference to the parent widget (QWidget) 29 @param parent reference to the parent widget (QWidget)
30 """ 30 """
31 super(HgGpgSignaturesDialog, self).__init__(parent) 31 super(HgGpgSignaturesDialog, self).__init__(parent)
32 self.setupUi(self) 32 self.setupUi(self)
33 self.setWindowFlags(Qt.Window) 33 self.setWindowFlags(Qt.WindowType.Window)
34 34
35 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) 35 self.buttonBox.button(
36 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) 36 QDialogButtonBox.StandardButton.Close).setEnabled(False)
37 self.buttonBox.button(
38 QDialogButtonBox.StandardButton.Cancel).setDefault(True)
37 39
38 self.vcs = vcs 40 self.vcs = vcs
39 self.__hgClient = vcs.getClient() 41 self.__hgClient = vcs.getClient()
40 42
41 self.show() 43 self.show()
76 def __finish(self): 78 def __finish(self):
77 """ 79 """
78 Private slot called when the process finished or the user pressed 80 Private slot called when the process finished or the user pressed
79 the button. 81 the button.
80 """ 82 """
81 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) 83 self.buttonBox.button(
82 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) 84 QDialogButtonBox.StandardButton.Close).setEnabled(True)
83 self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) 85 self.buttonBox.button(
84 self.buttonBox.button(QDialogButtonBox.Close).setFocus( 86 QDialogButtonBox.StandardButton.Cancel).setEnabled(False)
85 Qt.OtherFocusReason) 87 self.buttonBox.button(
88 QDialogButtonBox.StandardButton.Close).setDefault(True)
89 self.buttonBox.button(
90 QDialogButtonBox.StandardButton.Close).setFocus(
91 Qt.FocusReason.OtherFocusReason)
86 92
87 if self.signaturesList.topLevelItemCount() == 0: 93 if self.signaturesList.topLevelItemCount() == 0:
88 # no patches present 94 # no patches present
89 self.__generateItem("", "", self.tr("no signatures found")) 95 self.__generateItem("", "", self.tr("no signatures found"))
90 self.__resizeColumns() 96 self.__resizeColumns()
94 """ 100 """
95 Private slot called by a button of the button box clicked. 101 Private slot called by a button of the button box clicked.
96 102
97 @param button button that was clicked (QAbstractButton) 103 @param button button that was clicked (QAbstractButton)
98 """ 104 """
99 if button == self.buttonBox.button(QDialogButtonBox.Close): 105 if button == self.buttonBox.button(
106 QDialogButtonBox.StandardButton.Close
107 ):
100 self.close() 108 self.close()
101 elif button == self.buttonBox.button(QDialogButtonBox.Cancel): 109 elif button == self.buttonBox.button(
110 QDialogButtonBox.StandardButton.Cancel
111 ):
102 self.__hgClient.cancel() 112 self.__hgClient.cancel()
103 113
104 def __resort(self): 114 def __resort(self):
105 """ 115 """
106 Private method to resort the tree. 116 Private method to resort the tree.
112 def __resizeColumns(self): 122 def __resizeColumns(self):
113 """ 123 """
114 Private method to resize the list columns. 124 Private method to resize the list columns.
115 """ 125 """
116 self.signaturesList.header().resizeSections( 126 self.signaturesList.header().resizeSections(
117 QHeaderView.ResizeToContents) 127 QHeaderView.ResizeMode.ResizeToContents)
118 self.signaturesList.header().setStretchLastSection(True) 128 self.signaturesList.header().setStretchLastSection(True)
119 129
120 def __generateItem(self, revision, changeset, signature): 130 def __generateItem(self, revision, changeset, signature):
121 """ 131 """
122 Private method to generate a patch item in the list of patches. 132 Private method to generate a patch item in the list of patches.
128 if revision == "" and changeset == "": 138 if revision == "" and changeset == "":
129 QTreeWidgetItem(self.signaturesList, [signature]) 139 QTreeWidgetItem(self.signaturesList, [signature])
130 else: 140 else:
131 revString = "{0:>7}:{1}".format(revision, changeset) 141 revString = "{0:>7}:{1}".format(revision, changeset)
132 topItems = self.signaturesList.findItems( 142 topItems = self.signaturesList.findItems(
133 revString, Qt.MatchExactly) 143 revString, Qt.MatchFlag.MatchExactly)
134 if len(topItems) == 0: 144 if len(topItems) == 0:
135 # first signature for this changeset 145 # first signature for this changeset
136 topItm = QTreeWidgetItem(self.signaturesList, [ 146 topItm = QTreeWidgetItem(self.signaturesList, [
137 "{0:>7}:{1}".format(revision, changeset)]) 147 "{0:>7}:{1}".format(revision, changeset)])
138 topItm.setExpanded(True) 148 topItm.setExpanded(True)

eric ide

mercurial