Skip to content

Commit

Permalink
#143 ネットワーク上でのFileListTabからrootObject取得に対応し、ドライブ情報が閲覧可能となった。そのほかの機能にも…
Browse files Browse the repository at this point in the history
…使われる予定。
  • Loading branch information
yamahubuki committed Jul 19, 2020
1 parent 9c14922 commit 411a8aa
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
17 changes: 16 additions & 1 deletion misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@
import winreg
import win32api
import win32file

import constants
import globalVars
import workerThreadTasks

from logging import getLogger
from simpleDialog import dialog


log=getLogger("falcon.misc")

falconHelper=ctypes.cdll.LoadLibrary("falconHelper.dll")
Expand Down Expand Up @@ -275,3 +277,16 @@ def ResolveLocalIpAddress(name):
#end error
return addr

def GetNetworkResource(target):
#targetに指定した名前のネットワークリソースを取得(例:\\network。存在しない場合や何らかのエラー発生時はNoneを返す。)
try:
resources=workerThreadTasks.GetNetworkResources()
for resource in resources:
if resource.fullpath==target:
return resource
log.info("network resource \""+target+"\" not found.")
return None
except Exception as e:
return None


8 changes: 6 additions & 2 deletions tabs/fileList.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,11 +347,15 @@ def GetTabName(self):

def GetRootObject(self):
"""ドライブ詳細情報表示で用いる"""
rootPath=self.listObject.rootDirectory[0]
elem=None
if len(rootPath)==1:
rootPath=self.listObject.rootDirectory[0]
if rootPath!="\\": #\でないならそれはドライブ
try:
elem=lists.drive.GetDriveObject(int(ord(rootPath)-65))
except:
pass
else: #ネットワークリソース
rootPath=self.listObject.rootDirectory
rootPath=rootPath[0:rootPath[2:].find("\\")+2]
elem=misc.GetNetworkResource(rootPath)
return elem
2 changes: 1 addition & 1 deletion workerThreadTasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def GetNetworkResources(taskState=None,param=None):
lst.pop(0) #先頭はドライブではない者が入るので省く
for l in lst:
ret, shfileinfo=shell.SHGetFileInfo(l.lpRemoteName,0,shellcon.SHGFI_ICON)
if taskState.canceled: return False
if taskState and taskState.canceled: return False
addr=misc.ResolveLocalIpAddress(l.lpRemoteName[2:])
s=browsableObjects.NetworkResource()
s.Initialize(l.lpRemoteName[2:],l.lpRemoteName,addr,shfileinfo[0])
Expand Down

0 comments on commit 411a8aa

Please sign in to comment.