本文整理汇总了Python中PySide.QtUiTools.QUiLoader.reject方法的典型用法代码示例。如果您正苦于以下问题:Python QUiLoader.reject方法的具体用法?Python QUiLoader.reject怎么用?Python QUiLoader.reject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtUiTools.QUiLoader
的用法示例。
在下文中一共展示了QUiLoader.reject方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: WouseSetupDialog
# 需要导入模块: from PySide.QtUiTools import QUiLoader [as 别名]
# 或者: from PySide.QtUiTools.QUiLoader import reject [as 别名]
class WouseSetupDialog(object):
"""A dialog box for setting session parameters for training the wouse."""
def __init__(self):
""" Load .ui file from QtDesigner, add callbacks as necessary"""
ui_file = WOUSE_PKG+'/src/wouse/wouse_train_options.ui'
self.dialog = QUiLoader().load(ui_file)
self.dialog.rounds_spin.valueChanged.connect(self.update_time)
self.dialog.recording_spin.valueChanged.connect(self.update_time)
self.dialog.recovery_spin.valueChanged.connect(self.update_time)
self.dialog.file_button.clicked.connect(self.file_button_cb)
self.dialog.file_field_edit.setText(WOUSE_PKG+'/data/')
self.dialog.buttonBox.accepted.connect(self.ok_cb)
self.dialog.buttonBox.rejected.connect(self.cancel_cb)
self.update_time()
def file_button_cb(self):
"""Use file dialog to get .csv file. Check for csv, update Lineedit"""
direc = self.dialog.file_field_edit.text()
filename = QFileDialog.getOpenFileName(self.dialog,
caption="File to stop wouse training data",
dir=direc,
filter="*.csv")
if len(filename[0]) != 0:
if filename[0][-4:] != '.csv':
QMessageBox.warning(self.dialog, "Warning: Invalid File",
"Warning: Selected File does not appear to be a CSV (.csv)\
data file.")
self.dialog.file_field_edit.setText(filename[0])
def calc_time(self):
"""Calculate the time (s) required for full run with current settings"""
tot_time = (self.dialog.recording_spin.value()+
self.dialog.recovery_spin.value())
return len(ACTIONS)*self.dialog.rounds_spin.value()*tot_time
def update_time(self):
"""Parse time to minutes:seconds format, update interface"""
time = self.calc_time()
mins = str(int(time)/60)
secs = str(int(round(time%60.)))
if len(secs)==1:
secs = "".join(['0',secs])
self.dialog.duration.setText('%s:%s' %(mins,secs))
def ok_cb(self):
"""Check for acceptable file. Warn if bad, if good, close, return 1"""
if self.dialog.file_field_edit.text()[-4:] != '.csv':
return QMessageBox.warning(self.dialog, "Warning: Invalid File",
"Please choose a valid CSV (.csv) data file.")
self.dialog.accept()
def cancel_cb(self):
""" Close dialog, return 0/Rejected"""
self.dialog.reject()