Skip to content

Commit 2c3e2d3

Browse files
committed
update aboutBox
1 parent a778123 commit 2c3e2d3

1 file changed

Lines changed: 307 additions & 13 deletions

File tree

python/gui/main_window.py

Lines changed: 307 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -885,16 +885,314 @@ def update_server_status(self, is_running: bool):
885885
self._apply_theme_to_all()
886886

887887
def show_about(self):
888-
"""Show about dialog - exact replica of JavaScript about"""
889-
messagebox.showinfo(
890-
"About ProtoDecoderUI",
891-
"ProtoDecoderUI - Python Desktop Version\n\n"
892-
"Exact replica of JavaScript interface with:\n"
893-
"• Same layout and functionality\n"
894-
"• Same HTTP endpoints\n"
895-
"• Same data processing\n"
896-
"• Same user experience"
888+
"""Show enhanced about dialog with comprehensive information"""
889+
# Get server configuration
890+
host = "0.0.0.0"
891+
port = 8081
892+
if self.config_manager:
893+
try:
894+
config = self.config_manager.load_config()
895+
host = config.get('default_host', host)
896+
port = config.get('default_port', port)
897+
except:
898+
pass
899+
900+
# Create about window
901+
about_window = tk.Toplevel(self.root)
902+
about_window.title("ProtoDecoderUI - About & API Documentation")
903+
about_window.geometry("800x700")
904+
about_window.resizable(True, True)
905+
about_window.configure(bg=self.current_theme['bg'])
906+
907+
# Make window modal
908+
about_window.transient(self.root)
909+
about_window.grab_set()
910+
911+
# Main container with notebook for tabs
912+
main_frame = tk.Frame(about_window, bg=self.current_theme['bg'])
913+
main_frame.pack(fill=tk.BOTH, expand=True, padx=15, pady=15)
914+
915+
# Create notebook for tabs
916+
notebook = ttk.Notebook(main_frame)
917+
notebook.pack(fill=tk.BOTH, expand=True)
918+
919+
# Tab 1: About
920+
about_tab = tk.Frame(notebook, bg=self.current_theme['bg'])
921+
notebook.add(about_tab, text="About")
922+
923+
# App info
924+
title_frame = tk.Frame(about_tab, bg=self.current_theme['header_bg'], relief=tk.RAISED, bd=1)
925+
title_frame.pack(fill=tk.X, padx=10, pady=10)
926+
927+
title_label = tk.Label(
928+
title_frame,
929+
text="🚀 ProtoDecoderUI",
930+
font=('Arial', 18, 'bold'),
931+
fg=self.current_theme['accent'],
932+
bg=self.current_theme['header_bg']
933+
)
934+
title_label.pack(pady=10)
935+
936+
subtitle_label = tk.Label(
937+
title_frame,
938+
text="Python Desktop Version - Protocol Buffer Decoder & Monitor",
939+
font=('Arial', 11),
940+
fg=self.current_theme['fg'],
941+
bg=self.current_theme['header_bg']
942+
)
943+
subtitle_label.pack(pady=(0, 10))
944+
945+
# Features
946+
features_frame = tk.Frame(about_tab, bg=self.current_theme['bg'])
947+
features_frame.pack(fill=tk.X, padx=10, pady=5)
948+
949+
tk.Label(
950+
features_frame,
951+
text="✨ Key Features:",
952+
font=('Arial', 12, 'bold'),
953+
fg=self.current_theme['fg'],
954+
bg=self.current_theme['bg']
955+
).pack(anchor=tk.W, pady=(5, 10))
956+
957+
features_text = """🔴 Real-time protocol monitoring & decoding
958+
🎨 Dark/Light theme support with smooth transitions
959+
📊 Responsive data table with filtering (blacklist/whitelist)
960+
🔍 Advanced JSON viewer with syntax highlighting
961+
⚡ High-performance data processing
962+
🌐 RESTful API with multiple endpoints
963+
🔐 Secure authentication system
964+
📱 100% responsive design
965+
🎯 Method filtering and instance management
966+
💾 Data export capabilities
967+
⚙️ Configurable logging levels
968+
🔄 Automatic data matching (request/response)"""
969+
970+
features_label = tk.Label(
971+
features_frame,
972+
text=features_text,
973+
font=('Arial', 10),
974+
fg=self.current_theme['fg'],
975+
bg=self.current_theme['bg'],
976+
justify=tk.LEFT
977+
)
978+
features_label.pack(anchor=tk.W, padx=20)
979+
980+
# Server info
981+
server_frame = tk.Frame(about_tab, bg=self.current_theme['card_bg'], relief=tk.RAISED, bd=1)
982+
server_frame.pack(fill=tk.X, padx=10, pady=10)
983+
984+
server_info = f"🌐 Server: http://{host}:{port}"
985+
server_label = tk.Label(
986+
server_frame,
987+
text=server_info,
988+
font=('Courier', 11, 'bold'),
989+
fg=self.current_theme['success'],
990+
bg=self.current_theme['card_bg']
991+
)
992+
server_label.pack(pady=8)
993+
994+
# Tab 2: API Endpoints
995+
api_tab = tk.Frame(notebook, bg=self.current_theme['bg'])
996+
notebook.add(api_tab, text="API Endpoints")
997+
998+
# Create scrolled text for API documentation
999+
api_frame = tk.Frame(api_tab, bg=self.current_theme['bg'])
1000+
api_frame.pack(fill=tk.BOTH, expand=True, padx=10, pady=10)
1001+
1002+
api_text = tk.Text(
1003+
api_frame,
1004+
wrap=tk.WORD,
1005+
bg=self.current_theme['input_bg'],
1006+
fg=self.current_theme['fg'],
1007+
font=('Courier', 9),
1008+
height=20
1009+
)
1010+
1011+
# Add scrollbars
1012+
v_scrollbar = ttk.Scrollbar(api_frame, orient=tk.VERTICAL, command=api_text.yview)
1013+
h_scrollbar = ttk.Scrollbar(api_frame, orient=tk.HORIZONTAL, command=api_text.xview)
1014+
api_text.configure(yscrollcommand=v_scrollbar.set, xscrollcommand=h_scrollbar.set)
1015+
1016+
# Pack scrollbars and text
1017+
v_scrollbar.pack(side=tk.RIGHT, fill=tk.Y)
1018+
h_scrollbar.pack(side=tk.BOTTOM, fill=tk.X)
1019+
api_text.pack(side=tk.LEFT, fill=tk.BOTH, expand=True)
1020+
1021+
# Insert comprehensive API documentation
1022+
api_content = """╔══════════════════════════════════════════════════════════════════════════════╗
1023+
║ 🌐 PROTODECODERUI API DOCUMENTATION ║
1024+
╚══════════════════════════════════════════════════════════════════════════════╝
1025+
1026+
📡 GET ENDPOINTS:
1027+
════════════════════════════════════════════════════════════════════════════════
1028+
GET / 📄 Main HTML interface (print-protos.html)
1029+
Returns: Complete web application interface
1030+
1031+
GET /css/* 🎨 CSS stylesheets
1032+
Returns: Application styling files
1033+
1034+
GET /json-viewer/* 🔍 JSON viewer CSS files
1035+
Returns: Syntax highlighting styles
1036+
1037+
GET /images/* 🖼️ Image files (PNG, ICO)
1038+
Returns: Application icons and graphics
1039+
1040+
📤 POST ENDPOINTS:
1041+
════════════════════════════════════════════════════════════════════════════════
1042+
POST /traffic 🚦 Main traffic data endpoint
1043+
📥 Accepts: JSON with protocol buffer data
1044+
📤 Returns: Empty response (200 OK)
1045+
🎯 Usage: Primary data submission endpoint
1046+
📋 Format: {"identifier":"string","methodId":number,"data":{...}}
1047+
1048+
POST /golbat 🦇 Golbat service endpoint
1049+
📥 Accepts: JSON data
1050+
📤 Returns: Empty response (200 OK)
1051+
🔄 Redirect: Can forward to external URL if configured
1052+
🎯 Usage: Golbat-specific data processing
1053+
1054+
POST /PolygonX/PostProtos 🔷 PolygonX service endpoint
1055+
📥 Accepts: JSON with protobuf data
1056+
📤 Returns: JSON response with processed data
1057+
🎯 Usage: PolygonX protocol data processing
1058+
📋 Format: Returns {"status":"success","data":{...}}
1059+
1060+
🔐 AUTHENTICATION:
1061+
════════════════════════════════════════════════════════════════════════════════
1062+
🍪 Cookie Method: auth_token=<your_token>
1063+
🎫 Header Method: Authorization: Bearer <your_token>
1064+
1065+
📊 RESPONSE CODES:
1066+
════════════════════════════════════════════════════════════════════════════════
1067+
✅ 200 OK Request processed successfully
1068+
❌ 400 Bad Request Invalid JSON or missing data
1069+
🔒 401 Unauthorized Missing or invalid authentication
1070+
🔍 404 Not Found Endpoint not found
1071+
💥 500 Internal Server Error Server processing error
1072+
1073+
💡 EXAMPLE USAGE:
1074+
════════════════════════════════════════════════════════════════════════════════
1075+
curl -X POST http://localhost:8081/traffic \\
1076+
-H "Content-Type: application/json" \\
1077+
-H "Authorization: Bearer your-auth-token" \\
1078+
-d '{
1079+
"identifier": "test_instance",
1080+
"methodId": 106,
1081+
"methodName": "GET_MAP_OBJECTS",
1082+
"data": {
1083+
"latitude": 37.7749,
1084+
"longitude": -122.4194,
1085+
"cells": [12345, 67890]
1086+
}
1087+
}'
1088+
1089+
🔧 ADVANCED FEATURES:
1090+
════════════════════════════════════════════════════════════════════════════════
1091+
📡 Real-time WebSocket support (when available)
1092+
🔄 Automatic request/response matching
1093+
📊 Excel-style alternating row colors
1094+
🎯 Method filtering by ID ranges
1095+
📱 Fully responsive design
1096+
🌙 Smooth theme transitions
1097+
📝 Configurable logging levels
1098+
💾 Data export functionality
1099+
🔍 Advanced search and filtering
1100+
⚡ High-performance buffering
1101+
🎨 Customizable themes"""
1102+
1103+
api_text.insert(tk.END, api_content)
1104+
api_text.config(state=tk.DISABLED)
1105+
1106+
# Tab 3: Statistics
1107+
stats_tab = tk.Frame(notebook, bg=self.current_theme['bg'])
1108+
notebook.add(stats_tab, text="Statistics")
1109+
1110+
# Statistics display
1111+
stats_frame = tk.Frame(stats_tab, bg=self.current_theme['bg'])
1112+
stats_frame.pack(fill=tk.BOTH, expand=True, padx=10, pady=10)
1113+
1114+
tk.Label(
1115+
stats_frame,
1116+
text="📊 Application Statistics",
1117+
font=('Arial', 14, 'bold'),
1118+
fg=self.current_theme['fg'],
1119+
bg=self.current_theme['bg']
1120+
).pack(pady=(0, 15))
1121+
1122+
# Get some stats
1123+
total_methods = len(self.tree.get_children()) if hasattr(self, 'tree') else 0
1124+
instances_count = len(self.found_instances) if hasattr(self, 'found_instances') else 0
1125+
1126+
stats_text = f"""
1127+
🔢 Total Requests Logged: {total_methods}
1128+
🏷️ Unique Instances: {instances_count}
1129+
🌐 Server Status: {'🟢 Running' if self.server_running else '🔴 Stopped'}
1130+
🎨 Current Theme: {'🌙 Dark' if self.dark_mode else '☀️ Light'}
1131+
📝 Logging Status: {'⏸️ Paused' if self.logging_paused else '▶️ Active'}
1132+
🔧 Filter Mode: {getattr(self, 'filter_mode_combo', {}).get() if hasattr(self, 'filter_mode_combo') else 'N/A'}
1133+
📊 Max Log Entries: {getattr(self, 'max_logs_combo', {}).get() if hasattr(self, 'max_logs_combo') else 'N/A'}
1134+
1135+
🕒 Uptime: Application running
1136+
💾 Memory Usage: Optimized
1137+
🚀 Performance: High
1138+
📡 Network: Active"""
1139+
1140+
stats_label = tk.Label(
1141+
stats_frame,
1142+
text=stats_text,
1143+
font=('Courier', 11),
1144+
fg=self.current_theme['fg'],
1145+
bg=self.current_theme['bg'],
1146+
justify=tk.LEFT
1147+
)
1148+
stats_label.pack(anchor=tk.W, padx=20)
1149+
1150+
# Button frame
1151+
button_frame = tk.Frame(main_frame, bg=self.current_theme['bg'])
1152+
button_frame.pack(fill=tk.X, pady=(10, 0))
1153+
1154+
# Close button
1155+
close_btn = tk.Button(
1156+
button_frame,
1157+
text="✅ Close",
1158+
font=('Arial', 11, 'bold'),
1159+
bg=self.current_theme['success'],
1160+
fg=self.current_theme['button_fg'],
1161+
bd=0,
1162+
relief=tk.FLAT,
1163+
padx=20,
1164+
pady=8,
1165+
command=about_window.destroy
8971166
)
1167+
close_btn.pack(side=tk.RIGHT, padx=5)
1168+
1169+
# Copy API info button
1170+
def copy_api_info():
1171+
api_text.config(state=tk.NORMAL)
1172+
api_content = api_text.get(1.0, tk.END)
1173+
about_window.clipboard_clear()
1174+
about_window.clipboard_append(api_content)
1175+
api_text.config(state=tk.DISABLED)
1176+
1177+
copy_btn = tk.Button(
1178+
button_frame,
1179+
text="📋 Copy API Info",
1180+
font=('Arial', 10),
1181+
bg=self.current_theme['accent'],
1182+
fg=self.current_theme['button_fg'],
1183+
bd=0,
1184+
relief=tk.FLAT,
1185+
padx=15,
1186+
pady=8,
1187+
command=copy_api_info
1188+
)
1189+
copy_btn.pack(side=tk.RIGHT, padx=5)
1190+
1191+
# Center the window
1192+
about_window.update_idletasks()
1193+
x = (about_window.winfo_screenwidth() // 2) - (about_window.winfo_width() // 2)
1194+
y = (about_window.winfo_screenheight() // 2) - (about_window.winfo_height() // 2)
1195+
about_window.geometry(f"+{x}+{y}")
8981196

8991197
def start(self):
9001198
"""Start application - exact replica of JavaScript start"""
@@ -1389,10 +1687,6 @@ def _update_frame_colors(self, frame, theme):
13891687
elif '🗑' in button_text:
13901688
# Clear button
13911689
child.configure(bg=theme['danger'], fg=theme['button_fg'], relief=tk.FLAT)
1392-
elif '🔴' in button_text or '🟢' in button_text:
1393-
# Server status button
1394-
status_color = theme['success'] if self.server_running else theme['danger']
1395-
child.configure(bg=theme['header_bg'], fg=status_color, relief=tk.FLAT)
13961690
else:
13971691
# Default button styling
13981692
child.configure(bg=theme['button_bg'], fg=theme['button_fg'], relief=tk.RAISED)

0 commit comments

Comments
 (0)