comparison frontends/src/primitivus/primitivus @ 1946:827bb478d8af

primitivus: paste is now detected, and put in edit bar, so use can check and validate it
author Goffi <goffi@goffi.org>
date Thu, 21 Apr 2016 20:20:40 +0200
parents 2daf7b4c6756
children be4b143cf123
comparison
equal deleted inserted replaced
1945:2c75011d7b2d 1946:827bb478d8af
359 super(PrimitivusApp, self).postInit(self.main_widget) 359 super(PrimitivusApp, self).postInit(self.main_widget)
360 360
361 def inputFilter(self, input_, raw): 361 def inputFilter(self, input_, raw):
362 if self.__saved_overlay and input_ != a_key['OVERLAY_HIDE']: 362 if self.__saved_overlay and input_ != a_key['OVERLAY_HIDE']:
363 return 363 return
364
365 if len(input_) > 1: # XXX: it may be needed to increase this value if buffer
366 # or other things result in several chars at once
367 # (e.g. using Primitivus through ssh). Need some testing
368 # and experience to adjust value.
369 log.debug(u"Paste detected")
370 try:
371 edit_bar = self.editBar
372 except AttributeError:
373 log.warning(u"Paste discarded: there is no edit bar yet")
374 else:
375 # XXX: if a paste is detected, we append it directly to the edit bar text
376 # so the use can check it and press [enter] if it's OK
377 buf_paste = u''.join((unichr(k) for k in raw))
378 edit_bar.set_edit_text(u'{}{}'.format(edit_bar.edit_text, buf_paste))
379 return
380
364 for i in input_: 381 for i in input_:
365 if isinstance(i,tuple): 382 if isinstance(i,tuple):
366 if i[0] == 'mouse press': 383 if i[0] == 'mouse press':
367 if i[1] == 4: #Mouse wheel up 384 if i[1] == 4: #Mouse wheel up
368 input_[input_.index(i)] = a_key['HISTORY_PREV'] 385 input_[input_.index(i)] = a_key['HISTORY_PREV']