new copy and execute buttons on debug help
This commit is contained in:
parent
80afd2ee1f
commit
324843c92f
1 changed files with 82 additions and 21 deletions
103
gui/__main__.py
103
gui/__main__.py
|
@ -4923,11 +4923,6 @@ class Settings(Page):
|
||||||
|
|
||||||
scroll_layout.addWidget(ping_group)
|
scroll_layout.addWidget(ping_group)
|
||||||
|
|
||||||
app_path = "./hydra-veil-x86_64.AppImage"
|
|
||||||
if hasattr(sys, 'frozen'):
|
|
||||||
app_dir = os.path.dirname(app_path)
|
|
||||||
else:
|
|
||||||
app_dir = os.path.dirname(os.path.dirname(app_path))
|
|
||||||
|
|
||||||
command_group = QGroupBox("CLI Commands")
|
command_group = QGroupBox("CLI Commands")
|
||||||
command_group.setStyleSheet(f"""
|
command_group.setStyleSheet(f"""
|
||||||
|
@ -4991,7 +4986,7 @@ class Settings(Page):
|
||||||
|
|
||||||
find_command = QLineEdit()
|
find_command = QLineEdit()
|
||||||
find_command.setReadOnly(True)
|
find_command.setReadOnly(True)
|
||||||
find_command.setText("find ~ -name 'hydra-veil-x86_64.AppImage' 2>/dev/null")
|
find_command.setText(f"find ~ -name '{os.environ.get('APPIMAGE') or 'hydra-veil-x86_64.AppImage'}' 2>/dev/null")
|
||||||
find_command.setStyleSheet(f"""
|
find_command.setStyleSheet(f"""
|
||||||
QLineEdit {{
|
QLineEdit {{
|
||||||
color: white;
|
color: white;
|
||||||
|
@ -5006,9 +5001,11 @@ class Settings(Page):
|
||||||
""")
|
""")
|
||||||
command_layout.addWidget(find_command)
|
command_layout.addWidget(find_command)
|
||||||
|
|
||||||
copy_button = QPushButton("Copy Command")
|
cli_buttons_layout = QHBoxLayout()
|
||||||
copy_button.setFixedSize(120, 40)
|
|
||||||
copy_button.setStyleSheet(f"""
|
cli_copy_button = QPushButton("Copy CLI Command")
|
||||||
|
cli_copy_button.setFixedSize(140, 40)
|
||||||
|
cli_copy_button.setStyleSheet(f"""
|
||||||
QPushButton {{
|
QPushButton {{
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
background: #007AFF;
|
background: #007AFF;
|
||||||
|
@ -5025,13 +5022,13 @@ class Settings(Page):
|
||||||
background: #666666;
|
background: #666666;
|
||||||
}}
|
}}
|
||||||
""")
|
""")
|
||||||
copy_button.clicked.connect(self.copy_cli_command)
|
cli_copy_button.clicked.connect(self.copy_cli_command)
|
||||||
copy_button.setEnabled(False)
|
cli_copy_button.setEnabled(False)
|
||||||
command_layout.addWidget(copy_button)
|
cli_buttons_layout.addWidget(cli_copy_button)
|
||||||
|
|
||||||
execute_button = QPushButton("Execute Command")
|
cli_execute_button = QPushButton("Execute CLI Command")
|
||||||
execute_button.setFixedSize(120, 40)
|
cli_execute_button.setFixedSize(140, 40)
|
||||||
execute_button.setStyleSheet(f"""
|
cli_execute_button.setStyleSheet(f"""
|
||||||
QPushButton {{
|
QPushButton {{
|
||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
background: #4CAF50;
|
background: #4CAF50;
|
||||||
|
@ -5048,14 +5045,65 @@ class Settings(Page):
|
||||||
background: #666666;
|
background: #666666;
|
||||||
}}
|
}}
|
||||||
""")
|
""")
|
||||||
execute_button.clicked.connect(self.execute_cli_command)
|
cli_execute_button.clicked.connect(self.execute_cli_command)
|
||||||
execute_button.setEnabled(False)
|
cli_execute_button.setEnabled(False)
|
||||||
command_layout.addWidget(execute_button)
|
cli_buttons_layout.addWidget(cli_execute_button)
|
||||||
|
|
||||||
|
command_layout.addLayout(cli_buttons_layout)
|
||||||
|
|
||||||
|
# Buttons for find command
|
||||||
|
find_buttons_layout = QHBoxLayout()
|
||||||
|
|
||||||
|
find_copy_button = QPushButton("Copy Find Command")
|
||||||
|
find_copy_button.setFixedSize(140, 40)
|
||||||
|
find_copy_button.setStyleSheet(f"""
|
||||||
|
QPushButton {{
|
||||||
|
font-size: 12px;
|
||||||
|
background: #007AFF;
|
||||||
|
color: white;
|
||||||
|
border: none;
|
||||||
|
border-radius: 5px;
|
||||||
|
font-weight: bold;
|
||||||
|
{self.font_style}
|
||||||
|
}}
|
||||||
|
QPushButton:hover {{
|
||||||
|
background: #0056CC;
|
||||||
|
}}
|
||||||
|
QPushButton:disabled {{
|
||||||
|
background: #666666;
|
||||||
|
}}
|
||||||
|
""")
|
||||||
|
find_copy_button.clicked.connect(lambda: self.copy_find_command(find_command.text()))
|
||||||
|
find_buttons_layout.addWidget(find_copy_button)
|
||||||
|
|
||||||
|
find_execute_button = QPushButton("Execute Find Command")
|
||||||
|
find_execute_button.setFixedSize(140, 40)
|
||||||
|
find_execute_button.setStyleSheet(f"""
|
||||||
|
QPushButton {{
|
||||||
|
font-size: 10px;
|
||||||
|
background: #4CAF50;
|
||||||
|
color: white;
|
||||||
|
border: none;
|
||||||
|
border-radius: 5px;
|
||||||
|
font-weight: bold;
|
||||||
|
{self.font_style}
|
||||||
|
}}
|
||||||
|
QPushButton:hover {{
|
||||||
|
background: #45a049;
|
||||||
|
}}
|
||||||
|
QPushButton:disabled {{
|
||||||
|
background: #666666;
|
||||||
|
}}
|
||||||
|
""")
|
||||||
|
find_execute_button.clicked.connect(lambda: self.execute_find_command(find_command.text()))
|
||||||
|
find_buttons_layout.addWidget(find_execute_button)
|
||||||
|
|
||||||
|
command_layout.addLayout(find_buttons_layout)
|
||||||
|
|
||||||
scroll_layout.addWidget(command_group)
|
scroll_layout.addWidget(command_group)
|
||||||
|
|
||||||
self.cli_copy_button = copy_button
|
self.cli_copy_button = cli_copy_button
|
||||||
self.cli_execute_button = execute_button
|
self.cli_execute_button = cli_execute_button
|
||||||
|
|
||||||
wg_quick_group = QGroupBox("Direct Systemwide Wireguard")
|
wg_quick_group = QGroupBox("Direct Systemwide Wireguard")
|
||||||
wg_quick_group.setStyleSheet(f"""
|
wg_quick_group.setStyleSheet(f"""
|
||||||
|
@ -5184,6 +5232,19 @@ class Settings(Page):
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.update_status.update_status(f"Error executing command: {str(e)}")
|
self.update_status.update_status(f"Error executing command: {str(e)}")
|
||||||
|
|
||||||
|
def copy_find_command(self, command_text):
|
||||||
|
clipboard = QApplication.clipboard()
|
||||||
|
clipboard.setText(command_text)
|
||||||
|
self.update_status.update_status("Find command copied to clipboard")
|
||||||
|
|
||||||
|
def execute_find_command(self, command_text):
|
||||||
|
try:
|
||||||
|
command = command_text.split()
|
||||||
|
subprocess.Popen(command)
|
||||||
|
self.update_status.update_status("Find command executed")
|
||||||
|
except Exception as e:
|
||||||
|
self.update_status.update_status(f"Error executing find command: {str(e)}")
|
||||||
|
|
||||||
def update_debug_profile_list(self):
|
def update_debug_profile_list(self):
|
||||||
self.debug_profile_selector.clear()
|
self.debug_profile_selector.clear()
|
||||||
profiles = ProfileController.get_all()
|
profiles = ProfileController.get_all()
|
||||||
|
@ -5217,7 +5278,7 @@ class Settings(Page):
|
||||||
|
|
||||||
|
|
||||||
if profile and isinstance(profile, SystemProfile):
|
if profile and isinstance(profile, SystemProfile):
|
||||||
app_path = "./hydra-veil-x86_64.AppImage"
|
app_path = os.environ.get('APPIMAGE') or "./hydra-veil-x86_64.AppImage"
|
||||||
self.cli_command.setText(f"{app_path} --cli profile enable -i {profile_id}")
|
self.cli_command.setText(f"{app_path} --cli profile enable -i {profile_id}")
|
||||||
self.cli_copy_button.setEnabled(True)
|
self.cli_copy_button.setEnabled(True)
|
||||||
self.cli_execute_button.setEnabled(True)
|
self.cli_execute_button.setEnabled(True)
|
||||||
|
|
Loading…
Reference in a new issue