mirror of
https://github.com/leminlimez/Nugget.git
synced 2025-04-08 04:23:05 +08:00
add option to use the foreground for ca videos
This commit is contained in:
@@ -430,7 +430,7 @@ class DeviceManager:
|
||||
except Exception as e:
|
||||
# ignore clean up errors
|
||||
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:
|
||||
msg = "Please restart your device to see changes."
|
||||
show_alert(ApplyAlertMessage(txt="All done! " + msg, title="Success!", icon=QMessageBox.Information))
|
||||
|
||||
@@ -178,7 +178,9 @@ class MainWindow(QtWidgets.QMainWindow):
|
||||
self.ui.clearSuggestedBtn.clicked.connect(self.on_clearSuggestedBtn_clicked)
|
||||
self.ui.caVideoChk.toggled.connect(self.on_caVideoChk_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.useForegroundChk.hide()
|
||||
|
||||
self.ui.findPBBtn.clicked.connect(self.on_findPBBtn_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)
|
||||
# main layout
|
||||
layout = QtWidgets.QHBoxLayout(widget)
|
||||
layout.setContentsMargins(0, 0, 0, 9)
|
||||
layout.setContentsMargins(0, 0, 0, 3)
|
||||
layout.addWidget(titleBtn)
|
||||
layout.addItem(spacer)
|
||||
layout.addWidget(delBtn)
|
||||
@@ -1017,13 +1019,17 @@ class MainWindow(QtWidgets.QMainWindow):
|
||||
self.ui.pbVideoThumbLbl.hide()
|
||||
self.ui.clearSuggestedBtn.hide()
|
||||
self.ui.reverseLoopChk.show()
|
||||
self.ui.useForegroundChk.show()
|
||||
else:
|
||||
self.ui.chooseThumbBtn.show()
|
||||
self.ui.pbVideoThumbLbl.show()
|
||||
self.ui.clearSuggestedBtn.show()
|
||||
self.ui.reverseLoopChk.hide()
|
||||
self.ui.useForegroundChk.hide()
|
||||
def on_reverseLoopChk_toggled(self, checked: bool):
|
||||
tweaks["PosterBoard"].reverse_video = checked
|
||||
def on_useForegroundChk_toggled(self, checked: bool):
|
||||
tweaks["PosterBoard"].use_foreground = checked
|
||||
|
||||
def on_findPBBtn_clicked(self):
|
||||
webbrowser.open_new_tab("https://cowabun.ga/wallpapers")
|
||||
|
||||
@@ -4148,7 +4148,7 @@ To work properly, also disable the daemon using the toggle above.</string>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>9</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButton_10">
|
||||
@@ -4270,21 +4270,6 @@ To work properly, also disable the daemon using the toggle above.</string>
|
||||
</layout>
|
||||
</widget>
|
||||
</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>
|
||||
<widget class="QWidget" name="pbPagePicker" native="true">
|
||||
<property name="sizePolicy">
|
||||
@@ -4402,6 +4387,21 @@ To work properly, also disable the daemon using the toggle above.</string>
|
||||
</layout>
|
||||
</widget>
|
||||
</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>
|
||||
<widget class="QLabel" name="pbActionLbl">
|
||||
<property name="text">
|
||||
@@ -4590,6 +4590,13 @@ Will show up in Collections</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="useForegroundChk">
|
||||
<property name="text">
|
||||
<string>Make Foreground (hides clock)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_30">
|
||||
<item>
|
||||
|
||||
@@ -2187,7 +2187,7 @@ class Ui_Nugget(object):
|
||||
self.horizontalLayout_203 = QHBoxLayout(self.horizontalWidget_53)
|
||||
self.horizontalLayout_203.setSpacing(10)
|
||||
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.setObjectName(u"toolButton_103")
|
||||
self.toolButton_103.setEnabled(True)
|
||||
@@ -2249,16 +2249,6 @@ class Ui_Nugget(object):
|
||||
|
||||
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.setObjectName(u"pbPagePicker")
|
||||
sizePolicy5 = QSizePolicy(QSizePolicy.Policy.Preferred, QSizePolicy.Policy.Fixed)
|
||||
@@ -2314,6 +2304,16 @@ class Ui_Nugget(object):
|
||||
|
||||
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.setObjectName(u"pbActionLbl")
|
||||
|
||||
@@ -2414,6 +2414,11 @@ class Ui_Nugget(object):
|
||||
|
||||
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.setObjectName(u"horizontalLayout_30")
|
||||
self.chooseThumbBtn = QToolButton(self.pbVideoPage)
|
||||
@@ -3841,6 +3846,7 @@ class Ui_Nugget(object):
|
||||
#endif // QT_CONFIG(tooltip)
|
||||
self.caVideoChk.setText(QCoreApplication.translate("Nugget", u"Loop (use CoreAnimation method)", 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)
|
||||
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)
|
||||
|
||||
@@ -2187,7 +2187,7 @@ class Ui_Nugget(object):
|
||||
self.horizontalLayout_203 = QHBoxLayout(self.horizontalWidget_53)
|
||||
self.horizontalLayout_203.setSpacing(10)
|
||||
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.setObjectName(u"toolButton_103")
|
||||
self.toolButton_103.setEnabled(True)
|
||||
@@ -2249,16 +2249,6 @@ class Ui_Nugget(object):
|
||||
|
||||
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.setObjectName(u"pbPagePicker")
|
||||
sizePolicy5 = QSizePolicy(QSizePolicy.Policy.Preferred, QSizePolicy.Policy.Fixed)
|
||||
@@ -2314,6 +2304,16 @@ class Ui_Nugget(object):
|
||||
|
||||
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.setObjectName(u"pbActionLbl")
|
||||
|
||||
@@ -2414,6 +2414,11 @@ class Ui_Nugget(object):
|
||||
|
||||
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.setObjectName(u"horizontalLayout_30")
|
||||
self.chooseThumbBtn = QToolButton(self.pbVideoPage)
|
||||
@@ -3841,6 +3846,7 @@ class Ui_Nugget(object):
|
||||
#endif // QT_CONFIG(tooltip)
|
||||
self.caVideoChk.setText(QCoreApplication.translate("Nugget", u"Loop (use CoreAnimation method)", 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)
|
||||
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)
|
||||
|
||||
@@ -67,6 +67,7 @@ class PosterboardTweak(Tweak):
|
||||
self.videoFile = None
|
||||
self.loop_video = False
|
||||
self.reverse_video = False
|
||||
self.use_foreground = False
|
||||
self.bundle_id = "com.apple.PosterBoard"
|
||||
self.resetting = False
|
||||
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")
|
||||
video_output_dir = os.path.join(output_dir, "descriptor/VideoCAML")
|
||||
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")
|
||||
video_handler.create_caml(video_path=self.videoFile, output_file=contents_path, auto_reverses=self.reverse_video, update_label=update_label)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user