OptionsGui.py
1 # OptionsGui.py
2 # GUI for modifying MDBG options
3
4 import sys
5 sys.LoadAssemblyByName("System.Windows.Forms")
6
7 from System import *
8 from System.Windows.Forms import *
9
10 # display a GUI view of the current MDBG options
11 def OptionsGui():
12 guiWindow = OptionsGuiForm(Shell.Debugger.Options)
13 guiWindow.ShowDialog()
14
15
16 class OptionsGuiForm:
17 def __init__(self, options):
18 self.__options = options
19 self.__window = Form(Text = "MDbg Options", AutoSize = True, FormBorderStyle = FormBorderStyle.FixedDialog, MinimizeBox = False, MaximizeBox = False)
20 layout = TableLayoutPanel(ColumnCount = 2, RowCount = 0, AutoSize = True, Dock = DockStyle.Fill)
21
22 # create a check box for each option
23 self.__controls = dict()
24 self.__controls["CreateProcessWithNewConsole"] = CheckBox(Text = "Create process with new console", Checked = options.CreateProcessWithNewConsole, AutoSize = True)
25 self.__controls["InteropCallStack"] = CheckBox(Text = "Interop call stack", Checked = options.InteropCallStack, AutoSize = True)
26 self.__controls["ShowAddresses"] = CheckBox(Text = "Show addresses", Checked = options.ShowAddresses, AutoSize = True)
27 self.__controls["StopOnAssemblyLoad"] = CheckBox(Text = "Stop on assembly load", Checked = options.StopOnAssemblyLoad, AutoSize = True)
28 self.__controls["StopOnAssemblyUnload"] = CheckBox(Text = "Stop on assembly unload", Checked = options.StopOnAssemblyUnload, AutoSize = True)
29 self.__controls["StopOnClassLoad"] = CheckBox(Text = "Stop on class load", Checked = options.StopOnClassLoad, AutoSize = True)
30 self.__controls["StopOnException"] = CheckBox(Text = "Stop on exception", Checked = options.StopOnException, AutoSize = True)
31 self.__controls["StopOnExceptionEnhanced"] = CheckBox(Text = "Stop on exception enhanced", Checked = options.StopOnExceptionEnhanced, AutoSize = True)
32 self.__controls["StopOnLogMessage"] = CheckBox(Text = "Stop on log message", Checked = options.StopOnLogMessage, AutoSize = True)
33 self.__controls["StopOnModuleLoad"] = CheckBox(Text = "Stop on module load", Checked = options.StopOnModuleLoad, AutoSize = True)
34 self.__controls["StopOnNewThread"] = CheckBox(Text = "Stop on new thread", Checked = options.StopOnNewThread, AutoSize = True)
35 self.__controls["StopOnUnhandledException"] = CheckBox(Text = "Stop on unhandled exception", Checked = options.StopOnUnhandledException, AutoSize = True)
36
37 # add the checkboxes to the form
38 for controlName in self.__controls:
39 layout.Controls.Add(self.__controls[controlName])
40
41 # add a text box for the symbol path
42 symbolLabel = Label(Text = "Symbol path", Dock = DockStyle.Fill)
43 layout.Controls.Add(symbolLabel)
44 layout.SetColumnSpan(symbolLabel, 2)
45
46 self.__controls["SymbolPath"] = TextBox(Text = options.SymbolPath, Dock = DockStyle.Fill)
47 layout.Controls.Add(self.__controls["SymbolPath"])
48 layout.SetColumnSpan(self.__controls["SymbolPath"], 2)
49
50 # add ok and cancel buttons
51 okButton = Button(Text = "OK")
52 okButton.Click += self.__OnOkButtonClick
53 layout.Controls.Add(okButton)
54 self.__window.AcceptButton = okButton
55
56 cancelButton = Button(Text = "Cancel")
57 cancelButton.Click += self.__OnCancelButtonClick
58 layout.Controls.Add(cancelButton)
59 self.__window.CancelButton = cancelButton
60
61 # finish setting up the window
62 self.__window.Controls.Add(layout)
63 layout.PerformLayout()
64
65 def ShowDialog(self):
66 # if the user presses ok, then update the options structure
67 if self.__DoShowDialog() == DialogResult.OK:
68 self.__options.CreateProcessWithNewConsole = self.__controls["CreateProcessWithNewConsole"].Checked
69 self.__options.InteropCallStack = self.__controls["InteropCallStack"].Checked
70 self.__options.ShowAddresses = self.__controls["ShowAddresses"].Checked
71 self.__options.StopOnAssemblyLoad = self.__controls["StopOnAssemblyLoad"].Checked
72 self.__options.StopOnAssemblyUnload = self.__controls["StopOnAssemblyUnload"].Checked
73 self.__options.StopOnClassLoad = self.__controls["StopOnClassLoad"].Checked
74 self.__options.StopOnException = self.__controls["StopOnException"].Checked
75 self.__options.StopOnExceptionEnhanced = self.__controls["StopOnExceptionEnhanced"].Checked
76 self.__options.StopOnLogMessage = self.__controls["StopOnLogMessage"].Checked
77 self.__options.StopOnModuleLoad = self.__controls["StopOnModuleLoad"].Checked
78 self.__options.StopOnNewThread = self.__controls["StopOnNewThread"].Checked
79 self.__options.StopOnUnhandledException = self.__controls["StopOnUnhandledException"].Checked
80 self.__options.SymbolPath = self.__controls["SymbolPath"].Text
81
82 def __DoShowDialog(self):
83 return self.__window.ShowDialog()
84
85 def __OnOkButtonClick(self, sender, e):
86 self.__window.DialogResult = DialogResult.OK
87 self.__window.Close()
88
89 def __OnCancelButtonClick(self, sender, e):
90 self.__window.DialogResult = DialogResult.Cancel
91 self.__window.Close()
92
Comments
- Anonymous
September 02, 2005
Mike Stall recently completed a project to embed IronPython into the MDbg debugger as an MDbg extension. ... - Anonymous
September 02, 2005
Mike Stall recently completed a project to embed IronPython into the MDbg debugger as an MDbg extension. ...