def init(self):
    
        self.pos = ( 
            (2380, 129), (2500, 59), (1380, 89),
            (3780, 109), (580, 139), (680, 239), 
            (790, 259), (760, 150), (790, 150),
            (2930, 159), (590, 80), (530, 60),
            (1900, 259), (2660, 150), (1540, 90),
            (810, 220), (860, 320), (740, 180),
            (820, 128), (490, 170), (700, 230)
        )

        self.naliens = len(self.pos)

        self.scene = QtGui.QGraphicsScene()
        
        self.craft = Craft()
        self.scene.addItem(self.craft)         
        self.setScene(self.scene)  

        for i in range(len(self.pos)):
            alien = Alien(self.pos[i][0], self.pos[i][1])
            self.scene.addItem(alien)
            
        text = "Aliens left: %d" % self.naliens    
        self.score = self.scene.addText(text)
        self.score.setPos(15, 15)
        self.score.setDefaultTextColor(QtCore.Qt.white)
                 
        self.timer = QtCore.QBasicTimer()
        self.timer.start(DELAY, self)   
Beispiel #2
0
    def make_top(self):
        # 文件选择按钮
        self.file_text1 = QtGui.QLineEdit()
        self.file_button1 = QtGui.QPushButton(u'请选择文件1: ')
        self.file_button1.clicked.connect(
            partial(self.select_file, self.file_text1))
        self.file_text2 = QtGui.QLineEdit()
        self.file_button2 = QtGui.QPushButton(u'请选择文件2: ')
        self.file_button2.clicked.connect(
            partial(self.select_file, self.file_text2))

        # diff动作按钮
        self.diff_button = QtGui.QPushButton(u'diff')
        self.diffrst = None
        self.diff_button.clicked.connect(self.diff)
        self.top_layout.addWidget(self.file_button1, 0, 0, 1, 1)
        self.top_layout.addWidget(self.file_text1, 0, 1, 1, 2)
        self.top_layout.addWidget(self.file_button2, 0, 4, 1, 1)
        self.top_layout.addWidget(self.file_text2, 0, 5, 1, 2)
        self.top_layout.addWidget(self.diff_button, 0, 13, 1, 1)

        #进度条
        self.process_bar = QtGui.QProgressBar()
        self.process_bar.setValue(0)
        self.timer = QtCore.QBasicTimer()
        self.timer_step = 0
        self.process_bar.setFixedHeight(10)
        self.top_layout.addWidget(self.process_bar, 1, 1, 1, 10)
Beispiel #3
0
    def __init__(self, parent=None):
        super(Display, self).__init__(parent)

        self._timer = QtCore.QBasicTimer()
        self._timer.start(100, self)

        self.setCursor(QtGui.QCursor(QtCore.Qt.BlankCursor))

        self._font = QtGui.QFont()
        self._font.setPointSize(30)
        self._font_metrics = QtGui.QFontMetrics(self._font)
        self.setFont(self._font)

        self._pic = {}
        self._newpic = {}
        self._text = {}
        self._oldpics = {}

        self._oldpics[0] = [None, None, None, None, None, None, None, None]
        self._oldpics[1] = [None, None, None, None, None, None, None, None]

        self._newpic[0] = ''
        self._newpic[1] = ''

        self._text[0] = 'Loading 0...'
        self._text[1] = 'Loading 1...'
 def __init__(self):
     super(Downloader, self).__init__()
     self.initUI()
     self.timer = QtCore.QBasicTimer()
     self.tasks = {}
     self.tasksNum = 0
     self.position = 0
