| 1 | |
|---|
| 2 | import gtk |
|---|
| 3 | |
|---|
| 4 | from umitInterfaceEditor.RestructFiles import RestructFiles |
|---|
| 5 | from higwidgets.higwindows import HIGWindow |
|---|
| 6 | from higwidgets.higdialogs import HIGDialog |
|---|
| 7 | from higwidgets.higscrollers import HIGScrolledWindow |
|---|
| 8 | from higwidgets.higboxes import HIGVBox |
|---|
| 9 | from umitCore.Logging import log |
|---|
| 10 | from umitCore.I18N import _ |
|---|
| 11 | import gobject |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | ''' |
|---|
| 15 | DependecesOption is a Windows that shows the options in use |
|---|
| 16 | when remove button is pressed at Option Edit Mode |
|---|
| 17 | |
|---|
| 18 | ''' |
|---|
| 19 | |
|---|
| 20 | |
|---|
| 21 | |
|---|
| 22 | |
|---|
| 23 | |
|---|
| 24 | class DependenceOption(HIGDialog): |
|---|
| 25 | def __init__(self, option, restructfiles, profile, wizard): |
|---|
| 26 | HIGDialog.__init__(self, _('Dependence of Option %s ' % option )) |
|---|
| 27 | self.set_size_request(-1,300) |
|---|
| 28 | self.restructfiles = restructfiles |
|---|
| 29 | self._profile = profile |
|---|
| 30 | self._wizard = wizard |
|---|
| 31 | self._draw_widgets() |
|---|
| 32 | self.show_all() |
|---|
| 33 | def _draw_widgets(self): |
|---|
| 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')) |
|---|
| 36 | self._label.show() |
|---|
| 37 | self._label_q.show() |
|---|
| 38 | self.vbox.pack_start(self._label, False, False) |
|---|
| 39 | self.vbox.pack_start(self._label_q, False, False) |
|---|
| 40 | self._treeview_compare() |
|---|
| 41 | self.add_button(gtk.STOCK_YES, gtk.RESPONSE_YES) |
|---|
| 42 | self.add_button(gtk.STOCK_NO, gtk.RESPONSE_NO) |
|---|
| 43 | self.action_area.show_all() |
|---|
| 44 | def _treeview_compare(self): |
|---|
| 45 | self._model = gtk.TreeStore(gobject.TYPE_STRING) |
|---|
| 46 | profile = self._model.append( None, ['Profile']) |
|---|
| 47 | wizard = self._model.append( None, ['Wizard']) |
|---|
| 48 | |
|---|
| 49 | for i in self._profile: |
|---|
| 50 | |
|---|
| 51 | parent = self._model.append( profile, [i[0]]) |
|---|
| 52 | inside = self._model.append( parent, [i[1]] ) |
|---|
| 53 | if len(i) == 3: |
|---|
| 54 | self._model.append(inside, [i[2]]) |
|---|
| 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]]) |
|---|
| 62 | self._treeview = gtk.TreeView(self._model) |
|---|
| 63 | column = gtk.TreeViewColumn() |
|---|
| 64 | column.set_title('Name') |
|---|
| 65 | render_text = gtk.CellRendererText() |
|---|
| 66 | column.pack_start(render_text, expand=True) |
|---|
| 67 | column.add_attribute(render_text, 'text', 0) |
|---|
| 68 | self._treeview.append_column(column) |
|---|
| 69 | self.__scrolledwindow = HIGScrolledWindow() |
|---|
| 70 | self.__scrolledwindow.set_policy(gtk.POLICY_AUTOMATIC, |
|---|
| 71 | gtk.POLICY_AUTOMATIC) |
|---|
| 72 | self.__scrolledwindow.add(self._treeview) |
|---|
| 73 | self.vbox.pack_start(self.__scrolledwindow, True, True) |
|---|
| 74 | self.__scrolledwindow.show_all() |
|---|
| 75 | self._treeview.show_all() |
|---|
| 76 | self.vbox.show_all() |
|---|
| 77 | |
|---|
| 78 | |
|---|
| 79 | |
|---|
| 80 | |
|---|