Skip to content

Commit

Permalink
调整UI
Browse files Browse the repository at this point in the history
  • Loading branch information
molihuan committed Jul 18, 2023
1 parent 0b3972f commit 849612c
Show file tree
Hide file tree
Showing 8 changed files with 274 additions and 154 deletions.
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#忽略根目录下面的.idea文件夹
/.idea/
/.ropeproject/
#忽略所有的__pycache__文件夹
__pycache__/
/complete/
/packagescript/*
!/packagescript/Run.py
/test/py/
/test/download/*
!/test/download/666666/
!/test/download/999999/
/config.json
2 changes: 1 addition & 1 deletion BilibiliCacheVideoMergePython.pyproject.user
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 8.0.1, 2023-07-17T23:03:54. -->
<!-- Written by QtCreator 8.0.1, 2023-07-18T23:19:00. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
Expand Down
248 changes: 130 additions & 118 deletions main.ui
Original file line number Diff line number Diff line change
Expand Up @@ -14,124 +14,136 @@
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget">
<widget class="QPushButton" name="goBackBtn">
<property name="geometry">
<rect>
<x>10</x>
<y>50</y>
<width>93</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>上一级</string>
</property>
</widget>
<widget class="QTableWidget" name="dataTableWidget">
<property name="geometry">
<rect>
<x>10</x>
<y>90</y>
<width>781</width>
<height>421</height>
</rect>
</property>
</widget>
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>10</x>
<y>0</y>
<width>781</width>
<height>41</height>
</rect>
</property>
<layout class="QHBoxLayout" name="CatchVedioDirLayout">
<item>
<widget class="QLabel" name="vedioDirLabel">
<property name="text">
<string>视频缓存目录:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="vedioDirShowLineEdit">
<property name="dragEnabled">
<bool>true</bool>
</property>
<property name="clearButtonEnabled">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="selectVedioDirBtn">
<property name="text">
<string>选择目录</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>500</x>
<y>40</y>
<width>295</width>
<height>31</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QPushButton" name="completeFileBtn">
<property name="text">
<string>完成文件</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="selectAllBtn">
<property name="text">
<string>全选</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="refreshBtn">
<property name="text">
<string>刷新</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>300</x>
<y>520</y>
<width>195</width>
<height>31</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QPushButton" name="getMP3Btn">
<property name="text">
<string>提取音频</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="mergeBtn">
<property name="text">
<string>合并</string>
</property>
</widget>
</item>
</layout>
</widget>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="CatchVedioDirLayout">
<item>
<widget class="QLabel" name="vedioDirLabel">
<property name="text">
<string>视频缓存目录:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="vedioDirShowLineEdit">
<property name="dragEnabled">
<bool>true</bool>
</property>
<property name="clearButtonEnabled">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="selectVedioDirBtn">
<property name="text">
<string>选择目录</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="goBackBtn">
<property name="text">
<string>上一级</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QPushButton" name="completeFileBtn">
<property name="text">
<string>完成文件</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="selectAllBtn">
<property name="text">
<string>全选</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="refreshBtn">
<property name="text">
<string>刷新</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="QTableWidget" name="dataTableWidget"/>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="getMP3Btn">
<property name="text">
<string>提取音频</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="mergeBtn">
<property name="text">
<string>合并</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
Expand Down
3 changes: 2 additions & 1 deletion res/md/statement.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
@B站:A7RA3L小李y】 【@B站:啤酒配尖椒】 【@B站:林笙不是林笙】 【@娜】:设计软件图标,提供部分图片资源支持。 等等。
《软件协议》描述我们与您之间关于本软件许可使用及相关方面的权利义务。请您务必审慎阅读、充分理解各条款内容,并选择接受或不接受(未成年人应在法定监护人陪同下审阅)。除非您接受本《软件协议》条款,否则您无权下载、安装或使用本软件及其相关服务。您的安装、使用行为将视为对本《协议》的接受,并同意接受本《协议》各项条款的约束。
二、《软件协议》 【用户禁止行为】除非我们书面许可,您不得从事下列行为: (1)用于商业用途。 【法律责任与免责】 (1)本软件仅用于学习和技术交流,不可用于商业用途,造成的损失原作者不承担任何责任。
(2)可以进行二次修改,软件已经开源,你可以在Gitee下载源码:... 二次修改后的软件造成您的损失原作者不承担任何责任。 (3)如此软件侵犯到您的权益请联系我,我会进行处理,给您带来不便我深感抱歉。 【其他条款】
(2)可以进行二次修改,软件已经开源,你可以在GitHub下载源码:https://github.com/molihuan/BilibiliCacheVideoMergePython 二次修改后的软件造成您的损失原作者不承担任何责任。
(3)如此软件侵犯到您的权益请联系我,我会进行处理,给您带来不便我深感抱歉。 【其他条款】
(1)电子文本形式的授权协议如同双方书面签署的协议一样,具有完全的和等同的法律效力。您使用本软件或本服务即视为您已阅读并同意受本协议的约束。协议许可范围以外的行为,将直接违反本授权协议并构成侵权,我们有权随时终止授权,责令停止损害,并保留追究相关责任的权力。
(2)我们有权在必要时修改本协议条款。您可以在本软件的最新版本中查阅相关协议条款。本协议条款变更后,如果您继续使用本软件,即视为您已接受修改后的协议。如果您不接受修改后的协议,应当停止使用本软件。 (3)我们保留对本协议的最终解释权。
14 changes: 14 additions & 0 deletions service/dataarea/DataShowManage.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import os
import threading
from enum import Enum
from typing import List

from PySide6.QtCore import Qt
from PySide6.QtGui import QPixmap
from PySide6.QtWidgets import QTableWidget, QTableWidgetItem, QMainWindow

from entity.CacheInfo import CacheInfo
from service.base.BaseService import BaseService
from service.base.QDataMainWindow import QDataMainWindow
from ui.MImageLabel import ImageLoader, MImageLabel
from utils.CommonUtils import CommonUtils
from utils.JsonUtils import JsonUtils
from utils.PathUtils import PathUtils, CacheCompleteState
Expand Down Expand Up @@ -145,9 +148,20 @@ def showCollectionDataPage(self, cachePath):

dataItem = QTableWidgetItem(info.getPath())
dataListWidget.setItem(realIndex, 1, dataItem)
# 加载封面
loader = ImageLoader(dataListWidget, json_info.get_cover(), realIndex, 2)
loader.signal.connect(self.handleImageLoaded)
thread = threading.Thread(target=loader.load)
thread.start()

realIndex += 1

def handleImageLoaded(self, table, row, column, pixmap: QPixmap):
label = MImageLabel(pixmap, "")
table.setRowHeight(row, 160)
table.setColumnWidth(column, 220)
table.setCellWidget(row, column, label)

def showChapterDataPage(self, collectionPath):

self.dataPageType = DataPageType.CHAPTER_PAGE
Expand Down
33 changes: 32 additions & 1 deletion test/download/999999/2/entry.json
Original file line number Diff line number Diff line change
@@ -1 +1,32 @@
{"media_type":2,"has_dash_audio":true,"is_completed":true,"total_bytes":16081550,"downloaded_bytes":16081550,"title":"治愈系甜妹!热爱105度的你呀~","type_tag":"80","cover":"http:\/\/i1.hdslb.com\/bfs\/archive\/2ca00781d3914905c5c06bd7a44c9502f12cfbc9.jpg","prefered_video_quality":80,"guessed_total_bytes":0,"total_time_milli":73983,"danmaku_count":146,"time_update_stamp":1628141514698,"time_create_stamp":1628141504246,"avid":503790054,"spid":0,"seasion_id":0,"page_data":{"cid":359197516,"page":2,"from":"vupload","part":"【4k竖屏】","vid":"","has_alias":false,"weblink":"","tid":154,"width":2160,"height":3840,"rotate":0}}
{
" media_type": 2,
"has_dash_audio": true,
"is_completed": true,
"total_bytes": 16081550,
"downloaded_bytes": 16081550,
"title": "治愈系甜妹!热爱105度的你呀~",
"type_tag": "80",
"cover": "http:\/\/i1.hdslb.com\/bfs\/archive\/2ca00781d3914905c5c06bd7a44c9502f12cfbc9.jpg",
"prefered_video_quality": 80,
"guessed_total_bytes": 0,
"total_time_milli": 73983,
"danmaku_count": 146,
"time_update_stamp": 1628141514698,
"time_create_stamp": 1628141504246,
"avid": 503790054,
"spid": 0,
"seasion_id": 0,
"page_data": {
"cid": 359197516,
"page": 2,
"from": "vupload",
"part": "【4k竖屏】",
"vid": "",
"has_alias": false,
"weblink": "",
"tid": 154,
"width": 2160,
"height": 3840,
"rotate": 0
}
}
26 changes: 25 additions & 1 deletion ui/MImageLabel.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
from urllib.request import urlopen

from PySide6.QtCore import QObject, Signal
from PySide6.QtGui import QPixmap
from PySide6.QtWidgets import QWidget, QLabel, QVBoxLayout
from PySide6.QtWidgets import QWidget, QLabel, QVBoxLayout, QTableWidget


class ImageLoader(QObject):
signal = Signal(QTableWidget, int, int, QPixmap)

def __init__(self, table, image_url, row, column, parent=None):
super().__init__(parent)
self.table = table
self.image_url = image_url
self.row = row
self.column = column

def load(self):
try:
image_data = urlopen(self.image_url).read()

pixmap = QPixmap()
pixmap.loadFromData(image_data)
self.signal.emit(self.table, self.row, self.column, pixmap)
except Exception as e:
print(f"Error loading image: {e}")


class MImageLabel(QWidget):
Expand Down
Loading

0 comments on commit 849612c

Please sign in to comment.