示例#1
0
    def _execute_pattern(self, pat, block, duration):
        self.info('executing pattern {}'.format(pat))

        if not pat.endswith('.lp'):
            pat = '{}.lp'.format(pat)

        path = os.path.join(paths.pattern_dir, pat)
        if os.path.isfile(path):
            self.debug('Using local pattern {}'.format(pat))
            pat = pickle.dumps(path)
            self.debug('Sending Pattern:{}'.format(pat))

        self.debug('-------- laser version {}'.format(globalv.laser_version))
        if globalv.laser_version > 0:
            cmd = {'command': 'DoPattern',
                   'name': pat,
                   'duration': duration}
            cmd = json.dumps(cmd)
        else:
            cmd = 'DoPattern {}'.format(pat)

        self._ask(cmd, verbose=True)

        if block:
            time.sleep(0.5)
            if not self._block('IsPatterning', period=1, timeout=100):
                self._ask('AbortPattern')
示例#2
0
    def extract(self, value, units='', process=None):
        self.info('set laser output')

        cmd = {'command': 'SetLaserOutput',
               'value': value,
               'units': units}
        return self._ask(json.dumps(cmd)) == 'OK'
示例#3
0
    def extract(self, value, units='', process=None):
        self.info('set laser output')

        cmd = {'command': 'SetLaserOutput',
               'value': value,
               'units': units}
        return self._ask(json.dumps(cmd)) == 'OK'
示例#4
0
    def _execute_pattern(self, pat, block, duration):
        self.info('executing pattern {}'.format(pat))

        if not pat.endswith('.lp'):
            pat = '{}.lp'.format(pat)

        path = os.path.join(paths.pattern_dir, pat)
        if os.path.isfile(path):
            self.debug('Using local pattern {}'.format(pat))
            pat = pickle.dumps(path)
            self.debug('Sending Pattern:{}'.format(pat))

        self.debug('-------- laser version {}'.format(globalv.laser_version))
        if globalv.laser_version > 0:
            cmd = {'command': 'DoPattern', 'name': pat, 'duration': duration}
            cmd = json.dumps(cmd)
        else:
            cmd = 'DoPattern {}'.format(pat)

        self._ask(cmd, verbose=True)

        if block:
            time.sleep(0.5)
            if not self._block('IsPatterning', period=1, timeout=100):
                self._ask('AbortPattern')
示例#5
0
    def _put(self, cmd, **payload):
        headers = self._get_authorization()
        kw={}
        if globalv.cert_file:
            kw['verify'] = globalv.cert_file

        r = requests.put(cmd, data=json.dumps(payload), headers=headers, **kw)
        return r
示例#6
0
def create_card(card):
    column_id = os.environ.get('GITHUB_BUG_CARD', 2279248)
    cmd = '{}/projects/columns/{}/cards'.format(GITHUB_API_URL, column_id)
    data = json.dumps(card)
    return git_post(
        cmd,
        data=data,
        headers={'accept': 'application/vnd.github.inertia-preview+json'})
示例#7
0
def create_organization_repository(org, name, usr, pwd, **kw):
    cmd = '/orgs/{}/repos'.format(org)
    cmd = make_request(cmd)
    payload = {'name': name}
    payload.update(**kw)
    auth = base64.encodestring('{}:{}'.format(usr, pwd)).replace('\n', '')
    headers = {"Authorization": "Basic {}".format(auth)}
    r = requests.post(cmd, data=json.dumps(payload), headers=headers)
    print(cmd, payload, usr, pwd)
    print(r)
    return r
示例#8
0
文件: github.py 项目: NMGRL/pychron
def create_organization_repository(org, name, usr, pwd, **kw):
    cmd = '/orgs/{}/repos'.format(org)
    cmd = make_request(cmd)
    payload = {'name': name}
    payload.update(**kw)
    auth = base64.encodestring('{}:{}'.format(usr, pwd)).replace('\n', '')
    headers = {"Authorization": "Basic {}".format(auth)}
    r = requests.post(cmd, data=json.dumps(payload), headers=headers)
    print(cmd, payload, usr, pwd)
    print(r)
    return r
示例#9
0
def create_issue(issue):
    org = os.environ.get('GITHUB_ORGANIZATION', 'NMGRL')
    cmd = '{}/repos/{}/pychron/issues'.format(GITHUB_API_URL, org)

    data = json.dumps(issue)
    return git_post(cmd, data=data)
示例#10
0
def create_card(card):
    column_id = os.environ.get('GITHUB_BUG_CARD', 2279248)
    cmd = '{}/projects/columns/{}/cards'.format(GITHUB_API_URL, column_id)
    data = json.dumps(card)
    return git_post(cmd, data=data, headers={'accept': 'application/vnd.github.inertia-preview+json'})
示例#11
0
    def start_video_recording(self, name):
        self.info('Start Video Recording')
        cmd = {'command': 'StartVideoRecording', 'name': name}

        self._ask(json.dumps(cmd))
示例#12
0
    def start_video_recording(self, name):
        self.info('Start Video Recording')
        cmd = {'command': 'StartVideoRecording', 'name': name}

        self._ask(json.dumps(cmd))
示例#13
0
def create_issue(issue):
    org = os.environ.get('GITHUB_ORGANIZATION', 'NMGRL')
    cmd = '{}/repos/{}/pychron/issues'.format(GITHUB_API_URL, org)

    data = json.dumps(issue)
    return git_post(cmd, data=data)