本文整理匯總了Python中PySide.QtGui.QSlider.blockSignals方法的典型用法代碼示例。如果您正苦於以下問題:Python QSlider.blockSignals方法的具體用法?Python QSlider.blockSignals怎麽用?Python QSlider.blockSignals使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PySide.QtGui.QSlider
的用法示例。
在下文中一共展示了QSlider.blockSignals方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: EegCarDashboardWindow
# 需要導入模塊: from PySide.QtGui import QSlider [as 別名]
# 或者: from PySide.QtGui.QSlider import blockSignals [as 別名]
class EegCarDashboardWindow(QWidget):
def setSliderMaxThrottle(self, x):
self.setMaxThrottle(x)
# self.dashboard.set_throttle(x)
# self.dashboard.wheel.forward(x)
def setSteeringValue(self, x):
# x range is 1-9 need to scale (10-90)
x = x*10
self.dashboard.set_steering(x)
# self.dashboard.steering.turn_by_position(x)
pot = 1.5
self.dashboard.steering.turn_by_position(x, pot)
def setSteeringTurnRangeValue(self, x):
ticks = int(100000 * (x/10.0)) # max is 100000
# print "STEERING TURN TICKS %d" % ticks
self.dashboard.set_steering_eeg_turn_ticks(ticks)
def steering_update_current_pos(self):
# x = int(self.steering_current_pos.text()) + delta_x
# while check busy
## read position
## print 'current pos %d' % x
ticks = int(self.steering_move_ticks.text())
seconds = int(ticks/(DEFAULT_STEERING_SPEED*7))
seconds = seconds + 1 # at least one second
ending_time = time.time() + seconds
while time.time() < ending_time:
# print "ENDNIG: %d" % ending_time
# print "CURRENT: %d" % time.time()
self.steering_set_current_pos(self.dashboard.steering.get_current_location())
def steering_set_current_pos(self, x):
self.steering_current_pos.setText(str(x))
def steering_move_left(self):
ticks = int(self.steering_move_ticks.text())
# Stepping Motor MOVE!
self.dashboard.steering.stepping_driver.forward(ticks)
self.setMessage('Steering left')
self.steering_update_current_pos()
def steering_move_right(self):
ticks = int(self.steering_move_ticks.text())
# Stepping Motor MOVE!
self.dashboard.steering.stepping_driver.backward(ticks)
self.setMessage('Steering right')
self.steering_update_current_pos()
def set_steering_move_ticks_value(self):
self.steering_move_ticks.blockSignals(True) # update line edit
ticks = int(self.steering_move_ticks.text())
self.steering_move_ticks.setText(str(ticks))
self.steering_move_ticks.blockSignals(False)
self.steering_move_ticks.setModified(True)
if self.steering_move_ticks.isModified():
self.steering_move_ticks.clearFocus()
self.maxThrottle.setModified(False)
def steering_reset_position(self):
# RESET
self.setMessage('Steering Controller Reset')
self.dashboard.steering.stepping_driver.reset() # reset
self.dashboard.steering.stepping_driver.set_speed(DEFAULT_STEERING_SPEED) # set speed
self.steering_update_current_pos()
def setMessage(self, msg):
self.statusBar.showMessage(msg, 2000)
def remote_control(self, state):
if state == QtCore.Qt.Checked:
self.dashboard.set_rc_mode(True)
self.setMessage('SET RC MODE')
else:
self.dashboard.set_rc_mode(False)
self.setMessage('CLEAR RC MODE')
def keep_mode_control(self, state):
if state == QtCore.Qt.Checked:
self.keep_mode = True
self.setMessage('Keep Mode (EEG)')
else:
self.keep_mode = False
self.setMessage('Keyboard Mode')
def power_handle_mode_control(self, state):
if state == QtCore.Qt.Checked:
self.dashboard.set_power_handle_mode(True)
self.setMessage('Power Handle (Auto Steering Middle)')
else:
self.dashboard.set_power_handle_mode(False)
self.setMessage('Turn Off Power Handle')
def ignore_eeg_input_control(self, state):
if state == QtCore.Qt.Checked:
self.dashboard.set_ignore_eeg_input(True)
#.........這裏部分代碼省略.........