Beispiel #1
0
def sc_test012(resultlog, result_dir, namespace):
    '''
    This test adds a new user with SDOB keys and creates & verifies appointments in timeslots outside a clinic's normal operating window
    '''
    testname = sys._getframe().f_code.co_name
    resultlog.write('\n' + testname + ', ' + str(datetime.datetime.today()) + ': ')
    logging.debug('\n' + testname + ', ' + str(datetime.datetime.today()) + ': ')
    try:
        # Create new user with SDOB keys
        VistA1 = connect_VistA(testname, result_dir, namespace)
        SC = Actions(VistA1, user='******', code='SM12345!!')
        SC.signon()
        SC.adduser(name='CRANE,JON', ssn='000000065', gender='M', initials='JC', acode='fakejon1', vcode1='1SWUSH1234!!')
        SC.signoff()
        VistA1 = connect_VistA(testname + '_01', result_dir, namespace)
        SC = Actions(VistA1)
        SC.sigsetup(acode='fakejon1', vcode1='1SWUSH1234!!', vcode2='1SWUSH12345!!', sigcode='JONC123')
        SC.signoff()
        # Create appointment outside Clinic1's operating hours via fakedoc1
        VistA2 = connect_VistA(testname + '_02', result_dir, namespace)
        SC = SCActions(VistA2, user='******', code='1Doc!@#$')
        SC.signon()
        SC.gotoApptMgmtMenu()
        SC.makeapp(patient='333224444', clinic='Clinic1', datetime='t+5@9AM', fresh='No', badtimeresp='noslot')
        SC.signoff()
        # Create appointment outside Clinic1's operating hours via fakejon1 (SDOB key)
        VistA3 = connect_VistA(testname + '_02', result_dir, namespace)
        SC = SCActions(VistA3, user='******', code='1SWUSH12345!!')
        SC.signon()
        SC.gotoApptMgmtMenu()
        SC.makeapp(patient='333224444', clinic='Clinic1', datetime='t+10@9AM', fresh='No', badtimeresp='overbook')
        SC.signoff()
    except TestHelper.TestError, e:
        resultlog.write('\nEXCEPTION ERROR:' + str(e))
        logging.error('*****exception*********' + str(e))
Beispiel #2
0
def reg_test007(test_suite_details):
    '''Add a new doctor, wait 2 minutes, add another doctor, then attempt to add doctor during patient admitting using a prior date (REF-218) '''
    testname = sys._getframe().f_code.co_name
    test_driver = TestHelper.TestDriver(testname)

    test_driver.pre_test_run(test_suite_details)
    try:
        VistA1 = test_driver.connect_VistA(test_suite_details)
        reg = Actions(VistA1, user='******', code='SM1234!!!')
        reg.signon()
        reg.adduser(name='JONES,JOE', ssn='000000050', gender='M', initials='JJ', acode='fakejoe1', vcode1='1SWUSH1234!!')
        VistA1 = test_driver.connect_VistA(testname + '_01', result_dir, namespace)
        reg = Actions(VistA1)
        reg.sigsetup(acode='fakejoe1', vcode1='1SWUSH1234!!', vcode2='1SWUSH12345!!', sigcode='JOEJ123')
        VistA1 = test_driver.connect_VistA(testname + '_02', result_dir, namespace)
        reg = Actions(VistA1, user='******', code='SM1234!!!')
        reg.signon()
        reg.adduser(name='BURKE,BARBARA', ssn='000000051', gender='F', initials='BB', acode='fakebar1', vcode1='1OIG1234!!')
        VistA1 = test_driver.connect_VistA(testname + '_03', result_dir, namespace)
        reg = Actions(VistA1)
        reg.sigsetup(acode='fakebar1', vcode1='1OIG1234!!', vcode2='1OGI12345!!', sigcode='BARB123')
        reg.signoff()
        VistA1 = test_driver.connect_VistA(testname + '_04', result_dir, namespace)
        reg = ADTActions(VistA1, user='******', code='1Doc!@#$')
        reg.signon()
        reg.admit_a_patient(ssn='666551234', bed='2-B', time='t-1@01am', doctorlist=['BURKE', 'Alexander', 'JONES', 'Alexander'])
        reg.signoff()

        test_driver.post_test_run(test_suite_details)
    except TestHelper.TestError, e:
        test_driver.exception_handling(test_suite_details, e)
