Example #1
0
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)

        #设置文件、图片路径
        self.fileroot = 'Psyduck'
        
        #加载剧本
        self.loadScript()

        #临时对象
        self.image=QImage()
        
        #设置状态
        self.petStatus={'Status':0,'Script':0,'Step':-1,'Vx':0,'Vy':0,'ToRepeat':0,'NowPic':'','Mirror-X':False,'Mirror-Y':False}
        self.geometryLog={'old':{'left':0,'top':0},'new':{'left':0,'top':0}}
        self.workArea={'x':{'a':0,'b':0},'y':{'a':0,'b':0}}
        self.workAreaOld={'x':{'a':0,'b':0},'y':{'a':0,'b':0}}
        self.updateWorkArea()
        
        #调用initUI加载控件
        self.initUI()

        #定时器
        self.timer = QtCore.QBasicTimer()
        self.step = 0
        #设置定时器间隔
        self.timerInterval=20
        #启动定时器
        self.timer.start(self.timerInterval, self)
Example #2
0
 def __init__(self):
     QtWidgets .QMainWindow.__init__(self)
     Ui_MainWindow.__init__(self)
     self.setupUi(self)
     self.start.clicked.connect(self.crawlGui)
     self.timer =QtCore.QBasicTimer()  
     self.step = 0  
Example #3
0
 def __init__(self, parent=None):
     QtWidgets.QWidget.__init__(self, parent)
     self.step = 0
     self.direction = self.FORWARDS
     self.brush = self.palette().dark()
     self.pen = QtGui.QPen(self.brush, 0)
     self.timer = QtCore.QBasicTimer()
Example #4
0
 def __init__(self, camera_port=0, parent=None):
     super().__init__(parent)
     self.stop = False
     self.timer = QtCore.QBasicTimer()
     self.q = Queue(self.BUF_SIZE)
     self.PTR_PY_FRAME_CALLBACK = CFUNCTYPE(
         None, POINTER(uvc_frame), c_void_p)(self.py_frame_callback)
    def __init__(self, camera_port=1, parent=None):
        super().__init__(parent)
        self.camera = cv2.VideoCapture(camera_port)
        self.camera.set(cv2.CAP_PROP_FRAME_WIDTH, 1920)
        self.camera.set(cv2.CAP_PROP_FRAME_HEIGHT, 1440)

        self.timer = QtCore.QBasicTimer()
Example #6
0
 def __init__(self, camera_port=0, parent=None):
     super().__init__(parent)
     self.camera = cv2.VideoCapture(camera_port)
     self.camera.set(5, 30)  #set FPS
     self.camera.set(3, 480) #set width
     self.camera.set(4, 480) #set heigh
     self.timer = QtCore.QBasicTimer()
Example #7
0
 def __init__(self, camera_port="/dev/video3", parent=None):
     super().__init__(parent)
     self.camera_port = camera_port
     self.camera = cv2.VideoCapture(camera_port)
     self.timer = QtCore.QBasicTimer()
     self.counter = 0
     self.lastframe = None
Example #8
0
    def __init__(self, parent=None):
        super(Raycasting, self).__init__(parent)
        self.angle = 0.5
        self.playerPos = QtCore.QPointF(1.5, 1.5)
        self.angleDelta = 0
        self.moveDelta = 0
        self.touchDevice = False
        self.textureImg = QtGui.QImage()
        self.watch = QtCore.QTime()
        self.ticker = QtCore.QBasicTimer()
        self.buffer = QtGui.QImage()
        self.bufferSize = QtCore.QSize()

        # http://www.areyep.com/RIPandMCS-TextureLibrary.html
        self.textureImg.load(":/textures.png")
        self.textureImg = self.textureImg.convertToFormat(
            QtGui.QImage.Format_ARGB32
        )
        assert self.textureImg.width() == TEXTURE_SIZE * 2
        assert self.textureImg.bytesPerLine() == 4 * TEXTURE_SIZE * 2

        self.textureCount = self.textureImg.height() / TEXTURE_SIZE
        self.watch.start()
        self.ticker.start(25, self)
        self.setAttribute(QtCore.Qt.WA_OpaquePaintEvent, True)
        self.setMouseTracking(False)
