def show_translate(x, y, text): if len(filter(lambda word: word != "", (text.split(" ")))) > 1: translate_long = get_translate_long() if translate_long: translate_long.show_translate(x, y, text) else: translate_simple = get_translate_simple() if translate_simple: translate_simple.show_translate(x, y, text)
def hide_translate(): translate_simple = get_translate_simple() if translate_simple: if translate_simple.isVisible() and not translate_simple.in_translate_area(): translate_simple.hide_translate() translate_long = get_translate_long() if translate_long: if translate_long.isVisible() and not translate_long.in_translate_area(): translate_long.hide_translate()
def show_translate(x, y, text, search_mode=True): hide_translate() if len(filter(lambda word: word != "", (text.split(" ")))) > 1: translate_long = get_translate_long() if translate_long: translate_long.show_translate(x, y, text, search_mode) else: translate_simple = get_translate_simple() if translate_simple: translate_simple.show_translate(x, y, text, search_mode)
def hide_translate(): translate_simple = get_translate_simple() if translate_simple: if translate_simple.isVisible( ) and not translate_simple.in_translate_area(): translate_simple.hide_translate() translate_long = get_translate_long() if translate_long: if translate_long.isVisible( ) and not translate_long.in_translate_area(): translate_long.hide_translate()