eric6/Plugins/VcsPlugins/vcsMercurial/HgAnnotateDialog.py

changeset 8143
2c730d5fd177
parent 7970
c4ee8a81584c
child 8218
7c09585bd960
equal deleted inserted replaced
8141:27f636beebad 8143:2c730d5fd177
30 @param vcs reference to the vcs object 30 @param vcs reference to the vcs object
31 @param parent parent widget (QWidget) 31 @param parent parent widget (QWidget)
32 """ 32 """
33 super(HgAnnotateDialog, self).__init__(parent) 33 super(HgAnnotateDialog, self).__init__(parent)
34 self.setupUi(self) 34 self.setupUi(self)
35 self.setWindowFlags(Qt.Window) 35 self.setWindowFlags(Qt.WindowType.Window)
36 36
37 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) 37 self.buttonBox.button(
38 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) 38 QDialogButtonBox.StandardButton.Close).setEnabled(False)
39 self.buttonBox.button(
40 QDialogButtonBox.StandardButton.Cancel).setDefault(True)
39 41
40 self.vcs = vcs 42 self.vcs = vcs
41 self.__hgClient = vcs.getClient() 43 self.__hgClient = vcs.getClient()
42 44
43 self.__annotateRe = re.compile( 45 self.__annotateRe = re.compile(
96 def __finish(self): 98 def __finish(self):
97 """ 99 """
98 Private slot called when the process finished or the user pressed 100 Private slot called when the process finished or the user pressed
99 the button. 101 the button.
100 """ 102 """
101 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) 103 self.buttonBox.button(
102 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) 104 QDialogButtonBox.StandardButton.Close).setEnabled(True)
103 self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) 105 self.buttonBox.button(
104 self.buttonBox.button(QDialogButtonBox.Close).setFocus( 106 QDialogButtonBox.StandardButton.Cancel).setEnabled(False)
105 Qt.OtherFocusReason) 107 self.buttonBox.button(
108 QDialogButtonBox.StandardButton.Close).setDefault(True)
109 self.buttonBox.button(
110 QDialogButtonBox.StandardButton.Close).setFocus(
111 Qt.FocusReason.OtherFocusReason)
106 112
107 self.__resizeColumns() 113 self.__resizeColumns()
108 114
109 def on_buttonBox_clicked(self, button): 115 def on_buttonBox_clicked(self, button):
110 """ 116 """
111 Private slot called by a button of the button box clicked. 117 Private slot called by a button of the button box clicked.
112 118
113 @param button button that was clicked (QAbstractButton) 119 @param button button that was clicked (QAbstractButton)
114 """ 120 """
115 if button == self.buttonBox.button(QDialogButtonBox.Close): 121 if button == self.buttonBox.button(
122 QDialogButtonBox.StandardButton.Close
123 ):
116 self.close() 124 self.close()
117 elif button == self.buttonBox.button(QDialogButtonBox.Cancel): 125 elif button == self.buttonBox.button(
126 QDialogButtonBox.StandardButton.Cancel
127 ):
118 if self.__hgClient: 128 if self.__hgClient:
119 self.__hgClient.cancel() 129 self.__hgClient.cancel()
120 else: 130 else:
121 self.__finish() 131 self.__finish()
122 132
123 def __resizeColumns(self): 133 def __resizeColumns(self):
124 """ 134 """
125 Private method to resize the list columns. 135 Private method to resize the list columns.
126 """ 136 """
127 self.annotateList.header().resizeSections(QHeaderView.ResizeToContents) 137 self.annotateList.header().resizeSections(
138 QHeaderView.ResizeMode.ResizeToContents)
128 139
129 def __generateItem(self, revision, changeset, author, date, text): 140 def __generateItem(self, revision, changeset, author, date, text):
130 """ 141 """
131 Private method to generate an annotate item in the annotation list. 142 Private method to generate an annotate item in the annotation list.
132 143
139 itm = QTreeWidgetItem( 150 itm = QTreeWidgetItem(
140 self.annotateList, 151 self.annotateList,
141 [revision, changeset, author, date, "{0:d}".format(self.lineno), 152 [revision, changeset, author, date, "{0:d}".format(self.lineno),
142 text]) 153 text])
143 self.lineno += 1 154 self.lineno += 1
144 itm.setTextAlignment(0, Qt.AlignRight) 155 itm.setTextAlignment(0, Qt.AlignmentFlag.AlignRight)
145 itm.setTextAlignment(4, Qt.AlignRight) 156 itm.setTextAlignment(4, Qt.AlignmentFlag.AlignRight)
146 157
147 def __processOutputLine(self, line): 158 def __processOutputLine(self, line):
148 """ 159 """
149 Private method to process the lines of output. 160 Private method to process the lines of output.
150 161

eric ide

mercurial