Update UI.py, UtilPack.py, and ui_Tki.py
This commit is contained in:
52
UI.py
52
UI.py
@@ -129,10 +129,29 @@ class MyApp(QMainWindow):
|
||||
# 소스 폴더 목록에 추가
|
||||
self.list_SrcPath.addItem(folder_path)
|
||||
|
||||
#캘리버 서재 폴더인가?
|
||||
pathCalDB = os.path.join( folder_path, "metadata.db")
|
||||
if True == os.path.exists(pathCalDB):
|
||||
db = calDB.MgrCalibreDB(pathCalDB)
|
||||
db.init()
|
||||
listBooks = db.GetBookListforUI_ArcList()
|
||||
for book in listBooks:
|
||||
# 이름은 폴더/DB 파일이름
|
||||
FolderName = util.GetParentDirName(folder_path, 0)
|
||||
item = QListWidgetItem(f"{FolderName}/{book[0]}")
|
||||
|
||||
bookpath = os.path.join(folder_path, book[1])
|
||||
listfiles = util.FindFileFromExt(bookpath, "cbz")
|
||||
if 0 < len(listfiles):
|
||||
bookpath = os.path.join(bookpath, listfiles[0])
|
||||
|
||||
item.setData(Qt.UserRole, bookpath)
|
||||
self.list_ArcList.addItem(item)
|
||||
|
||||
return
|
||||
|
||||
# 폴더 내의 자식 폴더 목록을 가져온다.
|
||||
listFolders = util.ListSubDirectories(folder_path)
|
||||
|
||||
# 선택한 폴더도 리스트에 추가한다.
|
||||
listFolders.append(folder_path)
|
||||
|
||||
for folder in listFolders:
|
||||
@@ -140,8 +159,7 @@ class MyApp(QMainWindow):
|
||||
listFiles = util.ListContainFiles(folder)
|
||||
|
||||
# 파일 목록을 훑어서 내용을 판단
|
||||
# 1. 압축파일이 들어있나?
|
||||
# 2. 이미지 파일이 들어있나?
|
||||
# 1. 압축파일이 들어있나? 2. 이미지 파일이 들어있나?
|
||||
isImgIn = False
|
||||
for pathFile in listFiles:
|
||||
filename = util.GetParentDirName(pathFile, 0)
|
||||
@@ -157,25 +175,6 @@ class MyApp(QMainWindow):
|
||||
item.setData(Qt.UserRole, pathFile)
|
||||
self.list_ArcList.addItem(item)
|
||||
|
||||
|
||||
# 데이터베이스 파일이 들어 있다면...
|
||||
if fileExt.lower() in [".db"]:
|
||||
# 이름은 폴더/DB 파일이름
|
||||
FolderName = util.GetParentDirName(pathFile, 1)
|
||||
ItemName = os.path.join(FolderName, filename)
|
||||
item = QListWidgetItem(ItemName)
|
||||
# 전체 경로를 따로 저장
|
||||
#item.setData(Qt.UserRole, pathFile)
|
||||
#self.list_ArcList.addItem(item)
|
||||
print(pathFile)
|
||||
db = calDB.MgrCalibreDB(pathFile)
|
||||
db.init()
|
||||
listBooks = db.GetBookListforUI_ArcList()
|
||||
for book in listBooks:
|
||||
item.setData(Qt.UserRole, book[1])
|
||||
self.list_ArcList.addItem(book[0])
|
||||
|
||||
|
||||
# 이미지 파일이 들어있다면...
|
||||
if fileExt.lower() in [".jpg", ".webp", ".jpeg", ".png", ".gif"]:
|
||||
isImgIn = True
|
||||
@@ -187,7 +186,8 @@ class MyApp(QMainWindow):
|
||||
# 폴더 경로를 따로 저장
|
||||
item.setData(Qt.UserRole, folder)
|
||||
self.list_ArcList.addItem(item)
|
||||
|
||||
|
||||
return
|
||||
|
||||
def on_click_SrcDel(self):
|
||||
items = self.list_SrcPath.selectedItems()
|
||||
@@ -215,8 +215,8 @@ class MyApp(QMainWindow):
|
||||
for item in items:
|
||||
pathTarget = item.data(Qt.UserRole)
|
||||
|
||||
print(f"arc : {pathTarget}")
|
||||
if False == os.path.exists(pathTarget):
|
||||
print(pathTarget)
|
||||
if None == pathTarget or False == os.path.exists(pathTarget):
|
||||
return
|
||||
|
||||
# 압축파일일 경우...
|
||||
|
||||
Reference in New Issue
Block a user