Example #9
0
    def initUI(self, maxTime, cava, casa):
        self.setStyleSheet("QWidget { background: rgb(0,0,0) }")
        self.setFixedSize(772, 672)
        self.setWindowTitle("App")
        self.fim = None
        self.battle = False
        self.seque_cav = [0, 1, 2, 3, 4]
        self.cavaleiros = cava

        audioUrl = QtCore.QUrl.fromLocalFile(
            os.path.join(self.audio, "soundtrack.mp3"))
        audioOutput = QtMultimedia.QMediaContent(audioUrl)
        self.mediaObject = QtMultimedia.QMediaPlayer()
        self.mediaObject.setMedia(audioOutput)
        self.mediaObject.play()

        self.player = Player(37, 37)
        self.casas = casa
        self.maxTime = maxTime

        self.mapa = Mapa(42, 42, mapa_casas)
        self.caminho = IA().solu(self.player, self.casas[0], self.mapa)
        self.timer = QtCore.QBasicTimer()
        self.novo = 0
        self.casa_at = 0
        self.total_casa = 12
        self.tempo = 0
        self.fim = None

        self.start()
        self.show()
Example #10
0
	def __init__(self):
		super(MainUI, self).__init__()
		self.setupUi(self)
		
		
		#set play button
		style = self.bn_play.style()
		self.bn_play.setIcon(style.standardIcon(QtWidgets.QStyle.SP_MediaPlay))
		self.bn_slow.setIcon(style.standardIcon(QtWidgets.QStyle.SP_MediaSkipBackward))
		self.bn_fast.setIcon(style.standardIcon(QtWidgets.QStyle.SP_MediaSkipForward))
		self.bn_play.clicked.connect(self.bn_play_clicked)
		self.actionLoad_calibs.triggered.connect(self.load_calibs)
		self.actionLoad.triggered.connect(self.load_smpls)
		self.actionLoad_Skeletons.triggered.connect(self.load_skeletons)
	
	
		self.glWidget.resizeEvent = self.glWidget_resize
		self.mainGlWidget = domeGLWidget(self)
		self.mainGlWidget.setGeometry(self.glWidget.geometry())
		
		self.frame_slider.setMinimum(0)
		self.frame_slider.valueChanged.connect(self.mainGlWidget.set_frameid)
		self.frame_slider.valueChanged.connect(self.set_frameid)
		self.frameIdChanged.connect(self.frame_slider.setValue)
		
		self.xEdit.valueChanged.connect(self.mainGlWidget.setXTrans)
		self.mainGlWidget.xTransChanged.connect(self.xEdit.setValue)
		self.yEdit.valueChanged.connect(self.mainGlWidget.setYTrans)
		self.mainGlWidget.yTransChanged.connect(self.yEdit.setValue)
		self.zEdit.valueChanged.connect(self.mainGlWidget.setZTrans)
		self.mainGlWidget.zTransChanged.connect(self.zEdit.setValue)
		self.xRotEdit.valueChanged.connect(self.mainGlWidget.setXRotation)
		self.mainGlWidget.xRotationChanged.connect(self.xRotEdit.setValue)
		self.yRotEdit.valueChanged.connect(self.mainGlWidget.setYRotation)
		self.mainGlWidget.yRotationChanged.connect(self.yRotEdit.setValue)
		self.zRotEdit.valueChanged.connect(self.mainGlWidget.setZRotation)
		self.mainGlWidget.zRotationChanged.connect(self.zRotEdit.setValue)
		
		self.actionClear.triggered.connect(self.clear_smpls)
		self.actionClear.triggered.connect(self.mainGlWidget.clear_smpls)
		
		self.camCombo.addItem("Free viewpoint")
		self.camCombo.setCurrentIndex(0)

		self.camCombo.currentIndexChanged.connect(self.mainGlWidget.setCameraStatus)
		item = QtWidgets.QListWidgetItem()
		item.setText("Floor")
		item.setFlags(item.flags()|QtCore.Qt.ItemIsUserCheckable)
		item.setCheckState(QtCore.Qt.Checked)
		self.list_model.addItem(item)
		
		self.timer = QtCore.QBasicTimer()
		
		self.frame_id = 0
		self.frame_num = 0
		self.fps = 20
		self.paused = True

		self.timer.start(1000/self.fps,self)
