Exemplo n.º 1
0
Arquivo: Gui.py Projeto: elmom/pypsyc
	def input(self):
##		print "TkinterGui::MainWindow::input"
		cmd = self.inputField.get(1.0, Tkinter.END)
		self.inputField.delete(1.0, Tkinter.END)
		state = 'mmp'
		mmp = MMPState()
		psyc = PSYCState()
		for line in cmd.split('\n'):
			if line == ".":
				#end of packet
				break
			if line == "" or (not _isModifier(line)
					  and state == 'mmp'):
				state = 'psyc'
				
			if state == 'mmp':				
				mmp.set_state(line)
				continue
			if state == 'psyc':
				if _isModifier(line):
					psyc.set_state(line)
				elif line.__len__() and line[0] == '_':
					psyc.set_mc(line)
				else:
					psyc.append_text(line)

		self.center.send(mmp, psyc)
Exemplo n.º 2
0
    def auth(self):
        psyc = PSYCState()
        mmp = MMPState()
        if self.center:
            # das hier ist sicher weils nur an die eigene uni geht
            mmp.set_state(":_target\t" + self.config.get("main", "uni"))
            psyc.set_state(":_password\t" + self.config.get("main",
                                   "password"))
            psyc.set_mc("_set_password")

            self.center.send(mmp, psyc)