def actionPerformed(self, e): text = self.tf.getText() self.tf.setText("") if strip(text) != "": if text[0] == '/': event = guiMessage.guiMessage(text[1:]) else: event = guiMessage.guiMessage() event.type = guiMessage.MSG if hasattr(self, 'name'): event.source = self.name event.target = self.name # This should invoke some method event.data = text if self.handler: self.handler(self, event)
def run(self): while 1: text = raw_input() event = None if strip(text) != "": if text[0] == '/': event = guiMessage.guiMessage(text[1:]) # if event.type == guiMessage.UNKNOWN ... else: event = guiMessage.guiMessage() event.type = guiMessage.MSG if hasattr(self, 'name'): event.source = self.name event.target = self.name # This should invoke some method event.data = text if self.handler: self.handler(self, event)
def __init__(self, f_cm): #/ nome do método (logger) #/ ---------------------------------------------------------------------------------------- #l_szMetodo = "viewControle::__init__" #** --------------------------------------------------------------------------------------- #* m.poirot logger #*/ #l_log = logging.getLogger ( l_szMetodo ) #l_log.setLevel ( w_logLvl ) #l_log.debug ( ">> " ) #** --------------------------------------------------------------------------------------- #* verifica parâmetros de entrada #*/ #assert ( f_cm ) #** --------------------------------------------------------------------------------------- #* initialize super classe #*/ viewManager.viewManager.__init__(self, f_cm) #** --------------------------------------------------------------------------------------- #* obtém o PAR #*/ self._oPAR = self._oExe.getPAR() #assert ( self._oPAR ) #** --------------------------------------------------------------------------------------- #* define o título da janela #*/ pygame.display.set_caption(locDefs.xTXT_Tit + " [Controle/" + self._oExe.getKey() + "]") #** --------------------------------------------------------------------------------------- #* initialize info area #*/ self._infoBox = guiInfo.guiInfo(f_cm, self._screen, glbDefs.xSCR_POS[glbDefs.xSCR_Info][0], glbDefs.xSCR_POS[glbDefs.xSCR_Info][1]) #assert ( self._infoBox ) #** --------------------------------------------------------------------------------------- #* initialize strip list #*/ self._stripList = stripControle.stripControle( f_cm, self._screen, glbDefs.xSCR_CTR[glbDefs.xSCR_Strip][0], glbDefs.xSCR_CTR[glbDefs.xSCR_Strip][1]) #assert ( self._stripList ) #** --------------------------------------------------------------------------------------- #* initialize sliders box #*/ self._sldrBox = guiSliders.guiSliders( f_cm, self._screen, glbDefs.xSCR_CTR[glbDefs.xSCR_Sliders][0], glbDefs.xSCR_CTR[glbDefs.xSCR_Sliders][1]) #assert ( self._sldrBox ) #** --------------------------------------------------------------------------------------- #* initialize VoIP box #*/ self._voipBox = guiVoIP.guiVoIP(f_cm, self._screen, glbDefs.xSCR_CTR[glbDefs.xSCR_VoIP][0], glbDefs.xSCR_CTR[glbDefs.xSCR_VoIP][1]) #assert ( self._voipBox ) #** --------------------------------------------------------------------------------------- #* initialize info met area #*/ self._imetBox = guiIMet.guiIMet(f_cm, self._screen, glbDefs.xSCR_CTR[glbDefs.xSCR_IMet][0], glbDefs.xSCR_CTR[glbDefs.xSCR_IMet][1]) #assert ( self._imetBox ) #** --------------------------------------------------------------------------------------- #* initialize message box #*/ self._msgBox = guiMessage.guiMessage( f_cm, self._screen, glbDefs.xSCR_CTR[glbDefs.xSCR_Msg][0], glbDefs.xSCR_CTR[glbDefs.xSCR_Msg][1]) #assert ( self._msgBox ) #** --------------------------------------------------------------------------------------- #* inicia scope do controle #*/ self._scope = guiScopeControle.guiScopeControle( f_cm, self._screen, glbDefs.xSCR_POS[glbDefs.xSCR_Scope][0], glbDefs.xSCR_POS[glbDefs.xSCR_Scope][1]) #assert ( self._scope ) #** --------------------------------------------------------------------------------------- #* flight call sign #*/ self._bCallSign = False #** --------------------------------------------------------------------------------------- #* inicia área de mensagens de erro e de alerta #*/ self._msgBox.addTxt(locDefs.xTXT_Tit + " (C) ICEA 2009-10", locDefs.xCOR_Messages) #** --------------------------------------------------------------------------------------- #* atualiza a tela #*/ self.dispFlip()
def __init__(self, f_cm): #/ nome do método (logger) #/ ---------------------------------------------------------------------------------------- l_szMetodo = "viewPiloto::__init__" #** --------------------------------------------------------------------------------------- #* m.poirot logger #*/ #l_log = logging.getLogger ( l_szMetodo ) #l_log.setLevel ( w_logLvl ) #l_log.debug ( ">> " ) #** --------------------------------------------------------------------------------------- #* verifica parâmetros de entrada #*/ #assert ( f_cm ) #** --------------------------------------------------------------------------------------- #* initialize super class #*/ viewManager.viewManager.__init__(self, f_cm) #** --------------------------------------------------------------------------------------- #* define o título da janela #*/ pygame.display.set_caption(locDefs.xTXT_Tit + " [Piloto/" + self._oExe.getKey() + "]") #** --------------------------------------------------------------------------------------- #* initialize info area #*/ self._infoBox = guiInfo.guiInfo(f_cm, self._screen, glbDefs.xSCR_POS[glbDefs.xSCR_Info][0], glbDefs.xSCR_POS[glbDefs.xSCR_Info][1]) #assert ( self._infoBox ) #** --------------------------------------------------------------------------------------- #* initialize strip list #*/ self._stripList = stripPiloto.stripPiloto( f_cm, self._screen, glbDefs.xSCR_PIL[glbDefs.xSCR_Strip][0], glbDefs.xSCR_PIL[glbDefs.xSCR_Strip][1]) #assert ( self._stripList ) #** --------------------------------------------------------------------------------------- #* initialize VoIP box #*/ self._voipBox = guiVoIP.guiVoIP(f_cm, self._screen, glbDefs.xSCR_PIL[glbDefs.xSCR_VoIP][0], glbDefs.xSCR_PIL[glbDefs.xSCR_VoIP][1]) #assert ( self._voipBox ) #* ---------------------------------------------------------------------------------------- #* inicia a gui #* #gooeypy.init ( myscreen = self._screen ) #** --------------------------------------------------------------------------------------- #* inicia a app da gui #*/ #self._guiApp = gooeypy.App ( width = locDefs.xSCR_Size [ 0 ], # height = locDefs.xSCR_Size [ 1 ], # theme = "SiPAR" ) ##assert ( self._guiApp ) #** --------------------------------------------------------------------------------------- #* initialize menu list #*/ #self._menuBox = guiMenu.guiMenu ( f_cm, self._screen, self._guiApp, # glbDefs.xSCR_PIL [ glbDefs.xSCR_Menu ][ 0 ], # glbDefs.xSCR_PIL [ glbDefs.xSCR_Menu ][ 1 ] ) ##assert ( self._menuBox ) #** --------------------------------------------------------------------------------------- #* initialize message box #*/ self._msgBox = guiMessage.guiMessage( f_cm, self._screen, glbDefs.xSCR_PIL[glbDefs.xSCR_Msg][0], glbDefs.xSCR_PIL[glbDefs.xSCR_Msg][1]) #assert ( self._msgBox ) #** --------------------------------------------------------------------------------------- #* inicia scope do piloto #*/ self._scope = guiScopePiloto.guiScopePiloto( f_cm, self._screen, glbDefs.xSCR_POS[glbDefs.xSCR_Scope][0], glbDefs.xSCR_POS[glbDefs.xSCR_Scope][1]) #assert ( self._scope ) #** --------------------------------------------------------------------------------------- #* avisa ao menu sobre a lista de mensagens #*/ #self._menuBox.setMsgBox ( self._msgBox ) #** --------------------------------------------------------------------------------------- #* inicia área de mensagens de erro e de alerta #*/ self._msgBox.addTxt(locDefs.xTXT_Tit + " (C) ICEA 2008-10", locDefs.xCOR_Messages) #** --------------------------------------------------------------------------------------- #* atualiza a tela #*/ self.dispFlip()