add option to use the foreground for ca videos

This commit is contained in:
leminlimez
2025-03-31 14:29:36 -04:00
parent 9810fd6eaf
commit c88d80f3df
6 changed files with 74 additions and 41 deletions

View File

@@ -430,7 +430,7 @@ class DeviceManager:
except Exception as e: except Exception as e:
# ignore clean up errors # ignore clean up errors
print(str(e)) print(str(e))
msg = "Your device will now restart.\nRemember to turn Find My back on!" msg = "Your device will now restart.\n\nRemember to turn Find My back on!"
if not self.auto_reboot: if not self.auto_reboot:
msg = "Please restart your device to see changes." msg = "Please restart your device to see changes."
show_alert(ApplyAlertMessage(txt="All done! " + msg, title="Success!", icon=QMessageBox.Information)) show_alert(ApplyAlertMessage(txt="All done! " + msg, title="Success!", icon=QMessageBox.Information))

View File

@@ -178,7 +178,9 @@ class MainWindow(QtWidgets.QMainWindow):
self.ui.clearSuggestedBtn.clicked.connect(self.on_clearSuggestedBtn_clicked) self.ui.clearSuggestedBtn.clicked.connect(self.on_clearSuggestedBtn_clicked)
self.ui.caVideoChk.toggled.connect(self.on_caVideoChk_toggled) self.ui.caVideoChk.toggled.connect(self.on_caVideoChk_toggled)
self.ui.reverseLoopChk.toggled.connect(self.on_reverseLoopChk_toggled) self.ui.reverseLoopChk.toggled.connect(self.on_reverseLoopChk_toggled)
self.ui.useForegroundChk.toggled.connect(self.on_useForegroundChk_toggled)
self.ui.reverseLoopChk.hide() # hide by default self.ui.reverseLoopChk.hide() # hide by default
self.ui.useForegroundChk.hide()
self.ui.findPBBtn.clicked.connect(self.on_findPBBtn_clicked) self.ui.findPBBtn.clicked.connect(self.on_findPBBtn_clicked)
self.ui.pbHelpBtn.clicked.connect(self.on_pbHelpBtn_clicked) self.ui.pbHelpBtn.clicked.connect(self.on_pbHelpBtn_clicked)
@@ -923,7 +925,7 @@ class MainWindow(QtWidgets.QMainWindow):
spacer = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) spacer = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
# main layout # main layout
layout = QtWidgets.QHBoxLayout(widget) layout = QtWidgets.QHBoxLayout(widget)
layout.setContentsMargins(0, 0, 0, 9) layout.setContentsMargins(0, 0, 0, 3)
layout.addWidget(titleBtn) layout.addWidget(titleBtn)
layout.addItem(spacer) layout.addItem(spacer)
layout.addWidget(delBtn) layout.addWidget(delBtn)
@@ -1017,13 +1019,17 @@ class MainWindow(QtWidgets.QMainWindow):
self.ui.pbVideoThumbLbl.hide() self.ui.pbVideoThumbLbl.hide()
self.ui.clearSuggestedBtn.hide() self.ui.clearSuggestedBtn.hide()
self.ui.reverseLoopChk.show() self.ui.reverseLoopChk.show()
self.ui.useForegroundChk.show()
else: else:
self.ui.chooseThumbBtn.show() self.ui.chooseThumbBtn.show()
self.ui.pbVideoThumbLbl.show() self.ui.pbVideoThumbLbl.show()
self.ui.clearSuggestedBtn.show() self.ui.clearSuggestedBtn.show()
self.ui.reverseLoopChk.hide() self.ui.reverseLoopChk.hide()
self.ui.useForegroundChk.hide()
def on_reverseLoopChk_toggled(self, checked: bool): def on_reverseLoopChk_toggled(self, checked: bool):
tweaks["PosterBoard"].reverse_video = checked tweaks["PosterBoard"].reverse_video = checked
def on_useForegroundChk_toggled(self, checked: bool):
tweaks["PosterBoard"].use_foreground = checked
def on_findPBBtn_clicked(self): def on_findPBBtn_clicked(self):
webbrowser.open_new_tab("https://cowabun.ga/wallpapers") webbrowser.open_new_tab("https://cowabun.ga/wallpapers")

View File

