Skip to content
This repository was archived by the owner on Aug 28, 2020. It is now read-only.

Commit e88b7a0

Browse files
committed
rename start_debug to start_listening and add new action stop_listening
1 parent 95b1689 commit e88b7a0

File tree

2 files changed

+42
-18
lines changed

2 files changed

+42
-18
lines changed

pugdebug/gui/main_window.py

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -147,27 +147,38 @@ def setup_file_actions(self):
147147
self.quit_action.triggered.connect(self.close)
148148

149149
def setup_actions(self):
150-
self.start_debug_action = QAction("Start", self)
151-
self.start_debug_action.setToolTip("Start server (F1)")
152-
self.start_debug_action.setStatusTip(
153-
"Start listening to for connections. Shortcut: F1"
150+
self.start_listening_action = QAction("Start listening", self)
151+
self.start_listening_action.setToolTip(
152+
"Start listening for new connections (F1)"
154153
)
155-
self.start_debug_action.setShortcut(QKeySequence("F1"))
154+
self.start_listening_action.setStatusTip(
155+
"Start listening for incomming connections. Shortcut: F1"
156+
)
157+
self.start_listening_action.setShortcut(QKeySequence("F1"))
158+
159+
self.stop_listening_action = QAction("Stop listening", self)
160+
self.stop_listening_action.setToolTip(
161+
"Stop listening for new connections (F2)"
162+
)
163+
self.stop_listening_action.setStatusTip(
164+
"Stop listening to incomming connections. Shortcut: F2"
165+
)
166+
self.stop_listening_action.setShortcut(QKeySequence("F2"))
156167

157168
self.stop_debug_action = QAction("Stop", self)
158-
self.stop_debug_action.setToolTip("Stop server (F2)")
169+
self.stop_debug_action.setToolTip("Stop debugging (F3)")
159170
self.stop_debug_action.setStatusTip(
160-
"Stop listening to for connections. Shortcut: F2"
171+
"Stop debugging the current request. Shortcut: F3"
161172
)
162-
self.stop_debug_action.setShortcut(QKeySequence("F2"))
173+
self.stop_debug_action.setShortcut(QKeySequence("F3"))
163174

164175
self.detach_debug_action = QAction("Detach", self)
165-
self.detach_debug_action.setToolTip("Detach from server (F3)")
176+
self.detach_debug_action.setToolTip("Detach debugger (F4)")
166177
self.detach_debug_action.setStatusTip(
167-
"Stop the debugging session, but let the PHP process end normally."
168-
" Shortcut: F3"
178+
"Detach debugger from the current request."
179+
" Shortcut: F4"
169180
)
170-
self.detach_debug_action.setShortcut(QKeySequence("F3"))
181+
self.detach_debug_action.setShortcut(QKeySequence("F4"))
171182

172183
self.run_debug_action = QAction("Run", self)
173184
self.run_debug_action.setToolTip("Start/resume the script (F5)")
@@ -208,7 +219,9 @@ def setup_toolbar(self):
208219
toolbar = QToolBar("Main Toolbar")
209220
toolbar.setObjectName("main-toolbar")
210221

211-
toolbar.addAction(self.start_debug_action)
222+
toolbar.addAction(self.start_listening_action)
223+
toolbar.addAction(self.stop_listening_action)
224+
toolbar.addSeparator()
212225
toolbar.addAction(self.stop_debug_action)
213226
toolbar.addAction(self.detach_debug_action)
214227
toolbar.addSeparator()
@@ -235,7 +248,9 @@ def setup_menubar(self):
235248
view_menu.addAction(widget.toggleViewAction())
236249

237250
debug_menu = menu_bar.addMenu("&Debug")
238-
debug_menu.addAction(self.start_debug_action)
251+
debug_menu.addAction(self.start_listening_action)
252+
debug_menu.addAction(self.stop_listening_action)
253+
debug_menu.addSeparator()
239254
debug_menu.addAction(self.stop_debug_action)
240255
debug_menu.addAction(self.detach_debug_action)
241256
debug_menu.addSeparator()
@@ -247,13 +262,14 @@ def setup_menubar(self):
247262
self.setMenuBar(menu_bar)
248263

249264
def toggle_actions(self, enabled):
265+
self.stop_debug_action.setEnabled(enabled)
250266
self.detach_debug_action.setEnabled(enabled)
251267
self.run_debug_action.setEnabled(enabled)
252268
self.step_over_action.setEnabled(enabled)
253269
self.step_into_action.setEnabled(enabled)
254270
self.step_out_action.setEnabled(enabled)
255271

256-
self.start_debug_action.setEnabled(not enabled)
272+
self.start_listening_action.setEnabled(not enabled)
257273

258274
def get_file_browser(self):
259275
return self.file_browser

pugdebug/pugdebug.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,12 @@ def connect_toolbar_action_signals(self):
155155
Connect signals when the run and step continuation commands are
156156
triggered are connected.
157157
"""
158-
self.main_window.start_debug_action.triggered.connect(self.start_debug)
158+
self.main_window.start_listening_action.triggered.connect(
159+
self.start_listening
160+
)
161+
self.main_window.stop_listening_action.triggered.connect(
162+
self.stop_listening
163+
)
159164
self.main_window.stop_debug_action.triggered.connect(self.stop_debug)
160165
self.main_window.detach_debug_action.triggered.connect(
161166
self.detach_debug
@@ -429,8 +434,8 @@ def handle_debugger_features_changed(self):
429434
if self.debugger.is_connected():
430435
self.debugger.set_debugger_features()
431436

432-
def start_debug(self):
433-
"""Start a new debugging session
437+
def start_listening(self):
438+
"""Start listening to new incomming connections
434439
435440
Clear the variable viewer.
436441
@@ -512,6 +517,9 @@ def handle_debugging_post_start(self):
512517
else:
513518
self.step_into()
514519

520+
def stop_listening(self):
521+
pass
522+
515523
def stop_debug(self):
516524
"""Stop a debugging session
517525

0 commit comments

Comments
 (0)