Beispiel #3
0
def sc_test012(test_suite_details):
    '''
    This test adds a new user with SDOB keys and creates & verifies appointments in timeslots outside a clinic's normal operating window
    '''
    testname = sys._getframe().f_code.co_name
    test_driver = TestHelper.TestDriver(testname)

    test_driver.pre_test_run(test_suite_details)
    try:
        # create new user with SDOB keys
        VistA1 = test_driver.connect_VistA(test_suite_details)
        SC = Actions(VistA1, user='******', code='SM1234!!!')
        SC.signon()
        SC.adduser(name='CRANE,JON', ssn='000000065', gender='M', initials='JC', acode='fakejon1', vcode1='1SWUSH1234!!')
        SC.signoff()
        VistA1 = test_driver.connect_VistA(testname + '_01', result_dir, namespace)
        SC = Actions(VistA1)
        SC.sigsetup(acode='fakejon1', vcode1='1SWUSH1234!!', vcode2='1SWUSH12345!!', sigcode='JONC123')
        SC.signoff()
        # Create appointment outside Clinic1's operating hours via fakedoc1
        VistA2 = test_driver.connect_VistA(testname + '_02', result_dir, namespace)
        SC = SCActions(VistA2, user='******', code='1Doc!@#$')
        SC.signon()
        SC.gotoApptMgmtMenu()
        SC.makeapp(patient='333224444', clinic='Clinic1', datetime='t+5@9AM', fresh='No', badtimeresp='noslot')
        SC.signoff()
        # Create appointment outside Clinic1's operating hours via fakejon1 (SDOB key)
        VistA3 = test_driver.connect_VistA(testname + '_02', result_dir, namespace)
        SC = SCActions(VistA3, user='******', code='1SWUSH12345!!')
        SC.signon()
        SC.gotoApptMgmtMenu()
        SC.makeapp(patient='333224444', clinic='Clinic1', datetime='t+10@9AM', fresh='No', badtimeresp='overbook')
        SC.signoff()
    except TestHelper.TestError, e:
        test_driver.exception_handling(test_suite_details, e)
Beispiel #4
0
def reg_test007(resultlog, result_dir, namespace):
    '''Add a new doctor, wait 2 minutes, add another doctor, then attempt to add doctor during patient admitting using a prior date (REF-218) '''
    testname = sys._getframe().f_code.co_name
    resultlog.write('\n' + testname + ', ' + str(datetime.datetime.today()) + ': ')
    logging.debug('\n' + testname + ', ' + str(datetime.datetime.today()) + ': ')
    try:
        VistA1 = connect_VistA(testname, result_dir, namespace)
        reg = Actions(VistA1, user='******', code='SM12345!!')
        reg.signon()
        reg.adduser(name='JONES,JOE', ssn='000000050', gender='M', initials='JJ', acode='fakejoe1', vcode1='1SWUSH1234!!')
        VistA1 = connect_VistA(testname + '_01', result_dir, namespace)
        reg = Actions(VistA1)
        reg.sigsetup(acode='fakejoe1', vcode1='1SWUSH1234!!', vcode2='1SWUSH12345!!', sigcode='JOEJ123')
        VistA1 = connect_VistA(testname + '_02', result_dir, namespace)
        reg = Actions(VistA1, user='******', code='SM12345!!')
        reg.signon()
        reg.adduser(name='BURKE,BARBARA', ssn='000000051', gender='F', initials='BB', acode='fakebar1', vcode1='1OIG1234!!')
        VistA1 = connect_VistA(testname + '_03', result_dir, namespace)
        reg = Actions(VistA1)
        reg.sigsetup(acode='fakebar1', vcode1='1OIG1234!!', vcode2='1OGI12345!!', sigcode='BARB123')
        reg.signoff()
        VistA1 = connect_VistA(testname + '_04', result_dir, namespace)
        reg = ADTActions(VistA1, user='******', code='1Doc!@#$')
        reg.signon()
        reg.admit_a_patient(ssn='666551234', bed='2-B', time='t-1@01am', doctorlist=['BURKE', 'Alexander', 'JONES', 'Alexander'])
        reg.signoff()
    except TestHelper.TestError, e:
        resultlog.write(e.value)
        logging.error(testname + ' EXCEPTION ERROR: Unexpected test result')
Beispiel #5
0
def sc_test013(resultlog, result_dir, namespace):
    '''
    This test creates a Sharing Agreement subcategory and adds it to a select patient's eligibility
    '''
    testname = sys._getframe().f_code.co_name
    resultlog.write('\n' + testname + ', ' + str(datetime.datetime.today()) + ': ')
    logging.debug('\n' + testname + ', ' + str(datetime.datetime.today()) + ': ')
    if sys.platform == 'win32':
        try:
            # Create Sharing Agreement sub-category
            VistA1 = connect_VistA(testname, result_dir, namespace)
            aa = Actions(VistA1)
            aa.signon()
            aa.addSAsubtype(subcat='subcat1')
            aa.signon()
            aa.addSAsubtype(subcat='SUBCAT2')
        # Add Sharing Agreement to Patient Eligibility
            VistA1 = connect_VistA(testname + '_1', result_dir, namespace)
            adt = ADTActions(VistA1)
            adt.signon()
            adt.gotoADTmenu()
            adt.eligverific(patient='333224444', eligtype='SHARING AGREEMENT')
            adt.signoff()
        # Make Appointment using new sub-category
            VistA1 = connect_VistA(testname + '_2', result_dir, namespace)
            SC = SCActions(VistA1, user='******', code='1SWUSH12345!!')
            SC.signon()
            SC.gotoApptMgmtMenu()
            SC.makeapp(patient='333224444', clinic='Clinic1', datetime='t+9@5AM', fresh='No', apptype='SHARING AGREEMENT', subcat=['subcat1', 'SUBCAT2'])
            SC.signoff()
        except TestHelper.TestError, e:
            resultlog.write('\nEXCEPTION ERROR:' + str(e))
            logging.error('*****exception*********' + str(e))
        else:
            resultlog.write('Pass\n')
