equal
deleted
inserted
replaced
22 # along with this program; if not, write to the Free Software |
22 # along with this program; if not, write to the Free Software |
23 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
23 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
24 |
24 |
25 |
25 |
26 from __future__ import absolute_import |
26 from __future__ import absolute_import |
27 from types import TupleType |
27 from __future__ import division |
28 |
28 |
29 import wx |
29 import wx |
30 |
30 |
31 from controls.DebugVariablePanel.DebugVariableViewer import DebugVariableViewer |
31 from controls.DebugVariablePanel.DebugVariableViewer import DebugVariableViewer |
32 from controls.DebugVariablePanel.GraphButton import GraphButton |
32 from controls.DebugVariablePanel.GraphButton import GraphButton |
85 message = None |
85 message = None |
86 |
86 |
87 # Check that data is valid regarding DebugVariablePanel |
87 # Check that data is valid regarding DebugVariablePanel |
88 try: |
88 try: |
89 values = eval(data) |
89 values = eval(data) |
90 if not isinstance(values, TupleType): |
90 if not isinstance(values, tuple): |
91 raise ValueError |
91 raise ValueError |
92 except Exception: |
92 except Exception: |
93 message = _("Invalid value \"%s\" for debug variable") % data |
93 message = _("Invalid value \"%s\" for debug variable") % data |
94 values = None |
94 values = None |
95 |
95 |
102 |
102 |
103 # Get Before which Viewer the variable has to be moved or added |
103 # Get Before which Viewer the variable has to be moved or added |
104 # according to the position of mouse in Viewer. |
104 # according to the position of mouse in Viewer. |
105 _width, height = self.ParentControl.GetSize() |
105 _width, height = self.ParentControl.GetSize() |
106 target_idx = self.ParentControl.GetIndex() |
106 target_idx = self.ParentControl.GetIndex() |
107 if y > height / 2: |
107 if y > height // 2: |
108 target_idx += 1 |
108 target_idx += 1 |
109 |
109 |
110 # Drag'n Drop is an internal is an internal move inside Debug |
110 # Drag'n Drop is an internal is an internal move inside Debug |
111 # Variable Panel |
111 # Variable Panel |
112 if len(values) > 2 and values[2] == "move": |
112 if len(values) > 2 and values[2] == "move": |
207 item_path = item.GetVariable( |
207 item_path = item.GetVariable( |
208 self.ParentWindow.GetVariableNameMask()) |
208 self.ParentWindow.GetVariableNameMask()) |
209 |
209 |
210 # Draw item variable path at Viewer left side |
210 # Draw item variable path at Viewer left side |
211 w, h = gc.GetTextExtent(item_path) |
211 w, h = gc.GetTextExtent(item_path) |
212 gc.DrawText(item_path, 20, (height - h) / 2) |
212 gc.DrawText(item_path, 20, (height - h) // 2) |
213 |
213 |
214 # Update 'Release' button state and text color according to item forced |
214 # Update 'Release' button state and text color according to item forced |
215 # flag value |
215 # flag value |
216 item_forced = item.IsForced() |
216 item_forced = item.IsForced() |
217 self.Buttons[1].Enable(item_forced) |
217 self.Buttons[1].Enable(item_forced) |
220 gc.SetTextForeground(wx.BLUE) |
220 gc.SetTextForeground(wx.BLUE) |
221 |
221 |
222 # Draw item current value at right side of Viewer |
222 # Draw item current value at right side of Viewer |
223 item_value = item.GetValue() |
223 item_value = item.GetValue() |
224 w, h = gc.GetTextExtent(item_value) |
224 w, h = gc.GetTextExtent(item_value) |
225 gc.DrawText(item_value, width - 40 - w, (height - h) / 2) |
225 gc.DrawText(item_value, width - 40 - w, (height - h) // 2) |
226 |
226 |
227 # Draw other Viewer common elements |
227 # Draw other Viewer common elements |
228 self.DrawCommonElements(gc) |
228 self.DrawCommonElements(gc) |
229 |
229 |
230 gc.EndDrawing() |
230 gc.EndDrawing() |