예제 #1
0
 def __init__(self):
     self.window = tk.Tk()
     self.window.geometry("800x600")
     self.window.title("KS Backup")
     self.controler = Controler(self.window)
     self.controler.displayGUI()
     self.window.mainloop()
예제 #2
0
def main():
    app = QApplication([])
    controler = Controler()
    win = MainWindow(controler)
    win.show()
    app.exec()
    controler.close()
예제 #3
0
 def __init__(self, *args, **kwargs):
     super(Cooking, self).__init__(*args, **kwargs)
     self.controler = Controler()
     # add reaction for emergency switches
     self.ids.pump_block_checkbox.bind(
         state=lambda _, s: self.controler.block_pump(s == 'down'))
     self.ids.heaters_block_checkbox.bind(
         state=lambda _, s: self.controler.block_heaters(s == 'down'))
예제 #4
0
 def __init__(self, *args, **kwargs):
     super(NewBrew, self).__init__(*args, **kwargs)
     self.test = 0
     self.ids.temp_zacierania_knob.on_knob = self.on_knob_temp
     self.ids.mashing_time_knob.on_knob = self.on_knob_time
     self.conf=[{'temp': 20, 'time': 15}]
     self.update_layout()
     self.config_manager = ConfigManager()
     self.hops_amount = 3
     self.hops = []
     self.controler = Controler()
예제 #5
0
파일: main.py 프로젝트: magicalfish/Fingeth
from controler import Controler

ctr = Controler()

def menu():
    
    inp = int(input("1- Register.\n2- Add new device\n3- Authenticate.\n4- Create fingerprint.\n5- Receive fingerprint.\n6- Exit.\n>"))
    return inp
      
def switch(num,values):
    print(values[num + 1])

def main():
    val = 0
    while(val != 6):
        val = menu()
        
        if val == 1:
            
            r = ctr.register()
            v = ["An error ocurred. Please try it again later.","Register completed.","You are already registered."]
            switch(r,v)
                
        elif val == 2:
            
            r = int(input("1- Add this devide.\n2- Read fingerprint file.\n>"))
            ret = 0
            if r == 1:
                ret = ctr.addDevice()
            elif r == 2:
                f = input("Select the fingerprint's file: ")
예제 #6
0
    parser.add_argument('-a',
                        '--address',
                        default='0.0.0.0',
                        help='accesible address')
    parser.add_argument('-p', '--port', default=5125, type=int, help='port')
    parser.add_argument('-d',
                        '--debug',
                        action='store_true',
                        help='debug mode')

    return parser.parse_args(argv[1:])