Beispiel #5
0
  def __init__(self,parent):
    super(Board, self).__init__()
    self.parent = parent
    self.scene = QtGui.QGraphicsScene(self)
    self.setScene(self.scene)

    self.hwFlag = 0
    
    self.boardWidth = 50
    self.boardHeight = 50    
    
    # effectively sets the logical scene coordinates from 0,0 to 1000,1000
    myFrame = self.scene.addRect(0,0,self.boardWidth,self.boardHeight) 


    self.ball = Ball(self,self.boardWidth,self.boardHeight)

    self.rover = Rover(self)
    self.rover.setPos(25,25)
    self.rover.rotate(90)
    self.scene.addItem(self.rover)

    self.scene.addItem(self.ball)
 
    self.timer = QtCore.QBasicTimer()

    self.ball.setPos(35,35)
Beispiel #6
0
 def __init__(self):
     super(Mainwin, self).__init__()
     self.setGeometry(100, 100, 420, 270)
     self.setWindowTitle('MOD Mixer')
     x = 0
     self.makelabel(x + 5, 3, 80, 14, "Chan 1")
     self.ipgctl1 = IPGcontrol(self)
     self.ipgctl1.move(x + 8, 30)
     self.ipgctl1.valueEvent.connect(self.ipgevent)
     self.pgactl1 = PGAcontrol(self)
     self.pgactl1.move(x + 8, 75)
     self.pgactl1.valueEvent.connect(self.pgaevent)
     self.makelabel(x + 5, 130, 80, 11, "Input gain")
     self.dacctl1 = DACcontrol(self)
     self.dacctl1.move(x + 8, 150)
     self.dacctl1.valueEvent.connect(self.dacevent)
     self.makelabel(x + 5, 205, 70, 11, "Output")
     self.bpch1 = ButtonBase(self, BYPstyle, 0)
     self.bpch1.bpressEvent.connect(self.bypass)
     self.bpch1.move(x + 10, 235)
     self.meters1 = Kmeter(self, K20metrics, 2, 5)
     self.meters1.move(x + 83, 18)
     x += 150
     self.makelabel(x + 5, 3, 80, 14, "Chan 2")
     self.ipgctl2 = IPGcontrol(self)
     self.ipgctl2.move(x + 8, 30)
     self.ipgctl2.valueEvent.connect(self.ipgevent)
     self.pgactl2 = PGAcontrol(self)
     self.pgactl2.move(x + 8, 75)
     self.pgactl2.valueEvent.connect(self.pgaevent)
     self.makelabel(x + 5, 130, 80, 11, "Input gain")
     self.dacctl2 = DACcontrol(self)
     self.dacctl2.move(x + 8, 150)
     self.dacctl2.valueEvent.connect(self.dacevent)
     self.makelabel(x + 5, 205, 70, 11, "Output")
     self.bpch2 = ButtonBase(self, BYPstyle, 1)
     self.bpch2.bpressEvent.connect(self.bypass)
     self.bpch2.move(x + 10, 235)
     self.meters2 = Kmeter(self, K20metrics, 2, 5)
     self.meters2.move(x + 83, 18)
     x += 150
     self.bpfx = ButtonBase(self, FXBstyle, 2)
     self.bpfx.bpressEvent.connect(self.bypass)
     self.bpfx.move(x + 30, 20)
     self.hpip = ButtonBase(self, HP1style, 0)
     self.hpip.bpressEvent.connect(self.hpinp)
     self.hpip.move(x + 30, 135)
     self.hpop = ButtonBase(self, HP2style, 1)
     self.hpop.bpressEvent.connect(self.hpinp)
     self.hpop.move(x + 61, 135)
     self.auxctl = AUXcontrol(self)
     self.auxctl.move(x + 28, 160)
     self.auxctl.valueEvent.connect(self.auxevent)
     self.makelabel(x + 20, 205, 80, 11, "Monitor")
     self.count = 1
     self.tcpch = None
     self.timer = QtCore.QBasicTimer()
     self.timer.start(50, self)
     self.show()
Beispiel #7
0
 def __init__(self, parent):
     QtGui.QFrame.__init__(self, parent)
     self.timer = QtCore.QBasicTimer()
     self.setFocusPolicy(QtCore.Qt.StrongFocus)
     self.keyboard_image = QtGui.QImage('keyboard.png')
     self.current_layout = None
     self.current_stats = None
     self.generator = genetic_algorithm()
