Python win32con 模块,OFN_OVERWRITEPROMPT 实例源码

我们从Python开源项目中,提取了以下12个代码示例,用于说明如何使用win32con.OFN_OVERWRITEPROMPT

项目:OSPTF    作者:xSploited    | 项目源码 | 文件源码
def OnFileOpen(self, id, code):
        openFlags = win32con.OFN_OVERWRITEPROMPT | win32con.OFN_FILEMUSTEXIST
        fspec = "Type Libraries (*.tlb, *.olb)|*.tlb;*.olb|OCX Files (*.ocx)|*.ocx|DLL's (*.dll)|*.dll|All Files (*.*)|*.*||"
        dlg = win32ui.CreateFileDialog(1, None, None, openFlags, fspec)
        if dlg.DoModal() == win32con.IDOK:
            try:
                self.tlb = pythoncom.LoadTypeLib(dlg.GetPathName())
            except pythoncom.ole_error:
                self.MessageBox("The file does not contain type information")
                self.tlb = None
            self._SetupTLB()
项目:pupy    作者:ru-faraon    | 项目源码 | 文件源码
def OnFileOpen(self, id, code):
        openFlags = win32con.OFN_OVERWRITEPROMPT | win32con.OFN_FILEMUSTEXIST
        fspec = "Type Libraries (*.tlb, *.olb)|*.tlb;*.olb|OCX Files (*.ocx)|*.ocx|DLL's (*.dll)|*.dll|All Files (*.*)|*.*||"
        dlg = win32ui.CreateFileDialog(1, None, None, openFlags, fspec)
        if dlg.DoModal() == win32con.IDOK:
            try:
                self.tlb = pythoncom.LoadTypeLib(dlg.GetPathName())
            except pythoncom.ole_error:
                self.MessageBox("The file does not contain type information")
                self.tlb = None
            self._SetupTLB()
项目:inter    作者:rsms    | 项目源码 | 文件源码
def PutFile(message=None, fileName=None):
    """
    Save file dialog. Returns path if one is entered. Otherwise it returns None.
    Availability: FontLab, Macintosh, PC
    """
    path = None
    if MAC:
        if haveMacfs:
            fss, ok = macfs.StandardPutFile(message, fileName)
            if ok:
                path = fss.as_pathname()
        else:
            import EasyDialogs
            path = EasyDialogs.AskFileForSave(message, savedFileName=fileName)
    elif PC:
        if inFontLab:
            if not message:
                message = ''
            if not fileName:
                fileName = ''
            path = fl.GetFileName(0, message, fileName, '')
        else:
            openFlags = win32con.OFN_OVERWRITEPROMPT|win32con.OFN_EXPLORER
            mode_save = 0
            myDialog = win32ui.CreateFileDialog(mode_save, None, fileName, openFlags)
            myDialog.SetOFNTitle(message)
            is_OK = myDialog.DoModal()
            if is_OK == 1:
                path = myDialog.GetPathName()
    else:
        _raisePlatformError('GetFile')
    return path
项目:remoteControlPPT    作者:htwenning    | 项目源码 | 文件源码
def OnCmdSave(self, cmd, code):
        flags = win32con.OFN_OVERWRITEPROMPT 
        dlg = win32ui.CreateFileDialog(0, None, None, flags, "Text Files (*.txt)|*.txt||", self)
        dlg.SetOFNTitle("Save Results As")
        if dlg.DoModal() == win32con.IDOK:
            pn = dlg.GetPathName()
            self._obj_.SaveTextFile(pn)
        return 0
项目:remoteControlPPT    作者:htwenning    | 项目源码 | 文件源码
def OnCmdSave(self, cmd, code):
        flags = win32con.OFN_OVERWRITEPROMPT 
        dlg = win32ui.CreateFileDialog(0, None, None, flags, "Text Files (*.txt)|*.txt||", self)
        dlg.SetOFNTitle("Save Results As")
        if dlg.DoModal() == win32con.IDOK:
            pn = dlg.GetPathName()
            self._obj_.SaveFile(pn)
        return 0
项目:remoteControlPPT    作者:htwenning    | 项目源码 | 文件源码
def OnBrowse(self, id, cmd):
        openFlags = win32con.OFN_OVERWRITEPROMPT|win32con.OFN_FILEMUSTEXIST
        dlg = win32ui.CreateFileDialog(1,None,None,openFlags, "Python Scripts (*.py)|*.py||", self)
        dlg.SetOFNTitle("Run Script")
        if dlg.DoModal()!=win32con.IDOK:
            return 0
        self['script'] = dlg.GetPathName()
        self.UpdateData(0)
        return 0
