document.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:remoteControlPPT 作者: htwenning 项目源码 文件源码
def MakeDocumentWritable(self):
        pretend_ss = 0 # Set to 1 to test this without source safe :-)
        if not self.scModuleName and not pretend_ss: # No Source Control support.
            win32ui.SetStatusText("Document is read-only, and no source-control system is configured")
            win32api.MessageBeep()
            return 0

        # We have source control support - check if the user wants to use it.
        msg = "Would you like to check this file out?"
        defButton = win32con.MB_YESNO
        if self.IsModified(): 
            msg = msg + "\r\n\r\nALL CHANGES IN THE EDITOR WILL BE LOST"
            defButton = win32con.MB_YESNO
        if win32ui.MessageBox(msg, None, defButton)!=win32con.IDYES:
            return 0

        if pretend_ss:
            print "We are only pretending to check it out!"
            win32api.SetFileAttributes(self.GetPathName(), win32con.FILE_ATTRIBUTE_NORMAL)
            self.ReloadDocument()
            return 1

        # Now call on the module to do it.
        if self.scModule is None:
            try:
                self.scModule = __import__(self.scModuleName)
                for part in self.scModuleName.split('.')[1:]:
                    self.scModule = getattr(self.scModule, part)
            except:
                traceback.print_exc()
                print "Error loading source control module."
                return 0

        if self.scModule.CheckoutFile(self.GetPathName()):
            self.ReloadDocument()
            return 1
        return 0
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号