def MakeDialog(parent, title, main, head=None): Dialog = UI.BaseDialog(parent=parent, title=title, main=main, head=head or {}, style=wx.FRAME_NO_TASKBAR) x, y = Dialog.GetEffectiveMinSize() Dialog.SetSize((max(x, 120), max(y, UI.SETTINGS["DLG_HEAD"] + 10))) Dialog.CenterOnParent() Dialog.Play("FADEIN") return Dialog
def MakeWidgetDialog(widget): Frame = UI.BaseDialog(parent=widget.Canvas.F, title=widget.NAME, style=wx.FRAME_FLOAT_ON_PARENT, main=(widget.DIALOG, {"widget": widget}), head=(DetachedHead, {"help": widget.DIALOG.HELP}), grip={"minSize": widget.DIALOG.MIN_SIZE}, ) x, y = widget.DialogSize or Frame.GetEffectiveMinSize() Frame.SetSize((max(x, widget.DIALOG.MIN_SIZE[0]), max(y, UI.SETTINGS["DLG_HEAD"] + widget.DIALOG.MIN_SIZE[1]))) Frame.SetPosition(widget.DialogPos or UI.EnsureWindowInScreen(widget.Canvas.ClientToScreen(widget.GetPosition() + wx.Point(64, 0)), (x, y))) Frame.Main.GetData() Frame.Play("FADEIN") return Frame.Main
def SimpleDialog(parent, title, text, onOK=None): Dialog = UI.BaseDialog(parent=parent, title=title, head={"buttons": False}, style=wx.FRAME_NO_TASKBAR) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(wx.StaticText(Dialog.Main, label=text), 1, wx.EXPAND | wx.ALL, 8) if onOK: Dialog.Main.AddStdButton(sizer, onOK=((UI.DoNothing, ), onOK, Dialog.OnClose), onCancel=Dialog.OnClose) else: Dialog.Main.AddStdButton(sizer, onOK=Dialog.OnClose) Dialog.Main.SetSizer(sizer) x, y = Dialog.GetEffectiveMinSize() Dialog.SetSize((max(x, 120), max(y, UI.SETTINGS["DLG_HEAD"] + 10))) Dialog.Layout() Dialog.Center() Dialog.Play("FADEIN") return Dialog