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

Commit 871a0f3

Browse files
committed
Add docblocks
1 parent a412e2d commit 871a0f3

File tree

2 files changed

+54
-4
lines changed

2 files changed

+54
-4
lines changed

pugdebug/debugger.py

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,11 @@ def connect_server_signals(self):
7171
def connect_connection_signals(self, connection):
7272
"""Connect signals for a new connection
7373
74-
Connect signals that gets emitted when a connection is stopped
75-
or detached, when a step command is done, when variables are read,
76-
when stacktraces are read, when breakpoints are set or removed,
77-
when breakpoints are read, when expressions are evaluated.
74+
Connect signals that gets emitted when post start commands are done,
75+
a connection is stopped or detached, when a step command is done,
76+
when variables are read, when stacktraces are read, when breakpoints
77+
are set or removed, when breakpoints are read, when expressions are
78+
evaluated.
7879
"""
7980

8081
# Stop/detach signals
@@ -195,12 +196,24 @@ def start_new_connection(self):
195196
self.debugging_started_signal.emit()
196197

197198
def post_start_command(self, post_start_data):
199+
"""Issue a post start command
200+
201+
After a debugging session is started, set the init breakpoints
202+
and list the breakpoints.
203+
"""
198204
self.current_connection.post_start_command(post_start_data)
199205

200206
def handle_post_start(self):
207+
"""Handle post start command
208+
"""
201209
self.debugging_post_start_signal.emit()
202210

203211
def handle_server_stopped(self):
212+
"""Handle when the server is stopped
213+
214+
If the current connection is terminated, cleanup the debugging
215+
session and emit the debugging stopped signal.
216+
"""
204217
if not self.is_connected():
205218
self.cleanup()
206219
self.debugging_stopped_signal.emit()
@@ -310,9 +323,15 @@ def handle_expressions_evaluated(self, results):
310323
self.expressions_evaluated_signal.emit(results)
311324

312325
def handle_server_error(self, error):
326+
"""Handle when an error occurs in the server
327+
"""
313328
self.error_signal.emit(error)
314329

315330
def handle_connection_error(self, action, error):
331+
"""Handle when an error occurs in the connection
332+
333+
Kill the current connection and stop debugging.
334+
"""
316335
error = error + " during %s action" % action
317336
self.error_signal.emit(error)
318337

pugdebug/pugdebug.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ def setup_file_browser(self):
7878
self.file_browser.hide_columns()
7979

8080
def setup_projects_browser(self):
81+
"""Setup the projects browser
82+
83+
Sets the model on the projects browser.
84+
"""
8185
model = PugdebugProjects(self)
8286

8387
self.projects_browser.setModel(model)
@@ -108,6 +112,14 @@ def connect_file_browser_signals(self):
108112
self.file_browser.activated.connect(self.file_browser_item_activated)
109113

110114
def connect_projects_browser_signals(self):
115+
"""Connect projects browser signals
116+
117+
Connects the projects browser's activated signal to the
118+
slot that gets called when a project browser item is activated.
119+
120+
Connects the signal that gets emitted from the main window
121+
when a new project gets created.
122+
"""
111123
self.projects_browser.activated.connect(
112124
self.projects_browser_item_activated
113125
)
@@ -229,6 +241,12 @@ def connect_breakpoint_viewer_signals(self):
229241
)
230242

231243
def handle_new_project_created(self, project_name):
244+
"""Handle when a new project gets created
245+
246+
Reload the projects in the projects browser.
247+
248+
Find the project that was just created and load it.
249+
"""
232250
self.projects_browser.load_projects()
233251

234252
item = self.projects_browser.model().findItems(project_name)[0]
@@ -237,10 +255,19 @@ def handle_new_project_created(self, project_name):
237255
self.load_project(project)
238256

239257
def projects_browser_item_activated(self, index):
258+
"""Handle when a projects browser item gets activated
259+
260+
Find the project and load it.
261+
"""
240262
project = self.projects_browser.model().get_project_by_index(index)
241263
self.load_project(project)
242264

243265
def load_project(self, project):
266+
"""Load a project
267+
268+
Get the settings for the project and load them as the current
269+
application settings.
270+
"""
244271
project_settings = project.get_settings()
245272

246273
changed_settings = save_settings(project_settings)
@@ -745,6 +772,10 @@ def handle_expression_added_or_changed(self, index, expression):
745772
self.debugger.evaluate_expression(index, expression)
746773

747774
def handle_error(self, error):
775+
"""Handle when an error occurs
776+
777+
Show the error in an error message window.
778+
"""
748779
em = QErrorMessage(self.main_window)
749780
em.showMessage(error)
750781

0 commit comments

Comments
 (0)