Beispiel #8
0
 def __init__(self):
    self.width = 1280
    self.height = 720
    self.updateRate = 60
    self.timer = QtCore.QBasicTimer()
    super(Game, self).__init__()
    self.initUI()
    self.timer.start(1000/self.updateRate, self)
    def __init__(self):
        super(Splash, self).__init__()
        self.setPixmap(QtGui.QPixmap("img/apple.png"))
        self.show()

        self.timer = QtCore.QBasicTimer()
        self.step = 0
        self.timer.start(30, self)
Beispiel #10
0
 def creatProgressBar(self):
     if (self.LayoutConversao.count() == 2):
         self.progressBar.close()
         self.LayoutConversao.removeWidget(self.progressBar)
     self.progressBar = QtGui.QProgressBar()
     self.LayoutConversao.addWidget(self.progressBar)
     self.timer = QtCore.QBasicTimer()
     self.step = 0
Beispiel #11
0
    def initBoard(self):

        self.timer = QtCore.QBasicTimer()

        self.setFocusPolicy(QtCore.Qt.StrongFocus)
        self.isStarted = False
        self.isPaused = False
        self.setFocus()
Beispiel #12
0
 def updateTimers(self, i):
     if self.licznik[i] < len(self.timeTable[i]) - 1:
         self.licznik[i] = self.licznik[i] + 1
     else:
         self.licznik[i] = 0
     new_timer = QtCore.QBasicTimer()
     #print self.licznik
     new_timer.start(self.timeTable[i][self.licznik[i]], self.q_window)
     self.timers[i] = new_timer
Beispiel #13
0
    def affiche_jeux(self):
        '''Quand on clique sur la checkbox, on créé une nouvelle liste de raccourcis, avec ou sans filtre de jeux.'''
        self.listWidget.clear()

        self.th_liste = Th_liste_raccourcis(self.checkBox.checkState())
        self.th_liste.start()

        self.timer = QtCore.QBasicTimer()
        self.timer.start(200, self)
Beispiel #14
0
 def updateTimers(self, i):
     if self.licznik[i] < len(self.timeTable[i]) - 1:
         self.licznik[i] = self.licznik[i] + 1
     else:
         self.licznik[i] = 0
     new_timer = QtCore.QBasicTimer()
     new_timer.start(self.timeTable[i][self.licznik[i]], self)
     self.timers[i] = new_timer
     self.jazda[i] = self.jedz_table[i][self.licznik[i]]
Beispiel #15
0
    def __init__(self, fileSize, transferSize):
        QtGui.QWidget.__init__(self)
        self.setupUi(self)

        self.connect(self.pushButton, QtCore.SIGNAL('clicked()'), self.onStart)
        self.timer = QtCore.QBasicTimer()
        self.step = 0
        self.fileSize = fileSize
        self.transferSize = transferSize
    def __init__(self):
        super(MyPyQT_Form, self).__init__()
        self.setupUi(self)
        self.dir_path = ''

        self.step = 0
        self.timer = QtCore.QBasicTimer()
        self.tableWidget.setHorizontalHeaderLabels(
            [u'文件名', u'字数', u'重复字数', u'整体重复率(%)'])
Beispiel #17
0
 def __init__(self, parent, maze, moves):
     QtGui.QFrame.__init__(self, parent)
     self.timer = QtCore.QBasicTimer()
     self.setFocusPolicy(QtCore.Qt.StrongFocus)
     self.maze = maze  # abstrakcyjna reprezentacja labiryntu (ga.Maze)
     self.moves = moves  # lista ciągów ruchów
     self.path = [self.maze.start_pos]  # kolejne pozycje agenta
     self.path_ended = False
     self.generation_count = 1