Example #11
0
    def __init__(self, camera_url=0, parent=None):
        super().__init__(parent)
        self.camera_url = camera_url

        self.index = 0

        self.camera = None
        self.timer = QtCore.QBasicTimer()
Example #12
0
 def __init__(self):
     super().__init__()
     self.setupUi(self)
     self.retranslateUi(self)
     #构建计时器
     self.timer = QtCore.QBasicTimer()
     self.timer.start(1000,self)
     self.step = 0
Example #13
0
    def start(self):
        """ Start the simulation """

        self.isPaused = False
        self.timer = QtCore.QBasicTimer()
        self.timerSpeed = 10
        self.timer.start(self.timerSpeed, self)
        self.update()
Example #14
0
 def __init__(self):
     super(Widget, self).__init__(parent=None)
     self.timer = QtCore.QBasicTimer()
     self.timer.start(5, self)
     self.point = self.rect().center()
     self.speed = 5
     self.angle = random.randint(0, 360)
     self.ball_off = False
Example #15
0
 def __init__(self, camera_port=cv2.CAP_DSHOW, parent=None):
     global stopped
     super().__init__(parent)
     self.camera = cv2.VideoCapture(camera_port)
     self.camera.set(cv2.CAP_PROP_FRAME_WIDTH, 1280)
     self.camera.set(cv2.CAP_PROP_FRAME_HEIGHT, 720)
     self.timer = QtCore.QBasicTimer()
     stopped = False
Example #16
0
 def initUI(self):
     self.setGeometry(100, 100, 520, 520)
     self.setWindowTitle('Okno')
     self.timerEngine = QtCore.QBasicTimer()
     self.timerPeriod = 150
     #self.btnload = QtWidgets.QPushButton("load", self)
     #self.btnload.clicked.connect(self.startlaod)
     self.restart()
     self.show()
Example #17
0
 def __init__(self, parent=None):
     super().__init__(parent)
     self.timer = QtCore.QBasicTimer()
     self.state = 0
     self.count = 0
     self.initNpz()
     self.storeCount = 0
     self.storeData = False
     self.commOpen = False
Example #18
0
    def __init__(self, parent=None):
        super(CVCapture, self).__init__(parent)
        self._image = QtGui.QImage()
        self._index = 0

        self.m_videoCapture = cv2.VideoCapture()
        self.m_timer = QtCore.QBasicTimer()
        self.m_filters = []
        self.m_busy = False
Example #19
0
 def __init__(self, camera_port=port, parent=None):
     super().__init__(parent)
     # self.camera = cv2.VideoCapture(camera_port)
     # self.width = self.camera.get(cv2.CAP_PROP_FRAME_WIDTH)
     # self.height = self.camera.get(cv2.CAP_PROP_FRAME_HEIGHT)
     # self.camera.set(cv2.CAP_PROP_FRAME_WIDTH, 640)
     # self.camera.set(cv2.CAP_PROP_FRAME_HEIGHT, 480)
     # print (self.width,self.height)
     self.timer = QtCore.QBasicTimer()
    def __init__(self, parent=None):
        super().__init__(parent)

        self.parent = parent

        self.timer = QtCore.QBasicTimer()
        self.step = MINUTES

        self._init_ui_()
Example #21
0
    def __init__(self, camera_port=0, parent=None):
        super().__init__(parent)

        # PiCamera를 사용할 경우 30번 라인을 주석처리하고
        # 31번 라인의 코드의 주석을 해제
        self.camera = VideoStream(src=camera_port).start()
        #self.camera = VideoStream(usePiCamera=1).start()

        self.fps = FPS().start()
        self.timer = QtCore.QBasicTimer()