@@ -4148,7 +4148,7 @@ To work properly, also disable the daemon using the toggle above.</string>
<number>0</number> <number>0</number>
</property> </property>
<property name="bottomMargin"> <property name="bottomMargin">
<number>9</number> <number>0</number>
</property> </property>
<item> <item>
<widget class="QToolButton" name="toolButton_10"> <widget class="QToolButton" name="toolButton_10">
@@ -4270,21 +4270,6 @@ To work properly, also disable the daemon using the toggle above.</string>
</layout> </layout>
</widget> </widget>
</item> </item>
<item>
<widget class="Line" name="line_12">
<property name="styleSheet">
<string notr="true">QFrame {
color: #414141;
}</string>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item> <item>
<widget class="QWidget" name="pbPagePicker" native="true"> <widget class="QWidget" name="pbPagePicker" native="true">
<property name="sizePolicy"> <property name="sizePolicy">
@@ -4402,6 +4387,21 @@ To work properly, also disable the daemon using the toggle above.</string>
</layout> </layout>
</widget> </widget>
</item> </item>
<item>
<widget class="Line" name="line_12">
<property name="styleSheet">
<string notr="true">QFrame {
color: #414141;
}</string>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item> <item>
<widget class="QLabel" name="pbActionLbl"> <widget class="QLabel" name="pbActionLbl">
<property name="text"> <property name="text">
@@ -4590,6 +4590,13 @@ Will show up in Collections</string>
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QCheckBox" name="useForegroundChk">
<property name="text">
<string>Make Foreground (hides clock)</string>
</property>
</widget>
</item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_30"> <layout class="QHBoxLayout" name="horizontalLayout_30">
<item> <item>

View File

@@ -2187,7 +2187,7 @@ class Ui_Nugget(object):
self.horizontalLayout_203 = QHBoxLayout(self.horizontalWidget_53) self.horizontalLayout_203 = QHBoxLayout(self.horizontalWidget_53)
self.horizontalLayout_203.setSpacing(10) self.horizontalLayout_203.setSpacing(10)
self.horizontalLayout_203.setObjectName(u"horizontalLayout_203") self.horizontalLayout_203.setObjectName(u"horizontalLayout_203")
self.horizontalLayout_203.setContentsMargins(0, 9, 0, 9) self.horizontalLayout_203.setContentsMargins(0, 9, 0, 0)
self.toolButton_103 = QToolButton(self.horizontalWidget_53) self.toolButton_103 = QToolButton(self.horizontalWidget_53)
self.toolButton_103.setObjectName(u"toolButton_103") self.toolButton_103.setObjectName(u"toolButton_103")
self.toolButton_103.setEnabled(True) self.toolButton_103.setEnabled(True)
@@ -2249,16 +2249,6 @@ class Ui_Nugget(object):
self.verticalLayout_143.addWidget(self.horizontalWidget_53) self.verticalLayout_143.addWidget(self.horizontalWidget_53)
self.line_123 = QFrame(self.posterboardPage)
self.line_123.setObjectName(u"line_123")
self.line_123.setStyleSheet(u"QFrame {\n"
" color: #414141;\n"
"}")
self.line_123.setFrameShadow(QFrame.Plain)
self.line_123.setFrameShape(QFrame.Shape.HLine)
self.verticalLayout_143.addWidget(self.line_123)
self.pbPagePicker = QWidget(self.posterboardPage) self.pbPagePicker = QWidget(self.posterboardPage)
self.pbPagePicker.setObjectName(u"pbPagePicker") self.pbPagePicker.setObjectName(u"pbPagePicker")
sizePolicy5 = QSizePolicy(QSizePolicy.Policy.Preferred, QSizePolicy.Policy.Fixed) sizePolicy5 = QSizePolicy(QSizePolicy.Policy.Preferred, QSizePolicy.Policy.Fixed)
@@ -2314,6 +2304,16 @@ class Ui_Nugget(object):
self.verticalLayout_143.addWidget(self.pbPagePicker) self.verticalLayout_143.addWidget(self.pbPagePicker)
self.line_123 = QFrame(self.posterboardPage)
self.line_123.setObjectName(u"line_123")
self.line_123.setStyleSheet(u"QFrame {\n"
" color: #414141;\n"
"}")
self.line_123.setFrameShadow(QFrame.Plain)
self.line_123.setFrameShape(QFrame.Shape.HLine)
self.verticalLayout_143.addWidget(self.line_123)
self.pbActionLbl = QLabel(self.posterboardPage) self.pbActionLbl = QLabel(self.posterboardPage)
self.pbActionLbl.setObjectName(u"pbActionLbl") self.pbActionLbl.setObjectName(u"pbActionLbl")
@@ -2414,6 +2414,11 @@ class Ui_Nugget(object):
self.verticalLayout_39.addWidget(self.reverseLoopChk) self.verticalLayout_39.addWidget(self.reverseLoopChk)
self.useForegroundChk = QCheckBox(self.pbVideoPage)
self.useForegroundChk.setObjectName(u"useForegroundChk")
self.verticalLayout_39.addWidget(self.useForegroundChk)
self.horizontalLayout_30 = QHBoxLayout() self.horizontalLayout_30 = QHBoxLayout()
self.horizontalLayout_30.setObjectName(u"horizontalLayout_30") self.horizontalLayout_30.setObjectName(u"horizontalLayout_30")
self.chooseThumbBtn = QToolButton(self.pbVideoPage) self.chooseThumbBtn = QToolButton(self.pbVideoPage)
@@ -3841,6 +3846,7 @@ class Ui_Nugget(object):
#endif // QT_CONFIG(tooltip) #endif // QT_CONFIG(tooltip)
self.caVideoChk.setText(QCoreApplication.translate("Nugget", u"Loop (use CoreAnimation method)", None)) self.caVideoChk.setText(QCoreApplication.translate("Nugget", u"Loop (use CoreAnimation method)", None))
self.reverseLoopChk.setText(QCoreApplication.translate("Nugget", u"Reverse on Loop", None)) self.reverseLoopChk.setText(QCoreApplication.translate("Nugget", u"Reverse on Loop", None))
self.useForegroundChk.setText(QCoreApplication.translate("Nugget", u"Make Foreground (hides clock)", None))
#if QT_CONFIG(tooltip) #if QT_CONFIG(tooltip)
self.chooseThumbBtn.setToolTip(QCoreApplication.translate("Nugget", u"Choose a photo for the wallpaper to freeze on when finished (.heic files only)", None)) self.chooseThumbBtn.setToolTip(QCoreApplication.translate("Nugget", u"Choose a photo for the wallpaper to freeze on when finished (.heic files only)", None))
#endif // QT_CONFIG(tooltip) #endif // QT_CONFIG(tooltip)

