Plugins/VcsPlugins/vcsMercurial/QueuesExtension/HgQueuesDefineGuardsDialog.py

changeset 3008
7848489bcb92
parent 2771
281c9b30dd91
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, Qt, QProcess, QTimer, QCoreApplication 12 from PyQt4.QtCore import pyqtSlot, Qt, QProcess, QTimer, QCoreApplication
13 from PyQt4.QtGui import QDialog, QDialogButtonBox, QAbstractButton, QListWidgetItem 13 from PyQt4.QtGui import QDialog, QDialogButtonBox, QAbstractButton, \
14 QListWidgetItem
14 15
15 from E5Gui import E5MessageBox 16 from E5Gui import E5MessageBox
16 17
17 from .Ui_HgQueuesDefineGuardsDialog import Ui_HgQueuesDefineGuardsDialog 18 from .Ui_HgQueuesDefineGuardsDialog import Ui_HgQueuesDefineGuardsDialog
18 19
104 self.on_patchSelector_activated("") 105 self.on_patchSelector_activated("")
105 106
106 @pyqtSlot(str) 107 @pyqtSlot(str)
107 def on_patchSelector_activated(self, patch): 108 def on_patchSelector_activated(self, patch):
108 """ 109 """
109 Private slot to get the list of guards defined for the given patch name. 110 Private slot to get the list of guards defined for the given patch
111 name.
110 112
111 @param patch selected patch name (empty for current patch) 113 @param patch selected patch name (empty for current patch)
112 """ 114 """
113 if self.__dirtyList: 115 if self.__dirtyList:
114 res = E5MessageBox.question(self, 116 res = E5MessageBox.question(self,
147 process.start('hg', args) 149 process.start('hg', args)
148 procStarted = process.waitForStarted(5000) 150 procStarted = process.waitForStarted(5000)
149 if procStarted: 151 if procStarted:
150 finished = process.waitForFinished(30000) 152 finished = process.waitForFinished(30000)
151 if finished and process.exitCode() == 0: 153 if finished and process.exitCode() == 0:
152 output = \ 154 output = str(process.readAllStandardOutput(), ioEncoding,
153 str(process.readAllStandardOutput(), ioEncoding, 'replace').strip() 155 'replace').strip()
154 156
155 if output: 157 if output:
156 patchName, guards = output.split(":", 1) 158 patchName, guards = output.split(":", 1)
157 self.patchNameLabel.setText(patchName) 159 self.patchNameLabel.setText(patchName)
158 guardsList = guards.strip().split() 160 guardsList = guards.strip().split()
233 """ 235 """
234 Private slot to remove guard definitions from the list. 236 Private slot to remove guard definitions from the list.
235 """ 237 """
236 res = E5MessageBox.yesNo(self, 238 res = E5MessageBox.yesNo(self,
237 self.trUtf8("Remove Guards"), 239 self.trUtf8("Remove Guards"),
238 self.trUtf8("""Do you really want to remove the selected guards?""")) 240 self.trUtf8(
241 """Do you really want to remove the selected guards?"""))
239 if res: 242 if res:
240 for guardItem in self.guardsList.selectedItems(): 243 for guardItem in self.guardsList.selectedItems():
241 row = self.guardsList.row(guardItem) 244 row = self.guardsList.row(guardItem)
242 itm = self.guardsList.takeItem(row) 245 itm = self.guardsList.takeItem(row)
243 del itm 246 del itm
288 procStarted = process.waitForStarted(5000) 291 procStarted = process.waitForStarted(5000)
289 if procStarted: 292 if procStarted:
290 finished = process.waitForFinished(30000) 293 finished = process.waitForFinished(30000)
291 if finished: 294 if finished:
292 if process.exitCode() != 0: 295 if process.exitCode() != 0:
293 error = \ 296 error = str(
294 str(process.readAllStandardError(), ioEncoding, 'replace') 297 process.readAllStandardError(), ioEncoding,
298 'replace')
295 else: 299 else:
296 E5MessageBox.warning(self, 300 E5MessageBox.warning(self,
297 self.trUtf8("Apply Guard Definitions"), 301 self.trUtf8("Apply Guard Definitions"),
298 self.trUtf8("""The Mercurial process did not finish""" 302 self.trUtf8(
299 """ in time.""")) 303 """The Mercurial process did not finish"""
304 """ in time."""))
300 305
301 if error: 306 if error:
302 E5MessageBox.warning(self, 307 E5MessageBox.warning(self,
303 self.trUtf8("Apply Guard Definitions"), 308 self.trUtf8("Apply Guard Definitions"),
304 self.trUtf8("""<p>The defined guards could not be""" 309 self.trUtf8("""<p>The defined guards could not be"""
305 """ applied.</p><p>Reason: {0}</p>""")\ 310 """ applied.</p><p>Reason: {0}</p>""")\
306 .format(error)) 311 .format(error))
307 else: 312 else:
308 self.__dirtyList = False 313 self.__dirtyList = False
309 self.on_patchSelector_activated(self.patchNameLabel.text()) 314 self.on_patchSelector_activated(
315 self.patchNameLabel.text())

eric ide

mercurial