Example #22
0
    def __init__(self, camera=0, parent=None):  # , [obj1]
        super().__init__(parent)
        self.camera = camera

        self.timer = QtCore.QBasicTimer()
        self.tracking = False
        self.objects = list()
        self.last_frame = 255 * np.ones((1000, 1000, 3), np.uint8)
        self.isDetected = False
        self.yolo_detect = False
Example #23
0
 def __init__(self, camera_port=0, parent=None):
     super().__init__(parent)
     self.camera = cv2.VideoCapture(camera_port)
     global first_img, objects_to_track, trackable_objects_list
     read, img = self.camera.read()
     first_img = img
     trackable_objects_list = self.find_trackable_objects(first_img)
     self.timer = QtCore.QBasicTimer()
     self.tracking = True
     self.last_frame = 255 * np.ones((1000, 1000, 3), np.uint8)
Example #24
0
    def __init__(self, game_status: GameStatusModel, parent: StartGameWindow,
                 *args, **kwargs):
        super(GameWidget, self).__init__(*args, **kwargs)

        # == CRUCIAL FOR GETTING KEYS TO WORK
        self.setFocusPolicy(qtcore.Qt.StrongFocus)

        # -- Init some constants
        self.__DIRECTION_UP = 'UP'
        self.__DIRECTION_DOWN = 'DOWN'
        self.__DIRECTION_LEFT = 'LEFT'
        self.__DIRECTION_RIGHT = 'RIGHT'

        # -- Save game status to a local var
        self.game_status = game_status

        # -- Save parent to increase view points
        self.parent = parent

        # -- Window configuration / size / colors ...
        self.window_min_width = 501
        self.window_min_height = 501
        self.setMinimumWidth(self.window_min_width)
        self.setMinimumHeight(self.window_min_height)

        # -- Configure painter and painting parameters
        self.game_painter = qtgui.QPainter()
        self.game_painter.setBrush(qtgui.QColor(0, 0, 0))
        self.snake_cell_size = 5
        self.snake_direction = self.__DIRECTION_RIGHT

        # -- Configure timer
        self.game_timer = qtcore.QBasicTimer()
        self.calculate_snake_speed()

        # -- Configure layout of components
        self.vbox_layout = wigs.QVBoxLayout()
        self.hbox_layout = wigs.QHBoxLayout()
        self.hbox_layout.addLayout(self.vbox_layout)
        self.setLayout(self.hbox_layout)

        # -- Initialize snake
        self.snake_cells = [(10, 10)]
        for idx in range(self.game_status.snake_length - 1):
            self.snake_cells.append(
                (self.snake_cells[idx][0] + self.snake_cell_size,
                 self.snake_cells[idx][1]))

        # -- Initialize food
        self.food_position = None
        self.special_food_position = None
        self.special_food_max_time = 150
        self.special_food_current_time = 0

        self.start()
Example #25
0
    def __init__(self, mainWindow, parent=None):
        super(WormDisplay, self).__init__(parent)

        self.mainWindow = mainWindow
        self.timer = QtCore.QBasicTimer()
        self.setFocusPolicy(QtCore.Qt.StrongFocus)
        #
        # This next section is specific to our worm application. 
        #
        self.timerBaseSpeed = 500
        self.new_game()
Example #26
0
    def __init__(self):
        """Connect main Window"""
        super(Connector, self).__init__()

        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)

        self.timerMove = QtCore.QBasicTimer()
        self.show()
        self.modeBot = True
        self.createBoard()
    def __init__(self, parent=None):
        QtWidgets.QWidget.__init__(self, parent)

        self.mouse_x = 0
        self.mouse_y = 0
        self.setMouseTracking(True)

        self.init_enemies()

        self.rt = QtCore.QBasicTimer()
        self.rt.start(10, self)
Example #28
0
 def __init__(self):
     super().__init__()
     self.setupUi(self)
     self.timer = QtCore.QBasicTimer()
     self.snake = Snake()
     self.direction = Direction.RIGHT
     self.resetButton.clicked.connect(self.resetClicked)
     self.startButton.clicked.connect(self.start)
     self.exitButton.clicked.connect(self.exit)
     self.food = 0
     self.speed = 100
     self.isPaused = False
