Example #1
0
    def onInsertText(self, oWidget, strText, nLength, nPosition):

        strText = ''.join([s for s in strText if s not in '/\\'])
        nId, nDetail = GObject.signal_parse_name('insert-text', oWidget, True)

        if strText:

            nHandler = GObject.signal_handler_find(oWidget,
                                                   GObject.SignalMatchType.ID,
                                                   nId, nDetail, None, 0, 0)
            nPosition = oWidget.get_position()

            GObject.signal_handler_block(oWidget, nHandler)
            oWidget.insert_text(strText, nPosition)
            GObject.signal_handler_unblock(oWidget, nHandler)
            GObject.idle_add(oWidget.set_position, nPosition + len(strText))

        GObject.signal_stop_emission(oWidget, nId, nDetail)