Changeset 1426
- Timestamp:
- 08/18/07 18:27:28 (6 years ago)
- Location:
- branch/k0p/umitInterfaceEditor
- Files:
-
- 1 added
- 9 modified
-
Command.py (modified) (1 diff)
-
DependencesOption.py (modified) (2 diffs)
-
Main.py (modified) (1 diff)
-
OptionManager.py (modified) (7 diffs)
-
PageNotebook.py (modified) (1 diff)
-
Profile.py (modified) (1 diff)
-
ProfileCore.py (modified) (1 diff)
-
README (added)
-
RestructFiles.py (modified) (2 diffs)
-
Tools.py (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branch/k0p/umitInterfaceEditor/Command.py
r1089 r1426 146 146 return None 147 147 148 148 class CommandContainer(TwiceCommand, Command): 149 def __init__(self, description, state, commands): 150 Command.__init__(self, description) 151 TwiceCommand.__init__(self, state) 152 self._commands = commands 153 def _execute_1(self): 154 for i in self._commands: 155 i.execute() 156 def _execute_2(self): 157 #XXX: Later should be fix because it's only work in state = TRUE! 158 self._commands.reverse() 159 for i in self._commands: 160 i.execute() 161 162 163 164 165 149 166 class CommandManager(gobject.GObject): 150 167 __gsignals__ = { -
branch/k0p/umitInterfaceEditor/DependencesOption.py
r1424 r1426 10 10 from umitCore.I18N import _ 11 11 import gobject 12 13 12 14 ''' 13 15 DependecesOption is a Windows that shows the options in use … … 16 18 ''' 17 19 20 21 22 23 18 24 class DependenceOption(HIGDialog): 19 def __init__(self, option, restructfiles, results):25 def __init__(self, option, restructfiles, profile, wizard): 20 26 HIGDialog.__init__(self, _('Dependence of Option %s ' % option )) 21 27 self.set_size_request(-1,300) 22 28 self.restructfiles = restructfiles 23 self._results = results 29 self._profile = profile 30 self._wizard = wizard 24 31 self._draw_widgets() 25 32 self.show_all() 26 33 def _draw_widgets(self): 27 self._label = gtk.Label(_('There is a problem deleting this option. This options have dependences: ')) 34 self._label = gtk.Label(_('There is a problem deleting this option. This options have dependences. ')) 35 self._label_q = gtk.Label(_('Are you sure that can remove this option? Dependences should be removed too')) 28 36 self._label.show() 37 self._label_q.show() 29 38 self.vbox.pack_start(self._label, False, False) 39 self.vbox.pack_start(self._label_q, False, False) 30 40 self._treeview_compare() 31 self.add_button(gtk.STOCK_YES, gtk.RESPONSE_ CANCEL)32 self.add_button(gtk.STOCK_NO, gtk.RESPONSE_ OK)41 self.add_button(gtk.STOCK_YES, gtk.RESPONSE_YES) 42 self.add_button(gtk.STOCK_NO, gtk.RESPONSE_NO) 33 43 self.action_area.show_all() 34 44 def _treeview_compare(self): 35 45 self._model = gtk.TreeStore(gobject.TYPE_STRING) 36 for i in self._results: 46 profile = self._model.append( None, ['Profile']) 47 wizard = self._model.append( None, ['Wizard']) 48 49 for i in self._profile: 37 50 38 parent = self._model.append( None, [i[0]])51 parent = self._model.append( profile, [i[0]]) 39 52 inside = self._model.append( parent, [i[1]] ) 40 53 if len(i) == 3: 41 54 self._model.append(inside, [i[2]]) 42 55 56 for i in self._wizard: 57 58 parent = self._model.append( wizard, [i[0]]) 59 inside = self._model.append( parent, [i[1]] ) 60 if len(i) == 3: 61 self._model.append(inside, [i[2]]) 43 62 self._treeview = gtk.TreeView(self._model) 44 63 column = gtk.TreeViewColumn() -
branch/k0p/umitInterfaceEditor/Main.py
r1422 r1426 84 84 self.create_profile_edit() 85 85 self.create_wizard_edit() 86 self.opt_display.set_profile core(self.profile_box.get_profilecore())87 self.opt_display.set_wizard core(self.wizard_box.get_profilecore())86 self.opt_display.set_profile(self.profile_box) 87 self.opt_display.set_wizard(self.wizard_box) 88 88 89 89 -
branch/k0p/umitInterfaceEditor/OptionManager.py
r1424 r1426 46 46 from umitInterfaceEditor.OptionsCore import ListOptions, Option, ARG_TYPES 47 47 48 from umitInterfaceEditor.Command import Command, TwiceCommand, command_manager48 from umitInterfaceEditor.Command import Command, TwiceCommand, CommandContainer, command_manager 49 49 from umitInterfaceEditor.RestructFiles import RestructFiles 50 50 from umitInterfaceEditor.DependencesOption import DependenceOption 51 52 from umitInterfaceEditor.PageNotebook import CommandAddRemoveOption, CommandAddRemoveVoidplace 51 53 52 54 ''' … … 265 267 self._profilecore = None 266 268 self._wizardcore = None 269 self._notebook= None 270 self._profile = None 271 self._wizard = None 267 272 268 273 hbox = HIGHBox() … … 283 288 284 289 self.optionlist = option 285 def set_wizardcore(self, wizardcore): 286 self._wizardcore = wizardcore 287 def set_profilecore(self, profilecore): 288 self._profilecore = profilecore 290 def set_wizard(self, wizard): 291 self._wizard = wizard 292 self._wizardcore = wizard.get_profilecore() 293 def set_profile(self, profile): 294 self._profile = profile 295 self._profilecore = profile.get_profilecore() 289 296 def set_options_list(self, options): 290 297 ''' … … 313 320 opt = Option(name, options, hint, arguments, need_root, arg_type) 314 321 return opt 322 315 323 316 324 def delete_option(self, widget): … … 333 341 self._wizardcore, 334 342 self._profilecore) 335 used = self.rf.get_places(name) 343 profile, wizard = self.rf.get_places(name) 344 used = [] 345 for i in profile: 346 used.append(i) 347 for i in wizard: 348 used.append(i) 336 349 if used == []: 337 350 cmd = CommandAddRemoveOptionMode(self.get_option(), … … 343 356 else: 344 357 #Show Dialog Dependences etc!!! 345 dep = DependenceOption(name, self.rf, used) 346 dep.run() 347 pass 358 print used 359 dep = DependenceOption(name, self.rf, profile, wizard) 360 resp = dep.run() 361 dep.destroy() 362 363 if resp == gtk.RESPONSE_YES: 364 commands = [] 365 for i in profile: 366 boxedit = self._profile.notebook.get_page_name(i[0]) 367 widget = boxedit.search_option(i[1]) 368 cmd = CommandAddRemoveOption(widget, 369 boxedit, 370 self._profilecore, 371 False) 372 373 cmd2 = CommandAddRemoveVoidplace(boxedit, 374 widget, 375 boxedit._coords, 376 False) 377 commands.append(cmd) 378 commands.append(cmd2) 379 #for i in wizard: 380 # print i 381 cmd = CommandContainer('Remove option and deps', 382 True, 383 commands) 384 command_manager.add_command(cmd) 385 386 else: 387 return 388 389 348 390 349 391 #self.optionlist.options.remove_option(name) … … 361 403 d.run() 362 404 d.destroy() 363 405 406 407 def set_notebook(self, notebook): 408 self._notebook = notebook 409 364 410 def update_option(self, widget): 365 411 """ -
branch/k0p/umitInterfaceEditor/PageNotebook.py
r1415 r1426 634 634 635 635 636 def search_option(self, name): 637 ''' 638 returns widget 639 640 ''' 641 list = self._table.get_children() 642 result = None 643 for i in list : 644 if i.get_name() == name : 645 result = i 646 break 647 return result 648 636 649 def set_profile_core(self, profile_core): 637 650 self._profilecore = profile_core -
branch/k0p/umitInterfaceEditor/Profile.py
r1414 r1426 221 221 self._old_select.set_select(value) 222 222 self._old_select=None 223 224 225 def get_page_name(self, name): 226 result = None 227 for i in self.sections_widgets_list: 228 if i.get_name() == name : 229 result = self.sections_widgets[i] 230 break 231 if result==None: 232 return 233 return self.get_nth_page(result) 223 234 224 235 def on_button_press(self, widget, event): -
branch/k0p/umitInterfaceEditor/ProfileCore.py
r1407 r1426 493 493 element.removeChild(node_next) 494 494 element.insertBefore(node_next, node) 495 496 495 496 def get_opt_check(self, section, label): 497 elem = self.search_option(section,label) 498 return elem.getAttribute('option') 497 499 def get_list_opt(self, section, label): 498 500 ''' -
branch/k0p/umitInterfaceEditor/RestructFiles.py
r1424 r1426 36 36 37 37 def _search(self, option, core): 38 group_list = self.profilecore.groups38 group_list = core.groups 39 39 40 40 … … 67 67 def _search_profile(self, option): 68 68 return self._search(option, self.profilecore) 69 def _search_wizard(self, option): 70 return self._search(option, self.wizardcore) 69 71 70 72 def get_places(self,option): 71 result = self._search_profile(option) 72 return result 73 profile = self._search_profile(option) 74 wizard = self._search_wizard(option) 75 return profile, wizard 73 76 def restruct_all_files(self): 74 77 pass -
branch/k0p/umitInterfaceEditor/Tools.py
r1414 r1426 559 559 self._combo_type.connect('changed', self.change_combo) 560 560 561 self._label_opt = HIGEntryLabel(_('Option')) 562 self._entry_opt = HIGTextEntry() 563 self._entry_opt.set_sensitive(False) 564 561 565 #For option list open a dialog to add/remove options 562 566 self._button_list = HIGButton('Edit Option List') … … 572 576 self._table.attach(self._label_type, 0,1,1,2) 573 577 self._table.attach(self._combo_type, 1,2,1, 2) 578 574 579 self._table.attach(self._button_list, 0,2, 3,4) 580 self._table.attach(self._label_opt, 0,1, 4,5) 581 self._table.attach(self._entry_opt, 1,2,4,5) 575 582 576 583 self._box.pack_start(self._table, False, False) … … 624 631 pass 625 632 def hide_item(self): 633 self._label_opt.hide() 634 self._entry_opt.hide() 626 635 self._button_list.hide() 627 636 self._combo_type.hide() … … 636 645 self._combo_type.hide() 637 646 self._label_type.hide() 647 self._label_opt.hide() 648 self._entry_opt.hide() 638 649 self._selected = selected 639 650 def set_item(self, selected): 640 651 self._entry_name.show() 641 652 self._label_name.show() 653 642 654 self._selected = selected 643 655 if selected.get_name()!=None: … … 652 664 if isinstance(child_label, gtk.HBox): 653 665 #OptionCheck 666 self._label_opt.show() 667 self._entry_opt.show() 668 opt_ = self._profilecore.get_opt_check(self._boxeditable.get_name(), 669 selected.get_name()) 670 self._entry_opt.set_text(opt_) 654 671 self._button_list.hide() 655 672 child_label.cbutton.set_label(self._entry_name.get_text()) … … 673 690 674 691 def disable_all(self): 692 self._label_opt.hide() 693 self._entry_opt.hide() 675 694 self._button_list.hide() 676 695 self._combo_type.hide()
