Ejemplo n.º 1
0
    def __init__(
        self,
        parent,
        title="Choose Styles",
        label="Choose Styles: ",
        selection_choices=None,
        *args,
        **kwds,
    ):
        """
		:param parent: The parent window.
		:type parent: wx.Window
		:param title:
		:type title: str
		:param label:
		:type label: str
		:param selection_choices:
		:type selection_choices:
		:param id: An identifier for the panel. wx.ID_ANY is taken to mean a default.
		:type id: wx.WindowID, optional
		:param pos: The panel position. The value wx.DefaultPosition indicates a default position,
		chosen by either the windowing system or wxWidgets, depending on platform.
		:type pos: wx.Point, optional
		:param size: The panel size. The value wx.DefaultSize indicates a default size, chosen by
		either the windowing system or wxWidgets, depending on platform.
		:type size: wx.Size, optional
		:param style: The window style. See wx.Panel.
		:type style: int, optional
		:param name: Window name.
		:type name: str, optional
		"""

        self.title = title

        kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_DIALOG_STYLE
        wx.Panel.__init__(self, parent, *args, **kwds)
        self.StylePickerPanel = StylePickerPanel(self, label,
                                                 selection_choices)
        self.button_panel = wx.Panel(self, wx.ID_ANY)
        self.reset_btn = create_button(self.button_panel,
                                       label="Reset",
                                       handler=self.reset)
        self.apply_btn = create_button(self.button_panel,
                                       label="Apply",
                                       handler=self.apply)

        self._do_layout()
	def __init__(
			self, parent, id=wx.ID_ANY,
			message="Do you want to overwrite the existing file?",
			title='Overwrite File?', pos=wx.DefaultPosition, size=wx.DefaultSize,
			style=wx.DEFAULT_DIALOG_STYLE, name=wx.DialogNameStr
			):
		"""
		:param parent: Can be None, a frame or another dialog box.
		:type parent: wx.Window
		:param id: An identifier for the dialog. A value of -1 is taken to mean a default.
		:type id: wx.WindowID
		:param title: The title of the dialog.
		:type title: str
		:param pos: The dialog position. The value DefaultPosition indicates a
		default position, chosen by either the windowing system or wxWidgets,
		depending on platform.
		:type pos: wx.Point
		:param size: The dialog size. The value DefaultSize indicates a default
		size, chosen by either the windowing system or wxWidgets, depending on
		platform.
		:type size: wx.Size
		:param style: The window style.
		:type style: int
		:param name: Used to associate a name with the window, allowing the
		application user to set Motif resource values for individual dialog boxes.
		:type name: str
		"""
		
		wx.Dialog.__init__(self, parent, id=id, title=title, pos=pos, size=size, style=style, name=name)
		
		sizer = wx.BoxSizer(wx.VERTICAL)
		sizer.Add(wx.StaticText(self, label=str(message)), 0, wx.ALL, 10)
		
		btn_sizer = wx.BoxSizer(wx.HORIZONTAL)
		btn_sizer.AddSpacer(10)
		
		self.cancel_btn = create_button(self, label="Cancel", sizer=btn_sizer, handler=self.on_yes)
		self.no_btn = create_button(self, label="&No", sizer=btn_sizer, handler=self.on_yes_to_all)
		self.yes_btn = create_button(self, label="&Yes", sizer=btn_sizer, handler=self.on_no)
		self.yes_to_all_btn = create_button(self, label="Yes to All", sizer=btn_sizer, handler=self.on_cancel)
		
		sizer.Add(btn_sizer, 1, wx.EXPAND | wx.ALIGN_RIGHT | wx.ALL, 10)
		self.SetSizerAndFit(sizer)
		
		self.no_btn.SetFocus()
