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


Python win32con.FILE_ATTRIBUTE_NORMAL属性代码示例

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


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

示例1: _openHandle

# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import FILE_ATTRIBUTE_NORMAL [as 别名]
def _openHandle(path, bWriteAccess, bWriteShare,
                logfunc = lambda s: None):
    TIMEOUT, NUM_RETRIES = 10, 20
    for retry_count in range(6):
        try:
            access_flag = win32con.GENERIC_READ | \
                          (bWriteAccess and win32con.GENERIC_WRITE or 0)
            share_flag = win32con.FILE_SHARE_READ | \
                         (bWriteShare and win32con.FILE_SHARE_WRITE or 0)
            handle = win32file.CreateFile(
                path, access_flag, share_flag, None,
                win32con.OPEN_EXISTING, win32con.FILE_ATTRIBUTE_NORMAL, None)
            nth = { 0: 'first', 1:'second', 2:'third'}
            logfunc("Opening [%s]: success at the %s iteration" %
                    (path, nth.get(retry_count, '%sth' % (retry_count+1))))
            return handle
        except pywintypes.error as e:
            logfunc('Exception=>'+str(e))
            if NUM_RETRIES/3 < retry_count:
                bWriteShare = True
        time.sleep(TIMEOUT / float(NUM_RETRIES))
    else:
        raise RuntimeError("Couldn't open handle for %s." % path) 
开发者ID:mbusb,项目名称:multibootusb,代码行数:25,代码来源:win32.py

示例2: testComplex

# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import FILE_ATTRIBUTE_NORMAL [as 别名]
def testComplex(self):
        if sys.hexversion < 0x2030000:
            # no kw-args to dict in 2.2 - not worth converting!
            return
        clsid = pythoncom.MakeIID("{CD637886-DB8B-4b04-98B5-25731E1495BE}")
        ctime, atime, wtime = self._getTestTimes()
        d = dict(cFileName="foo.txt",
                 clsid=clsid,
                 sizel=(1,2),
                 pointl=(3,4),
                 dwFileAttributes = win32con.FILE_ATTRIBUTE_NORMAL,
                 ftCreationTime=ctime,
                 ftLastAccessTime=atime,
                 ftLastWriteTime=wtime,
                 nFileSize=sys_maxsize + 1)
        self._testRT(d) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:18,代码来源:testShell.py

示例3: run

# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import FILE_ATTRIBUTE_NORMAL [as 别名]
def run(self):
        #open file/device
        try:
            handle = win32file.CreateFile(
                self.devicePath,
                win32con.GENERIC_READ | win32con.GENERIC_WRITE,
                win32con.FILE_SHARE_READ | win32con.FILE_SHARE_WRITE,
                None,  # no security
                win32con.OPEN_EXISTING,
                win32con.FILE_ATTRIBUTE_NORMAL | win32con.FILE_FLAG_OVERLAPPED,
                0
            )
        except pywintypes.error as (errno, function, strerror):
            self.lockObject.release()
            eg.PrintError(self.text.errorOpen + self.deviceName + " (" + strerror + ")")
            return 
开发者ID:EventGhost,项目名称:EventGhost,代码行数:18,代码来源:HID.py

示例4: findVolumeGuids

# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import FILE_ATTRIBUTE_NORMAL [as 别名]
def findVolumeGuids():
    DiskExtent = collections.namedtuple(
        'DiskExtent', ['DiskNumber', 'StartingOffset', 'ExtentLength'])
    Volume = collections.namedtuple(
        'Volume', ['Guid', 'MediaType', 'DosDevice', 'Extents'])
    found = []
    h, guid = FindFirstVolume()
    while h and guid:
        #print (guid)
        #print (guid, win32file.GetDriveType(guid),
        #       win32file.QueryDosDevice(guid[4:-1]))
        hVolume = win32file.CreateFile(
            guid[:-1], win32con.GENERIC_READ,
            win32con.FILE_SHARE_READ | win32con.FILE_SHARE_WRITE,
            None, win32con.OPEN_EXISTING, win32con.FILE_ATTRIBUTE_NORMAL,  None)
        extents = []
        driveType = win32file.GetDriveType(guid)
        if driveType in [win32con.DRIVE_REMOVABLE, win32con.DRIVE_FIXED]:
            x = win32file.DeviceIoControl(
                hVolume, winioctlcon.IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS,
                None, 512, None)
            instream = io.BytesIO(x)
            numRecords = struct.unpack('<q', instream.read(8))[0]
            fmt = '<qqq'
            sz = struct.calcsize(fmt)
            while 1:
                b = instream.read(sz)
                if len(b) < sz:
                    break
                rec = struct.unpack(fmt, b)
                extents.append( DiskExtent(*rec) )
        vinfo = Volume(guid, driveType, win32file.QueryDosDevice(guid[4:-1]),
                       extents)
        found.append(vinfo)
        guid = FindNextVolume(h)
    return found 