Beispiel #6
0
def main() -> int:
    server = WebServer(
        port=8085
    )  # Change this number to change the web server port being served.
    robot = Robot(
        port=None
    )  # Change this number to change the serial port number being used to control the robot.

    detector = ImageDetector(
        resolution_front=Resolution(1280, 720),
        resolution_bottom=Resolution(1280, 720),
        in_video_front=
        'f.mp4',  # Set the in_video_front and in_video_bottom to 0 and 1 for cameras.
        in_video_bottom='b.mp4',
        # video_path_front=f'output_f_{time.time()}.avi',
        # video_path_bottom=f'output_b_{time.time()}.avi',
    )
    detector_thread = Thread(target=detector_loop(detector, robot))
    detector_thread.daemon = False
    detector_thread.start()

    actions = Actions(robot=robot, detector=detector)
    robot.set_handler(actions.on_read)
    for name, action in actions.list.items():
        server.add_rule(name, action)
    server.run()
    actions.run()

    def on_exit():
        robot.close()
        server.close()

    register_exit_event(on_exit)
    return 0
Beispiel #7
0
def sc_test013(test_suite_details):
    '''
    This test creates a Sharing Agreement subcategory and adds it to a select patient's eligibility
    '''
    testname = sys._getframe().f_code.co_name
    test_driver = TestHelper.TestDriver(testname)

    test_driver.pre_test_run(test_suite_details)
    if sys.platform == 'win32':
        try:
            # Create Sharing Agreement sub-category
            VistA1 = test_driver.connect_VistA(test_suite_details)
            aa = Actions(VistA1)
            aa.signon()
            aa.addSAsubtype(subcat='subcat1')
            aa.signon()
            aa.addSAsubtype(subcat='SUBCAT2')
        # Add Sharing Agreement to Patient Eligibility
            VistA1 = test_driver.connect_VistA(testname + '_1', result_dir, namespace)
            adt = ADTActions(VistA1)
            adt.signon()
            adt.gotoADTmenu()
            adt.eligverific(patient='333224444', eligtype='SHARING AGREEMENT')
            adt.signoff()
        # Make Appointment using new sub-category
            VistA1 = test_driver.connect_VistA(testname + '_2', result_dir, namespace)
            SC = SCActions(VistA1, user='******', code='1SWUSH12345!!')
            SC.signon()
            SC.gotoApptMgmtMenu()
            SC.makeapp(patient='333224444', clinic='Clinic1', datetime='t+9@5AM', fresh='No', apptype='SHARING AGREEMENT', subcat=['subcat1', 'SUBCAT2'])
            SC.signoff()
        except TestHelper.TestError, e:
            test_driver.exception_handling(test_suite_details, e)
        finally:
Beispiel #8
0
def round_start():
    # resets all the players best hand values
    reset_best()

    # to generate the deck
    global deck
    deck_obj = Deck()
    deck_obj.generate_deck()
    deck_obj.shuffle_deck()
    deck = deck_obj.get_deck()

    # to deal the players their cards
    for i in range(0, num_players):
        cards.append(Actions(deck))
        cards[i].initial_deal()
        deck = cards[i].get_deck()

    # to get the images corresponding to the players cards
    for i in range(0, num_players):
        p_cards = cards[i].get_player_cards()
        for j in range(0, 2):
            if p_cards[j][-1] == 'D':
                player_card_images[i][j] = card_images[0][int(p_cards[j][:-1])-1]
            elif p_cards[j][-1] == 'C':
                player_card_images[i][j] = card_images[1][int(p_cards[j][:-1])-1]
            elif p_cards[j][-1] == 'H':
                player_card_images[i][j] = card_images[2][int(p_cards[j][:-1])-1]
            else:
                player_card_images[i][j] = card_images[3][int(p_cards[j][:-1])-1]
 def __init__(self, launchpad, UI, profiles):
     if not launchpad.Open():
         print("No Launchpad found")
         return
     self.profiles: List[profiles] = profiles
     self.actions: Actions = Actions(self)
     self.launchpad = launchpad
     self.pressedButton = [None, None]
     self.GUI = UI
     self.setButtons()
     self.GUI.colorUIButtons(self.buttons, True)