View File

@@ -2187,7 +2187,7 @@ class Ui_Nugget(object):
self.horizontalLayout_203 = QHBoxLayout(self.horizontalWidget_53) self.horizontalLayout_203 = QHBoxLayout(self.horizontalWidget_53)
self.horizontalLayout_203.setSpacing(10) self.horizontalLayout_203.setSpacing(10)
self.horizontalLayout_203.setObjectName(u"horizontalLayout_203") self.horizontalLayout_203.setObjectName(u"horizontalLayout_203")
self.horizontalLayout_203.setContentsMargins(0, 9, 0, 9) self.horizontalLayout_203.setContentsMargins(0, 9, 0, 0)
self.toolButton_103 = QToolButton(self.horizontalWidget_53) self.toolButton_103 = QToolButton(self.horizontalWidget_53)
self.toolButton_103.setObjectName(u"toolButton_103") self.toolButton_103.setObjectName(u"toolButton_103")
self.toolButton_103.setEnabled(True) self.toolButton_103.setEnabled(True)
@@ -2249,16 +2249,6 @@ class Ui_Nugget(object):
self.verticalLayout_143.addWidget(self.horizontalWidget_53) self.verticalLayout_143.addWidget(self.horizontalWidget_53)
self.line_123 = QFrame(self.posterboardPage)
self.line_123.setObjectName(u"line_123")
self.line_123.setStyleSheet(u"QFrame {\n"
" color: #414141;\n"
"}")
self.line_123.setFrameShadow(QFrame.Plain)
self.line_123.setFrameShape(QFrame.HLine)
self.verticalLayout_143.addWidget(self.line_123)
self.pbPagePicker = QWidget(self.posterboardPage) self.pbPagePicker = QWidget(self.posterboardPage)
self.pbPagePicker.setObjectName(u"pbPagePicker") self.pbPagePicker.setObjectName(u"pbPagePicker")
sizePolicy5 = QSizePolicy(QSizePolicy.Policy.Preferred, QSizePolicy.Policy.Fixed) sizePolicy5 = QSizePolicy(QSizePolicy.Policy.Preferred, QSizePolicy.Policy.Fixed)
@@ -2314,6 +2304,16 @@ class Ui_Nugget(object):
self.verticalLayout_143.addWidget(self.pbPagePicker) self.verticalLayout_143.addWidget(self.pbPagePicker)
self.line_123 = QFrame(self.posterboardPage)
self.line_123.setObjectName(u"line_123")
self.line_123.setStyleSheet(u"QFrame {\n"
" color: #414141;\n"
"}")
self.line_123.setFrameShadow(QFrame.Plain)
self.line_123.setFrameShape(QFrame.HLine)
self.verticalLayout_143.addWidget(self.line_123)
self.pbActionLbl = QLabel(self.posterboardPage) self.pbActionLbl = QLabel(self.posterboardPage)
self.pbActionLbl.setObjectName(u"pbActionLbl") self.pbActionLbl.setObjectName(u"pbActionLbl")
@@ -2414,6 +2414,11 @@ class Ui_Nugget(object):
self.verticalLayout_39.addWidget(self.reverseLoopChk) self.verticalLayout_39.addWidget(self.reverseLoopChk)
self.useForegroundChk = QCheckBox(self.pbVideoPage)
self.useForegroundChk.setObjectName(u"useForegroundChk")
self.verticalLayout_39.addWidget(self.useForegroundChk)
self.horizontalLayout_30 = QHBoxLayout() self.horizontalLayout_30 = QHBoxLayout()
self.horizontalLayout_30.setObjectName(u"horizontalLayout_30") self.horizontalLayout_30.setObjectName(u"horizontalLayout_30")
self.chooseThumbBtn = QToolButton(self.pbVideoPage) self.chooseThumbBtn = QToolButton(self.pbVideoPage)
@@ -3841,6 +3846,7 @@ class Ui_Nugget(object):
#endif // QT_CONFIG(tooltip) #endif // QT_CONFIG(tooltip)
self.caVideoChk.setText(QCoreApplication.translate("Nugget", u"Loop (use CoreAnimation method)", None)) self.caVideoChk.setText(QCoreApplication.translate("Nugget", u"Loop (use CoreAnimation method)", None))
self.reverseLoopChk.setText(QCoreApplication.translate("Nugget", u"Reverse on Loop", None)) self.reverseLoopChk.setText(QCoreApplication.translate("Nugget", u"Reverse on Loop", None))
self.useForegroundChk.setText(QCoreApplication.translate("Nugget", u"Make Foreground (hides clock)", None))
#if QT_CONFIG(tooltip) #if QT_CONFIG(tooltip)
self.chooseThumbBtn.setToolTip(QCoreApplication.translate("Nugget", u"Choose a photo for the wallpaper to freeze on when finished (.heic files only)", None)) self.chooseThumbBtn.setToolTip(QCoreApplication.translate("Nugget", u"Choose a photo for the wallpaper to freeze on when finished (.heic files only)", None))
#endif // QT_CONFIG(tooltip) #endif // QT_CONFIG(tooltip)

