当前位置: 首页>>代码示例>>Python>>正文


Python QUiLoader.reject方法代码示例

本文整理汇总了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()
开发者ID:gt-ros-pkg,项目名称:hrl,代码行数:56,代码来源:training_gui.py


注:本文中的PySide.QtUiTools.QUiLoader.reject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。