Beispiel #10
0
    def __init__(self, speed):
        self.button = TouchSensor()
        self.action = Actions(speed)

        # Get current time HH:MM:SS
        now = datetime.now()
        time = now.strftime("%H:%M:%S")

        print(str(time) + "\tExecuting Touch Sensor Thread\n")

        # Execute button thread
        buttonThread = Thread(target=self.isPressed, args=())
        buttonThread.start()
Beispiel #11
0
    def __init__(self, client, display):
        self.minVoltage = PowerSupply().min_voltage
        self.maxVoltage = PowerSupply().max_voltage
        self.medVoltage = self.maxVoltage * 0.5
        self.exitVoltage = self.minVoltage + (self.minVoltage * 0.05)

        self.action = Actions()

        self.client = client
        self.display = display
        print("Starting battery thread")

        # Execute battery thread
        batteryThread = Thread(target=self.chargeStatus, args=())
        batteryThread.start()
Beispiel #12
0
    def __init__(self, speed):
        self.minVoltage = PowerSupply().min_voltage
        self.maxVoltage = PowerSupply().max_voltage
        self.medVoltage = self.maxVoltage * 0.5
        self.exitVoltage = self.minVoltage + (self.minVoltage * 0.05)

        self.action = Actions(speed)

        # Get current time HH:MM:SS
        now = datetime.now()
        time = now.strftime("%H:%M:%S")

        print(str(time) + "\tExecuting Battery Thread\n")

        # Execute battery thread
        batteryThread = Thread(target=self.chargeStatus, args=())
        batteryThread.start()
Beispiel #13
0
    def __init__(self):
        print("initializing")

        ##def main IO classes
        self.actions = Actions(self)         ##routines to publish actions to mavros
        self.perceptions = Perceptions(self) ##listeners to the perceptions coming from mav-ros
        self.comFMC = Com_FMC(self)          ##communication with the Fire Monitoring Center, represented by a human user in this system 
        self.slamHandler = SlamHandler(self) ##Map handler, slam-sensor topic listener, colision detection
        
        ##some important constants
        self.TAKEOFF_ALT_DEF = 7 ##default altitude to take off
        

        ##start state machine
        self.stateLock = RLock()
        self.currentState = self.S_Awaiting
        self.stateChanged = True

        self.trajectoryState = self.T_None
        self.trajectory = [[0, 0, 0]]   ##trajectory will always be a finite 3d array of points
        self.trajPointer = -1   ##pointer which shows the current destination in the array above that drone is following
Beispiel #14
0
    def __init__(self):
        rospy.init_node('project_3', anonymous=True)
        self.state_manager = StateManager()

        self.Pos1 = True
        self.pose = None
        self.spawned = False
        self.actions = Actions()
        self.q_table = QTable(self.state_manager)
        self.stuck_count = 0
        self.max_stuck = 10
        self.prev_pose = None
        self.poses = []
        self.Episode = 1
        self.poses.append(add_pose(0.0, 2.0, 6.15))
        self.poses.append(add_pose(-1.8, -1.8, 0.0))

        rospy.Subscriber("/scan", LaserScan, self.laser_callback)
        rospy.Subscriber("/gazebo/model_states", ModelStates, self.wait_for_models)
        rospy.wait_for_service('/gazebo/set_model_state')
        rospy.wait_for_service('/gazebo/get_model_state')
        self.move_model = rospy.ServiceProxy('/gazebo/set_model_state', SetModelState)
Beispiel #15
0
    def __init__(self, state_manager):
        # type: (StateManager) -> None
        self.changed = False

        self.state_manager = state_manager
        self.NUM_STATES = self.state_manager.NUM_STATES
        self.actions = Actions()
        self.q_table = np.zeros((self.NUM_STATES, len(self.actions)))
        self.load_table()

        for val in range(0, self.NUM_STATES):
            self.rewards[val] = 0

        # setting negative rewards for being too close to any side
        for rightVal in self.state_manager.sensors[0].distances:
            for rightFrontVal in self.state_manager.sensors[1].distances:
                for frontVal in self.state_manager.sensors[2].distances:
                    for leftVal in self.state_manager.sensors[3].distances:
                        if rightVal == "too_far" \
                                or rightVal == "too_close" \
                                or frontVal == "too_close" \
                                or leftVal == "too_close":
                            self.rewards[self.state_manager \
                                .generate_state_index(rightVal, rightFrontVal, frontVal, leftVal)] = -1