Beispiel #18
0
 def __init__(self, parent, heights):
     QtGui.QFrame.__init__(self, parent)
     self.timer = QtCore.QBasicTimer()
     self.setFocusPolicy(QtCore.Qt.StrongFocus)
     self.plane_img = QtGui.QImage('plane.png')
     self.heights = heights  # wysokości samolotu w kolejnych sekundach
     self.time_count = 0
     self.coord_x = 0  # współrzędna x samolotu
     self.coord_y = 50  # współrzędna y samolotu
Beispiel #19
0
 def __init__(self, parent, board, speed):
     QtGui.QFrame.__init__(self, parent)
     Scene.speed = speed
     self.timer = QtCore.QBasicTimer()
     self.setFocusPolicy(QtCore.Qt.StrongFocus)
     self.iter_count = 0
     self.board = board
     self.board_width = len(self.board[0])
     self.board_height = len(self.board)
Beispiel #20
0
    def __init__(self, path, parent=None, f=QtCore.Qt.WindowFlags()):
        QtGui.QWidget.__init__(self, parent, f)

        self.setupUi(self)
        self.displayedDate = ""
        self.displayedTime = ""

        self.update()
        self.dateTimer = QtCore.QBasicTimer()
        self.dateTimer.start( 1000, self )
Beispiel #21
0
 def initBoard(self):
     self.timer = QtCore.QBasicTimer()
     self.isWaitingAfterLine = False
     self.curX = 0
     self.curY = 0
     self.numLinesRemoved = 0
     self.board = []
     self.setFocusPolicy(QtCore.Qt.StrongFocus)
     self.isStarted = False
     self.isPaused = False
     self.clearBoard()
Beispiel #22
0
    def __init__(self, camera_port=0, parent=None):
        super(RecordVideo, self).__init__(parent)
        self.puerto = camera_port
        self.camera = VideoStream(camera_port).start()
        self.is_opened = self.camera.stream.isOpened()

        self.timer = QtCore.QBasicTimer()
        self.outline = np.zeros((480, 720, 3), np.uint8)
        cv2.putText(self.outline, 'CAMARA FUERA DE LINEA', (100, 250),
                    cv2.FONT_HERSHEY_SIMPLEX, 1, (255, 255, 255),
                    2)  #,cv2.LINE_AA)
    def __init__(self, parent):
        super(Viewer, self).__init__()
        self.parent = parent
        self.scene = QtGui.QGraphicsScene(self)
        self.setScene(self.scene)
        self.myRect = self.scene.addRect(0, 0, 50, 50)
        self.myCircle = self.scene.addEllipse(0, 0, 100, 100)

        # timer code
        self.timer = QtCore.QBasicTimer()
        self.timer.start(2000, self.parent)
Beispiel #24
0
    def __init__(self, parent=None):
        super(DisplayWidget, self).__init__(parent)

        self.empty = True
        self.emptying = False
        self.shapes = []
        self.timer = QtCore.QBasicTimer()

        self.enableUpdates()

        self.setBackgroundRole(QtGui.QPalette.Base)
        self.setMouseTracking(True)
Beispiel #25
0
 def __init__(self, parent):
     QtGui.QFrame.__init__(self, parent)
     self.timer = QtCore.QBasicTimer()
     self.isWaitingAfterLine = False
     self.curX = 0
     self.curY = 0
     self.numLinesRemoved = 0
     self.board = []
     self.setFocusPolicy(QtCore.Qt.StrongFocus)
     self.isStarted = False
     self.isPaused = False
     self.isselected = False
Beispiel #26
0
 def __init__(self, parent = None):
     QtGui.QWidget.__init__(self)
     self.setGeometry(300, 300, 250, 150)
     self.setWindowTitle('ProgressBar')
     self.pbar = QtGui.QProgressBar(self)
     self.pbar.setGeometry(30, 40, 200, 25)
     self.button = QtGui.QPushButton('Start', self)
     self.button.setFocusPolicy(QtCore.Qt.NoFoc us)
     self.button.move(40, 80)
     self.connect(self.button, QtCore.SIGNAL('clicked()'), self.onStart)
     self.timer = QtCore.QBasicTimer()
     self.step = 0
