本文整理汇总了Python中options.Options.getRatio方法的典型用法代码示例。如果您正苦于以下问题:Python Options.getRatio方法的具体用法?Python Options.getRatio怎么用?Python Options.getRatio使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类options.Options
的用法示例。
在下文中一共展示了Options.getRatio方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MyForm
# 需要导入模块: from options import Options [as 别名]
# 或者: from options.Options import getRatio [as 别名]
#.........这里部分代码省略.........
print 'main widget: ',self.centralWidget()
self.centralWidget().setMouseTracking(True)
# mode of working
self.mode = Mode(self, ("MEASURING", "CAL_X", "CAL_Y"))
# storing programs options
self.options = Options()
# object that manages all other objects :)
self.mediator = Mediator(self.cursor(), self)
# distance the user wants the device to travel
self.wantedX, self.wantedY = 0.0, 0.0
self.setMeasuringMode()
# set default values
self.reset()
def reset(self):
u"""resets ui and mediator, loads ratio from file (if was calibrated at runtime and not saved, then calibration data will
be lost, sets distance to 0"""
# distance travelled by the input device in the measurements units (defalutly milimeters)
self.distX, self.distY = 0.0, 0.0
self.mediator.reset()
self.mediator.storeRatio(self.options.getRatio())
self.updateUi()
def askWanted(self, axis):
text, ok = QtGui.QInputDialog.getText(self, programName, _('Distance to measure in %s axis:')%axis)
name = {'X':'wantedX', 'Y':'wantedY'}
try:
# force converting to float
text="%s.0" % text
distance = float(eval(text))
setattr(self, name[axis], distance)
except:
self.showInfoMessage(_("You entered inproper number. You can use arithmetic operators (+, -, * /)"))
self.updateUi()
def askWantedX(self):self.askWanted('X')
def askWantedY(self):self.askWanted('Y')
def allowCalibrate(self):
text, ok = QtGui.QInputDialog.getText(self, programName, _("""Enter below "SUWMIARKA".
It is protection against accidentally changing of the calibration configuration.
Entering word other than "SUWMIARKA" or pressing Cancel key simply returns to the mail menu and doesn't allow calibration.
If you choose to allow calibrating, and then with any cause you would like to turn off allowing calibration, choose option """)
+_('Measuring mode'))
if ok:
if text == "SUWMIARKA":
for i in (4,5): self.ui.menu.activate(i)
def saveRatio(self):
u"""saves ratio to a file"""
try:
self.options.saveRatio()