Ejemplo n.º 3
0
    def create_buttons_sizer(self):
        btn_sizer = wx.GridSizer(1, 4, 0, 0)

        self.cancel_btn = create_button(self, wx.ID_CANCEL, sizer=btn_sizer)
        self.reset_btn = create_button(self,
                                       label="Reset",
                                       handler=self.on_reset,
                                       sizer=btn_sizer)
        self.apply_btn = create_button(self,
                                       wx.ID_APPLY,
                                       handler=self.on_apply,
                                       sizer=btn_sizer)
        self.ok_btn = create_button(self,
                                    wx.ID_OK,
                                    handler=self.on_ok,
                                    sizer=btn_sizer)

        return btn_sizer
Ejemplo n.º 4
0
    def create_buttons_sizer(self):
        btn_sizer = wx.GridSizer(2, 2, 0, 0)

        even_btn_kwargs = dict(sizer_flags=wx.RIGHT, sizer_border=5)
        self.cancel_btn = create_button(self, wx.ID_CANCEL, sizer=btn_sizer)
        self.reset_btn = create_button(self,
                                       label="Reset",
                                       handler=self.on_reset,
                                       sizer=btn_sizer,
                                       **even_btn_kwargs)
        self.apply_btn = create_button(self,
                                       wx.ID_APPLY,
                                       handler=self.on_apply,
                                       sizer=btn_sizer)
        self.ok_btn = create_button(self,
                                    wx.ID_OK,
                                    handler=self.on_ok,
                                    sizer=btn_sizer,
                                    **even_btn_kwargs)

        return btn_sizer
Ejemplo n.º 5
0
    def __init__(self,
                 parent,
                 title="Choose Colours",
                 label="Choose Colours: ",
                 picker_choices=None,
                 selection_choices=None,
                 *args,
                 **kwds):
        self.title = title
        self.picker_choices = picker_choices

        kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_DIALOG_STYLE
        wx.Panel.__init__(self, parent, *args, **kwds)
        self.StylePickerPanel = ColourPickerPanel(self, label,
                                                  selection_choices)
        self.button_panel = wx.Panel(self, wx.ID_ANY)
        self.reset_btn = create_button(self.button_panel,
                                       label="Reset",
                                       handler=self.reset)
        self.apply_btn = create_button(self.button_panel,
                                       label="Apply",
                                       handler=self.apply)

        self._do_layout()
Ejemplo n.º 6
0
    def __init__(self,
                 parent,
                 id=wx.ID_ANY,
                 pos=wx.DefaultPosition,
                 size=wx.DefaultSize,
                 style=wx.TAB_TRAVERSAL,
                 name="NewCalibreButtonPanel"):
        """
		:param parent: The parent window.
		:type parent: wx.Window
		:param id: An identifier for the panel. wx.ID_ANY is taken to mean a default.
		:type id: wx.WindowID, optional
		:param pos: The panel position. The value wx.DefaultPosition indicates a default position,
		chosen by either the windowing system or wxWidgets, depending on platform.
		:type pos: wx.Point, optional
		:param size: The panel size. The value wx.DefaultSize indicates a default size, chosen by
		either the windowing system or wxWidgets, depending on platform.
		:type size: wx.Size, optional
		:param style: The window style. See wx.Panel.
		:type style: int, optional
		:param name: Window name.
		:type name: str, optional
		"""

        wx.Panel.__init__(self,
                          parent,
                          id=id,
                          pos=pos,
                          size=size,
                          name=name,
                          style=style | wx.TAB_TRAVERSAL)

        grid_sizer = wx.BoxSizer(wx.VERTICAL)

        self.new_calibre_btn = create_button(self,
                                             ID_NEW_CALIBRE,
                                             "New Calibre",
                                             sizer=grid_sizer,
                                             sizer_flags=wx.ALIGN_RIGHT
                                             | wx.ALIGN_BOTTOM)
        self.new_calibre_btn.Enable(False)

        self.SetSizer(grid_sizer)
        grid_sizer.Fit(self)
        self.Layout()