Example #29
0
    def createToolbar(self):
        ###########################
        # create toolbar
        ###########################
        self.toolbar = self.addToolBar('File')
        self.toolbar.addAction(self.openAct)
        self.toolbar.addAction(self.saveAct)
        #self.toolbar.addAction(self.exitAct)
        #
        self.toolbar = self.addToolBar('Edit')
        self.toolbar.addAction(self.settingAct)
        self.toolbar.addAction(self.selectAct)
        #
        self.toolbar = self.addToolBar('Act')
        self.toolbar.addAction(self.extractAct)
        self.toolbar.addAction(self.splitAct)
        self.toolbar.addAction(self.fillAct)
        self.toolbar.addAction(self.autoAct)
        self.toolbar.addAction(self.mergeAct)
        #
        self.toolbar = self.addToolBar('Tool')
        self.toolbar.addAction(self.todocxAct)
        self.toolbar.addAction(self.toxmlAct)
        self.toolbar.addAction(self.tohtmlAct)
        #
        #self.toolbar = self.addToolBar('Setting')
        #self.toolbar.addAction(self.settingAct)
        #
        self.toolbar = self.addToolBar('Delete')
        self.toolbar.addAction(self.deleteAct)
        ####
        # create combobox
        self.toolbar = self.addToolBar('Select Target')
        self.combobox = QComboBox()
        self.combobox.currentIndexChanged.connect(self.selection_change)
        self.combobox.setMinimumWidth(150)
        self.combobox.setMinimumHeight(20)
        self.toolbar.addWidget(self.combobox)
        # create progress bar
        self.toolbar = self.addToolBar('Progress')

        self.progressBar = QProgressBar(self)
        self.progressBar.setEnabled(True)
        #width = self.frameGeometry().width()
        #height = self.frameGeometry().height()
        #self.progressBar.setGeometry(0, height-20, width-20, 20)
        self.progressBar.setSizePolicy(QSizePolicy.Expanding,
                                       QSizePolicy.Expanding)
        self.progressBar.setValue(self.step)
        #self.setCentralWidget(self.progressBar)
        self.timer = QtCore.QBasicTimer()
        self.timer.start(20, self)
        self.toolbar.addWidget(self.progressBar)
Example #30
0
    def __init__(self, parent=None, scale=1.3):
        super(Visualizer, self).__init__(parent)
        self.varsd = {
            'input': '/dev/video3',
            'match_algo': 'HUNGARIAN',
            'd_lm': 'CPU',
            'd_fd': 'CPU',
            'perf_stats': False,
            't_id': 0.3,
            'cpu_lib': '',
            'run_detector': False,
            'fd_input_height': 0,
            'timelapse': False,
            'm_fd': 'models/face-detection-retail-0004.xml',
            't_fd': 0.6,
            'crop_height': 0,
            'no_show': False,
            'exp_r_fd': 1.15,
            'fd_input_width': 0,
            'allow_grow': False,
            'm_lm': 'models/landmarks-regression-retail-0009.xml',
            'gpu_lib': '',
            'crop_width': 0,
            'fg': 'Face_Gallery',
            'verbose': True,
            'm_reid': 'models/face-reidentification-retail-0095.xml',
            'd_reid': 'CPU'
        }

        self.frame_processor = FrameProcessor(self.varsd)
        self.display = not self.varsd["no_show"]
        self.print_perf_stats = self.varsd["perf_stats"]

        self.frame_time = 0
        self.frame_start_time = 0
        self.fps = 0
        self.frame_num = 0
        self.frame_count = -1

        self.timer = QtCore.QBasicTimer()

        self.input_crop = None
        if self.varsd["crop_width"] and self.varsd["crop_height"]:
            self.input_crop = np.array(
                (self.varsd["crop_width"], self.varsd["crop_height"]))

        self.frame_timeout = 0 if self.varsd["timelapse"] else 1
        self.vsc = scale
        self.input_stream = cv2.VideoCapture(self.varsd["input"])

        self.modeFR = 0
        self.FRTrainflag = 0