Beispiel #16
0
    def start(self):
        driver = WebDriverFactory.get_chrome_driver(self.__driver_path)
        executor = Actions(driver)

        driver.get(self.__url)

        # 进入登入界面
        executor.click_element('input[title="ログイン"]')

        # 输入账号密码 登入
        executor.input_text('input[id="tel"]', self.__tel)
        executor.input_text('input[id="pass"]', self.__tel_password)
        executor.click_element('input[alt="ログイン"]')

        # 点击ボイスワープ按钮
        executor.click_element('input[alt="ボイスワープ"]')

        # 点击サービス開始/停止按钮
        executor.click_element('input[alt="サービス開始/停止"]')

        # 点击开始单选按钮 设定时间
        if self.__start_or_stop:
            executor.click_element('input[id="r2"]')
            executor.input_text('input[id="call_sec2"]', '5')
        else:
            executor.click_element('input[id="stop"]')
        # 点击设定按钮
        executor.click_element('input[alt="設定"]')

        # 登出
        executor.click_element('input[title="ログアウト"]')

        # 发送邮件
        mail_provider = MailProvider(
            self.__mail_account, self.__mail_password, self.__mail_subject, self.__mail_text)
        mail_provider.send_mail(self.__mail_list)
Beispiel #17
0
from Actions import Actions

if __name__ == "__main__":
    print(Request.delete('instance'))
    json = Request.post('instance')
    if json == -1:
        print("No JSON")
    curr_state = State(json)

    c_map = curr_state.curr_map

    robot = Robot(json)

    while not curr_state.finished:
        if 'U' in curr_state.curr_map[robot.pos[1]][robot.pos[0]]:
            Actions().scan(curr_state, robot.pos[0], robot.pos[1])
            robot.next_objective = ["", -1, -1, 0]

        # Get next instruction
        [next_instr, x, y] = Decisions().eval_function(state=curr_state,
                                                       robot=robot)
        print(next_instr, x, y)

        print("Next instruction: ", next_instr)
        print("Target x: ", x)
        print("Target y: ", y)
        print("Current x: ", robot.pos[0])
        print("Current y: ", robot.pos[1])
        print("Current direction: ", robot.pos[2])

        # Robot executes next instruction if at target location
