def _free_slot(self, pos, force_layout=True): "Replaces the element at pos with an empty slot" if self._is_removing_pages: return old_child = self.children[pos] slot = Slot(self, pos) slot.create() label = self.tabs[pos][0] if self.widget: self.widget.RemovePage(pos) old_child.recursive_remove() if self.widget: self.widget.InsertPage(pos, slot.widget, label) self.widget.SetSelection(pos) return slot
def builder(parent, pos, klass=None, base=None, name=None): "factory function for EditFrame objects" global last_choices if klass is None or base is None: import window_dialog base_classes = ['wxFrame', 'wxMDIChildFrame'] klass = 'wxFrame' if common.root.language.lower( ) == 'xrc' else 'MyFrame' dialog = window_dialog.WindowDialog(klass, base_classes, 'Select frame class', True, options, last_choices) res = dialog.show() dialog.Destroy() if res is None: return None klass, base = res last_choices[:] = dialog.get_options() # remember for next time if config.debugging and last_choices[1]: XXX # provoke an error name = dialog.get_next_name("frame") interactive = True else: interactive = False # last_choices not to be obeyed if base == "wxFrame": base_class = EditFrame else: base_class = EditMDIChildFrame editor = base_class(name, parent, name, "wxDEFAULT_FRAME_STYLE", klass=klass) editor.properties['size'].set((400, 300), activate=True) editor.create() editor.widget.Show() editor.design.update_label() if interactive and last_choices[0]: # add a default panel and vertical sizer to the frame import edit_sizers, widgets.panel.panel panel_editor = widgets.panel.panel.builder(editor, 0) edit_sizers._builder(panel_editor, 0) else: # just add a slot Slot(editor, 0) import clipboard editor.drop_target = clipboard.DropTarget(editor) editor.widget.SetDropTarget(editor.drop_target) if wx.Platform == '__WXMSW__': #editor.widget.CenterOnScreen() editor.widget.Raise() return editor