eric6/Plugins/VcsPlugins/vcsGit/GitStatusDialog.py

changeset 7257
c4d0cac9b5c9
parent 7229
53054eb5b15a
child 7360
9190402e4505
equal deleted inserted replaced
7256:4ef3b78ebb4e 7257:c4d0cac9b5c9
12 import os 12 import os
13 import tempfile 13 import tempfile
14 14
15 from PyQt5.QtCore import pyqtSlot, Qt, QProcess, QTimer, QSize 15 from PyQt5.QtCore import pyqtSlot, Qt, QProcess, QTimer, QSize
16 from PyQt5.QtGui import QTextCursor 16 from PyQt5.QtGui import QTextCursor
17 from PyQt5.QtWidgets import QWidget, QDialogButtonBox, QMenu, QHeaderView, \ 17 from PyQt5.QtWidgets import (
18 QTreeWidgetItem, QLineEdit, QInputDialog 18 QWidget, QDialogButtonBox, QMenu, QHeaderView, QTreeWidgetItem, QLineEdit,
19 QInputDialog
20 )
19 21
20 from E5Gui.E5Application import e5App 22 from E5Gui.E5Application import e5App
21 from E5Gui import E5MessageBox 23 from E5Gui import E5MessageBox
22 24
23 from Globals import strToQByteArray 25 from Globals import strToQByteArray
262 """ 264 """
263 Protected slot implementing a close event handler. 265 Protected slot implementing a close event handler.
264 266
265 @param e close event (QCloseEvent) 267 @param e close event (QCloseEvent)
266 """ 268 """
267 if self.process is not None and \ 269 if (
268 self.process.state() != QProcess.NotRunning: 270 self.process is not None and
271 self.process.state() != QProcess.NotRunning
272 ):
269 self.process.terminate() 273 self.process.terminate()
270 QTimer.singleShot(2000, self.process.kill) 274 QTimer.singleShot(2000, self.process.kill)
271 self.process.waitForFinished(3000) 275 self.process.waitForFinished(3000)
272 276
273 self.vcs.getPlugin().setPreferences( 277 self.vcs.getPlugin().setPreferences(
335 339
336 itm.setTextAlignment(self.__statusWorkColumn, Qt.AlignHCenter) 340 itm.setTextAlignment(self.__statusWorkColumn, Qt.AlignHCenter)
337 itm.setTextAlignment(self.__statusIndexColumn, Qt.AlignHCenter) 341 itm.setTextAlignment(self.__statusIndexColumn, Qt.AlignHCenter)
338 itm.setTextAlignment(self.__pathColumn, Qt.AlignLeft) 342 itm.setTextAlignment(self.__pathColumn, Qt.AlignLeft)
339 343
340 if status not in self.ConflictStates + ["??", "!!"] and \ 344 if (
341 statusIndexText in self.modifiedIndicators: 345 status not in self.ConflictStates + ["??", "!!"] and
346 statusIndexText in self.modifiedIndicators
347 ):
342 itm.setFlags(itm.flags() | Qt.ItemIsUserCheckable) 348 itm.setFlags(itm.flags() | Qt.ItemIsUserCheckable)
343 itm.setCheckState(self.__toBeCommittedColumn, Qt.Checked) 349 itm.setCheckState(self.__toBeCommittedColumn, Qt.Checked)
344 else: 350 else:
345 itm.setFlags(itm.flags() & ~Qt.ItemIsUserCheckable) 351 itm.setFlags(itm.flags() & ~Qt.ItemIsUserCheckable)
346 352
418 def __finish(self): 424 def __finish(self):
419 """ 425 """
420 Private slot called when the process finished or the user pressed 426 Private slot called when the process finished or the user pressed
421 the button. 427 the button.
422 """ 428 """
423 if self.process is not None and \ 429 if (
424 self.process.state() != QProcess.NotRunning: 430 self.process is not None and
431 self.process.state() != QProcess.NotRunning
432 ):
425 self.process.terminate() 433 self.process.terminate()
426 QTimer.singleShot(2000, self.process.kill) 434 QTimer.singleShot(2000, self.process.kill)
427 self.process.waitForFinished(3000) 435 self.process.waitForFinished(3000)
428 436
429 self.inputGroup.setEnabled(False) 437 self.inputGroup.setEnabled(False)
910 @return list of all items, the user has not checked 918 @return list of all items, the user has not checked
911 """ 919 """
912 items = [] 920 items = []
913 for index in range(self.statusList.topLevelItemCount()): 921 for index in range(self.statusList.topLevelItemCount()):
914 itm = self.statusList.topLevelItem(index) 922 itm = self.statusList.topLevelItem(index)
915 if itm.flags() & Qt.ItemIsUserCheckable and \ 923 if (
916 itm.checkState(self.__toBeCommittedColumn) == Qt.Unchecked: 924 itm.flags() & Qt.ItemIsUserCheckable and
925 itm.checkState(self.__toBeCommittedColumn) == Qt.Unchecked
926 ):
917 items.append(itm) 927 items.append(itm)
918 return items 928 return items
919 929
920 def __getModifiedItems(self): 930 def __getModifiedItems(self):
921 """ 931 """
967 977
968 @return list of all items with a stageable status 978 @return list of all items with a stageable status
969 """ 979 """
970 stageableItems = [] 980 stageableItems = []
971 for itm in self.statusList.selectedItems(): 981 for itm in self.statusList.selectedItems():
972 if itm.text(self.__statusWorkColumn) in \ 982 if (
973 self.modifiedIndicators + self.unmergedIndicators: 983 itm.text(self.__statusWorkColumn) in
984 self.modifiedIndicators + self.unmergedIndicators
985 ):
974 stageableItems.append(itm) 986 stageableItems.append(itm)
975 return stageableItems 987 return stageableItems
976 988
977 def __getUnstageableItems(self): 989 def __getUnstageableItems(self):
978 """ 990 """

eric ide

mercurial