- Katılım
- 1 Tem 2021
- Mesajlar
- 1,132
- Beğeniler
- 316
Bu kullanıcıyla herhangi bir iş veya ticaret yapmak istiyorsanız, forumdan uzaklaştırıldığını sakın unutmayın.
GORSEL
Geliştirmeye musait
Geliştirmeye musait
Python:
from PyQt5.QtWidgets import (
QApplication, QWidget, QLabel, QVBoxLayout, QHBoxLayout, QPushButton, QMessageBox, QFileDialog
)
from PyQt5.QtCore import Qt, QPoint
from PyQt5.QtGui import QFont, QIcon
class CleanerApp(QWidget):
def __init__(self):
super().__init__()
# Main window settings
self.setWindowFlags(Qt.FramelessWindowHint | Qt.Window)
self.setAttribute(Qt.WA_TranslucentBackground)
self.setFixedSize(450, 400)
self.old_position = QPoint()
# Main layout
main_layout = QVBoxLayout()
main_layout.setContentsMargins(10, 10, 10, 10)
# Main container (rounded background)
container = QWidget()
container.setStyleSheet("""
QWidget {
background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1, stop:0 #4A4A4A, stop:1 #2E2E2E);
border-radius: 15px;
}
""")
container_layout = QVBoxLayout()
container_layout.setContentsMargins(0, 0, 0, 0)
# Custom title bar
title_bar = QWidget()
title_bar.setStyleSheet("""
background-color: #3A3A3A;
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("✨ Windows Cleaner ✨")
title_label.setStyleSheet("color: white; font-size: 16px; font-weight: bold;")
title_bar_layout.addWidget(title_label)
close_button = QPushButton("X")
close_button.setFixedSize(25, 25)
close_button.setStyleSheet("""
QPushButton {
background-color: #FF4D4D;
color: white;
font-weight: bold;
border: none;
border-radius: 12px;
}
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("Cleaner Dashboard")
app_title.setFont(QFont("Arial", 18, QFont.Bold))
app_title.setStyleSheet("color: white;")
app_title.setAlignment(Qt.AlignCenter)
content_layout.addWidget(app_title)
# Buttons
button_style = """
QPushButton {
background-color: #4CAF50;
color: white;
font-size: 14px;
font-weight: bold;
padding: 12px;
border-radius: 10px;
border: 2px solid #3E8E41;
}
QPushButton:hover {
background-color: #45A049;
}
QPushButton:pressed {
background-color: #3E8E41;
}
"""
clean_button = QPushButton("🧹 Clean Junk Files")
clean_button.setStyleSheet(button_style)
clean_button.clicked.connect(self.clean_junk_files)
optimize_button = QPushButton("🚀 Optimize Performance")
optimize_button.setStyleSheet(button_style)
optimize_button.clicked.connect(self.optimize_performance)
logs_button = QPushButton("📜 View Logs")
logs_button.setStyleSheet(button_style)
logs_button.clicked.connect(self.view_logs)
# Add buttons to layout
content_layout.addWidget(clean_button)
content_layout.addSpacing(10)
content_layout.addWidget(optimize_button)
content_layout.addSpacing(10)
content_layout.addWidget(logs_button)
# Status Bar (Footer)
self.status_label = QLabel("Ready")
self.status_label.setStyleSheet("""
color: #CCCCCC;
font-size: 12px;
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)
self.setLayout(main_layout)
main_layout.addWidget(container)
# Button Actions
def clean_junk_files(self):
"""Simulated cleaning function."""
self.status_label.setText("Cleaning junk files...")
QMessageBox.information(self, "Cleaner", "Junk files cleaned successfully!")
self.status_label.setText("Ready")
def optimize_performance(self):
"""Simulated optimization function."""
self.status_label.setText("Optimizing system performance...")
QMessageBox.information(self, "Optimizer", "System performance optimized!")
self.status_label.setText("Ready")
def view_logs(self):
"""Simulated log viewer."""
QMessageBox.information(self, "Logs", "No logs available yet.")
self.status_label.setText("Ready")
# 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 look
window = CleanerApp()
window.show()
sys.exit(app.exec_())