Beispiel #18
0
    def setupUiMainWindow(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(798, 551)
        self.Frame = QtGui.QFrame()
        #MainWindow.setCentralWidget(self.Frame)
        self.menubar = QtGui.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 798, 27))
        self.menubar.setObjectName("menubar")
        self.menuFile = QtGui.QMenu(self.menubar)
        self.menuFile.setObjectName("menuFile")
        self.menuEdit = QtGui.QMenu(self.menubar)
        self.menuEdit.setObjectName("menuEdit")
        self.menuSerach = QtGui.QMenu(self.menubar)
        self.menuSerach.setObjectName("menuSerach")
        self.menuHelp = QtGui.QMenu(self.menubar)
        self.menuHelp.setObjectName("menuHelp")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtGui.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)
        self.actionNew_File = QtGui.QAction(MainWindow)
        self.actionNew_File.setObjectName("actionNew_File")
        self.actionNew_File.setShortcut('Ctrl+N')
        self.actionOpen_File = QtGui.QAction(MainWindow)
        self.actionOpen_File.setObjectName("actionOpen_File")
        self.actionOpen_File.setShortcut('Ctrl+O')
        self.actionSave_File = QtGui.QAction(MainWindow)
        self.actionSave_File.setObjectName("actionSave_File")
        self.actionSave_File.setShortcut('Ctrl+S')
        self.actionSave_All = QtGui.QAction(MainWindow)
        self.actionSave_All.setObjectName("actionSave_All")
        self.actionSave_All.setShortcut('Ctrl+Shift+S')
        self.actionClose_File = QtGui.QAction(MainWindow)
        self.actionClose_File.setObjectName("actionClose_File")
        self.actionClose_File.setShortcut('Ctrl+W')
        self.actionClose_All = QtGui.QAction(MainWindow)
        self.actionClose_All.setObjectName("actionClose_All")
        self.actionClose_All.setShortcut('Ctrl+Shift+S')
        self.actionExit = QtGui.QAction(MainWindow)
        self.actionExit.setObjectName("actionExit")
        self.actionExit.setShortcut('Ctrl+Q')
        self.actionUndo = QtGui.QAction(MainWindow)
        self.actionUndo.setObjectName("actionUndo")
        self.actionUndo.setShortcut('Ctrl+Z')
        self.actionRedo = QtGui.QAction(MainWindow)
        self.actionRedo.setObjectName("actionRedo")
        self.actionRedo.setShortcut('Ctrl+Y')
        self.actionCut = QtGui.QAction(MainWindow)
        self.actionCut.setObjectName("actionCut")
        self.actionCut.setShortcut('Ctrl+X')
        self.actionCopy = QtGui.QAction(MainWindow)
        self.actionCopy.setObjectName("actionCopy")
        self.actionCopy.setShortcut('Ctrl+C')
        self.actionPaste = QtGui.QAction(MainWindow)
        self.actionPaste.setObjectName("actionPaste")
        self.actionPaste.setShortcut('Ctrl+V')
        self.actionSelect_All = QtGui.QAction(MainWindow)
        self.actionSelect_All.setObjectName("actionSelect_All")
        self.actionSelect_All.setShortcut('Ctrl+A')
        self.actionFind = QtGui.QAction(MainWindow)
        self.actionFind.setObjectName("actionFind")
        self.actionFind_Next = QtGui.QAction(MainWindow)
        self.actionFind_Next.setObjectName("actionFind_Next")
        self.actionFind_Next.setShortcut('Ctrl+G')
        self.actionFind.setShortcut('Ctrl+F')
        self.actionFind_Prev = QtGui.QAction(MainWindow)
        self.actionFind_Prev.setObjectName("actionFind_Prev")
        self.actionFind_Prev.setShortcut('Ctrl+Shift+G')
        self.actionOnline_Help = QtGui.QAction(MainWindow)
        self.actionOnline_Help.setObjectName("actionOnline_Help")
        self.actionOnline_Help.setShortcut('F1')
        self.actionLua_Help = QtGui.QAction(MainWindow)
        self.actionLua_Help.setObjectName("actionLua_Help")
        self.actionAbout_Lua = QtGui.QAction(MainWindow)
        self.actionAbout_Lua.setObjectName("actionAbout_Lua")
        self.actionAbout_Apolo = QtGui.QAction(MainWindow)
        self.actionAbout_Apolo.setObjectName("actionAbout_Apolo")
        self.actionLicense = QtGui.QAction(MainWindow)
        self.actionLicense.setObjectName("actionLicense")
        self.actionReport_bug = QtGui.QAction(MainWindow)
        self.actionReport_bug.setObjectName("actionReport_bug")
        self.actionSuggestions = QtGui.QAction(MainWindow)
        self.actionSuggestions.setObjectName("actionSuggestions")
        self.menuFile.addAction(self.actionNew_File)
        self.menuFile.addAction(self.actionOpen_File)
        self.menuFile.addAction(self.actionSave_File)
        self.menuFile.addAction(self.actionSave_All)
        self.menuFile.addSeparator()
        self.menuFile.addAction(self.actionClose_File)
        self.menuFile.addAction(self.actionClose_All)
        self.menuFile.addSeparator()
        self.menuFile.addAction(self.actionExit)
        self.menuEdit.addAction(self.actionUndo)
        self.menuEdit.addAction(self.actionRedo)
        self.menuEdit.addSeparator()
        self.menuEdit.addAction(self.actionCut)
        self.menuEdit.addAction(self.actionCopy)
        self.menuEdit.addAction(self.actionPaste)
        self.menuEdit.addSeparator()
        self.menuEdit.addAction(self.actionSelect_All)
        self.menuSerach.addAction(self.actionFind)
        self.menuSerach.addSeparator()
        self.menuSerach.addAction(self.actionFind_Next)
        self.menuSerach.addAction(self.actionFind_Prev)
        self.menuHelp.addAction(self.actionOnline_Help)
        self.menuHelp.addAction(self.actionLua_Help)
        self.menuHelp.addSeparator()
        self.menuHelp.addAction(self.actionSuggestions)
        self.menuHelp.addAction(self.actionReport_bug)
        self.menuHelp.addSeparator()
        self.menuHelp.addAction(self.actionLicense)
        self.menuHelp.addAction(self.actionAbout_Lua)
        self.menuHelp.addAction(self.actionAbout_Apolo)
        self.menubar.addAction(self.menuFile.menuAction())
        self.menubar.addAction(self.menuEdit.menuAction())
        self.menubar.addAction(self.menuSerach.menuAction())
        self.menubar.addAction(self.menuHelp.menuAction())

        self.BtmArea = BottomArea()

        self.Split = QtGui.QSplitter(QtCore.Qt.Vertical)

        self.layout = QtGui.QHBoxLayout()
        self.Frame.setLayout(self.layout)
        self.Split.insertWidget(0, self.Frame)
        self.Split.insertWidget(1, self.BtmArea)
        self.Split.setStretchFactor(0, 10)
        self.Split.setStretchFactor(1, 5)

        self.setCentralWidget(self.Split)

        #instance de tabs
        self.Tabs = TabWidget()
        self.layout.addWidget(self.Tabs)
        #instance editor
        self.Edt = Editor()
        self.Edt.setPlainText('Welcome')
        self.Edt.setReadOnly(True)
        self.Edt.FileName = 'Start Page'
        self.Tabs.add_Tab(0, self.Edt, 'Start Page')

        self.retranslateUi(self)  #to turn toolbox visible

        #instance Actions
        self.Act = Actions(self)

        #drawing toolbar
        self.ToolBar = self.addToolBar('ToolBar')

        #new File
        Action_NewFile = QtGui.QAction(QtGui.QIcon('gui/icons/new_file.png'),
                                       'New File', self)
        self.ToolBar.addAction(Action_NewFile)
        Action_NewFile.triggered.connect(self.Act.New_File)
        #Open File
        self.Action_OpenFile = QtGui.QAction(
            QtGui.QIcon('gui/icons/open_file.png'), 'Open File', self)
        self.ToolBar.addAction(self.Action_OpenFile)
        self.Action_OpenFile.triggered.connect(self.Act.Open_File)
        #Save File
        Action_SaveFile = QtGui.QAction(QtGui.QIcon('gui/icons/save_file.png'),
                                        'Save File', self)
        self.ToolBar.addAction(Action_SaveFile)
        Action_SaveFile.triggered.connect(self.Act.Save_File)
        #Save All
        Action_SaveAll = QtGui.QAction(QtGui.QIcon('gui/icons/save_all.png'),
                                       'Save All', self)
        self.ToolBar.addAction(Action_SaveAll)
        Action_SaveAll.triggered.connect(self.Act.Save_All)
        #Separator
        self.ToolBar.addSeparator()
        #Cut
        Action_Cut = QtGui.QAction(QtGui.QIcon('gui/icons/cut.png'), 'Cut',
                                   self)
        self.ToolBar.addAction(Action_Cut)
        Action_Cut.triggered.connect(self.Act.Cut)
        #Copy
        Action_Copy = QtGui.QAction(QtGui.QIcon('gui/icons/copy.png'), 'Copy',
                                    self)
        self.ToolBar.addAction(Action_Copy)
        Action_Copy.triggered.connect(self.Act.Copy)
        #Paste
        Action_Paste = QtGui.QAction(QtGui.QIcon('gui/icons/paste.png'),
                                     'Paste', self)
        self.ToolBar.addAction(Action_Paste)
        Action_Paste.triggered.connect(self.Act.Paste)
        #Separator
        self.ToolBar.addSeparator()
        #Run
        Action_Run = QtGui.QAction(QtGui.QIcon('gui/icons/run.png'), 'Run',
                                   self)
        self.ToolBar.addAction(Action_Run)
        Action_Run.triggered.connect(self.Act.Run)
        #Stop
        Action_Stop = QtGui.QAction(QtGui.QIcon('gui/icons/stop.png'), 'Stop',
                                    self)
        self.ToolBar.addAction(Action_Stop)
        Action_Stop.triggered.connect(self.Act.Stop)

        #tab signal
        #  self.Tabs.tabCloseRequested.connect(self.Act.Close_File)
        self.Tabs.connect(self.Tabs, QtCore.SIGNAL("tabCloseRequested(int)"),
                          self.Act.Close_File)

        #menu signals....
        self.actionNew_File.triggered.connect(self.Act.New_File)
        self.actionOpen_File.triggered.connect(self.Act.Open_File)
        self.actionSave_File.triggered.connect(self.Act.Save_File)
        self.actionSave_All.triggered.connect(self.Act.Save_All)
        self.actionClose_File.triggered.connect(self.Act.Close_File)
        self.actionClose_All.triggered.connect(self.Act.Close_All)
        self.actionExit.triggered.connect(self.Act.Exit)
        self.actionRedo.triggered.connect(self.Act.Redo)
        self.actionUndo.triggered.connect(self.Act.Undo)
        self.actionCut.triggered.connect(self.Act.Cut)
        self.actionPaste.triggered.connect(self.Act.Paste)
        self.actionCopy.triggered.connect(self.Act.Copy)
        self.actionSelect_All.triggered.connect(self.Act.Select_All)
        self.actionFind.triggered.connect(self.Act.Find)
        self.actionFind_Next.triggered.connect(self.Act.Find_Next)
        self.actionFind_Prev.triggered.connect(self.Act.Find_Prev)
        self.actionOnline_Help.triggered.connect(self.Act.Online_Help)
        self.actionLua_Help.triggered.connect(self.Act.Lua_Help)
        self.actionReport_bug.triggered.connect(self.Act.IDE_Forum)
        self.actionSuggestions.triggered.connect(self.Act.IDE_Forum)
        self.actionLicense.triggered.connect(self.Act.Show_License)

        self.retranslateUi(self)
        QtCore.QMetaObject.connectSlotsByName(self)