Beispiel #27
0
    def initBoard(self):
        self.timer = QtCore.QBasicTimer()
        self.GameOver = False
        self.pause = False
        self.life = 5
        #Tło
        pixmap = QtGui.QPixmap("2.png")
        self.lbl = QtGui.QLabel(self)
        self.lbl.setPixmap(pixmap)
        self.lbl.move(0, 0)
        self.WindowWidth = pixmap.width()
        self.WindowHeight = pixmap.height()

        #Dane
        QtGui.QFrame.setFont(self, QtGui.QFont('Fantasy', 15))
        self.points = QtGui.QLabel(self)
        self.points.setScaledContents(True)
        self.points.setText("Punkty:    0")
        self.points.move(550, 0)

        self.lifes = QtGui.QLabel(self)
        self.lifes.setText("Życie:    5")
        self.lifes.move(700, 0)

        #Kaczki
        self.max_number_ducks = 5
        self.duck_label_list = [
            QtGui.QLabel(self) for i in range(self.max_number_ducks)
        ]  #Kaczka jako obrazek
        duck_picture = QtGui.QPixmap("kaczor.png")
        self.duck_height = duck_picture.height()
        self.duck_width = duck_picture.width()

        self.duck_list = []  #Kaczka jako współrzędne w programie
        self.duck_alive_speed = 5
        self.duck_dead_speed = 70
        self.gone = 0
        self.dead = 0
        for i in range(self.max_number_ducks):
            self.newduck(self.duck_list)
            self.duck_label_list[i].setPixmap(duck_picture)
            self.duck_label_list[i].move(self.duck_list[i][0],
                                         self.duck_list[i][1])

        #Celownik
        self.sighX = self.WindowWidth / 2
        self.sighY = self.WindowHeight / 2
        self.sigh_move = 30
        sigh_picture = QtGui.QPixmap("celownik.png")
        self.sigh_size = sigh_picture.height()
        self.sigh_lbl = QtGui.QLabel(self)
        self.sigh_lbl.setPixmap(sigh_picture)
        self.sigh_lbl.move(self.sighX, self.sighY)
Beispiel #28
0
    def __init__(self, parent=None):
        super(GameWindow, self).__init__(parent)
        self.timer = QtCore.QBasicTimer()

        self.setFixedSize(280, 480)
        self.printGrid = [[0 for x in range(self.GameHeight)]
                          for y in range(self.GameWidth)]
        self.printGridLeftTime = [[0 for x in range(self.GameHeight)]
                                  for y in range(self.GameWidth)]
        self.timer.start(GameWindow.Speed, self)
        self.countTime = 0
        self.gameScore = 0
        self.gameMiss = 0
    def initUI(self):
        img_path = os.path.dirname(
            os.path.abspath(inspect.getfile(
                inspect.currentframe()))) + "\pics\crosshair.jpg"
        img_path = img_path.replace('\\', '/')
        self.statusBar()
        self.setStyleSheet("border-image: url(%s); " % img_path)

        self.setGeometry(100, 100, 200, 200)
        self.setWindowTitle('Virtual Joystick')
        self.show()
        self.timer = QtCore.QBasicTimer()
        self.statusBar().showMessage('started')
Beispiel #30
0
    def compare(self,type=None):
        self.toolbar.setEnabled(False)
        self.timer = QtCore.QBasicTimer()
        self.step = 0
        self.threadRunning=True
        self.thread = cper.Comparer(self.leftConnection,self.rightConnection,self.callbackCompare,self.callbackCompareCC,type)
        self.thread.start()

        self.middle.show()
        self.bottom.hide()
        self.middle.setGeometry(self.bottom.geometry())
        self.processbarCenter()
        self.onStart()