Skip to content

The only downloader you need. 下载器的集大成者。

赛博塑料厂改为仅向高贵的 Windows 用户开放

XiaoYouChRb10636676595
diff --git a/app/common/config.py b/app/common/config.py
index c5952e45..6b2c6595 100644
--- a/app/common/config.py
+++ b/app/common/config.py
@@ -1,5 +1,5 @@
# coding:utf-8
-
+import sys
from re import compile
from PySide6.QtCore import QDir
@@ -38,7 +38,8 @@ class Config(QConfig):
# personalization
# backgroundEffect = OptionsConfigItem("Personalization", "BackgroundEffect", "Mica", OptionsValidator(["Acrylic", "Mica", "MicaBlur", "MicaAlt", "Transparent", "Aero", "None"]))
- backgroundEffect = OptionsConfigItem("Personalization", "BackgroundEffect", "Mica", OptionsValidator(["Acrylic", "Mica", "MicaBlur", "MicaAlt", "Aero"]))
+ if sys.platform == "win32":
+ backgroundEffect = OptionsConfigItem("Personalization", "BackgroundEffect", "Mica", OptionsValidator(["Acrylic", "Mica", "MicaBlur", "MicaAlt", "Aero"]))
dpiScale = OptionsConfigItem(
"Personalization", "DpiScale", "Auto", OptionsValidator([1, 1.25, 1.5, 1.75, 2, "Auto"]), restart=True)
diff --git a/app/view/main_window.py b/app/view/main_window.py
index c066b229..a46132d0 100644
--- a/app/view/main_window.py
+++ b/app/view/main_window.py
@@ -1,5 +1,6 @@
# coding: utf-8
import ctypes
+import sys
from ctypes import byref, c_int
from pathlib import Path
@@ -126,19 +127,20 @@ class MainWindow(MSFluentWindow):
self.applyBackgroundEffectByCfg()
def applyBackgroundEffectByCfg(self): # 不应设置 _isMicaEnabled 的值
- self.windowEffect.removeBackgroundEffect(self.winId())
-
- if cfg.backgroundEffect.value == 'Acrylic':
- self.windowEffect.setAcrylicEffect(self.winId(), "F2F2F230" if darkdetect.isDark() else "00000030")
- elif cfg.backgroundEffect.value == 'Mica':
- self.windowEffect.setMicaEffect(self.winId(), darkdetect.isDark())
- elif cfg.backgroundEffect.value == 'MicaBlur':
- self.windowEffect.setMicaEffect(self.winId(), darkdetect.isDark())
- self.windowEffect.DwmSetWindowAttribute(self.winId(), 38, byref(c_int(3)), 4)
- elif cfg.backgroundEffect.value == 'MicaAlt':
- self.windowEffect.setMicaEffect(self.winId(), darkdetect.isDark(), True)
- elif cfg.backgroundEffect.value == 'Aero':
- self.windowEffect.setAeroEffect(self.winId())
+ if sys.platform == 'win32':
+ self.windowEffect.removeBackgroundEffect(self.winId())
+
+ if cfg.backgroundEffect.value == 'Acrylic':
+ self.windowEffect.setAcrylicEffect(self.winId(), "F2F2F230" if darkdetect.isDark() else "00000030")
+ elif cfg.backgroundEffect.value == 'Mica':
+ self.windowEffect.setMicaEffect(self.winId(), darkdetect.isDark())
+ elif cfg.backgroundEffect.value == 'MicaBlur':
+ self.windowEffect.setMicaEffect(self.winId(), darkdetect.isDark())
+ self.windowEffect.DwmSetWindowAttribute(self.winId(), 38, byref(c_int(3)), 4)
+ elif cfg.backgroundEffect.value == 'MicaAlt':
+ self.windowEffect.setMicaEffect(self.winId(), darkdetect.isDark(), True)
+ elif cfg.backgroundEffect.value == 'Aero':
+ self.windowEffect.setAeroEffect(self.winId())
def initNavigation(self):
diff --git a/app/view/setting_interface.py b/app/view/setting_interface.py
index b958b2c1..106ec9af 100644
--- a/app/view/setting_interface.py
+++ b/app/view/setting_interface.py
@@ -254,14 +254,15 @@ class SettingInterface(ScrollArea):
# self.tr('Change the theme color of you application'),
# self.personalGroup
# )
- self.backgroundEffectCard = ComboBoxSettingCard(
- cfg.backgroundEffect,
- FIF.BRUSH,
- "窗口背景透明材质",
- "设置窗口背景透明效果和透明材质",
- texts=["Acrylic", "Mica", "MicaBlur", "MicaAlt", "Aero"],
- parent=self.personalGroup
- )
+ if sys.platform == "win32":
+ self.backgroundEffectCard = ComboBoxSettingCard(
+ cfg.backgroundEffect,
+ FIF.BRUSH,
+ "窗口背景透明材质",
+ "设置窗口背景透明效果和透明材质",
+ texts=["Acrylic", "Mica", "MicaBlur", "MicaAlt", "Aero"],
+ parent=self.personalGroup
+ )
self.zoomCard = ComboBoxSettingCard(
cfg.dpiScale,
@@ -361,7 +362,8 @@ class SettingInterface(ScrollArea):
self.browserGroup.addSettingCard(self.installExtensionCard)
# self.personalGroup.addSettingCard(self.themeCard)
# self.personalGroup.addSettingCard(self.themeColorCard)
- self.personalGroup.addSettingCard(self.backgroundEffectCard)
+ if sys.platform == "win32":
+ self.personalGroup.addSettingCard(self.backgroundEffectCard)
self.personalGroup.addSettingCard(self.zoomCard)
# self.personalGroup.addSettingCard(self.languageCard)
@@ -506,7 +508,8 @@ class SettingInterface(ScrollArea):
self.installExtensionCard.clicked.connect(self.__onInstallExtensionCardClicked)
# personalization
- self.backgroundEffectCard.comboBox.currentIndexChanged.connect(self.__onBackgroundEffectCardChanged)
+ if sys.platform == "win32":
+ self.backgroundEffectCard.comboBox.currentIndexChanged.connect(self.__onBackgroundEffectCardChanged)
# software
self.autoRunCard.checkedChanged.connect(self.__onAutoRunCardChecked)
diff --git a/main.py b/main.py
index cb326fb5..d2164b9b 100644
--- a/main.py
+++ b/main.py
@@ -79,7 +79,7 @@ from app.common.methods import loadPlugins
from app.view.main_window import MainWindow
# 防止 Mica 背景失效
-app.setAttribute(Qt.AA_DontCreateNativeWidgetSiblings)
+# app.setAttribute(Qt.AA_DontCreateNativeWidgetSiblings)
# config loguru
logger.add('{}/Ghost Downloader 运行日志.log'.format(cfg.appPath), rotation="512 KB")