本文整理汇总了Python中configuration.Configuration.getValueStr方法的典型用法代码示例。如果您正苦于以下问题:Python Configuration.getValueStr方法的具体用法?Python Configuration.getValueStr怎么用?Python Configuration.getValueStr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类configuration.Configuration
的用法示例。
在下文中一共展示了Configuration.getValueStr方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from configuration import Configuration [as 别名]
# 或者: from configuration.Configuration import getValueStr [as 别名]
def __init__(self, parent=None):
super(MainWindow, self).__init__(parent)
self.ui = uic.loadUi("mainwindow.ui",self)
self.setWindowTitle("python-whiteboard")
self.setWindowFlags( qt.Qt.CustomizeWindowHint | qt.Qt.WindowMinimizeButtonHint |
qt.Qt.WindowCloseButtonHint )
self.connected = False
self.calibrated = False
self.active = False
self.mustquit = False
self.wii = None
self.cursor = None
self.batteryLevel.reset()
self.batteryLevel.setRange(0,99)
self.batteryLevel.setValue(0)
conf = Configuration()
self.ui.pushButtonConnect.clicked.connect(self.connectWii)
self.ui.pushButtonCalibrate.clicked.connect(self.calibrateWiiScreen)
self.ui.pushButtonActivate.clicked.connect(self.activateWii)
self.ui.pushButtonLoadCal.clicked.connect(self.calibrateWiiFromSettings)
self.ui.pushButtonSettings.clicked.connect(self.showHideSettings)
self.ui.comboProfiles.currentIndexChanged.connect(self.changeProfile)
self.updateButtons()
self.ui.actionQuit.triggered.connect(self.mustQuit)
self.ui.actionHelp.triggered.connect(self.showAboutDlg)
self.ui.actionNew_Profile.triggered.connect(self.addProfile)
self.ui.actionDelete_Current_Profile.triggered.connect(self.delCurrentProfile)
self.ui.actionWipe_configuration.triggered.connect(self.wipeConfiguration)
self.ui.moveOnlyCheck.setChecked( conf.getValueStr('moveonly') == 'Yes' )
self.ui.moveOnlyCheck.stateChanged.connect(self.checkMoveOnly)
if conf.getValueStr("autoconnect") == "Yes":
self.timer = qt.QTimer(self)
self.timer.setInterval(500)
self.timer.timeout.connect(self.autoConnect)
self.timer.start()
self.timer2 = qt.QTimer(self)
self.timer2.setInterval(4000)
self.timer2.timeout.connect(self.checkWii)
self.timer2.start()
self.confDialog = ConfigDialog(self, self.wii)
layout = QtWidgets.QGridLayout()
layout.addWidget(self.confDialog)
self.ui.confContainer.setLayout(layout)
self.ui.confContainer.setVisible(False)
self.refreshProfiles()
self.center()
示例2: loadCalibration
# 需要导入模块: from configuration import Configuration [as 别名]
# 或者: from configuration.Configuration import getValueStr [as 别名]
def loadCalibration(self,wii):
try:
conf = Configuration()
pwii = []
pscr = []
for i in range(0,4):
p = []
p.append(float(conf.getValueStr("screenPoint"+str(i)+"x")))
p.append(float(conf.getValueStr("screenPoint"+str(i)+"y")))
q = []
q.append(float(conf.getValueStr("wiiPoint"+str(i)+"x")))
q.append(float(conf.getValueStr("wiiPoint"+str(i)+"y")))
pwii.append(list(q))
pscr.append(list(p))
wii.calibrate(pscr,pwii)
return True
except:
return False
示例3: refreshProfiles
# 需要导入模块: from configuration import Configuration [as 别名]
# 或者: from configuration.Configuration import getValueStr [as 别名]
def refreshProfiles(self):
conf = Configuration()
self.ui.comboProfiles.clear()
self.ui.comboProfiles.addItem(self.tr("default"))
for p in conf.getProfileList():
self.ui.comboProfiles.addItem(p)
self.confDialog.refreshWidgets()
self.ui.moveOnlyCheck.setChecked( conf.getValueStr('moveonly') == 'Yes' )
示例4: changeProfile
# 需要导入模块: from configuration import Configuration [as 别名]
# 或者: from configuration.Configuration import getValueStr [as 别名]
def changeProfile(self,i):
conf = Configuration()
if i == 0:
conf.setGroup("default")
else:
g = unicode(self.ui.comboProfiles.currentText())
conf.setGroup(hashlib.md5(g.encode('utf-8')).hexdigest())
self.confDialog.refreshWidgets()
self.ui.moveOnlyCheck.setChecked( conf.getValueStr('moveonly') == 'Yes' )
示例5: doCalibration
# 需要导入模块: from configuration import Configuration [as 别名]
# 或者: from configuration.Configuration import getValueStr [as 别名]
def doCalibration(parent,wii):
conf = Configuration()
wii.disable()
wii.putCallbackBTN(None)
if conf.getValueStr("fullscreen") == "Yes":
dialog = CalibrateDialog(parent,wii)
dialog.showFullScreen()
dialog.grabKeyboard()
dialog.exec_()
dialog.releaseKeyboard()
else:
dialog = CalibrateDialog2(parent,wii)
dialog.exec_()
if len(dialog.wiiPoints) == 4:
wii.calibrate(dialog.CalibrationPoints,dialog.wiiPoints)
else:
raise CalibrationAbort()
示例6: activateWii
# 需要导入模块: from configuration import Configuration [as 别名]
# 或者: from configuration.Configuration import getValueStr [as 别名]
def activateWii(self):
if self.active:
# Deactivate
self.deactivateWii()
else:
# Activate
self.cursor = FakeCursor(self.wii)
if self.ui.moveOnlyCheck.isChecked():
self.cursor.noClicks = True
# Installs button callback (for calling calibration)
self.wii.disable()
self.wii.putCallbackBTN(self.makeBTNCallback())
conf = Configuration()
zones = [ conf.getValueStr(z) for z in ("zone1","zone2","zone3","zone4") ]
self.cursor.setZones(zones)
self.cursor.runThread()
self.active = True
self.pushButtonActivate.setText(self.tr("Deactivate"))
self.updateButtons()
示例7: __init__
# 需要导入模块: from configuration import Configuration [as 别名]
# 或者: from configuration.Configuration import getValueStr [as 别名]
def __init__(self):
self.data = []
conf = Configuration()
self.limit = int(conf.getValueStr("smoothing"))
示例8: connectWii
# 需要导入模块: from configuration import Configuration [as 别名]
# 或者: from configuration.Configuration import getValueStr [as 别名]
def connectWii(self):
if self.connected:
self.disconnectDevice()
return
self.wii = Wiimote()
pBar = PBarDlg(self)
pBar.setModal( True )
pBar.show()
conf = Configuration()
selectedMac = conf.getValueStr("selectedmac")
while 1:
thread = self.wii.createConnectThread(selectedMac)
thread.start()
while not thread.wait(30):
QtGui.QApplication.processEvents()
if pBar.cancelled == True:
if self.wii.isConnected():
self.wii.close()
self.wii = None
pBar.close()
return
if self.wii.isConnected():
self.connected = True
self.calibrated = False
self.active = False
self.updateButtons()
self.batteryLevel.setValue(self.wii.battery()*100)
self.pushButtonConnect.setText(self.tr("Disconnect"))
pBar.close()
self.confDialog.wii = self.wii
self.confDialog.checkButtons()
self.wii.disable()
self.wii.putCallbackBTN(self.makeBTNCallback())
self.wii.putCallbackIR(None)
self.wii.enable()
# Start calibration if configuration says so
conf = Configuration()
if conf.getValueStr("autocalibration") == "Yes":
if conf.getValueStr("automatrix") == "Yes":
self.calibrateWiiFromSettings()
else:
self.calibrateWiiScreen()
return
if self.wii.error:
self.wii = None
msgbox = QtGui.QMessageBox( self )
msgbox.setWindowTitle( self.tr('Error') )
msgbox.setText( self.tr("Error. Check your bluetooth driver") )
msgbox.setModal( True )
ret = msgbox.exec_()
pBar.close()
return
if not self.wii.isConnected() and len(self.wii.wiimotesDetected) > 1:
item, ok = QtGui.QInputDialog.getItem(self,
self.tr("Warning"), self.tr("Choose device"), self.wii.wiimotesDetected, 0, False)
if ok:
selectedMac = unicode(item)
示例9: connectWii
# 需要导入模块: from configuration import Configuration [as 别名]
# 或者: from configuration.Configuration import getValueStr [as 别名]
def connectWii(self):
if self.connected:
self.disconnectDevice()
return
self.wii = Wiimote()
pBar = PBarDlg(self)
pBar.setModal( True )
pBar.show()
conf = Configuration()
selectedMac = conf.getValueStr("selectedmac")
pBar.reInit(selectedMac)
pool = []
while 1:
thread = self.wii.createConnectThread(selectedMac,pool)
thread.start()
while not thread.wait(30):
QtWidgets.QApplication.processEvents()
if pBar.cancelled == True:
if self.wii.isConnected():
self.wii.close()
self.wii = None
pBar.close()
return
if selectedMac == '*' and len(pool) >= 1:
if Configuration().getValueStr('nowaitdevices') == 'Yes':
selectedMac = pool[0]
else:
pBar.inform(self.tr('Found ') + str(len(pool)) + self.tr(' Devices. Press to Choose'))
if self.wii.isConnected():
self.connected = True
self.calibrated = False
self.active = False
self.updateButtons()
self.batteryLevel.setValue(self.wii.battery()*100)
self.pushButtonConnect.setText(self.tr("Disconnect"))
pBar.close()
self.confDialog.wii = self.wii
self.confDialog.checkButtons()
self.wii.disable()
self.wii.putCallbackBTN(self.makeBTNCallback())
self.wii.putCallbackIR(None)
self.wii.enable()
# Start calibration if configuration says so
conf = Configuration()
if conf.getValueStr("autocalibration") == "Yes":
if conf.getValueStr("automatrix") == "Yes":
self.calibrateWiiFromSettings()
else:
self.calibrateWiiScreen()
return
if self.wii.error:
self.wii = None
msgbox = QtWidgets.QMessageBox( self )
msgbox.setWindowTitle( self.tr('Error') )
msgbox.setText( self.tr("Error. Check your bluetooth driver") )
msgbox.setModal( True )
ret = msgbox.exec_()
pBar.close()
return
if pBar.choice:
if len(pool) == 1:
selectedMac = str(pool[0])
pBar.reInit(selectedMac)
else:
item, ok = QtWidgets.QInputDialog.getItem(self,
self.tr("Warning"), self.tr("Choose device"), pool, 0, False)
if ok:
selectedMac = str(item)
pBar.reInit(selectedMac)
else:
pBar.close()
return