Beispiel #1
0
def main():
    if True:
        setupLog(False)
    else:
        daemonize()
    server = RPC_Server()
    server.serve_forever()
Beispiel #2
0
def main():
    if True:
        setupLog(False)
    else:
        daemonize()
    server = RPC_Server()
    server.serve_forever()
Beispiel #3
0
def daemonize():
    pid = fork()
    if pid:
        exit(0)
    pid = fork()
    if pid:
        print "RPC server started, listening at port %s" % RPC_PORT
        print "Server pid: %s" % pid
        exit(0)
    setupLog(LOG_FILENAME)
    for fd in xrange(3):
        close(fd)
Beispiel #4
0
def daemonize():
    pid = fork()
    if pid:
        exit(0)
    pid = fork()
    if pid:
        print "RPC server started, listening at port %s" % RPC_PORT
        print "Server pid: %s" % pid
        exit(0)
    setupLog(LOG_FILENAME)
    for fd in xrange(3):
        close(fd)
Beispiel #5
0
import subprocess
import pickle

# QT
from PyQt4 import QtCore, QtGui, QtSvg
from PyQt4.QtCore import *
from PyQt4.QtGui import *

# Config info

import config

# Logfile

from log import setupLog
logging = setupLog(__name__)

from iomodules.objects import *
import ringbuffer

import ui.aboutbox as aboutbox

from threads import *

import pyVacuum


class pyVacuumAboutDialog(QtGui.QDialog):
    def __init__(self, *args):
        QtGui.QDialog.__init__(self, *args)
        ui = aboutbox.Ui_Dialog()
Beispiel #6
0
import log

logger = log.setupLog(__name__, 'debug')


class TestGPIOSwitch():
    '''a test switch. Only have on and off status'''

    commonResponse = 'Action OK'

    def __init__(self,
                 name: str,
                 description: str = 'no description',
                 pin: int = 11) -> None:
        '''init

        Args:
            name (str): the name of the swtich, e.g.: lamp
            description (str): default to "no description". describe the switch, e.g.: my desktop lamp
            pin (int): the pin number of the gpio pin you want to use.
        '''

    def act(self, action: str, kwargs: dict = {}) -> str:
        '''take an action

        Args:
            action (str): {'action':'action name', 'kwargs': ['kwargs' (optional)]}
            kwargs (dict): default {}. Any possible keyword arguments
        '''
        logger.debug(action)
        response = self.actionBook[action](self, **kwargs)
Beispiel #7
0
"""
import gevent

from ircConnector import IrcConnector
from dispatch import BotDispatch
from sparkfunBot import sparkfunBot

from log import setupLog


#class JoshBot(ChannelBot):
    #personal = True
    #def processMsg(self, who, said):
        #logger.debug("Hi Josh! " + said)
        #self.reply("Hi Josh! " + said)


if __name__ == '__main__':
    logger = setupLog()

    connection = IrcConnector()
    connection.run()

    bots = [
      sparkfunBot("#josh-test"),
      #JoshBot("JoshAshby-SFE")
    ]

    dispatcher = BotDispatch(bots, connection)
    dispatcher.dispatch()
Beispiel #8
0
import json
import re
from http.server import BaseHTTPRequestHandler, HTTPServer

import calculator
import canvasapi
import log

CANVAS_URL = 'https://canvas.instructure.com'

# for development
logger = log.setupLog(__name__, 'info')

index_html_path = './index.html'

# with open('server-config.json') as file1:
#     config = json.load(file1)


class CustomCanvas(canvasapi.Canvas):
    """A custom class of canvas."""

    course_list_cache = None

    def _turncate_course_name(self, course_name):
        """Turncate long course name into shorter names.
        
        Takes the content before first comma,
        if there is no comma, take the first eight character.

        - Arguments
Beispiel #9
0
#

import sys
import math
import numpy
import time

from PyQt4 import Qt, QtCore, QtGui

from iomodules.objects import *
import ringbuffer

from plots import CCDTwoDPlot

from log import setupLog
logging = setupLog(__name__)

class pyVacObject(QtGui.QWidget):

    statusc = { VacObject.ERROR : QtGui.QColor(QtCore.Qt.lightGray),
                VacObject.ON    : QtGui.QColor(QtCore.Qt.darkGreen),
                VacObject.OFF   : QtGui.QColor(QtCore.Qt.red),
                VacObject.ACCEL : QtGui.QColor(QtCore.Qt.green),
                VacObject.BRAKE : QtGui.QColor(QtCore.Qt.darkRed),
                VacObject.FAULT : QtGui.QColor(QtCore.Qt.yellow),
                VacObject.DEGAS : QtGui.QColor(QtCore.Qt.green),
                VacObject.OPEN  : QtGui.QColor(QtCore.Qt.darkGreen),
                VacObject.CLOSE : QtGui.QColor(QtCore.Qt.red)}
    

    statusText = { VacObject.ERROR : "ERROR",
Beispiel #10
0
def main():
    setupLog(False)
    server = RemoteServer("localhost")
    server.test()
    server.stop()
    ls = RemoteProcess(server, "ls", ["-la"], False(server, "ls", ["-la"], False))