Ejemplo n.º 1
0
 def __init__(self,readonly=True,readpasswd='',writepasswd='',clientport=5400):
     '''
     Parameters:
     readonly=True if the server won't allow keyboard and mouse control
     readpasswd= passwd to use when not controlling keyboard and mouse
     writepasswd= passwd to use when controlling keyboard and mouse
     clientport=the port the client has to use to connect to a VNC server
     '''
     if readpasswd=='':
         self.readPasswd=MyUtils.generateUUID()
     else:
         self.readPasswd=readpasswd
         
     if writepasswd=='':
         self.writePasswd=MyUtils.generateUUID()
     else:
         self.writePasswd=writepasswd
         
     self.isLTSP=MyUtils.isLTSP()
         
     if self.isLTSP=='':
         self.port=str(NetworkUtils.getUsableTCPPort('127.0.0.1',5400))
     else:
         d=self.isLTSP.split('.')
         if len(d)<4: #sometimes, it needs two tries :(
             d=self.isLTSP.split('.')
         self.port=str(5400 + int(d[3]))
         
     self.readonly=readonly
     
     self.procServer=None
     self.clientport=clientport
     self.myteacher=None
     self.mylogin=MyUtils.getLoginName()
     self.myIP=''
     self.activeBB=False
Ejemplo n.º 2
0
    log_formatter = logging.Formatter(fmt = '%(asctime)s %(levelname)-8s %(message)s', datefmt = '%a, %d %b %Y %H:%M:%S')
    log_handler.setFormatter(log_formatter)
    root_logger = logging.getLogger()
    root_logger.addHandler(log_handler)
    root_logger.level = logging.DEBUG

    # Initialise the signal handler.
    signal.signal(signal.SIGINT, SigHandler)

    #Get and save some global variables:
    isTeacher = MyUtils.userIsTeacher()

    #isTeacher=False  #enable for debugging
    USERNAME = MyUtils.getLoginName()
    HOSTNAME = NetworkUtils.getHostName()
    Configs.PORT = NetworkUtils.getUsableTCPPort("localhost", PORT)
    MyUtils.putLauncher('', Configs.PORT, isTeacher)

    if not isTeacher:
        from twisted.internet import glib2reactor
        glib2reactor.install()
    from twisted.internet import reactor
    from twisted.web import server
    
    ######### Begin the application loop #######
    if  isTeacher:
        logging.getLogger().debug("The user is a teacher")
        from ControlAula import TeacherMainLoop, Classroom
        from ControlAula.Utils  import Publications

        NetworkUtils.getWirelessData()