def run(self): self.running = True while self.running: QThread.usleep(100) if self.scrollingTimer.isActive(): self.scrollMeasureSignal.emit(self.time.elapsed(), self.counter) self.running = False
def wait_until(self, end_time = None): """ Wait until the desired time, or infinitely if no end is specified. """ if end_time is None: # no end time, so just loop while not self._stopped: self._new_time = now() self.processEvents() self._last_time = self._new_time QThread.usleep(100) else: while self._new_time < end_time and not self._stopped: self._new_time = now() self.processEvents() self._last_time = self._new_time QThread.usleep(100)
def wait_until(self, end_time=None): """ Wait until the desired time, or infinitely if no end is specified. """ if end_time is None: # no end time, so just loop while not self._stopped: self._new_time = now() self.processEvents() self._last_time = self._new_time QThread.usleep(100) else: while self._new_time < end_time and not self._stopped: self._new_time = now() self.processEvents() self._last_time = self._new_time QThread.usleep(100)
def vertexAndColors(self, *args, **kwargs): from utils.misc import Ice, Fire, Hot, IceAndFire, Grey self.vertexList, self.colors =[], [] min_, max_ = min(map(min, self.intensityList)), max(map(max, self.intensityList)) for i, mass_of_spectrum in enumerate(self.massList): for j, mass in enumerate(mass_of_spectrum): self.vertexList.append([ - self.corner_ + mass, -self.corner_, - self.near_- 2*self.corner_ - self.rtList[i][0]]) self.vertexList.append([ - self.corner_ + mass, - self.corner_ + self.intensityList[i][j], - self.near_- 2*self.corner_ - self.rtList[i][0]]) color =IceAndFire._get_color(self.intensityList[i][j]/max_) for n in xrange(2): self.colors.append(color) QThread.usleep(10)
x = bool(0) y = bool(1) # define key event (not used currently) f = QtGui.QKeyEvent(QtCore.QEvent.KeyPress, 0, QtCore.Qt.KeypadModifier, QtCore.QString(), x, 1) # icon widget icon = Icon() # allow for keyboard input when widget is activated icon.setFocusPolicy(QtCore.Qt.StrongFocus) # enable widget to accept keyboard input icon.setEnabled(y) # show icon icon.show() # allow user to enter input for 'interval' seconds interval = 10 timeLength = now() + interval start = now() print "now =", start print "input allowed until", timeLength, "\n" while True: new_time = now() app.processEvents() last_time = new_time QThread.usleep(100) #sys.exit(app.exec_())
y = bool(1) # define key event (not used currently) f = QtGui.QKeyEvent(QtCore.QEvent.KeyPress, 0, QtCore.Qt.KeypadModifier, QtCore.QString(), x, 1) # icon widget icon = Icon() # allow for keyboard input when widget is activated icon.setFocusPolicy(QtCore.Qt.StrongFocus) # enable widget to accept keyboard input icon.setEnabled(y) # show icon icon.show() # allow user to enter input for 'interval' seconds interval = 10 timeLength = now() + interval start = now() print "now =", start print "input allowed until", timeLength, "\n" while True: new_time = now() app.processEvents() last_time = new_time QThread.usleep(100) #sys.exit(app.exec_())