Axius
Efsane Üye
- Katılım
- 2 Ara 2023
- Mesajlar
- 1,090
- Beğeniler
- 228
- İletişim
GORSEL
Python:
import os
import shutil
from PyQt5.QtWidgets import (
QApplication, QWidget, QLabel, QVBoxLayout, QHBoxLayout, QPushButton, QMessageBox
)
from PyQt5.QtCore import Qt, QPoint
from PyQt5.QtGui import QFont
class ValorantLogsCleaner(QWidget):
def __init__(self):
super().__init__()
# Main window settings
self.setWindowFlags(Qt.FramelessWindowHint)
self.setAttribute(Qt.WA_TranslucentBackground)
self.setFixedSize(400, 300) # Daha küçük bir pencere boyutu
self.old_position = QPoint()
# Main layout
main_layout = QVBoxLayout()
main_layout.setContentsMargins(10, 10, 10, 10)
# Container for content
container = QWidget()
container.setStyleSheet("""
QWidget {
background-color: #000000; /* Siyah arka plan */
border-radius: 15px;
border: 2px solid #E91E63; /* Pembe kenar çizgisi */
}
""")
container_layout = QVBoxLayout()
container_layout.setContentsMargins(0, 0, 0, 0)
# Title Bar
title_bar = QWidget()
title_bar.setStyleSheet("""
background-color: #1F1C33;
border-top-left-radius: 15px;
border-top-right-radius: 15px;
""")
title_bar_layout = QHBoxLayout()
title_bar_layout.setContentsMargins(10, 5, 10, 5)
title_label = QLabel("Valorant Logs Cleaner")
title_label.setStyleSheet("color: white; font-size: 14px; font-weight: bold;")
title_bar_layout.addWidget(title_label)
close_button = QPushButton("X")
close_button.setFixedSize(20, 20)
close_button.setStyleSheet("""
QPushButton {
background-color: #FF4D4D;
color: white;
font-weight: bold;
border: none;
border-radius: 10px;
}
QPushButton:hover {
background-color: #FF6666;
}
""")
close_button.clicked.connect(self.close)
title_bar_layout.addWidget(close_button, alignment=Qt.AlignRight)
title_bar.setLayout(title_bar_layout)
container_layout.addWidget(title_bar)
# Content Section
content_layout = QVBoxLayout()
content_layout.setContentsMargins(20, 20, 20, 20)
# Title Label
app_title = QLabel("🧹 Valorant Logs Cleaner!")
app_title.setFont(QFont("Arial", 14, QFont.Bold))
app_title.setStyleSheet("color: white;")
app_title.setAlignment(Qt.AlignCenter)
content_layout.addWidget(app_title)
# Buttons
button_style = """
QPushButton {
background-color: #E91E63; /* Pembe renk */
color: white;
font-size: 12px;
font-weight: bold;
padding: 10px;
border-radius: 8px;
border: 1px solid #C2185B;
}
QPushButton:hover {
background-color: #EC407A;
}
QPushButton:pressed {
background-color: #C2185B;
}
"""
clean_logs_button = QPushButton("🧹 Clean Logs")
clean_logs_button.setStyleSheet(button_style)
clean_logs_button.clicked.connect(self.clean_logs)
view_logs_button = QPushButton("📂 View Logs")
view_logs_button.setStyleSheet(button_style)
view_logs_button.clicked.connect(self.view_logs)
# Add Buttons
content_layout.addWidget(clean_logs_button)
content_layout.addSpacing(10)
content_layout.addWidget(view_logs_button)
# Status Bar
self.status_label = QLabel("Ready")
self.status_label.setStyleSheet("""
color: #CCCCCC;
font-size: 10px;
font-style: italic;
padding: 5px;
""")
self.status_label.setAlignment(Qt.AlignCenter)
content_layout.addWidget(self.status_label)
# Set layout
container.setLayout(content_layout)
container_layout.addWidget(container)
main_layout.addWidget(container)
self.setLayout(main_layout)
# Button Actions
def clean_logs(self):
"""Clean Valorant log files."""
valorant_logs_path = os.path.expanduser("~\\AppData\\Local\\VALORANT\\Saved\\Logs")
if os.path.exists(valorant_logs_path):
try:
for filename in os.listdir(valorant_logs_path):
file_path = os.path.join(valorant_logs_path, filename)
if os.path.isfile(file_path):
os.remove(file_path)
elif os.path.isdir(file_path):
shutil.rmtree(file_path)
QMessageBox.information(self, "Logs Cleaner", "All Valorant logs cleaned successfully!")
self.status_label.setText("Logs cleaned successfully.")
except Exception as e:
QMessageBox.critical(self, "Error", f"Failed to clean logs: {e}")
self.status_label.setText("Error cleaning logs.")
else:
QMessageBox.warning(self, "Logs Cleaner", "Valorant logs folder not found!")
self.status_label.setText("Logs folder not found.")
def view_logs(self):
"""Open Valorant logs folder."""
valorant_logs_path = os.path.expanduser("~\\AppData\\Local\\VALORANT\\Saved\\Logs")
if os.path.exists(valorant_logs_path):
os.startfile(valorant_logs_path)
self.status_label.setText("Opened logs folder.")
else:
QMessageBox.warning(self, "Logs Viewer", "Valorant logs folder not found!")
self.status_label.setText("Logs folder not found.")
# Enable window dragging
def mousePressEvent(self, event):
if event.button() == Qt.LeftButton:
self.old_position = event.globalPos()
def mouseMoveEvent(self, event):
if event.buttons() == Qt.LeftButton:
delta = QPoint(event.globalPos() - self.old_position)
self.move(self.x() + delta.x(), self.y() + delta.y())
self.old_position = event.globalPos()
if __name__ == "__main__":
import sys
app = QApplication(sys.argv)
app.setStyle("Fusion") # Modern style
window = ValorantLogsCleaner()
window.show()
sys.exit(app.exec_())