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

Commit 7979b9c

Browse files
committed
Merge pull request #96 from robertbasic/feature/debugger-features-from-settings
Feature/debugger features from settings. Resolves #95
2 parents 96f12fd + dc2c081 commit 7979b9c

File tree

3 files changed

+59
-6
lines changed

3 files changed

+59
-6
lines changed

pugdebug/gui/settings.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,29 @@ def __init__(self, parent):
7070
break_at_first_line = int(get_setting('debugger/break_at_first_line'))
7171
self.break_at_first_line.setCheckState(break_at_first_line)
7272

73+
self.max_depth = QLineEdit()
74+
75+
self.max_depth.editingFinished.connect(self.handle_max_depth_changed)
76+
77+
max_depth = get_setting('debugger/max_depth')
78+
self.max_depth.setText(max_depth)
79+
80+
self.max_children = QLineEdit()
81+
82+
self.max_children.editingFinished.connect(
83+
self.handle_max_children_changed
84+
)
85+
86+
max_children = get_setting('debugger/max_children')
87+
self.max_children.setText(max_children)
88+
89+
self.max_data = QLineEdit()
90+
91+
self.max_data.editingFinished.connect(self.handle_max_data_changed)
92+
93+
max_data = get_setting('debugger/max_data')
94+
self.max_data.setText(max_data)
95+
7396
layout = QFormLayout()
7497
self.setLayout(layout)
7598

@@ -79,6 +102,9 @@ def __init__(self, parent):
79102
layout.addRow("Port", self.port_number)
80103
layout.addRow("IDE Key", self.idekey)
81104
layout.addRow("", self.break_at_first_line)
105+
layout.addRow("Max depth", self.max_depth)
106+
layout.addRow("Max children", self.max_children)
107+
layout.addRow("Max data", self.max_data)
82108

83109
def get_project_root(self):
84110
return self.project_root.text()
@@ -116,3 +142,15 @@ def handle_idekey_changed(self):
116142

117143
def handle_break_at_first_line_changed(self, value):
118144
set_setting('debugger/break_at_first_line', value)
145+
146+
def handle_max_depth_changed(self):
147+
value = self.max_depth.text()
148+
set_setting('debugger/max_depth', value)
149+
150+
def handle_max_children_changed(self):
151+
value = self.max_children.text()
152+
set_setting('debugger/max_children', value)
153+
154+
def handle_max_data_changed(self):
155+
value = self.max_data.text()
156+
set_setting('debugger/max_data', value)

pugdebug/models/settings.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,15 @@ def setup_debugger_settings(self):
5656
# between checked and unchecked state
5757
self.application_settings.setValue('break_at_first_line', 2)
5858

59+
if not self.application_settings.contains('max_depth'):
60+
self.application_settings.setValue('max_depth', '3')
61+
62+
if not self.application_settings.contains('max_children'):
63+
self.application_settings.setValue('max_children', '128')
64+
65+
if not self.application_settings.contains('max_data'):
66+
self.application_settings.setValue('max_data', '512')
67+
5968
self.application_settings.endGroup()
6069

6170
def setup_path_settings(self):

pugdebug/server.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,18 +148,24 @@ def init_connection(self):
148148
if idekey != '' and init_message['idekey'] != idekey:
149149
return False
150150

151-
command = 'feature_set -i %d -n max_depth -v 9' % (
152-
self.__get_transaction_id()
151+
max_depth = int(get_setting('debugger/max_depth'))
152+
command = 'feature_set -i %d -n max_depth -v %d' % (
153+
self.__get_transaction_id(),
154+
max_depth
153155
)
154156
response = self.__send_command(command)
155157

156-
command = 'feature_set -i %d -n max_children -v 512' % (
157-
self.__get_transaction_id()
158+
max_children = int(get_setting('debugger/max_children'))
159+
command = 'feature_set -i %d -n max_children -v %d' % (
160+
self.__get_transaction_id(),
161+
max_children
158162
)
159163
response = self.__send_command(command)
160164

161-
command = 'feature_set -i %d -n max_data -v 4096' % (
162-
self.__get_transaction_id()
165+
max_data = int(get_setting('debugger/max_data'))
166+
command = 'feature_set -i %d -n max_data -v %d' % (
167+
self.__get_transaction_id(),
168+
max_data
163169
)
164170
response = self.__send_command(command)
165171

0 commit comments

Comments
 (0)