| | 484 | def construct_end(self, title, end): |
|---|
| | 485 | hbox = gtk.HBox() |
|---|
| | 486 | label = gtk.Label(title) |
|---|
| | 487 | label.set_justify(gtk.JUSTIFY_LEFT) |
|---|
| | 488 | self.size_group.add_widget(label) |
|---|
| | 489 | hbox.pack_start(label, expand=False) |
|---|
| | 490 | |
|---|
| | 491 | entry = gtk.Entry() |
|---|
| | 492 | entry.set_text(render_attribute(end.subject) or '') |
|---|
| | 493 | entry.connect('changed', self._on_end_name_change, end) |
|---|
| | 494 | hbox.pack_start(entry) |
|---|
| | 495 | |
|---|
| | 496 | combo = gtk.combo_box_new_text() |
|---|
| | 497 | for t in ('Unknown navigation', 'Not navigable', 'Navigable'): |
|---|
| | 498 | combo.append_text(t) |
|---|
| | 499 | |
|---|
| | 500 | combo.set_active([None, False, True].index(end.navigability)) |
|---|
| | 501 | |
|---|
| | 502 | combo.connect('changed', self._on_navigability_change, end) |
|---|
| | 503 | hbox.pack_start(combo, expand=False) |
|---|
| | 504 | |
|---|
| | 505 | combo = gtk.combo_box_new_text() |
|---|
| | 506 | for t in ('No aggregation', 'Shared', 'Composite'): |
|---|
| | 507 | combo.append_text(t) |
|---|
| | 508 | |
|---|
| | 509 | combo.set_active(['none', 'shared', 'composite'].index(end.subject.aggregation)) |
|---|
| | 510 | |
|---|
| | 511 | combo.connect('changed', self._on_aggregation_change, end) |
|---|
| | 512 | hbox.pack_start(combo, expand=False) |
|---|
| | 513 | |
|---|
| | 514 | return hbox |
|---|
| | 515 | |
|---|
| 486 | | return page |
|---|
| 487 | | |
|---|
| 488 | | hbox = gtk.HBox() |
|---|
| 489 | | label = gtk.Label(_('Dependency type')) |
|---|
| 490 | | label.set_justify(gtk.JUSTIFY_LEFT) |
|---|
| 491 | | self.size_group.add_widget(label) |
|---|
| 492 | | hbox.pack_start(label, expand=False) |
|---|
| 493 | | |
|---|
| 494 | | dependency_type = gtk.ListStore(str) |
|---|
| 495 | | |
|---|
| 496 | | for t, l in self.dependency_types: |
|---|
| 497 | | dependency_type.append([t]) |
|---|
| 498 | | |
|---|
| 499 | | self.dependency_type = dependency_type |
|---|
| 500 | | |
|---|
| 501 | | combo = gtk.ComboBox(dependency_type) |
|---|
| 502 | | cell = gtk.CellRendererText() |
|---|
| 503 | | combo.pack_start(cell, True) |
|---|
| 504 | | combo.add_attribute(cell, 'text', 0) |
|---|
| 505 | | combo.connect('changed', self._on_dependency_type_change) |
|---|
| 506 | | self.combo = combo |
|---|
| 507 | | |
|---|
| 508 | | hbox.pack_start(combo, expand=False) |
|---|
| 509 | | |
|---|
| 510 | | page.pack_start(hbox, expand=False) |
|---|
| 511 | | |
|---|
| 512 | | hbox = gtk.HBox() |
|---|
| 513 | | |
|---|
| 514 | | label = gtk.Label(_('Automatic')) |
|---|
| 515 | | label.set_justify(gtk.JUSTIFY_LEFT) |
|---|
| 516 | | self.size_group.add_widget(label) |
|---|
| 517 | | hbox.pack_start(label, expand=False) |
|---|
| 518 | | |
|---|
| 519 | | button = gtk.CheckButton() |
|---|
| 520 | | button.set_active(self.context.auto_dependency) |
|---|
| 521 | | button.connect('toggled', self._on_auto_dependency_change) |
|---|
| 522 | | hbox.pack_start(button) |
|---|
| 523 | | |
|---|
| | 518 | |
|---|
| | 519 | if not self.context.subject: |
|---|
| | 520 | return page |
|---|
| | 521 | |
|---|
| | 522 | hbox = self.construct_end(_('Head'), self.context.head_end) |
|---|
| | 523 | page.pack_start(hbox, expand=False) |
|---|
| | 524 | |
|---|
| | 525 | hbox = self.construct_end(_('Tail'), self.context.tail_end) |
|---|
| 533 | | for index, (_, dep_type) in enumerate(self.dependency_types): |
|---|
| 534 | | if dep_type is self.context.dependency_type: |
|---|
| 535 | | self.combo.set_active(index) |
|---|
| 536 | | break |
|---|
| 537 | | |
|---|
| 538 | | def _on_dependency_type_change(self, combo): |
|---|
| 539 | | self.context.dependency_type = self.dependency_types[combo.get_active()][1] |
|---|
| 540 | | |
|---|
| 541 | | def _on_auto_dependency_change(self, button): |
|---|
| 542 | | self.context.auto_dependency = button.get_active() |
|---|
| | 535 | pass |
|---|
| | 536 | |
|---|
| | 537 | def _on_end_name_change(self, entry, end): |
|---|
| | 538 | end.subject.parse(entry.get_text()) |
|---|
| | 539 | |
|---|
| | 540 | def _on_navigability_change(self, combo, end): |
|---|
| | 541 | end.navigability = (None, False, True)[combo.get_active()] |
|---|
| | 542 | |
|---|
| | 543 | def _on_aggregation_change(self, combo, end): |
|---|
| | 544 | end.subject.aggregation = ('none', 'shared', 'composite')[combo.get_active()] |
|---|