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)
Example #3
0
class SimpleDialog(wx.Dialog):

	_timer = None
	add_line = True

	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)

	def build(self):pass
	def set_dialog_buttons(self):pass
	def get_result(self): return None
	def on_close(self, event=None): self.end_modal(const.BUTTON_CANCEL)
	def set_title(self, title): self.SetTitle(title)
	def set_minsize(self, size): self.SetMinSize(size)
	def get_size(self):return self.GetSize()
	def show_modal(self):return self.ShowModal()
	def end_modal(self, ret): self.EndModal(ret)
	def destroy(self): self.Destroy()

	def pack(self, *args, **kw):
		obj = args[0]
		if not obj.GetParent() == self.panel:
			obj.Reparent(self.panel)
		self.panel.pack(*args, **kw)

	def show(self):
		self.show_modal()
		self.destroy()
Example #4
0
 def __init__(self,
              parent,
              modes,
              icons,
              names,
              on_change=None,
              allow_none=False):
     self.modes = modes
     self.mode_buts = []
     self.callback = on_change
     self.allow_none = allow_none
     VPanel.__init__(self, parent)
     for item in self.modes:
         but = ModeToggleButton(self, self, item, icons, names,
                                self.changed, self.allow_none)
         self.mode_buts.append(but)
         self.pack(but)
Example #5
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)
Example #6
0
class SimpleDialog(wx.Dialog, mixins.DialogMixin):
    _timer = None
    add_line = True

    def __init__(
            self, parent, title, size=(-1, -1), style=VERTICAL,
            resizable=False, on_load=None, add_line=True, margin=None):
        dlg_style = wx.DEFAULT_DIALOG_STYLE
        if resizable:
            dlg_style |= wx.RESIZE_BORDER | wx.MAXIMIZE_BOX
        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)

        if margin is None:
            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.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(500)

    def build(self):
        pass

    def set_dialog_buttons(self):
        pass

    def get_result(self):
        return None

    def on_close(self, event=None):
        self.end_modal(const.BUTTON_CANCEL)

    def pack(self, *args, **kw):
        obj = args[0]
        if not obj.GetParent() == self.panel:
            obj.Reparent(self.panel)
        self.panel.pack(*args, **kw)

    def show(self):
        self.show_modal()
        self.destroy()