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


Python Model.load方法代码示例

本文整理汇总了Python中Model.Model.load方法的典型用法代码示例。如果您正苦于以下问题:Python Model.load方法的具体用法?Python Model.load怎么用?Python Model.load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Model.Model的用法示例。


在下文中一共展示了Model.load方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: MainWindowController

# 需要导入模块: from Model import Model [as 别名]
# 或者: from Model.Model import load [as 别名]
class MainWindowController(QMainWindow):
    '''
    classdocs
    '''

    def __init__(self, version=None, year=None, parent=None, logger=None):
        '''
        Constructor
        '''
        self.version = version
        self.year = year
        self.logger = logger
        self.model = None
        super(MainWindowController, self).__init__(parent)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        self.connectButtons()
        self.setWindowTitle('ReqExtractor: No Project')
        
    def connectButtons(self):
        '''
        Menu
        '''
        # File
        self.ui.action_NewProject.triggered.connect(self.action_NewProject)
        self.ui.action_OpenProject.triggered.connect(self.action_OpenProject)
        self.ui.action_SaveProject.triggered.connect(self.action_SaveProject)
        self.ui.action_SaveProjectAs.triggered.connect(self.action_SaveProjectAs)
        self.ui.action_AddFile.triggered.connect(self.action_AddFile)
        self.ui.action_DelFile.triggered.connect(self.action_DelFile)
        self.ui.action_ExportRequirementsAsExcelFile.triggered.connect(self.action_ExportRequirementsAsExcelFile)
        self.ui.action_Quit.triggered.connect(self.action_Quit)
        # Tools
        self.ui.action_ExtractRequirements.triggered.connect(self.action_ExtractRequirements)
        self.ui.action_CheckForErrors.triggered.connect(self.action_CheckForErrors)
        self.ui.action_Options.triggered.connect(self.action_Options)
        # Help
        self.ui.action_AboutReqExt.triggered.connect(self.action_AboutReqExt)
        self.ui.action_AboutPlatform.triggered.connect(self.action_AboutPlatform)
        # GroupBox 'Project Files'
        self.ui.toolButton_AddFile.clicked.connect(self.action_AddFile)
        self.ui.toolButton_DelFile.clicked.connect(self.action_DelFile)
        self.ui.toolButton_OpenFile.clicked.connect(self.action_OpenFile)
        self.ui.treeWidget.itemDoubleClicked.connect(self.action_OpenFile)
        # TabWidget
        self.ui.lineEdit_ReqIDFilter.textChanged.connect(self.lineEdit_ReqFilter)
        self.ui.lineEdit_ReqContentFilter.textChanged.connect(self.lineEdit_ReqFilter)
        
    def action_NewProject(self):
        self.logger.debug('action_NewProject')
        if self.saveProjectDialog() == True:
            self.view_resetUi()
            dlg = NewProjectController(parent=self)
            if dlg.projectName != '':
                self.model = Model(logger=self.logger, projectName=dlg.projectName)
                self.model.register(self)
                self.view_setTitle(self.model.dp_getProjectName()+' *')
                self.view_updateUiAfterProjectLoad()
    
    def action_OpenProject(self):
        self.logger.debug('action_OpenProject')
        if self.saveProjectDialog() == True:
            self.view_resetUi()
            projectFile = QFileDialog.getOpenFileName(self,
                                                           caption='Open project',
                                                           dir=os.curdir,
                                                           filter="Requirement Extractor Project File (*.pkl)")[0]
            if projectFile != '':
                self.model = Model(logger=self.logger, projectFilePath=projectFile)
                self.model.load()
                self.model.printModel()
                self.model.register(self)
                self.view_setTitle(self.model.dp_getProjectName())
                self.view_updateUiAfterProjectLoad()

    def action_SaveProject(self):
        self.logger.debug('action_SaveProject')
        self.model.save()
            
    def action_SaveProjectAs(self):
        self.logger.debug('action_SaveProjectAs')
        projectFile = QFileDialog.getSaveFileName(self,
                                                       caption="Save project as",
                                                       dir=os.curdir,
                                                       filter="Requirement Extractor Project File (*.pkl)")[0]
        self.model.setProjectFilePath(projectFile)
        self.model.save()
        
    def action_AddFile(self):
        self.logger.debug('action_AddFile')
        dlg = AddFileController(parent=self)
        if dlg.status is True:
            self.view_addFileInTree([dlg.filePath, dlg.regex])
            
    def action_DelFile(self):
        self.logger.debug('action_DelFile')
        coupleFilepathAndRegex = self.view_delFileInTree()
        if coupleFilepathAndRegex is not None:
            self.logger.debug('Remove %s from Model Datapool'%(coupleFilepathAndRegex))
            self.model.dp_DelFile2FileList(coupleFilepathAndRegex)
#.........这里部分代码省略.........
开发者ID:tbores,项目名称:RequirementsExtractor,代码行数:103,代码来源:MainWindowController.py


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