Plugins/VcsPlugins/vcsMercurial/BookmarksExtension/HgBookmarksInOutDialog.py

changeset 3008
7848489bcb92
parent 2962
d6c9d1ca2da4
child 3020
542e97d4ecb3
child 3057
10516539f238
equal deleted inserted replaced
3007:bad2e89047e7 3008:7848489bcb92
8 """ 8 """
9 9
10 import os 10 import os
11 11
12 from PyQt4.QtCore import pyqtSlot, QProcess, Qt, QTimer, QCoreApplication 12 from PyQt4.QtCore import pyqtSlot, QProcess, Qt, QTimer, QCoreApplication
13 from PyQt4.QtGui import QDialog, QDialogButtonBox, QHeaderView, QTreeWidgetItem, \ 13 from PyQt4.QtGui import QDialog, QDialogButtonBox, QHeaderView, \
14 QLineEdit 14 QTreeWidgetItem, QLineEdit
15 15
16 from E5Gui import E5MessageBox 16 from E5Gui import E5MessageBox
17 17
18 from .Ui_HgBookmarksInOutDialog import Ui_HgBookmarksInOutDialog 18 from .Ui_HgBookmarksInOutDialog import Ui_HgBookmarksInOutDialog
19 19
20 import Preferences 20 import Preferences
21 21
22 22
23 class HgBookmarksInOutDialog(QDialog, Ui_HgBookmarksInOutDialog): 23 class HgBookmarksInOutDialog(QDialog, Ui_HgBookmarksInOutDialog):
24 """ 24 """
25 Class implementing a dialog to show a list of incoming or outgoing bookmarks. 25 Class implementing a dialog to show a list of incoming or outgoing
26 bookmarks.
26 """ 27 """
27 INCOMING = 0 28 INCOMING = 0
28 OUTGOING = 1 29 OUTGOING = 1
29 30
30 def __init__(self, vcs, mode, parent=None): 31 def __init__(self, vcs, mode, parent=None):
53 self.process = QProcess() 54 self.process = QProcess()
54 self.vcs = vcs 55 self.vcs = vcs
55 self.mode = mode 56 self.mode = mode
56 self.__hgClient = vcs.getClient() 57 self.__hgClient = vcs.getClient()
57 58
58 self.bookmarksList.headerItem().setText(self.bookmarksList.columnCount(), "") 59 self.bookmarksList.headerItem().setText(
60 self.bookmarksList.columnCount(), "")
59 self.bookmarksList.header().setSortIndicator(3, Qt.AscendingOrder) 61 self.bookmarksList.header().setSortIndicator(3, Qt.AscendingOrder)
60 62
61 self.process.finished.connect(self.__procFinished) 63 self.process.finished.connect(self.__procFinished)
62 self.process.readyReadStandardOutput.connect(self.__readStdout) 64 self.process.readyReadStandardOutput.connect(self.__readStdout)
63 self.process.readyReadStandardError.connect(self.__readStderr) 65 self.process.readyReadStandardError.connect(self.__readStderr)
145 self.inputGroup.setEnabled(True) 147 self.inputGroup.setEnabled(True)
146 self.inputGroup.show() 148 self.inputGroup.show()
147 149
148 def __finish(self): 150 def __finish(self):
149 """ 151 """
150 Private slot called when the process finished or the user pressed the button. 152 Private slot called when the process finished or the user pressed
153 the button.
151 """ 154 """
152 if self.process is not None and \ 155 if self.process is not None and \
153 self.process.state() != QProcess.NotRunning: 156 self.process.state() != QProcess.NotRunning:
154 self.process.terminate() 157 self.process.terminate()
155 QTimer.singleShot(2000, self.process.kill) 158 QTimer.singleShot(2000, self.process.kill)
159 self.inputGroup.hide() 162 self.inputGroup.hide()
160 163
161 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) 164 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True)
162 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) 165 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False)
163 self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) 166 self.buttonBox.button(QDialogButtonBox.Close).setDefault(True)
164 self.buttonBox.button(QDialogButtonBox.Close).setFocus(Qt.OtherFocusReason) 167 self.buttonBox.button(QDialogButtonBox.Close).setFocus(
168 Qt.OtherFocusReason)
165 169
166 self.process = None 170 self.process = None
167 171
168 if self.bookmarksList.topLevelItemCount() == 0: 172 if self.bookmarksList.topLevelItemCount() == 0:
169 # no bookmarks defined 173 # no bookmarks defined
203 207
204 def __resizeColumns(self): 208 def __resizeColumns(self):
205 """ 209 """
206 Private method to resize the list columns. 210 Private method to resize the list columns.
207 """ 211 """
208 self.bookmarksList.header().resizeSections(QHeaderView.ResizeToContents) 212 self.bookmarksList.header().resizeSections(
213 QHeaderView.ResizeToContents)
209 self.bookmarksList.header().setStretchLastSection(True) 214 self.bookmarksList.header().setStretchLastSection(True)
210 215
211 def __generateItem(self, changeset, name): 216 def __generateItem(self, changeset, name):
212 """ 217 """
213 Private method to generate a bookmark item in the bookmarks list. 218 Private method to generate a bookmark item in the bookmarks list.

eric ide

mercurial