ViewManager/ViewManager.py

changeset 1128
b8ab8eac9dde
parent 1112
8a7d1b9d18db
child 1131
7781e396c903
equal deleted inserted replaced
1127:b1802ebe0066 1128:b8ab8eac9dde
2191 qtb.addAction(self.quickFindtextAction) 2191 qtb.addAction(self.quickFindtextAction)
2192 qtb.addAction(self.quickSearchAct) 2192 qtb.addAction(self.quickSearchAct)
2193 qtb.addAction(self.quickSearchBackAct) 2193 qtb.addAction(self.quickSearchBackAct)
2194 qtb.addAction(self.quickSearchExtendAct) 2194 qtb.addAction(self.quickSearchExtendAct)
2195 self.quickFindtextCombo.setEnabled(False) 2195 self.quickFindtextCombo.setEnabled(False)
2196 self.__quickSearchToolbar = qtb
2197 self.__quickSearchToolbarVisibility = None
2196 2198
2197 tb = QToolBar(QApplication.translate('ViewManager', 'Search'), self.ui) 2199 tb = QToolBar(QApplication.translate('ViewManager', 'Search'), self.ui)
2198 tb.setIconSize(UI.Config.ToolBarIconSize) 2200 tb.setIconSize(UI.Config.ToolBarIconSize)
2199 tb.setObjectName("SearchToolbar") 2201 tb.setObjectName("SearchToolbar")
2200 tb.setToolTip(QApplication.translate('ViewManager', 'Search')) 2202 tb.setToolTip(QApplication.translate('ViewManager', 'Search'))
3689 """ 3691 """
3690 if not isinstance(now, (Editor, Shell, Terminal)): 3692 if not isinstance(now, (Editor, Shell, Terminal)):
3691 self.editActGrp.setEnabled(False) 3693 self.editActGrp.setEnabled(False)
3692 self.copyActGrp.setEnabled(False) 3694 self.copyActGrp.setEnabled(False)
3693 self.viewActGrp.setEnabled(False) 3695 self.viewActGrp.setEnabled(False)
3696
3697 if not isinstance(now, (Editor, Shell, Terminal)) and \
3698 now is not self.quickFindtextCombo:
3694 self.searchActGrp.setEnabled(False) 3699 self.searchActGrp.setEnabled(False)
3700
3701 if now is self.quickFindtextCombo:
3702 self.searchActGrp.setEnabled(True)
3695 3703
3696 if isinstance(old, (Editor, Shell, Terminal)): 3704 if isinstance(old, (Editor, Shell, Terminal)):
3697 self.__lastFocusWidget = old 3705 self.__lastFocusWidget = old
3698 3706
3699 ################################################################## 3707 ##################################################################
3909 """ 3917 """
3910 Private slot to handle the incremental quick search. 3918 Private slot to handle the incremental quick search.
3911 """ 3919 """
3912 # first we have to check if quick search is active 3920 # first we have to check if quick search is active
3913 # and try to activate it if not 3921 # and try to activate it if not
3922 if self.__quickSearchToolbarVisibility is None:
3923 self.__quickSearchToolbarVisibility = self.__quickSearchToolbar.isVisible()
3924 if not self.__quickSearchToolbar.isVisible():
3925 self.__quickSearchToolbar.show()
3914 if not self.quickFindtextCombo.lineEdit().hasFocus(): 3926 if not self.quickFindtextCombo.lineEdit().hasFocus():
3915 aw = self.activeWindow() 3927 aw = self.activeWindow()
3916 self.quickFindtextCombo.lastActive = aw 3928 self.quickFindtextCombo.lastActive = aw
3917 if aw: 3929 if aw:
3918 self.quickFindtextCombo.lastCursorPos = aw.getCursorPosition() 3930 self.quickFindtextCombo.lastCursorPos = aw.getCursorPosition()
3937 Private slot to handle the incremental quick search return pressed 3949 Private slot to handle the incremental quick search return pressed
3938 (jump back to text) 3950 (jump back to text)
3939 """ 3951 """
3940 if self.quickFindtextCombo.lastActive: 3952 if self.quickFindtextCombo.lastActive:
3941 self.quickFindtextCombo.lastActive.setFocus() 3953 self.quickFindtextCombo.lastActive.setFocus()
3954 if self.__quickSearchToolbarVisibility is not None:
3955 self.__quickSearchToolbar.setVisible(self.__quickSearchToolbarVisibility)
3956 self.__quickSearchToolbarVisibility = None
3942 3957
3943 def __quickSearchEscape(self): 3958 def __quickSearchEscape(self):
3944 """ 3959 """
3945 Private slot to handle the incremental quick search escape pressed 3960 Private slot to handle the incremental quick search escape pressed
3946 (jump back to text) 3961 (jump back to text)
3949 self.quickFindtextCombo.lastActive.setFocus() 3964 self.quickFindtextCombo.lastActive.setFocus()
3950 aw = self.activeWindow() 3965 aw = self.activeWindow()
3951 if aw and self.quickFindtextCombo.lastCursorPos: 3966 if aw and self.quickFindtextCombo.lastCursorPos:
3952 aw.setCursorPosition(self.quickFindtextCombo.lastCursorPos[0], 3967 aw.setCursorPosition(self.quickFindtextCombo.lastCursorPos[0],
3953 self.quickFindtextCombo.lastCursorPos[1]) 3968 self.quickFindtextCombo.lastCursorPos[1])
3969 if self.__quickSearchToolbarVisibility is not None:
3970 self.__quickSearchToolbar.setVisible(self.__quickSearchToolbarVisibility)
3971 self.__quickSearchToolbarVisibility = None
3954 3972
3955 def __quickSearchText(self): 3973 def __quickSearchText(self):
3956 """ 3974 """
3957 Private slot to handle the textChanged signal of the quicksearch edit. 3975 Private slot to handle the textChanged signal of the quicksearch edit.
3958 """ 3976 """
4060 text = aw.text(line) 4078 text = aw.text(line)
4061 4079
4062 re = QRegExp('[^\w_]') 4080 re = QRegExp('[^\w_]')
4063 end = re.indexIn(text, index) 4081 end = re.indexIn(text, index)
4064 if end > index: 4082 if end > index:
4065 ext = text[index:end + 1] 4083 ext = text[index:end]
4066 txt += ext 4084 txt += ext
4067 self.quickFindtextCombo.lineEdit().setText(txt) 4085 self.quickFindtextCombo.lineEdit().setText(txt)
4068 4086
4069 def __search(self): 4087 def __search(self):
4070 """ 4088 """

eric ide

mercurial