项目:remoteControlPPT    作者:htwenning    | 项目源码 | 文件源码
def OnFileOpen(self, id, code):
        openFlags = win32con.OFN_OVERWRITEPROMPT | win32con.OFN_FILEMUSTEXIST
        fspec = "Type Libraries (*.tlb, *.olb)|*.tlb;*.olb|OCX Files (*.ocx)|*.ocx|DLL's (*.dll)|*.dll|All Files (*.*)|*.*||"
        dlg = win32ui.CreateFileDialog(1, None, None, openFlags, fspec)
        if dlg.DoModal() == win32con.IDOK:
            try:
                self.tlb = pythoncom.LoadTypeLib(dlg.GetPathName())
            except pythoncom.ole_error:
                self.MessageBox("The file does not contain type information")
                self.tlb = None
            self._SetupTLB()
项目:CodeReader    作者:jasonrbr    | 项目源码 | 文件源码
def OnCmdSave(self, cmd, code):
        flags = win32con.OFN_OVERWRITEPROMPT 
        dlg = win32ui.CreateFileDialog(0, None, None, flags, "Text Files (*.txt)|*.txt||", self)
        dlg.SetOFNTitle("Save Results As")
        if dlg.DoModal() == win32con.IDOK:
            pn = dlg.GetPathName()
            self._obj_.SaveTextFile(pn)
        return 0
项目:CodeReader    作者:jasonrbr    | 项目源码 | 文件源码
def OnCmdSave(self, cmd, code):
        flags = win32con.OFN_OVERWRITEPROMPT 
        dlg = win32ui.CreateFileDialog(0, None, None, flags, "Text Files (*.txt)|*.txt||", self)
        dlg.SetOFNTitle("Save Results As")
        if dlg.DoModal() == win32con.IDOK:
            pn = dlg.GetPathName()
            self._obj_.SaveFile(pn)
        return 0
项目:CodeReader    作者:jasonrbr    | 项目源码 | 文件源码
def OnBrowse(self, id, cmd):
        openFlags = win32con.OFN_OVERWRITEPROMPT|win32con.OFN_FILEMUSTEXIST
        dlg = win32ui.CreateFileDialog(1,None,None,openFlags, "Python Scripts (*.py)|*.py||", self)
        dlg.SetOFNTitle("Run Script")
        if dlg.DoModal()!=win32con.IDOK:
            return 0
        self['script'] = dlg.GetPathName()
        self.UpdateData(0)
        return 0
项目:CodeReader    作者:jasonrbr    | 项目源码 | 文件源码
def OnFileOpen(self, id, code):
        openFlags = win32con.OFN_OVERWRITEPROMPT | win32con.OFN_FILEMUSTEXIST
        fspec = "Type Libraries (*.tlb, *.olb)|*.tlb;*.olb|OCX Files (*.ocx)|*.ocx|DLL's (*.dll)|*.dll|All Files (*.*)|*.*||"
        dlg = win32ui.CreateFileDialog(1, None, None, openFlags, fspec)
        if dlg.DoModal() == win32con.IDOK:
            try:
                self.tlb = pythoncom.LoadTypeLib(dlg.GetPathName())
            except pythoncom.ole_error:
                self.MessageBox("The file does not contain type information")
                self.tlb = None
            self._SetupTLB()
项目:crisscross    作者:bhaveshAn    | 项目源码 | 文件源码
def run(self):
        try:
            if self.mode != "dir":
                args = {}

                if self.path:
                    args["InitialDir"] = os.path.dirname(self.path)
                    path = os.path.splitext(os.path.dirname(self.path))
                    args["File"] = path[0]
                    args["DefExt"] = path[1]
                args["Title"] = self.title if self.title else "Pick a file..."
                args["CustomFilter"] = 'Other file types\x00*.*\x00'
                args["FilterIndex"] = 1

                filters = ""
                for f in self.filters:
                    if type(f) == str:
                        filters += (f + "\x00") * 2
                    else:
                        filters += f[0] + "\x00" + ";".join(f[1:]) + "\x00"
                args["Filter"] = filters

                flags = (win32con.OFN_EXTENSIONDIFFERENT |
                         win32con.OFN_OVERWRITEPROMPT)
                if self.multiple:
                    flags |= win32con.OFN_ALLOWmultiple | win32con.OFN_EXPLORER
                if self.show_hidden:
                    flags |= win32con.OFN_FORCESHOWHIDDEN
                args["Flags"] = flags

                if self.mode == "open":
                    self.fname, _, _ = win32gui.GetOpenFileNameW(**args)
                elif self.mode == "save":
                    self.fname, _, _ = win32gui.GetSaveFileNameW(**args)

                if self.fname:
                    if self.multiple:
                        seq = str(self.fname).split("\x00")
                        dir_n, base_n = seq[0], seq[1:]
                        self.selection = [os.path.join(dir_n, i)
                                          for i in base_n]
                    else:
                        self.selection = str(self.fname).split("\x00")
            else:
                # From http://goo.gl/UDqCqo
                pidl, display_name, image_list = shell.SHBrowseForFolder(
                    win32gui.GetDesktopWindow(),
                    None,
                    self.title if self.title else "Pick a folder...",
                    0, None, None
                )
                self.selection = [str(shell.SHGetPathFromIDList(pidl))]

            return self.selection
        except (RuntimeError, pywintypes.error):
            return None