-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsection_window.py
More file actions
69 lines (55 loc) · 2.48 KB
/
section_window.py
File metadata and controls
69 lines (55 loc) · 2.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QTableWidget, QTableWidgetItem, QPushButton, QStatusBar
from PyQt5.QtCore import Qt
import pyperclip
from commands.security import security_commands
from commands.networking import networking_commands
from commands.android import android_commands
from commands.web import web_commands
from banner import AnimatedBanner
class SectionWindow(QWidget):
def __init__(self, category):
super().__init__()
self.setWindowTitle(f"أوامر {category}")
self.setFixedSize(900, 600)
self.setStyleSheet(open("style.qss").read())
layout = QVBoxLayout()
layout.setAlignment(Qt.AlignTop)
# بنر متحرك خاص بالقسم
self.banner = AnimatedBanner()
self.banner.setText(f"DevDaRK Kabo - {category}")
layout.addWidget(self.banner)
# جدول الأوامر
self.table = QTableWidget()
layout.addWidget(self.table)
# شريط الحالة لرسائل النسخ
self.status_bar = QStatusBar()
layout.addWidget(self.status_bar)
self.setLayout(layout)
self.load_commands(category)
def load_commands(self, category):
data = {
"Security": security_commands,
"Networking": networking_commands,
"Android": android_commands,
"Web": web_commands
}.get(category, [])
self.table.setRowCount(len(data))
self.table.setColumnCount(3)
self.table.setHorizontalHeaderLabels(["الأمر", "الوصف", "نسخ"])
self.table.horizontalHeader().setStretchLastSection(True)
self.table.setEditTriggers(QTableWidget.NoEditTriggers)
# جعل الأعمدة تأخذ حجم مناسب
self.table.horizontalHeader().setDefaultSectionSize(250)
self.table.horizontalHeader().setMinimumSectionSize(200)
for i, item in enumerate(data):
self.table.setItem(i, 0, QTableWidgetItem(item["command"]))
self.table.setItem(i, 1, QTableWidgetItem(item["description"]))
copy_btn = QPushButton("📋 نسخ")
copy_btn.setCursor(Qt.PointingHandCursor)
copy_btn.clicked.connect(self.make_copy_handler(item["command"]))
self.table.setCellWidget(i, 2, copy_btn)
def make_copy_handler(self, cmd):
def handler():
pyperclip.copy(cmd)
self.status_bar.showMessage(f"✅ تم نسخ الأمر: {cmd}", 2000)
return handler