View File

@@ -67,6 +67,7 @@ class PosterboardTweak(Tweak):
self.videoFile = None self.videoFile = None
self.loop_video = False self.loop_video = False
self.reverse_video = False self.reverse_video = False
self.use_foreground = False
self.bundle_id = "com.apple.PosterBoard" self.bundle_id = "com.apple.PosterBoard"
self.resetting = False self.resetting = False
self.resetType = 0 # 0 for descriptor, 1 for prb, 2 for suggested photos self.resetType = 0 # 0 for descriptor, 1 for prb, 2 for suggested photos
@@ -211,7 +212,14 @@ class PosterboardTweak(Tweak):
source_dir = get_bundle_files("files/posterboard/VideoCAML") source_dir = get_bundle_files("files/posterboard/VideoCAML")
video_output_dir = os.path.join(output_dir, "descriptor/VideoCAML") video_output_dir = os.path.join(output_dir, "descriptor/VideoCAML")
copytree(source_dir, video_output_dir, dirs_exist_ok=True) copytree(source_dir, video_output_dir, dirs_exist_ok=True)
contents_path = os.path.join(video_output_dir, "versions/1/contents/9183.Custom-810w-1080h@2x~ipad.wallpaper/9183.Custom_Background-810w-1080h@2x~ipad.ca") contents_path = os.path.join(video_output_dir, "versions/1/contents/9183.Custom-810w-1080h@2x~ipad.wallpaper")
if self.use_foreground:
# rename the foreground layer to background
bg_path = os.path.join(contents_path, "9183.Custom_Background-810w-1080h@2x~ipad.ca")
contents_path = os.path.join(contents_path, "9183.Custom_Floating-810w-1080h@2x~ipad.ca")
os.rename(contents_path, bg_path)
else:
contents_path = os.path.join(contents_path, "9183.Custom_Background-810w-1080h@2x~ipad.ca")
print(f"path at {contents_path}, creating caml") print(f"path at {contents_path}, creating caml")
video_handler.create_caml(video_path=self.videoFile, output_file=contents_path, auto_reverses=self.reverse_video, update_label=update_label) video_handler.create_caml(video_path=self.videoFile, output_file=contents_path, auto_reverses=self.reverse_video, update_label=update_label)