예제 #1
0
파일: ui2.py 프로젝트: leesing9/dltools
 def run_thermal_matching(self, *a):
     thermal_dic = readJson(self.lineEdit_4.text())
     for path in self.thermal_images:
         image = np.array(Image.open(path))
         filename = Path(path).stem
         thermal_matching_v2(image, thermal_dic, self.lineEdit_7.text(),
                             filename)
예제 #2
0
파일: api.py 프로젝트: leesing9/dltools
    def login(self,
              username: str = None,
              password: str = None) -> Union[requests.Session, bool]:
        session = requests.session()

        data = {'username': username, 'password': password}

        r = session.post(self.get_api_url('auth') + '/login',
                         data=data,
                         timeout=3)
        self.r = r
        r.raise_for_status()
        if 'csrftoken' in r.cookies:
            session.headers['X-CSRFToken'] = r.cookies['csrftoken']
        API.session = session

        crypto = Crypt()
        cfg_path = Path(__file__).parent / '../config.json'
        cfg = readJson(cfg_path)
        cfg['username'] = username
        cfg['password'] = crypto.encrypt(password)
        cfg['base_url'] = API.base_url
        saveJson(cfg_path, cfg)

        return r.json()
예제 #3
0
from dltools.api.user import UserAPI
import sys
from PyQt5.QtWidgets import *
from PyQt5 import uic
from pathlib import Path

from dltools.dataset.utils import readJson
from dltools.api import AuthAPI, TaskAPI, ProjectAPI, JobAPI
from dltools.dataset.crypto import Crypt


cfg_path = Path(__file__).parent/'../config.json'
cfg = readJson(cfg_path)
crypt = Crypt()
project_api = ProjectAPI()

#UI파일 연결
#단, UI파일은 Python 코드 파일과 같은 디렉토리에 위치해야한다.
ui_path = Path(__file__).parent/"ui.ui"
form_class = uic.loadUiType(ui_path)[0]

#화면을 띄우는데 사용되는 Class 선언
class WindowClass(QMainWindow, form_class) :
    def __init__(self) :
        super().__init__()
        self.setupUi(self)

        #sign in
        self.url.setText(cfg['base_url'])
        self.id.setText(cfg['username'])
        self.password.setText(crypt.decrypt(cfg['password']))