if __name__ == "__main__":
    args = parse_arg(sys.argv)
    controler = Controler(os.path.abspath('../model'))
    # emotions = np.array(controler.list_model()['LJ40K_svm'])
    emotions = np.array(controler.list_model()['YAHOO_svm'])
    logger = Logger()

    if args.debug:
        args.port += 1
        app.run(args.address,
                args.port,
                debug=False,
                threaded=True,
                use_reloader=False)
    else:
        print "* Running on http://{}:{}/".format(args.address, args.port)
        WSGIServer(app,
                   multithreaded=True,
예제 #7
0
def main():

    controler = Controler()
    controler.start()
예제 #8
0
from controler import Controler
from view import View

if __name__ == '__main__':
    controler = Controler()
    view = View(controler)
    view.run()
예제 #9
0
def run_proc():
    pygame.init()

    global_settings = Settings()  #实例化

    # 创建游戏主窗口
    screen = pygame.display.set_mode(
        (global_settings.SCREEN_WIDTH,
         global_settings.SCREEN_HEIGHT))  # 元组参数表示窗口大小,默认全屏024
    pygame.display.set_caption("My Picture Tool")

    SCREEN_RECT = screen.get_rect()
    pygame.display.update()

    #创建按钮
    buttonArray = []
    #按钮的元素:
    #'handle'按钮句柄,
    #Field:所属区域
    #'ProcType'执行动作类型,
    buttonArray.append({
        'handle': Button((0, 0), "ROT", visible=True),
        'ProcType': 'rotate'
    })
    buttonArray.append({
        'handle': Button((0, 1), "TRAP", visible=True),
        'ProcType': 'trapezoid'
    })
    buttonArray.append({
        'handle': Button((0, 2), "PARA", visible=True),
        'ProcType': 'parallelograms'
    })
    buttonArray.append({
        'handle': Button((1, 0), "ZOOM", visible=True),
        'ProcType': 'zoom'
    })
    buttonArray.append({
        'handle': Button((1, 1), "GRAY", visible=True),
        'ProcType': 'gray'
    })
    buttonArray.append({
        'handle': Button((1, 2), "B/W", visible=True),
        'ProcType': 'blackwhite'
    })
    buttonArray.append({
        'handle': Button((2, 0), "SEL", visible=True),
        'ProcType': 'select'
    })
    buttonArray.append({
        'handle': Button((2, 1), "GRID", visible=True),
        'ProcType': 'grid'
    })
    buttonArray.append({
        'handle': Button((2, 2), "BATCH", visible=True),
        'ProcType': 'batch'
    })
    buttonArray.append({
        'handle': Button((4, 0), "UNDO", visible=True),
        'ProcType': 'undo'
    })

    #当前选中的功能按钮
    config.setCurProcType("None")

    #创建图像
    imgFile = get_path("*.*")
    if not imgFile:
        return
    image = cv2.imread(imgFile, cv2.IMREAD_UNCHANGED)
    pic = Picture(image)

    (filepath, tempfilename) = os.path.split(imgFile)
    (filename, extension) = os.path.splitext(tempfilename)
    config.setPicFilePathAndExt(filepath, filename, extension)

    #创建控制器
    ctrl = Controler()

    while True:
        screen.fill(global_settings.BG_COLOR)  #调用属性设置屏幕的填充颜色
        #绘制各个按钮
        for item in buttonArray:
            item['handle'].draw(screen)

        #事件处理循环
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                sys.exit()
            elif event.type == pygame.MOUSEBUTTONDOWN:
                mouse_x, mouse_y = pygame.mouse.get_pos()

                #检查是否点击了某个按钮
                for item in buttonArray:
                    tempButtonHandle = item['handle']
                    if tempButtonHandle.checkClick(mouse_x, mouse_y):
                        print(tempButtonHandle.getButtonText(), 'click')
                        #call entry
                        ButtonProcEntry(item, pic)
                        config.setCurProcType(item['ProcType'])
            elif event.type == pygame.KEYUP:
                if config.getCurProcType():
                    ctrl.KeyUpProcEntry(config.getCurProcType(), event.key,
                                        event.mod, pic)
                pass

        #绘制图形
        if pic.isNeedUpdate:
            img = pic.show(global_settings.getImageRect())
            screen.blit(
                img,
                (global_settings.DRAWING_LEFT, global_settings.DRAWING_TOP),
                img.get_rect())
            #pic.isNeedUpdate=False

        pygame.display.flip()  #使最近绘制的屏幕可见

    pygame.quit()
예제 #10
0
    def seuilChange(self):
        Hmin, Hmax, Smin, Smax, Vmin, Vmax = self.lireHSV()
        self.chgtSeuils.emit(Hmin, Hmax, Smin, Smax, Vmin, Vmax)

    # Affichage de l'image seuillée sur l'écran
    def majImageCouleur(self, img):
        height, width, channel = img.shape
        bytesPerLine = 3 * width
        mQImage = QImage(img, width, height, bytesPerLine,
                         QImage.Format_RGB888)
        pix = QPixmap.fromImage(mQImage)
        self.zoneImage.setPixmap(pix)

    def closeEvent(self, evnt):
        self.controler.finEpreuve()
        QApplication.instance().quit()
        sys.exit()
        print('fin close')


####################################################################################################################
if __name__ == "__main__":
    import sys
    app = QApplication(sys.argv)
    webcam = WebcamProcessing()
    controler = Controler(webcam)
    w = IhmTracking(webcam, controler)
    controler.start()  # Lance la séquence de toutes les épreuves
    w.show()
    sys.exit(app.exec_())