src/eric7/Plugins/VcsPlugins/vcsPySvn/SvnStatusDialog.py

branch
eric7
changeset 10438
4cd7e5a8b3cf
parent 9653
e67609152c5e
child 10439
21c28b0f9e41
equal deleted inserted replaced
10437:2f70ca07f0af 10438:4cd7e5a8b3cf
43 def __init__(self, vcs, parent=None): 43 def __init__(self, vcs, parent=None):
44 """ 44 """
45 Constructor 45 Constructor
46 46
47 @param vcs reference to the vcs object 47 @param vcs reference to the vcs object
48 @param parent parent widget (QWidget) 48 @type Subversion
49 @param parent parent widget
50 @type QWidget
49 """ 51 """
50 super().__init__(parent) 52 super().__init__(parent)
51 self.setupUi(self) 53 self.setupUi(self)
52 SvnDialogMixin.__init__(self) 54 SvnDialogMixin.__init__(self)
53 55
232 path, 234 path,
233 ): 235 ):
234 """ 236 """
235 Private method to generate a status item in the status list. 237 Private method to generate a status item in the status list.
236 238
237 @param changelist name of the changelist (string) 239 @param changelist name of the changelist
238 @param status text status (pysvn.wc_status_kind) 240 @type str
239 @param propStatus property status (pysvn.wc_status_kind) 241 @param status text status
240 @param locked locked flag (boolean) 242 @type pysvn.wc_status_kind
241 @param history history flag (boolean) 243 @param propStatus property status
242 @param switched switched flag (boolean) 244 @type pysvn.wc_status_kind
243 @param lockinfo lock indicator (string) 245 @param locked locked flag
244 @param uptodate up to date flag (boolean) 246 @type bool
245 @param revision revision (integer) 247 @param history history flag
246 @param change revision of last change (integer) 248 @type bool
247 @param author author of the last change (string) 249 @param switched switched flag
248 @param path path of the file or directory (string) 250 @type bool
251 @param lockinfo lock indicator
252 @type str
253 @param uptodate up to date flag
254 @type bool
255 @param revision revision
256 @type int
257 @param change revision of last change
258 @type int
259 @param author author of the last change
260 @type str
261 @param path path of the file or directory
262 @type str
249 """ 263 """
250 statusText = self.tr(svnStatusMap[status]) 264 statusText = self.tr(svnStatusMap[status])
251 itm = QTreeWidgetItem(self.statusList) 265 itm = QTreeWidgetItem(self.statusList)
252 itm.setData(0, Qt.ItemDataRole.DisplayRole, "") 266 itm.setData(0, Qt.ItemDataRole.DisplayRole, "")
253 itm.setData(1, Qt.ItemDataRole.DisplayRole, changelist) 267 itm.setData(1, Qt.ItemDataRole.DisplayRole, changelist)
296 def start(self, fn): 310 def start(self, fn):
297 """ 311 """
298 Public slot to start the svn status command. 312 Public slot to start the svn status command.
299 313
300 @param fn filename(s)/directoryname(s) to show the status of 314 @param fn filename(s)/directoryname(s) to show the status of
301 (string or list of strings) 315 @type str or list of str
302 """ 316 """
303 self.errorGroup.hide() 317 self.errorGroup.hide()
304 318
305 for act in self.menuactions: 319 for act in self.menuactions:
306 act.setEnabled(False) 320 act.setEnabled(False)
350 cwd = os.getcwd() 364 cwd = os.getcwd()
351 os.chdir(self.dname) 365 os.chdir(self.dname)
352 try: 366 try:
353 with EricMutexLocker(self.vcs.vcsExecutionMutex): 367 with EricMutexLocker(self.vcs.vcsExecutionMutex):
354 for name in fnames: 368 for name in fnames:
355 # step 1: determine changelists and their files 369 # step 1: determine change lists and their files
356 changelistsDict = {} 370 changelistsDict = {}
357 if hasattr(self.client, "get_changelist"): 371 if hasattr(self.client, "get_changelist"):
358 if recurse: 372 if recurse:
359 depth = pysvn.depth.infinity 373 depth = pysvn.depth.infinity
360 else: 374 else:
501 515
502 def on_buttonBox_clicked(self, button): 516 def on_buttonBox_clicked(self, button):
503 """ 517 """
504 Private slot called by a button of the button box clicked. 518 Private slot called by a button of the button box clicked.
505 519
506 @param button button that was clicked (QAbstractButton) 520 @param button button that was clicked
521 @type QAbstractButton
507 """ 522 """
508 if button == self.buttonBox.button(QDialogButtonBox.StandardButton.Close): 523 if button == self.buttonBox.button(QDialogButtonBox.StandardButton.Close):
509 self.close() 524 self.close()
510 elif button == self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel): 525 elif button == self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel):
511 self.__finish() 526 self.__finish()
521 536
522 def __showError(self, msg): 537 def __showError(self, msg):
523 """ 538 """
524 Private slot to show an error message. 539 Private slot to show an error message.
525 540
526 @param msg error message to show (string) 541 @param msg error message to show
542 @type str
527 """ 543 """
528 self.errorGroup.show() 544 self.errorGroup.show()
529 self.errors.insertPlainText(msg) 545 self.errors.insertPlainText(msg)
530 self.errors.ensureCursorVisible() 546 self.errors.ensureCursorVisible()
531 547
571 @pyqtSlot(QTreeWidgetItem, int) 587 @pyqtSlot(QTreeWidgetItem, int)
572 def on_statusList_itemChanged(self, item, column): 588 def on_statusList_itemChanged(self, item, column):
573 """ 589 """
574 Private slot to act upon item changes. 590 Private slot to act upon item changes.
575 591
576 @param item reference to the changed item (QTreeWidgetItem) 592 @param item reference to the changed item
577 @param column index of column that changed (integer) 593 @type QTreeWidgetItem
594 @param column index of column that changed
595 @type int
578 """ 596 """
579 if column == self.__toBeCommittedColumn: 597 if column == self.__toBeCommittedColumn:
580 self.__updateCommitButton() 598 self.__updateCommitButton()
581 599
582 @pyqtSlot() 600 @pyqtSlot()
634 652
635 def __showContextMenu(self, coord): 653 def __showContextMenu(self, coord):
636 """ 654 """
637 Private slot to show the context menu of the status list. 655 Private slot to show the context menu of the status list.
638 656
639 @param coord the position of the mouse pointer (QPoint) 657 @param coord the position of the mouse pointer
658 @type QPoint
640 """ 659 """
641 self.menu.popup(self.statusList.mapToGlobal(coord)) 660 self.menu.popup(self.statusList.mapToGlobal(coord))
642 661
643 def __commit(self): 662 def __commit(self):
644 """ 663 """
901 self.vcs.svnAddToChangelist(names) 920 self.vcs.svnAddToChangelist(names)
902 self.on_refreshButton_clicked() 921 self.on_refreshButton_clicked()
903 922
904 def __removeFromChangelist(self): 923 def __removeFromChangelist(self):
905 """ 924 """
906 Private slot to remove entries from their changelists. 925 Private slot to remove entries from their change lists.
907 """ 926 """
908 names = [ 927 names = [
909 os.path.join(self.dname, itm.text(self.__pathColumn)) 928 os.path.join(self.dname, itm.text(self.__pathColumn))
910 for itm in self.__getChangelistItems() 929 for itm in self.__getChangelistItems()
911 ] 930 ]
925 def __getCommitableItems(self): 944 def __getCommitableItems(self):
926 """ 945 """
927 Private method to retrieve all entries the user wants to commit. 946 Private method to retrieve all entries the user wants to commit.
928 947
929 @return list of all items, the user has checked 948 @return list of all items, the user has checked
949 @rtype list of QTreeWidgetItem
930 """ 950 """
931 commitableItems = [] 951 commitableItems = []
932 for index in range(self.statusList.topLevelItemCount()): 952 for index in range(self.statusList.topLevelItemCount()):
933 itm = self.statusList.topLevelItem(index) 953 itm = self.statusList.topLevelItem(index)
934 if itm.checkState(self.__toBeCommittedColumn) == Qt.CheckState.Checked: 954 if itm.checkState(self.__toBeCommittedColumn) == Qt.CheckState.Checked:
938 def __getModifiedItems(self): 958 def __getModifiedItems(self):
939 """ 959 """
940 Private method to retrieve all entries, that have a modified status. 960 Private method to retrieve all entries, that have a modified status.
941 961
942 @return list of all items with a modified status 962 @return list of all items with a modified status
963 @rtype list of QTreeWidgetItem
943 """ 964 """
944 modifiedItems = [] 965 modifiedItems = []
945 for itm in self.statusList.selectedItems(): 966 for itm in self.statusList.selectedItems():
946 if ( 967 if (
947 itm.text(self.__statusColumn) in self.modifiedIndicators 968 itm.text(self.__statusColumn) in self.modifiedIndicators
954 """ 975 """
955 Private method to retrieve all entries, that have an 976 Private method to retrieve all entries, that have an
956 unversioned status. 977 unversioned status.
957 978
958 @return list of all items with an unversioned status 979 @return list of all items with an unversioned status
980 @rtype list of QTreeWidgetItem
959 """ 981 """
960 unversionedItems = [] 982 unversionedItems = []
961 for itm in self.statusList.selectedItems(): 983 for itm in self.statusList.selectedItems():
962 if itm.text(self.__statusColumn) in self.unversionedIndicators: 984 if itm.text(self.__statusColumn) in self.unversionedIndicators:
963 unversionedItems.append(itm) 985 unversionedItems.append(itm)
966 def __getMissingItems(self): 988 def __getMissingItems(self):
967 """ 989 """
968 Private method to retrieve all entries, that have a missing status. 990 Private method to retrieve all entries, that have a missing status.
969 991
970 @return list of all items with a missing status 992 @return list of all items with a missing status
993 @rtype list of QTreeWidgetItem
971 """ 994 """
972 missingItems = [] 995 missingItems = []
973 for itm in self.statusList.selectedItems(): 996 for itm in self.statusList.selectedItems():
974 if itm.text(self.__statusColumn) in self.missingIndicators: 997 if itm.text(self.__statusColumn) in self.missingIndicators:
975 missingItems.append(itm) 998 missingItems.append(itm)
977 1000
978 def __getLockActionItems(self, indicators): 1001 def __getLockActionItems(self, indicators):
979 """ 1002 """
980 Private method to retrieve all entries, that have a locked status. 1003 Private method to retrieve all entries, that have a locked status.
981 1004
982 @param indicators list of indicators to check against (list of strings) 1005 @param indicators list of indicators to check against
1006 @type list of str
983 @return list of all items with a locked status 1007 @return list of all items with a locked status
1008 @rtype list of QTreeWidgetItem
984 """ 1009 """
985 lockitems = [] 1010 lockitems = []
986 for itm in self.statusList.selectedItems(): 1011 for itm in self.statusList.selectedItems():
987 if itm.text(self.__lockinfoColumn) in indicators: 1012 if itm.text(self.__lockinfoColumn) in indicators:
988 lockitems.append(itm) 1013 lockitems.append(itm)
992 """ 1017 """
993 Private method to retrieve all entries, that are members of 1018 Private method to retrieve all entries, that are members of
994 a changelist. 1019 a changelist.
995 1020
996 @return list of all items belonging to a changelist 1021 @return list of all items belonging to a changelist
1022 @rtype list of QTreeWidgetItem
997 """ 1023 """
998 clitems = [] 1024 clitems = []
999 for itm in self.statusList.selectedItems(): 1025 for itm in self.statusList.selectedItems():
1000 if itm.text(self.__changelistColumn): 1026 if itm.text(self.__changelistColumn):
1001 clitems.append(itm) 1027 clitems.append(itm)
1005 """ 1031 """
1006 Private method to retrieve all entries, that are not members of 1032 Private method to retrieve all entries, that are not members of
1007 a changelist. 1033 a changelist.
1008 1034
1009 @return list of all items not belonging to a changelist 1035 @return list of all items not belonging to a changelist
1036 @rtype list of QTreeWidgetItem
1010 """ 1037 """
1011 clitems = [] 1038 clitems = []
1012 for itm in self.statusList.selectedItems(): 1039 for itm in self.statusList.selectedItems():
1013 if not itm.text(self.__changelistColumn): 1040 if not itm.text(self.__changelistColumn):
1014 clitems.append(itm) 1041 clitems.append(itm)
1016 1043
1017 def __commitSelect(self, selected): 1044 def __commitSelect(self, selected):
1018 """ 1045 """
1019 Private slot to select or deselect all entries. 1046 Private slot to select or deselect all entries.
1020 1047
1021 @param selected commit selection state to be set (boolean) 1048 @param selected commit selection state to be set
1049 @type bool
1022 """ 1050 """
1023 for index in range(self.statusList.topLevelItemCount()): 1051 for index in range(self.statusList.topLevelItemCount()):
1024 itm = self.statusList.topLevelItem(index) 1052 itm = self.statusList.topLevelItem(index)
1025 if ( 1053 if (
1026 itm.flags() & Qt.ItemFlag.ItemIsUserCheckable 1054 itm.flags() & Qt.ItemFlag.ItemIsUserCheckable

eric ide

mercurial