Skip to content

Commit 7b5693e

Browse files
committed
修复在mac上运行错误,调整项目文件
1 parent eeaabd6 commit 7b5693e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+540
-35681
lines changed

.gitignore

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,5 @@ __pycache__/
1414
!/script/uiConnectResources.py
1515
!/script/appDetails.py
1616

17-
/test/py/
18-
/test/download/*
19-
!/test/download/666666/
20-
!/test/download/999999/
21-
/test/bilibili/*
22-
!/test/bilibili/666666/
23-
!/test/bilibili/999999/
17+
/test/
2418
/config.json
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"files": ["main.py","modules/main.ui","modules/resources.qrc","res"]
2+
"files": ["main.py","modules/main.ui","modules/resources.qrc","res","modules/player/player.ui"]
33
}

BilibiliCacheVideoMergePython.pyproject.user

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!DOCTYPE QtCreatorProject>
3-
<!-- Written by QtCreator 8.0.1, 2023-07-22T09:37:59. -->
3+
<!-- Written by QtCreator 8.0.1, 2023-07-24T07:50:36. -->
44
<qtcreator>
55
<data>
66
<variable>EnvironmentId</variable>

README.md

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -82,18 +82,19 @@ https://github.com/molihuan/BilibiliCacheVideoMergePython/releases
8282

8383
#### 第一步
8484

85-
在你的平台上安装python3.8.0以上(推荐安装和我一样的版本python3.8.6,避免一些为止的错误
85+
在你的平台上安装python3.8.0以上(推荐安装和我一样的版本python3.8.6,避免一些未知的错误
8686

8787
安装依赖库
8888

8989
```sh
9090
#图形库依赖
9191
pip install pyside6 -i https://pypi.tuna.tsinghua.edu.cn/simple
9292

93-
#打包依赖(任选其一,或者都安装,推荐新手使用pyinstaller,nuitka还需要其他的配置比较麻烦)
94-
#如果只选择一个则打包时需要修改script下面的packagescript.py,把另一个打包依赖的代码删掉。
95-
pip install nuitka
93+
#打包依赖(任选其一,或者都安装,推荐新手使用pyinstaller。nuitka还需要其他的配置比较麻烦)
94+
#推荐
9695
pip install pyinstaller
96+
#可选
97+
pip install nuitka
9798
```
9899

99100
#### 第二步
@@ -106,7 +107,7 @@ pip install pyinstaller
106107

107108
没成功就自己看哪里有问题(该导库的导库,该引入依赖的引入依赖,自己解决)
108109

109-
编译打包:运行script下面的packagescript.py,自行打包,打包后的文件在script下面
110+
编译打包:运行script下面的packagescript.py,自行打包,打包后的文件在script下面(作者分别在Win10,Ubuntu22,Mac14.3.1打包成功)
110111

111112
## 开发环境
112113

@@ -121,8 +122,8 @@ python3.8.6
121122
pip install pyside6 -i https://pypi.tuna.tsinghua.edu.cn/simple
122123

123124
#打包依赖
124-
pip install nuitka
125125
pip install pyinstaller
126+
pip install nuitka
126127
```
127128

128129
## 更新日志:
@@ -140,19 +141,19 @@ pip install pyinstaller
140141
## LICENSE
141142

142143
```
143-
Copyright [2023] molihuan
144+
Copyright [2023] molihuan
144145
145-
Licensed under the Apache License, Version 2.0 (the "License");
146-
you may not use this file except in compliance with the License.
147-
You may obtain a copy of the License at
146+
Licensed under the Apache License, Version 2.0 (the "License");
147+
you may not use this file except in compliance with the License.
148+
You may obtain a copy of the License at
148149
149-
http://www.apache.org/licenses/LICENSE-2.0
150+
http://www.apache.org/licenses/LICENSE-2.0
150151
151-
Unless required by applicable law or agreed to in writing, software
152-
distributed under the License is distributed on an "AS IS" BASIS,
153-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
154-
See the License for the specific language governing permissions and
155-
limitations under the License.
152+
Unless required by applicable law or agreed to in writing, software
153+
distributed under the License is distributed on an "AS IS" BASIS,
154+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
155+
See the License for the specific language governing permissions and
156+
limitations under the License.
156157
```
157158

158159

main.py

Lines changed: 44 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,36 +14,45 @@
1414
#
1515
# ///////////////////////////////////////////////////////////////
1616

17-
import sys
18-
import os
19-
import time
20-
2117
# IMPORT / GUI AND MODULES AND WIDGETS
2218
# ///////////////////////////////////////////////////////////////
19+
import os
20+
import sys
21+
22+
from PySide6.QtCore import Qt
23+
from PySide6.QtGui import QIcon
24+
from PySide6.QtWidgets import QMainWindow, QHeaderView, QApplication
25+
26+
from modules.framework import *
27+
from modules.framework.ui_main import Ui_MainWindow
2328

24-
from modules import *
25-
from modules import Settings
26-
from modules.service.manager.ConfigManager import ConfigManager, ConfigKey
29+
from modules.player.PlayerPage import PlayerPage
30+
from modules.framework.manager.ConfigManager import ConfigManager, ConfigKey
31+
from modules.utils.Log import Log
32+
from modules.utils.PathUtils import PathUtils
2733

2834
from modules.utils.SysUtils import SysUtils, SysType
29-
from modules.widgets.WorkPage import WorkPage
30-
from modules.widgets.settings.BaseSettingsPage import BaseSettingsPage
35+
from modules.home.WorkPage import WorkPage
36+
from modules.settings.BaseSettingsPage import BaseSettingsPage
3137
from script.appDetails import APP_NAME, APP_VERSION
3238

3339
os.environ["QT_FONT_DPI"] = "96" # FIX Problem for High DPI and Scale above 100%
3440

3541
# SET AS GLOBAL WIDGETS
3642
# ///////////////////////////////////////////////////////////////
37-
widgets = None
43+
widgets: Ui_MainWindow = None
3844

3945
appVersion = None
4046

4147

4248
class MainWindow(QMainWindow):
4349
def __init__(self):
4450
QMainWindow.__init__(self)
51+
# 是否开启调试,mac打包下必须关闭
52+
Log.setDebug(True)
53+
4554
# 程序所在的路径
46-
self.selfPath = os.getcwd()
55+
self.selfPath = PathUtils.getcwd()
4756
configJsonPath = os.path.join(self.selfPath, 'config.json')
4857
# 配置管理者
4958
self.ConfigManager = ConfigManager(configJsonPath)
@@ -118,6 +127,7 @@ def openCloseRightBox():
118127
# absPath = os.path.dirname(os.path.abspath(sys.executable))
119128
# elif __file__:
120129
# absPath = os.path.dirname(os.path.abspath(__file__))
130+
# themeFile = os.path.abspath(os.path.join(absPath, "themes/py_dracula_light.qss"))
121131

122132
self.useCustomTheme = True
123133

@@ -129,8 +139,16 @@ def openCloseRightBox():
129139

130140
# SET THEME AND HACKS
131141
if self.useCustomTheme:
142+
132143
# LOAD AND APPLY STYLE
133-
UIFunctions.theme(self, self.themeFile, True)
144+
if not UIFunctions.theme(self, self.themeFile, True):
145+
os.remove(configJsonPath)
146+
self.ConfigManager.removeAll()
147+
themesPath = os.path.join(self.selfPath, "themes/py_dracula_dark.qss")
148+
self.ConfigManager.add(ConfigKey.THEMES_PATH, themesPath)
149+
self.ConfigManager.save()
150+
UIFunctions.theme(self, self.themeFile, True)
151+
134152
# SET HACKS
135153
AppFunctions.setThemeHack(self)
136154

@@ -163,7 +181,7 @@ def buttonClick(self):
163181
widgets.stackedWidget.setCurrentWidget(widgets.widgets)
164182
UIFunctions.resetStyle(self, btnName)
165183
btn.setStyleSheet(UIFunctions.selectMenu(btn.styleSheet()))
166-
print(self.workPage.DataShowManage.selectedCacheList)
184+
Log.i(self.workPage.DataShowManage.selectedCacheList)
167185
pass
168186

169187
# 改变主题
@@ -183,6 +201,16 @@ def buttonClick(self):
183201
# 退出
184202
if btnName == "btn_exit":
185203
self.close()
204+
# # 实例化视图
205+
# self.playerPage: PlayerPage = PlayerPage(self.ConfigManager)
206+
# # 添加到StackedWidget中
207+
# widgets.stackedWidget.addWidget(self.playerPage)
208+
# # 设置为当前显示页
209+
# widgets.stackedWidget.setCurrentWidget(self.playerPage)
210+
# # 设置选中按钮样式
211+
# widgets.btn_exit.setStyleSheet(UIFunctions.selectMenu(widgets.btn_exit.styleSheet()))
212+
213+
pass
186214
# 基础设置按钮
187215
if btnName == "btn_base_settings":
188216
# 实例化视图
@@ -197,7 +225,7 @@ def buttonClick(self):
197225
pass
198226

199227
# PRINT BTN NAME
200-
print(f'按钮 "{btnName}" 点击!')
228+
Log.i(f'按钮 "{btnName}" 点击!')
201229

202230
# 加载ui后要进行的处理
203231
def afterLoadUi(self):
@@ -219,9 +247,9 @@ def mousePressEvent(self, event):
219247

220248
# PRINT MOUSE EVENTS
221249
if event.buttons() == Qt.LeftButton:
222-
print('Mouse click: LEFT CLICK')
250+
Log.i('Mouse click: LEFT CLICK')
223251
if event.buttons() == Qt.RightButton:
224-
print('Mouse click: RIGHT CLICK')
252+
Log.i('Mouse click: RIGHT CLICK')
225253

226254
# 关闭之前调用
227255
def closeEvent(self, event):

modules/__init__.py

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +0,0 @@
1-
# ///////////////////////////////////////////////////////////////
2-
#
3-
# BY: WANDERSON M.PIMENTA
4-
# PROJECT MADE WITH: Qt Designer and PySide6
5-
# V: 1.0.0
6-
#
7-
# This project can be used freely for all uses, as long as they maintain the
8-
# respective credits only in the Python scripts, any information in the visual
9-
# interface (GUI) can be modified without any implication.
10-
#
11-
# There are limitations on Qt licenses if you want to use your products
12-
# commercially, I recommend reading them on the official website:
13-
# https://doc.qt.io/qtforpython/licenses.html
14-
#
15-
# ///////////////////////////////////////////////////////////////
16-
from PySide6.QtCore import *
17-
from PySide6.QtGui import *
18-
from PySide6.QtWidgets import *
19-
20-
# GUI FILE
21-
from .ui_main import Ui_MainWindow
22-
23-
# APP SETTINGS
24-
from .app_settings import Settings
25-
26-
# IMPORT FUNCTIONS
27-
from .ui_functions import *
28-
29-
# APP FUNCTIONS
30-
from .app_functions import *

modules/framework/__init__.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# ///////////////////////////////////////////////////////////////
2+
#
3+
# BY: WANDERSON M.PIMENTA
4+
# PROJECT MADE WITH: Qt Designer and PySide6
5+
# V: 1.0.0
6+
#
7+
# This project can be used freely for all uses, as long as they maintain the
8+
# respective credits only in the Python scripts, any information in the visual
9+
# interface (GUI) can be modified without any implication.
10+
#
11+
# There are limitations on Qt licenses if you want to use your products
12+
# commercially, I recommend reading them on the official website:
13+
# https://doc.qt.io/qtforpython/licenses.html
14+
#
15+
# ///////////////////////////////////////////////////////////////
16+
17+
# GUI FILE
18+
19+
# APP SETTINGS
20+
from .app_settings import Settings
21+
22+
# IMPORT FUNCTIONS
23+
from .ui_functions import *
24+
25+
# APP FUNCTIONS
26+
from .app_functions import *
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)