| 778 | | if dabo.settings.MDI and isinstance(parent, wx.MDIParentFrame): |
|---|
| 779 | | # Hack this into an MDI Child: |
|---|
| 780 | | dForm.__bases__ = (BaseForm, wx.MDIChildFrame) |
|---|
| 781 | | preClass = wx.PreMDIChildFrame |
|---|
| 782 | | self._mdi = True |
|---|
| | 778 | if kwargs.pop("Modal", False): |
|---|
| | 779 | # Hack this into a wx.Dialog, for true modality |
|---|
| | 780 | dForm.__bases__ = (BaseForm, wx.Dialog) |
|---|
| | 781 | preClass = wx.PreDialog |
|---|
| | 782 | self._modal = True |
|---|
| 784 | | # This is a normal SDI form: |
|---|
| 785 | | dForm.__bases__ = (BaseForm, wx.Frame) |
|---|
| 786 | | preClass = wx.PreFrame |
|---|
| 787 | | self._mdi = False |
|---|
| 788 | | ## (Note that it is necessary to run the above block each time, because |
|---|
| | 784 | # Normal dForm |
|---|
| | 785 | if dabo.settings.MDI and isinstance(parent, wx.MDIParentFrame): |
|---|
| | 786 | # Hack this into an MDI Child: |
|---|
| | 787 | dForm.__bases__ = (BaseForm, wx.MDIChildFrame) |
|---|
| | 788 | preClass = wx.PreMDIChildFrame |
|---|
| | 789 | self._mdi = True |
|---|
| | 790 | else: |
|---|
| | 791 | # This is a normal SDI form: |
|---|
| | 792 | dForm.__bases__ = (BaseForm, wx.Frame) |
|---|
| | 793 | preClass = wx.PreFrame |
|---|
| | 794 | self._mdi = False |
|---|
| | 795 | |
|---|
| | 796 | ## (Note that it is necessary to run the above blocks each time, because |
|---|
| | 808 | def _getModal(self): |
|---|
| | 809 | return getattr(self, "_modal", False) |
|---|
| | 810 | |
|---|
| | 811 | def _getVisible(self): |
|---|
| | 812 | return self.IsShown() |
|---|
| | 813 | |
|---|
| | 814 | def _setVisible(self, val): |
|---|
| | 815 | if self._constructed(): |
|---|
| | 816 | val = bool(val) |
|---|
| | 817 | if val and self.Modal: |
|---|
| | 818 | self.ShowModal() |
|---|
| | 819 | else: |
|---|
| | 820 | self.Show(val) |
|---|
| | 821 | else: |
|---|
| | 822 | self._properties["Visible"] = val |
|---|
| | 823 | |
|---|
| | 824 | Modal = property(_getModal, None, None, |
|---|
| | 825 | _("""Specifies whether this dForm is modal or not (bool) |
|---|
| | 826 | |
|---|
| | 827 | A modal dForm runs its own event loop, blocking program flow until the |
|---|
| | 828 | form is hidden or closed, exactly like a dDialog does it. This property |
|---|
| | 829 | may only be sent to the constructor, and once instantiated you may not |
|---|
| | 830 | change the modality of a form. For example, |
|---|
| | 831 | frm = dabo.ui.dForm(Modal=True) |
|---|
| | 832 | will create a modal form. |
|---|
| | 833 | |
|---|
| | 834 | Note that a modal dForm is actually a dDialog, and as such does not |
|---|
| | 835 | have the ability to contain MenuBars, StatusBars, or ToolBars.""")) |
|---|
| | 836 | |
|---|
| | 837 | Visible = property(_getVisible, _setVisible, None, |
|---|
| | 838 | _("Specifies whether the form is shown or hidden. (bool)") ) |
|---|
| | 839 | |
|---|
| | 840 | |
|---|