Example #1
0
    def __init__(self, parent, title, size=(-1, -1), style=VERTICAL,
                 resizable=False, on_load=None, add_line=True, margin=None):
        stl = wx.DEFAULT_DIALOG_STYLE
        stl = stl | wx.RESIZE_BORDER | wx.MAXIMIZE_BOX if resizable else stl
        self.add_line = add_line

        wx.Dialog.__init__(self, parent, -1, tr(title), wx.DefaultPosition,
                           size, style=stl)

        sizer = wx.BoxSizer(wx.VERTICAL)
        self.SetSizer(sizer)

        if margin is None:
            margin = 5 if const.IS_GTK else 10

        self.box = VPanel(self)
        sizer.Add(self.box, 1, ALL | EXPAND, margin)

        if style == HORIZONTAL:
            self.panel = HPanel(self.box)
        else:
            self.panel = VPanel(self.box)
        self.box.pack(self.panel, expand=True, fill=True)

        self.build()
        self.set_dialog_buttons()
        if size == (-1, -1):
            self.Fit()
        self.CenterOnParent()
        self.panel.layout()
        self.Bind(wx.EVT_CLOSE, self.on_close, self)
        if on_load:
            self._timer = wx.Timer(self)
            self.Bind(wx.EVT_TIMER, on_load)
            self._timer.Start(200)
Example #2
0
    def __init__(self,
                 parent,
                 title,
                 size=(-1, -1),
                 style=VERTICAL,
                 resizable=False,
                 on_load=None,
                 add_line=True):
        dlg_style = wx.DEFAULT_DIALOG_STYLE
        if resizable: dlg_style |= wx.RESIZE_BORDER
        self.add_line = add_line

        wx.Dialog.__init__(self,
                           parent,
                           -1,
                           title,
                           wx.DefaultPosition,
                           size,
                           style=dlg_style)

        sizer = wx.BoxSizer(wx.VERTICAL)
        self.SetSizer(sizer)

        margin = 5
        if not const.is_gtk(): margin = 10

        self.box = VPanel(self)
        sizer.Add(self.box, 1, ALL | EXPAND, margin)

        if style == HORIZONTAL:
            self.panel = HPanel(self.box)
        else:
            self.panel = VPanel(self.box)
        self.box.pack(self.panel, expand=True, fill=True)

        self.build()
        self.set_dialog_buttons()
        if size == (-1, -1): self.Fit()
        self.CenterOnParent()
        self.Bind(wx.EVT_CLOSE, self.on_close, self)
        if on_load:
            self._timer = wx.Timer(self)
            self.Bind(wx.EVT_TIMER, on_load)
            self._timer.Start(500)