(self)
| 554 | pass |
| 555 | |
| 556 | def create_toolbar(self): |
| 557 | # Purge any existing toolbar items |
| 558 | self.purge_toolbar() |
| 559 | |
| 560 | # Create the new toolbar items. |
| 561 | if self.interface.toolbar: |
| 562 | for cmd in self.interface.toolbar: |
| 563 | if isinstance(cmd, Command): |
| 564 | self._toolbar_items[toolbar_identifier(cmd)] = cmd |
| 565 | |
| 566 | self.native_toolbar = NSToolbar.alloc().initWithIdentifier( |
| 567 | f"Toolbar-{id(self)}" |
| 568 | ) |
| 569 | self.native_toolbar.setDelegate(self.native) |
| 570 | else: |
| 571 | self.native_toolbar = None |
| 572 | |
| 573 | self.native.setToolbar(self.native_toolbar) |
| 574 | |
| 575 | # Adding/removing a toolbar changes the size of the content window. |
| 576 | if self.interface.content: |
| 577 | self.interface.content.refresh() |
| 578 | |
| 579 | def purge_toolbar(self): |
| 580 | while self._toolbar_items: |
no test coverage detected