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


Python Controller.reset_all方法代码示例

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


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

示例1: MainWindow

# 需要导入模块: from Controller import Controller [as 别名]
# 或者: from Controller.Controller import reset_all [as 别名]
class MainWindow(QtGui.QMainWindow):
    def __init__(self, parent=None,debug=False,filePath=None):
        """
        MainWindow constructor
        """

        QtGui.QMainWindow.__init__(self)

        ## variables
        self.appName = "lpEdit"
        self.controller = Controller(debug=debug)
        self.nga = NoGuiAnalysis(self.controller,mainWindow=self)
        self.setWindowTitle(self.appName)
        screen = QtGui.QDesktopWidget().screenGeometry()
        self.screenWidth = screen.width()
        self.screenHeight = screen.height()
        self.mainWidget = QtGui.QWidget(self)
        self.preferences = None
        self.progressBar = None
        self.sphinxLogs = {}
        self.newProject = None
        self.tabWidget = None
        self.titleLabel = None
        self.unsaved = []

        ## initialize widgets
        self.controller.reset_all()
        self.init_button_dock()
     
        ## initialize all main widgets
        self.transitions = Transitions(self)

        ## initialize menu bar
        create_menubar_toolbar(self)

        ## ensure we have absolute file path
        if filePath != None:
            filePath =  os.path.realpath(filePath)

        if filePath == None:
            self.transitions.move_to_logo()
        elif filePath != None and os.path.exists(filePath) == False:
            print "WARNING: MainWindow -- invalid file path specified as input"
            print 'skipping...'
        else:
            self.transitions.add_new_editor_tab(filePath)
            self.transitions.move_to_editor()
            
        ## finalize layout
        self.show()
        self.showMaximized()

    def load_file(self,filePath,fileLang=None):
        '''
        load a given file path both for the controller and the tabs
        load file is called when a tab widget is already present 
        '''

        ## ensure we have absolute file path 
        if filePath != None:
            filePath = os.path.realpath(filePath)

        ## ensure the path exists
        if filePath == None or os.path.exists(filePath) == False:
            print "WARNING: MainWindow.load_file -- bad file path specified"
            print "...", filePath
            return

        ## ensure the file is not already loaded
        if filePath in self.controller.filePathList:
            errMsg = "Cannot load file: file of same name is already loaded"
            self.display_warning(errMsg)
            return

        ## ensure we do not have more than the max number of documents
        numActive = self.controller.get_number_active_files()
        if int(numActive) == int(self.controller.maxDocuments):
            self.display_info("The maximum number of documents are open\nClose a document an then try again")
            return
        
        ## load files
        self.nga.load_file(filePath,fileLang=fileLang)
        
    def ensure_tab_is_current(self):
        """
        action to take on user changing current file index
        """

        currentIndex = self.tabWidget.currentIndex()
    
        self.controller.currentFileIndex = currentIndex
        fileLang = self.controller.fileLangList[currentIndex]
        fileName = self.controller.fileNameList[currentIndex]
        
        if str(fileName) == 'None':
            return
            

        if re.search("\.rnw|\.nw",fileName,flags=re.IGNORECASE):
            reportType = "PDF"
#.........这里部分代码省略.........
开发者ID:lpedit-devs,项目名称:lpedit,代码行数:103,代码来源:MainWindow.py


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