Beispiel #19
0
        message = client.recv(1024).decode()
        print("Server message: " + message)

        # Start Ev3 screen
        display = RobotDisplay('maker')
        display.startScreen()

        # Starting battery thread
        battery = Battery(client, display)

        # Starting button thread
        button = Button(client, display)

        # Declare movement
        action = Actions()

        print("Start main thread\n")

        while True:
            action.movement(client, display)

    # Server is not connected
    except ConnectionRefusedError:
        # Declare movement
        action = Actions()

        # Play error sound
        action.playFile("Sounds/4.wav")

        # Get current time HH:MM:SS
Beispiel #20
0
def qbasic():
    global atmOn, accountsList, transactionSummary, totalAmount, deletedAccounts, newlyCreatedAccounts, testMode

    userInput = Console()
    # tester = Validity()
    currentSession = Session()
    actions = Actions()

    # infinite loop while bank machine is "on"
    while atmOn == True:
        # retrieve user input
        try:
            cmd = userInput.commandInput(testMode)
        except EOFError:
            cmd = "off"

        # go through the possible input cases
        if cmd == "off":
            atmOn = False
            # ends the program
        elif (cmd == "ignore"):
            # input was invalid, do nothing
            pass
        elif (cmd == "login"):
            currentSession.login(testMode)
        elif (cmd == "logout"):
            currentSession.logout(transactionSummary)
            totalAmount = 0  # reset session's totalAmount
        elif (cmd == "create"):
            accountNumber = 0000000
            if (currentSession.loggedInAgent == True):
                accountNumber = userInput.accountNumberInput(testMode)
                if accountNumber == "ignore":
                    continue
                newlyCreatedAccounts.append(int(accountNumber))
            actions.create(currentSession, transactionSummary, accountsList,
                           deletedAccounts, accountNumber, testMode)
        elif (cmd == "delete"):
            accountNumber = 0000000
            if (currentSession.loggedInAgent == True):
                accountNumber = userInput.accountNumberInput(testMode)
                if accountNumber == "ignore":
                    continue
                deletedAccounts.append(int(accountNumber))
            actions.delete(currentSession, transactionSummary, accountsList,
                           accountNumber, deletedAccounts,
                           newlyCreatedAccounts, testMode)
        elif (cmd == "deposit"):
            actions.deposit(currentSession, transactionSummary,
                            deletedAccounts, newlyCreatedAccounts,
                            accountsList, testMode)
        elif (cmd == "withdraw"):
            accountNumber = 0000000
            amount = 0
            if (currentSession.loggedInGeneral == True):
                accountNumber = userInput.accountNumberInput(testMode)
                if accountNumber == "ignore":
                    continue
                amount = userInput.amountInput(testMode, currentSession)
                if amount == "ignore":
                    continue
                totalAmount += int(amount)
            actions.withdraw(currentSession, transactionSummary, accountNumber,
                             amount, totalAmount, deletedAccounts,
                             newlyCreatedAccounts, accountsList, testMode)
        elif (cmd == "transfer"):
            actions.transfer(currentSession, transactionSummary, accountsList,
                             deletedAccounts, newlyCreatedAccounts, testMode)

    transactionSummary.close()
