QScintilla/QsciScintillaCompat.py

changeset 3238
fa28dab59a9e
parent 3233
33b91e6c5ae4
child 3257
a2b4a45e14de
equal deleted inserted replaced
3236:92e15257b24e 3238:fa28dab59a9e
65 self.__targetSearchFlags = 0 65 self.__targetSearchFlags = 0
66 self.__targetSearchExpr = "" 66 self.__targetSearchExpr = ""
67 self.__targetSearchStart = 0 67 self.__targetSearchStart = 0
68 self.__targetSearchEnd = -1 68 self.__targetSearchEnd = -1
69 self.__targetSearchActive = False 69 self.__targetSearchActive = False
70
71 self.userListActivated.connect(self.__completionListSelected)
70 72
71 def setLexer(self, lex=None): 73 def setLexer(self, lex=None):
72 """ 74 """
73 Public method to set the lexer. 75 Public method to set the lexer.
74 76
1248 1250
1249 ########################################################################### 1251 ###########################################################################
1250 ## replacements for buggy methods 1252 ## replacements for buggy methods
1251 ########################################################################### 1253 ###########################################################################
1252 1254
1253 def showUserList(self, id, lst): 1255 if "showUserList" not in QsciScintilla.__dict__:
1254 """ 1256 def showUserList(self, id, lst):
1255 Public method to show a user supplied list. 1257 """
1256 1258 Public method to show a user supplied list.
1257 @param id id of the list (integer) 1259
1258 @param lst list to be show (list of strings) 1260 @param id id of the list (integer)
1259 """ 1261 @param lst list to be show (list of strings)
1260 if id <= 0: 1262 """
1261 return 1263 if id <= 0:
1262 1264 return
1263 self.SendScintilla(QsciScintilla.SCI_AUTOCSETSEPARATOR, 1265
1264 ord(self.UserSeparator)) 1266 self.SendScintilla(
1265 self.SendScintilla(QsciScintilla.SCI_USERLISTSHOW, id, 1267 QsciScintilla.SCI_AUTOCSETSEPARATOR,
1266 self._encodeString(self.UserSeparator.join(lst))) 1268 ord(self.UserSeparator))
1269 self.SendScintilla(
1270 QsciScintilla.SCI_USERLISTSHOW, id,
1271 self._encodeString(self.UserSeparator.join(lst)))
1272
1273 ###########################################################################
1274 ## work-arounds for buggy behavior
1275 ###########################################################################
1276
1277 def __completionListSelected(self, id, txt):
1278 """
1279 Private slot to handle the selection from the completion list.
1280
1281 Note: This works around an issue of some window managers taking
1282 focus away from the application when clicked inside a completion
1283 list but not giving it back when an item is selected via a
1284 double-click.
1285
1286 @param id the ID of the user list (integer)
1287 @param txt the selected text (string)
1288 """
1289 self.activateWindow()
1267 1290
1268 ########################################################################### 1291 ###########################################################################
1269 ## utility methods 1292 ## utility methods
1270 ########################################################################### 1293 ###########################################################################
1271 1294

eric ide

mercurial