Public Member Functions | |
| def | __init__ |
| def | loadConfig |
| Loads the configuration from the optionsConfigurator object and displays it onto the screen. | |
| def | createWidgets |
| Creates all various widgets and displays them onto the screen. | |
| def | layoutWidgets |
| Lays out all all widgets onto the screen. | |
| def | doBinding |
| Binds all the various buttons and controls to their handler methods. | |
| def | OnOK |
| "OK" Button handler | |
| def | OnCancel |
| "Cancel" Button handler | |
| def | OnCloseWindow |
| Cleanly closes the window. | |
| def | OnItemSelected |
| Handler which is called when an item (a network device) is selected. | |
| def | OnSaveSelection |
| Handler which is called "Remember this choice" CheckBox is clicked. | |
Public Attributes | |
| chosenDevice | |
| deviceDict | |
| mainSizer | |
| deviceIdxDict | |
| saveSelection | |
| listc | |
| cehckbox | |
| button_ok | |
| button_cancel | |
Definition at line 26 of file networkSettings.py.
| def objects.gui.networkSettings.networkSettings.__init__ | ( | self, | ||
| parent, | ||||
| deviceDict | ||||
| ) |
Definition at line 27 of file networkSettings.py.
00027 : 00028 wx.Dialog.__init__(self, parent, -1, "Which device would you like to monitor?", 00029 size=(400,220)) 00030 00031 self.chosenDevice = None 00032 self.deviceDict = deviceDict 00033 00034 self.mainSizer = wx.BoxSizer(wx.VERTICAL) 00035 00036 self.deviceIdxDict = dict() 00037 self.saveSelection = False 00038 00039 self.createWidgets() 00040 self.layoutWidgets() 00041 self.doBinding() 00042 00043 00044 self.SetSizer(self.mainSizer) 00045 00046 00047 ## Loads the configuration from the optionsConfigurator object and displays it onto the screen
| def objects.gui.networkSettings.networkSettings.createWidgets | ( | self | ) |
Creates all various widgets and displays them onto the screen.
Definition at line 66 of file networkSettings.py.
00066 : 00067 # 00068 # list box 00069 # 00070 self.listc = wx.ListCtrl(self, -1, style=wx.LC_REPORT|wx.LC_SINGLE_SEL, 00071 size=(400, 120)) 00072 00073 self.listc.InsertColumn(0, "Network Device", width=340) 00074 self.listc.InsertColumn(1, "Packets",width=50) 00075 00076 00077 for name, desc in self.deviceDict.iteritems(): 00078 index = self.listc.InsertStringItem(sys.maxint, name) 00079 self.listc.SetStringItem(index, 1, "-") 00080 self.deviceIdxDict[name] = index 00081 00082 00083 00084 if len(self.deviceDict) > 0: 00085 self.listc.Select(0) 00086 00087 # 00088 # CheckBox 00089 # 00090 self.cehckbox = wx.CheckBox(self, -1, "Remember this choice") 00091 00092 00093 # 00094 # Buttons 00095 # 00096 self.button_ok = wx.Button(self, wx.ID_OK, "Ok") 00097 self.button_cancel = wx.Button(self, wx.ID_CANCEL, "Cancel") 00098 00099 00100 ## Lays out all all widgets onto the screen
| def objects.gui.networkSettings.networkSettings.doBinding | ( | self | ) |
Binds all the various buttons and controls to their handler methods.
Definition at line 136 of file networkSettings.py.
00136 : 00137 00138 self.Bind(wx.EVT_BUTTON, self.OnOK, self.button_ok) 00139 self.Bind(wx.EVT_BUTTON, self.OnCancel, self.button_cancel) 00140 00141 self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnItemSelected, self.listc) 00142 00143 self.Bind(wx.EVT_CHECKBOX, self.OnSaveSelection, self.cehckbox) 00144 00145 """
| def objects.gui.networkSettings.networkSettings.layoutWidgets | ( | self | ) |
Lays out all all widgets onto the screen.
Definition at line 102 of file networkSettings.py.
00102 : 00103 # layout list box 00104 ctrlSizer = wx.BoxSizer(wx.HORIZONTAL) 00105 ctrlSizer.Add(self.listc, 10) 00106 00107 self.mainSizer.Add(ctrlSizer, 0, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 10) 00108 00109 emptySizer = wx.BoxSizer(wx.HORIZONTAL) 00110 emptySizer.Add((15,15), 1) 00111 00112 self.mainSizer.Add(emptySizer, 0,wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 10) 00113 00114 #layout checkbox 00115 chkSizer = wx.BoxSizer(wx.HORIZONTAL) 00116 chkSizer.Add(self.cehckbox, 1) 00117 00118 self.mainSizer.Add(chkSizer, 0, wx.LEFT, 10) 00119 00120 emptySizer = wx.BoxSizer(wx.HORIZONTAL) 00121 emptySizer.Add((15,15), 1) 00122 00123 self.mainSizer.Add(emptySizer, 0,wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 10) 00124 00125 # buttons 00126 btnSizer = wx.BoxSizer(wx.HORIZONTAL) 00127 00128 btnSizer.Add(self.button_ok) 00129 btnSizer.Add((10,10), 1) 00130 btnSizer.Add(self.button_cancel) 00131 00132 self.mainSizer.Add(btnSizer, 0, wx.ALIGN_RIGHT | wx.RIGHT,10) 00133 00134 ## Binds all the various buttons and controls to their handler methods
| def objects.gui.networkSettings.networkSettings.loadConfig | ( | self, | ||
| optConf | ||||
| ) |
Loads the configuration from the optionsConfigurator object and displays it onto the screen.
| optConf | optionsConfigurator object |
Definition at line 50 of file networkSettings.py.
00050 : 00051 saveSel = optConf.network_getSaveDeviceSelection() 00052 selectedDevice = optConf.network_getSelectedDevice() 00053 00054 if saveSel == True: 00055 self.saveSelection = True 00056 if self.deviceIdxDict.has_key(selectedDevice): 00057 self.listc.Select(self.deviceIdxDict[selectedDevice]) 00058 self.cehckbox.SetValue(True) 00059 else: 00060 self.saveSelection = False 00061 00062 00063 00064 ## Creates all various widgets and displays them onto the screen.
| def objects.gui.networkSettings.networkSettings.OnCancel | ( | self, | ||
| event | ||||
| ) |
"Cancel" Button handler
| event | Standard wx.Button event |
Definition at line 163 of file networkSettings.py.
00163 : 00164 return self.EndModal(wx.ID_CANCEL) 00165 00166 00167
| def objects.gui.networkSettings.networkSettings.OnCloseWindow | ( | self, | ||
| event | ||||
| ) |
Cleanly closes the window.
| event | Standard wx.Button event |
Definition at line 170 of file networkSettings.py.
00170 : 00171 self.Destroy() 00172 00173
| def objects.gui.networkSettings.networkSettings.OnItemSelected | ( | self, | ||
| evt | ||||
| ) |
Handler which is called when an item (a network device) is selected.
| evt | Standard wx.Button event |
Definition at line 176 of file networkSettings.py.
00176 : 00177 item = evt.GetItem() 00178 self.chosenDevice = item.GetText() 00179 ## Handler which is called "Remember this choice" CheckBox is clicked
| def objects.gui.networkSettings.networkSettings.OnOK | ( | self, | ||
| event | ||||
| ) |
"OK" Button handler
| event | Standard wx.Button event |
Definition at line 151 of file networkSettings.py.
00151 : 00152 if self.chosenDevice == None: 00153 dlg = wx.MessageDialog(None, "No Item was selected", 'Error', wx.ICON_ERROR) 00154 dlg.ShowModal() 00155 dlg.Destroy() 00156 return 00157 00158 logger.log(__name__ + ":Item selected:" + self.chosenDevice ) 00159 return self.EndModal(wx.ID_OK) 00160
| def objects.gui.networkSettings.networkSettings.OnSaveSelection | ( | self, | ||
| evt | ||||
| ) |
Handler which is called "Remember this choice" CheckBox is clicked.
| evt | Standard wx.Button event |
Definition at line 182 of file networkSettings.py.
00182 : 00183 self.saveSelection = self.cehckbox.GetValue() 00184 00185 00186 00187 00188 00189 00190 00191 00192
Definition at line 97 of file networkSettings.py.
Definition at line 96 of file networkSettings.py.
Definition at line 90 of file networkSettings.py.
Definition at line 31 of file networkSettings.py.
Definition at line 32 of file networkSettings.py.
Definition at line 36 of file networkSettings.py.
Definition at line 70 of file networkSettings.py.
Definition at line 34 of file networkSettings.py.
Definition at line 37 of file networkSettings.py.
1.5.8