开发者ID:mbusb,项目名称:multibootusb,代码行数:38,代码来源:win32.py

示例5: MakeDocumentWritable

# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import FILE_ATTRIBUTE_NORMAL [as 别名]
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 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:39,代码来源:document.py

示例6: testUnicode

# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import FILE_ATTRIBUTE_NORMAL [as 别名]
def testUnicode(self):
        # exercise a bug fixed in build 210 - multiple unicode objects failed.
        if sys.hexversion < 0x2030000:
            # no kw-args to dict in 2.2 - not worth converting!
            return

        ctime, atime, wtime = self._getTestTimes()
        d = [dict(cFileName="foo.txt",
                 sizel=(1,2),
                 pointl=(3,4),
                 dwFileAttributes = win32con.FILE_ATTRIBUTE_NORMAL,
                 ftCreationTime=ctime,
                 ftLastAccessTime=atime,
                 ftLastWriteTime=wtime,
                 nFileSize=sys_maxsize + 1),
            dict(cFileName="foo2.txt",
                 sizel=(1,2),
                 pointl=(3,4),
                 dwFileAttributes = win32con.FILE_ATTRIBUTE_NORMAL,
                 ftCreationTime=ctime,
                 ftLastAccessTime=atime,
                 ftLastWriteTime=wtime,
                 nFileSize=sys_maxsize + 1),
            dict(cFileName=u"foo\xa9.txt",
                 sizel=(1,2),
                 pointl=(3,4),
                 dwFileAttributes = win32con.FILE_ATTRIBUTE_NORMAL,
                 ftCreationTime=ctime,
                 ftLastAccessTime=atime,
                 ftLastWriteTime=wtime,
                 nFileSize=sys_maxsize + 1),
            ]
        s = shell.FILEGROUPDESCRIPTORAsString(d, 1)
        d2 = shell.StringAsFILEGROUPDESCRIPTOR(s)
        # clobber 'dwFlags' - they are not expected to be identical
        for t in d2:
            del t['dwFlags']
        self.assertEqual(d, d2) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:40,代码来源:testShell.py

示例7: tearDown

# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import FILE_ATTRIBUTE_NORMAL [as 别名]
def tearDown(self):
        file = os.path.expanduser('~/.ctSESAM_test.pws')
        if os.path.isfile(file):
            try:
                import win32con
                import win32api
                win32api.SetFileAttributes(file, win32con.FILE_ATTRIBUTE_NORMAL)
            except ImportError:
                pass
            os.remove(file) 
开发者ID:pinae,项目名称:ctSESAM-python-memorizing,代码行数:12,代码来源:test_PasswordSettingsManager.py

示例8: show_file

# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import FILE_ATTRIBUTE_NORMAL [as 别名]
def show_file(file_name):
    """Unset a file as hidden."""
    try:
        win32api.SetFileAttributes(file_name, win32con.FILE_ATTRIBUTE_NORMAL)
    except win32api.error:
        return False
    return True 
开发者ID:Peter92,项目名称:MouseTracks,代码行数:9,代码来源:main.py

示例9:

# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import FILE_ATTRIBUTE_NORMAL [as 别名]
def 構建工程(工程路徑, 標題, 圖標=None):
    if 圖標:
        subprocess.Popen(f'{此處}\\構建用\\ResourceHacker.exe -open {此處}\\構建用\\沒有窗口的虛僞的exe.exe -save {標題}.exe -action addoverwrite -res {圖標} -mask ICONGROUP,1,0')
    else:
        os.system(f'copy {此處}\\構建用\\沒有窗口的虛僞的exe.exe {標題}.exe')

    if os.path.isfile(f'_{標題}.kuzu'):
        win32api.SetFileAttributes(f'_{標題}.kuzu', win32con.FILE_ATTRIBUTE_NORMAL)
    with open(f'_{標題}.kuzu', 'w') as f:
        f.write(f'Librian.py --project "{工程路徑}"')
    win32api.SetFileAttributes(f'_{標題}.kuzu', win32con.FILE_ATTRIBUTE_HIDDEN) 
开发者ID:RimoChan,项目名称:Librian,代码行数:13,代码来源:構建.py


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