Beispiel #21
0
if __name__ == '__main__':
    """ Instantiate classes """
    micro = Microlink(['Micro1', 'Micro2', 'Micro3', 'Micro4'], strict=True)

    if inhibit != 'n2o':
        n2o = Wireless_Sensing(
            port=Definitions.N2O['port'],
            mac_addr=Definitions.N2O['mac'],
            #                                 ip = Definitions.N2O['ip'],
        )

    state = State_Generator()
    hdcs = HDCS_Link()
    hacs = HACS_Link()
    act = Actions(micro, hdcs)
    """ Initialize variables """
    Command = dict(Definitions.Command)
    State = dict(Definitions.State)
    log = Log([State, Command])

    while True:

        # Acquire human input and update commands
        hdcsCmd = hdcs.transceive_and_parse(State)
        hacsCmd = hacs.update(State)

        if hdcsCmd:
            Command.update(hdcsCmd)
            print('hdcs cmd update! >>', hdcsCmd)
Beispiel #22
0
from datetime import datetime
from Actions import Actions
from TouchSensor import Button
from Battery import Battery

# Initialize movement speed
speed = 100

# Start Touch Sensor thread
button = Button(speed)

# Start Battery thread
battery = Battery(speed)

# Declare movement
actions = Actions(speed)

# Get current time HH:MM:SS
now = datetime.now()
time = str(now.strftime("%H:%M:%S"))

print(time + "\tLaunching program\n")

app = Flask (__name__)

# Move vehicle in the given direction
@app.route('/GET/Ev3/F1/movement/<action>', methods = ['GET'])
def movement(action):

    # Get current time HH:MM:SS
    now = datetime.now()