VCS/VersionControl.py

changeset 6529
1c2968f124b7
parent 6048
82ad8ec9548c
child 6645
ad476851d7e0
equal deleted inserted replaced
6528:3e194fec0eaa 6529:1c2968f124b7
30 and the common methods. 30 and the common methods.
31 31
32 @signal vcsStatusMonitorData(list of str) emitted to update the VCS status 32 @signal vcsStatusMonitorData(list of str) emitted to update the VCS status
33 @signal vcsStatusMonitorStatus(str, str) emitted to signal the status of 33 @signal vcsStatusMonitorStatus(str, str) emitted to signal the status of
34 the monitoring thread (ok, nok, op, off) and a status message 34 the monitoring thread (ok, nok, op, off) and a status message
35 @signal vcsStatusMonitorInfo(str) emitted to signal some info of the
36 monitoring thread
35 @signal vcsStatusChanged() emitted to indicate a change of the overall 37 @signal vcsStatusChanged() emitted to indicate a change of the overall
36 VCS status 38 VCS status
37 """ 39 """
38 vcsStatusMonitorData = pyqtSignal(list) 40 vcsStatusMonitorData = pyqtSignal(list)
39 vcsStatusMonitorStatus = pyqtSignal(str, str) 41 vcsStatusMonitorStatus = pyqtSignal(str, str)
42 vcsStatusMonitorInfo = pyqtSignal(str)
40 vcsStatusChanged = pyqtSignal() 43 vcsStatusChanged = pyqtSignal()
41 44
42 canBeCommitted = 1 # Indicates that a file/directory is in the vcs. 45 canBeCommitted = 1 # Indicates that a file/directory is in the vcs.
43 canBeAdded = 2 # Indicates that a file/directory is not in vcs. 46 canBeAdded = 2 # Indicates that a file/directory is not in vcs.
44 47
626 ## VCS status monitor thread related methods 629 ## VCS status monitor thread related methods
627 ########################################################################### 630 ###########################################################################
628 631
629 def __statusMonitorStatus(self, status, statusMsg): 632 def __statusMonitorStatus(self, status, statusMsg):
630 """ 633 """
631 Private method to receive the status monitor status. 634 Private slot to receive the status monitor status.
632 635
633 It simply reemits the received status. 636 It simply re-emits the received status.
634 637
635 @param status status of the monitoring thread (string, ok, nok or off) 638 @param status status of the monitoring thread
636 @param statusMsg explanotory text for the signaled status (string) 639 @type str (one of ok, nok or off)
640 @param statusMsg explanotory text for the signaled status
641 @type str
637 """ 642 """
638 self.vcsStatusMonitorStatus.emit(status, statusMsg) 643 self.vcsStatusMonitorStatus.emit(status, statusMsg)
639 QApplication.flush() 644 QApplication.flush()
640 645
641 def __statusMonitorData(self, statusList): 646 def __statusMonitorData(self, statusList):
642 """ 647 """
643 Private method to receive the status monitor status. 648 Private method to receive the status monitor status.
644 649
645 It simply reemits the received status list. 650 It simply re-emits the received status list.
646 651
647 @param statusList list of status records (list of strings) 652 @param statusList list of status records
653 @type list of str
648 """ 654 """
649 self.vcsStatusMonitorData.emit(statusList) 655 self.vcsStatusMonitorData.emit(statusList)
650 QApplication.flush() 656 QApplication.flush()
651 657
658 def __statusMonitorInfo(self, info):
659 """
660 Private slot to receive the status monitor info message.
661
662 It simply re-emits the received info message.
663
664 @param info received info message
665 @type str
666 """
667 self.vcsStatusMonitorInfo.emit(info)
668 QApplication.flush()
669
652 def startStatusMonitor(self, project): 670 def startStatusMonitor(self, project):
653 """ 671 """
654 Public method to start the VCS status monitor thread. 672 Public method to start the VCS status monitor thread.
655 673
656 @param project reference to the project object 674 @param project reference to the project object
668 if self.statusMonitorThread is not None: 686 if self.statusMonitorThread is not None:
669 self.statusMonitorThread.vcsStatusMonitorData.connect( 687 self.statusMonitorThread.vcsStatusMonitorData.connect(
670 self.__statusMonitorData, Qt.QueuedConnection) 688 self.__statusMonitorData, Qt.QueuedConnection)
671 self.statusMonitorThread.vcsStatusMonitorStatus.connect( 689 self.statusMonitorThread.vcsStatusMonitorStatus.connect(
672 self.__statusMonitorStatus, Qt.QueuedConnection) 690 self.__statusMonitorStatus, Qt.QueuedConnection)
691 self.statusMonitorThread.vcsStatusMonitorInfo.connect(
692 self.__statusMonitorInfo, Qt.QueuedConnection)
673 self.statusMonitorThread.setAutoUpdate( 693 self.statusMonitorThread.setAutoUpdate(
674 Preferences.getVCS("AutoUpdate")) 694 Preferences.getVCS("AutoUpdate"))
675 self.statusMonitorThread.start() 695 self.statusMonitorThread.start()
676 else: 696 else:
677 self.statusMonitorThread = None 697 self.statusMonitorThread = None
685 self.__statusMonitorData(["--RESET--"]) 705 self.__statusMonitorData(["--RESET--"])
686 self.statusMonitorThread.vcsStatusMonitorData.disconnect( 706 self.statusMonitorThread.vcsStatusMonitorData.disconnect(
687 self.__statusMonitorData) 707 self.__statusMonitorData)
688 self.statusMonitorThread.vcsStatusMonitorStatus.disconnect( 708 self.statusMonitorThread.vcsStatusMonitorStatus.disconnect(
689 self.__statusMonitorStatus) 709 self.__statusMonitorStatus)
710 self.statusMonitorThread.vcsStatusMonitorInfo.disconnect(
711 self.__statusMonitorInfo)
690 self.statusMonitorThread.stop() 712 self.statusMonitorThread.stop()
691 self.statusMonitorThread.wait(10000) 713 self.statusMonitorThread.wait(10000)
692 if not self.statusMonitorThread.isFinished(): 714 if not self.statusMonitorThread.isFinished():
693 self.statusMonitorThread.terminate() 715 self.statusMonitorThread.terminate()
694 self.statusMonitorThread.wait(10000) 716 self.statusMonitorThread.wait(10000)
696 self.__statusMonitorStatus( 718 self.__statusMonitorStatus(
697 "off", 719 "off",
698 QCoreApplication.translate( 720 QCoreApplication.translate(
699 "VersionControl", 721 "VersionControl",
700 "Repository status checking is switched off")) 722 "Repository status checking is switched off"))
723 self.__statusMonitorInfo("")
701 724
702 def setStatusMonitorInterval(self, interval, project): 725 def setStatusMonitorInterval(self, interval, project):
703 """ 726 """
704 Public method to change the monitor interval. 727 Public method to change the monitor interval.
705 728

eric ide

mercurial