Add mica on windows
This commit is contained in:
2 files changed
+45
-6
No files matched your search
@@ -8,6 +8,7 @@ import gzip
|
||||
import zlib
|
||||
import pyperclip
|
||||
import hashlib
|
||||
from winmica import EnableMica, BackdropType, is_mica_supported
|
||||
|
||||
MAC_SAVE_KEY = (
|
||||
b"\x69\x70\x75\x39\x54\x55\x76\x35\x34\x79\x76\x5d\x69\x73\x46\x4d"
|
||||
@@ -95,6 +96,7 @@ class MainWindow(QMainWindow):
|
||||
super().__init__()
|
||||
self.setWindowTitle("GDUtils")
|
||||
self.setGeometry(100, 100, 400, 300)
|
||||
self.apply_mica(self)
|
||||
|
||||
titleLabel = QLabel("GDUtils")
|
||||
font = QFont()
|
||||
@@ -166,6 +168,12 @@ class MainWindow(QMainWindow):
|
||||
container.setLayout(layout)
|
||||
self.setCentralWidget(container)
|
||||
|
||||
def apply_mica(self, widget):
|
||||
if is_mica_supported():
|
||||
widget.setAttribute(Qt.WidgetAttribute.WA_TranslucentBackground, True)
|
||||
hwnd = int(widget.winId())
|
||||
EnableMica(hwnd, BackdropType.MICA)
|
||||
|
||||
def on_save_decode_click(self):
|
||||
file_path, _ = QFileDialog.getOpenFileName(
|
||||
self,
|
||||
@@ -224,48 +232,78 @@ class MainWindow(QMainWindow):
|
||||
f.write(encrypt_save_data(data))
|
||||
|
||||
def on_level_decode_click(self):
|
||||
data, ok = QInputDialog.getText(window, "Level decoder", "Enter the level data to decode:")
|
||||
dialog = QInputDialog(self)
|
||||
dialog.setWindowTitle("Level decoder")
|
||||
dialog.setLabelText("Enter the level data to decode:")
|
||||
self.apply_mica(dialog)
|
||||
ok = dialog.exec()
|
||||
data = dialog.textValue()
|
||||
if ok and data:
|
||||
pyperclip.copy(decode_level(data, self.levelDataIsOfficial.isChecked()))
|
||||
msg = QMessageBox()
|
||||
msg.setWindowTitle("Level decoder")
|
||||
msg.setText("The decoded level data has been copied to your clipboard")
|
||||
self.apply_mica(msg)
|
||||
msg.exec()
|
||||
|
||||
def on_level_encode_click(self):
|
||||
data, ok = QInputDialog.getText(window, "Level encoder", "Enter the level data to encode:")
|
||||
dialog = QInputDialog(self)
|
||||
dialog.setWindowTitle("Level encoder")
|
||||
dialog.setLabelText("Enter the level data to encode:")
|
||||
self.apply_mica(dialog)
|
||||
ok = dialog.exec()
|
||||
data = dialog.textValue()
|
||||
if ok and data:
|
||||
pyperclip.copy(encode_level(data, self.levelDataIsOfficial.isChecked()))
|
||||
msg = QMessageBox()
|
||||
msg.setWindowTitle("Level encoder")
|
||||
msg.setText("The encoded level data has been copied to your clipboard")
|
||||
self.apply_mica(msg)
|
||||
msg.exec()
|
||||
|
||||
def on_gjp_decode_click(self):
|
||||
data, ok = QInputDialog.getText(window, "GJP decoder", "Enter the GJP to decode:")
|
||||
dialog = QInputDialog(self)
|
||||
dialog.setWindowTitle("GJP decoder")
|
||||
dialog.setLabelText("Enter the GJP to decode:")
|
||||
self.apply_mica(dialog)
|
||||
ok = dialog.exec()
|
||||
data = dialog.textValue()
|
||||
if ok and data:
|
||||
pyperclip.copy(decode_gjp(data))
|
||||
msg = QMessageBox()
|
||||
msg.setWindowTitle("GJP decoder")
|
||||
msg.setText("The decoded GJP has been copied to your clipboard")
|
||||
self.apply_mica(msg)
|
||||
msg.exec()
|
||||
|
||||
def on_gjp_encode_click(self):
|
||||
data, ok = QInputDialog.getText(window, "GJP encoder", "Enter the password to encode:")
|
||||
dialog = QInputDialog(self)
|
||||
dialog.setWindowTitle("GJP encoder")
|
||||
dialog.setLabelText("Enter the password to encode:")
|
||||
self.apply_mica(dialog)
|
||||
ok = dialog.exec()
|
||||
data = dialog.textValue()
|
||||
if ok and data:
|
||||
pyperclip.copy(encode_gjp(data))
|
||||
msg = QMessageBox()
|
||||
msg.setWindowTitle("GJP encoder")
|
||||
msg.setText("The encoded GJP has been copied to your clipboard")
|
||||
self.apply_mica(msg)
|
||||
msg.exec()
|
||||
|
||||
def on_gjp2_encode_click(self):
|
||||
data, ok = QInputDialog.getText(window, "GJP2 encoder", "Enter the password to encode:")
|
||||
dialog = QInputDialog(self)
|
||||
dialog.setWindowTitle("GJP2 encoder")
|
||||
dialog.setLabelText("Enter the password to encode:")
|
||||
self.apply_mica(dialog)
|
||||
ok = dialog.exec()
|
||||
data = dialog.textValue()
|
||||
if ok and data:
|
||||
pyperclip.copy(encode_gjp2(data))
|
||||
msg = QMessageBox()
|
||||
msg.setWindowTitle("GJP2 encoder")
|
||||
msg.setText("The encoded GJP2 has been copied to your clipboard")
|
||||
self.apply_mica(msg)
|
||||
msg.exec()
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
|
||||
Reference in new issue
Block a user