Changeset 895
- Timestamp:
- 06/29/07 16:57:47 (6 years ago)
- Location:
- branch/k0p
- Files:
-
- 3 modified
-
umitCore/UmitConf.py (modified) (2 diffs)
-
umitGUI/ProfileEditor.py (modified) (1 diff)
-
umitGUI/ProfileManager.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branch/k0p/umitCore/UmitConf.py
r871 r895 203 203 return self.set(profile, attribute, value) 204 204 205 def add_profile(self, profile_name, **attributes):205 def add_profile(self, profile_name, save=True, **attributes): 206 206 try: self.add_section(profile_name) 207 207 except: return None … … 212 212 for opt in options: 213 213 if options[opt]: 214 self._set_it(profile_name, opt, options[opt]) 215 self.save_changes() 214 self._set_it(profile_name, opt, options[opt], save) 215 if save: 216 self.save_changes() 217 216 218 217 219 def remove_profile(self, profile_name): -
branch/k0p/umitGUI/ProfileEditor.py
r891 r895 321 321 self.deleted=False 322 322 self.quit() 323 324 325 326 327 323 328 324 329 325 -
branch/k0p/umitGUI/ProfileManager.py
r894 r895 30 30 31 31 from umitGUI.Wizard import Wizard 32 32 from umitCore.NmapCommand import CommandConstructor 33 33 # Testing at devel 34 34 from os.path import split, join … … 101 101 self.cancel_button.connect("clicked", self.quit) 102 102 self.ok_button = HIGButton(stock='gtk-ok') 103 self.ok_button.connect("clicked", self.apply_modifications) 103 104 104 105 def __fill_widgets(self): … … 194 195 Copy selected Profile 195 196 """ 197 198 196 199 d = ProfileName(_("Insert a profile name")) 200 profile_name = d.run() 201 if profile_name == None: 202 return None 203 #get commands of selected profile 204 profile_selected = self.get_selected_profile() 205 command = self.profiles.get_command(profile_selected) 206 hint = self.profiles.get_hint(profile_selected) 207 description = self.profiles.get_description(profile_selected) 208 annotation = self.profiles.get_annotation(profile_selected) 209 #Options??? 210 prof = self.profiles.get_profile(profile_selected) 211 options_used = prof['options'] 212 options = CommandConstructor(options_used) 213 214 self.profiles.add_profile(profile_name,\ 215 save = False,\ 216 command=command,\ 217 hint=hint,\ 218 description=description,\ 219 annotation=annotation,\ 220 options=options.get_options()) 221 222 myiter = self.model.insert_after(None, None) 223 self.model.set_value(myiter, 0, profile_name) 224 197 225 198 226 def delete_profile(self, widget=None): … … 206 234 model.remove(iter) 207 235 208 209 236 def _reload_profile_list(self): 237 """ 238 Reload a list of profiles 239 """ 240 241 242 243 def apply_modifications(self, widget): 244 """ 245 Apply changes when clicked ok. Save based on treeview. 246 """ 247 248 self.profiles.save_changes() 249 250 251 252 210 253 def quit(self, widget): 211 254 self.destroy() 212 213 class ProfileName: 255 256 257 class ProfileName(HIGDialog): 214 258 def __init__(self, text): 215 d = HIGDialog(title=_('Profile\'s Name'),216 buttons=(gtk.STOCK_OK, gtk.RESPONSE_ACCEPT)) 259 HIGDialog.__init__(self, _('Profile\'s Name')) 260 217 261 dialog_label = HIGDialogLabel(text) 218 262 dialog_label.show() 219 d.vbox.pack_start(dialog_label) 220 221 entry_text = HIGTextEntry() 222 entry_text.show() 223 d.vbox.pack_start(entry_text) 224 225 d.run() 226 227 d.destroy() 263 self.vbox.pack_start(dialog_label) 264 self.entry_text = HIGTextEntry() 265 self.entry_text.show() 266 self.vbox.pack_start(self.entry_text) 267 self.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL) 268 self.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK) 269 270 def run(self): 271 """ 272 Returns text of entry 273 and None if someone clicked Cancel. 274 """ 275 text = None 276 response = HIGDialog.run(self) 277 text = self.entry_text.get_text() 278 if response==gtk.RESPONSE_CANCEL: 279 text = None 280 self.destroy() 281 return text 282 228 283 229 284 class ProfileChosse(HIGHBox):
