39 def __init__(self, vcs, mq=False, parent=None): |
39 def __init__(self, vcs, mq=False, parent=None): |
40 """ |
40 """ |
41 Constructor |
41 Constructor |
42 |
42 |
43 @param vcs reference to the vcs object |
43 @param vcs reference to the vcs object |
44 @param mq flag indicating to show a queue repo status (boolean) |
44 @type Hg |
45 @param parent parent widget (QWidget) |
45 @param mq flag indicating to show a queue repo status |
|
46 @type bool |
|
47 @param parent parent widget |
|
48 @type QWidget |
46 """ |
49 """ |
47 super().__init__(parent) |
50 super().__init__(parent) |
48 self.setupUi(self) |
51 self.setupUi(self) |
49 |
52 |
50 self.__toBeCommittedColumn = 0 |
53 self.__toBeCommittedColumn = 0 |
284 |
288 |
285 def __generateItem(self, status, path): |
289 def __generateItem(self, status, path): |
286 """ |
290 """ |
287 Private method to generate a status item in the status list. |
291 Private method to generate a status item in the status list. |
288 |
292 |
289 @param status status indicator (string) |
293 @param status status indicator |
290 @param path path of the file or directory (string) |
294 @type str |
|
295 @param path path of the file or directory |
|
296 @type str |
291 """ |
297 """ |
292 statusText = self.status[status] |
298 statusText = self.status[status] |
293 itm = QTreeWidgetItem( |
299 itm = QTreeWidgetItem( |
294 self.statusList, |
300 self.statusList, |
295 [ |
301 [ |
314 def start(self, fn): |
320 def start(self, fn): |
315 """ |
321 """ |
316 Public slot to start the hg status command. |
322 Public slot to start the hg status command. |
317 |
323 |
318 @param fn filename(s)/directoryname(s) to show the status of |
324 @param fn filename(s)/directoryname(s) to show the status of |
319 (string or list of strings) |
325 @type str or list of str |
320 """ |
326 """ |
321 self.errorGroup.hide() |
327 self.errorGroup.hide() |
322 self.intercept = False |
328 self.intercept = False |
323 self.args = fn |
329 self.args = fn |
324 |
330 |
387 |
393 |
388 def on_buttonBox_clicked(self, button): |
394 def on_buttonBox_clicked(self, button): |
389 """ |
395 """ |
390 Private slot called by a button of the button box clicked. |
396 Private slot called by a button of the button box clicked. |
391 |
397 |
392 @param button button that was clicked (QAbstractButton) |
398 @param button button that was clicked |
|
399 @type QAbstractButton |
393 """ |
400 """ |
394 if button == self.buttonBox.button(QDialogButtonBox.StandardButton.Close): |
401 if button == self.buttonBox.button(QDialogButtonBox.StandardButton.Close): |
395 self.close() |
402 self.close() |
396 elif button == self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel): |
403 elif button == self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel): |
397 self.__hgClient.cancel() |
404 self.__hgClient.cancel() |
400 |
407 |
401 def __processOutputLine(self, line): |
408 def __processOutputLine(self, line): |
402 """ |
409 """ |
403 Private method to process the lines of output. |
410 Private method to process the lines of output. |
404 |
411 |
405 @param line output line to be processed (string) |
412 @param line output line to be processed |
|
413 @type str |
406 """ |
414 """ |
407 if line[0] in "ACIMR?!" and line[1] == " ": |
415 if line[0] in "ACIMR?!" and line[1] == " ": |
408 status, path = line.strip().split(" ", 1) |
416 status, path = line.strip().split(" ", 1) |
409 self.__generateItem(status, path) |
417 self.__generateItem(status, path) |
410 |
418 |
411 def __showError(self, out): |
419 def __showError(self, out): |
412 """ |
420 """ |
413 Private slot to show some error. |
421 Private slot to show some error. |
414 |
422 |
415 @param out error to be shown (string) |
423 @param out error to be shown |
|
424 @type str |
416 """ |
425 """ |
417 self.errorGroup.show() |
426 self.errorGroup.show() |
418 self.errors.insertPlainText(out) |
427 self.errors.insertPlainText(out) |
419 self.errors.ensureCursorVisible() |
428 self.errors.ensureCursorVisible() |
420 |
429 |
579 |
588 |
580 def __lfAdd(self, mode): |
589 def __lfAdd(self, mode): |
581 """ |
590 """ |
582 Private slot to add a file to the repository. |
591 Private slot to add a file to the repository. |
583 |
592 |
584 @param mode add mode (string one of 'normal' or 'large') |
593 @param mode add mode (one of 'normal' or 'large') |
|
594 @type str |
585 """ |
595 """ |
586 names = [ |
596 names = [ |
587 os.path.join(self.__repoPath, itm.text(self.__pathColumn)) |
597 os.path.join(self.__repoPath, itm.text(self.__pathColumn)) |
588 for itm in self.__getUnversionedItems() |
598 for itm in self.__getUnversionedItems() |
589 ] |
599 ] |
722 def __getCommitableItems(self): |
732 def __getCommitableItems(self): |
723 """ |
733 """ |
724 Private method to retrieve all entries the user wants to commit. |
734 Private method to retrieve all entries the user wants to commit. |
725 |
735 |
726 @return list of all items, the user has checked |
736 @return list of all items, the user has checked |
|
737 @rtype list of QTreeWidgetItems |
727 """ |
738 """ |
728 commitableItems = [] |
739 commitableItems = [] |
729 for index in range(self.statusList.topLevelItemCount()): |
740 for index in range(self.statusList.topLevelItemCount()): |
730 itm = self.statusList.topLevelItem(index) |
741 itm = self.statusList.topLevelItem(index) |
731 if itm.checkState(self.__toBeCommittedColumn) == Qt.CheckState.Checked: |
742 if itm.checkState(self.__toBeCommittedColumn) == Qt.CheckState.Checked: |
736 """ |
747 """ |
737 Private method to retrieve all entries the user may commit but hasn't |
748 Private method to retrieve all entries the user may commit but hasn't |
738 selected. |
749 selected. |
739 |
750 |
740 @return list of all items, the user has checked |
751 @return list of all items, the user has checked |
|
752 @rtype list of QTreeWidgetItems |
741 """ |
753 """ |
742 items = [] |
754 items = [] |
743 for index in range(self.statusList.topLevelItemCount()): |
755 for index in range(self.statusList.topLevelItemCount()): |
744 itm = self.statusList.topLevelItem(index) |
756 itm = self.statusList.topLevelItem(index) |
745 if ( |
757 if ( |
752 def __getModifiedItems(self): |
764 def __getModifiedItems(self): |
753 """ |
765 """ |
754 Private method to retrieve all entries, that have a modified status. |
766 Private method to retrieve all entries, that have a modified status. |
755 |
767 |
756 @return list of all items with a modified status |
768 @return list of all items with a modified status |
|
769 @rtype list of QTreeWidgetItems |
757 """ |
770 """ |
758 modifiedItems = [] |
771 modifiedItems = [] |
759 for itm in self.statusList.selectedItems(): |
772 for itm in self.statusList.selectedItems(): |
760 if itm.text(self.__statusColumn) in self.modifiedIndicators: |
773 if itm.text(self.__statusColumn) in self.modifiedIndicators: |
761 modifiedItems.append(itm) |
774 modifiedItems.append(itm) |
765 """ |
778 """ |
766 Private method to retrieve all entries, that have an unversioned |
779 Private method to retrieve all entries, that have an unversioned |
767 status. |
780 status. |
768 |
781 |
769 @return list of all items with an unversioned status |
782 @return list of all items with an unversioned status |
|
783 @rtype list of QTreeWidgetItems |
770 """ |
784 """ |
771 unversionedItems = [] |
785 unversionedItems = [] |
772 for itm in self.statusList.selectedItems(): |
786 for itm in self.statusList.selectedItems(): |
773 if itm.text(self.__statusColumn) in self.unversionedIndicators: |
787 if itm.text(self.__statusColumn) in self.unversionedIndicators: |
774 unversionedItems.append(itm) |
788 unversionedItems.append(itm) |
777 def __getMissingItems(self): |
791 def __getMissingItems(self): |
778 """ |
792 """ |
779 Private method to retrieve all entries, that have a missing status. |
793 Private method to retrieve all entries, that have a missing status. |
780 |
794 |
781 @return list of all items with a missing status |
795 @return list of all items with a missing status |
|
796 @rtype list of QTreeWidgetItems |
782 """ |
797 """ |
783 missingItems = [] |
798 missingItems = [] |
784 for itm in self.statusList.selectedItems(): |
799 for itm in self.statusList.selectedItems(): |
785 if itm.text(self.__statusColumn) in self.missingIndicators: |
800 if itm.text(self.__statusColumn) in self.missingIndicators: |
786 missingItems.append(itm) |
801 missingItems.append(itm) |
788 |
803 |
789 def __commitSelect(self, selected): |
804 def __commitSelect(self, selected): |
790 """ |
805 """ |
791 Private slot to select or deselect all entries. |
806 Private slot to select or deselect all entries. |
792 |
807 |
793 @param selected commit selection state to be set (boolean) |
808 @param selected commit selection state to be set |
|
809 @type bool |
794 """ |
810 """ |
795 for index in range(self.statusList.topLevelItemCount()): |
811 for index in range(self.statusList.topLevelItemCount()): |
796 itm = self.statusList.topLevelItem(index) |
812 itm = self.statusList.topLevelItem(index) |
797 if ( |
813 if ( |
798 itm.flags() & Qt.ItemFlag.ItemIsUserCheckable |
814 itm.flags() & Qt.ItemFlag.ItemIsUserCheckable |