def event_show(self, event): """ Event when frame show, set position of frame and set timer 3 sec. after that frame hide """ if not self.showFrame: # print "popup show" self.showFrame=True cursorPos=[] if os.name =="nt": cursorPos=win32gui.GetCursorPos() elif os.name =="posix": data = display.Display().screen().root.query_pointer()._data cursorPos.append(data["root_x"]) cursorPos.append(data["root_y"]) displaySize=wx.DisplaySize() frameSize = self.view.GetSizeTuple() if displaySize[0]<cursorPos[0]+frameSize[0]: x=cursorPos[0]-frameSize[0]-5 else: x=cursorPos[0]+10 if displaySize[1]<cursorPos[1]+frameSize[1]: y=cursorPos[1]-frameSize[1] else: y=cursorPos[1] self.view.Move((x,y-10)) self.timer.Start(3000) else: if os.name =="nt": clipboardlib.event_press_ctrl() config.isRunTranslate=False
def event_show(self, event): """ Show this frame and start translate text """ if not self.showResult: self.hide_controls() self.view.Layout() self.set_languages() self.view.SetFocus() self.showResult=True # print "show resultframe" self.start_translate(config.defaultLangFrom, config.defaultLangTo) else: if os.name =="nt": clipboardlib.event_press_ctrl() config.isRunTranslate=False