def setup_gui(self): self.width = spinctrl(self, 12000, self.config.default_width(), self.on_width) self.height = spinctrl(self, 12000, self.config.default_height(), self.on_height) statusbar = checkbox(self, _("View the status bar"), self.config.statusbar(), self.on_statusbar) toolbar = checkbox(self, _("View the toolbar"), self.config.toolbar(), self.on_toolbar) title = checkbox(self, _("Show the title when printing"), self.config.print_title(), self.on_title) preview = checkbox(self, _("Show the tool preview"), self.config.tool_preview(), self.on_preview) colour = checkbox(self, _("Show the color grid"), self.config.colour_grid(), self.on_colour) transparency = wx.CheckBox(self, label=wordwrap(_("Transparent Bitmap Select (may draw slowly)"), 350, wx.ClientDC(self))) if self.config.bmp_select_transparent(): transparency.SetValue(True) self.sizer.Add(label(self, _("Default Canvas Width")), 0, wx.ALL, 15) self.sizer.Add(self.width, 0, wx.LEFT, 30) self.sizer.Add(label(self, _("Default Canvas Height")), 0, wx.ALL, 15) self.sizer.Add(self.height, 0, wx.LEFT, 30) self.sizer.Add((10, 15)) self.sizer.Add(statusbar, 0, wx.ALL, 10) self.sizer.Add(toolbar, 0, wx.LEFT | wx.BOTTOM, 10) self.sizer.Add(title, 0, wx.LEFT | wx.BOTTOM, 10) self.sizer.Add(preview, 0, wx.LEFT | wx.BOTTOM, 10) self.sizer.Add(colour, 0, wx.LEFT, 10) self.sizer.Add((10, 25)) self.sizer.Add(transparency, 0, wx.LEFT, 10) transparency.Bind(wx.EVT_CHECKBOX, self.on_transparency)
def __init__(self, gui): """ Two spinctrls are used to set the width/height. Canvas updates as the values change """ wx.Dialog.__init__(self, gui, title=_("Resize Canvas")) self.gui = gui gap = wx.LEFT | wx.TOP | wx.RIGHT width, height = self.gui.canvas.buffer.GetSize() self.size = (width, height) self.wctrl = spinctrl(self, 12000, width, self.resize) self.hctrl = spinctrl(self, 12000, height, self.resize) csizer = wx.GridSizer(cols=2, hgap=1, vgap=2) csizer.Add(wx.StaticText(self, label=_("Width:")), 0, wx.TOP | wx.ALIGN_RIGHT, 10) csizer.Add(self.wctrl, 1, gap, 7) csizer.Add(wx.StaticText(self, label=_("Height:")), 0, wx.TOP | wx.ALIGN_RIGHT, 7) csizer.Add(self.hctrl, 1, gap, 7) okButton = button(self, wx.ID_OK, _("&OK"), self.ok) okButton.SetDefault() cancelButton = button(self, wx.ID_CANCEL, _("&Cancel"), self.cancel) applyButton = button(self, wx.ID_APPLY, _("&Apply"), self.apply) btnSizer = wx.StdDialogButtonSizer() btnSizer.AddButton(okButton) btnSizer.AddButton(cancelButton) btnSizer.AddButton(applyButton) btnSizer.Realize() sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(csizer, 0, gap, 7) sizer.Add((10, 15)) sizer.Add(btnSizer, 0, wx.ALIGN_CENTRE | wx.ALL, 5) sizer.Add((15, 5)) self.SetSizer(sizer) self.SetFocus() self.SetEscapeId(cancelButton.GetId()) self.Fit() fix_std_sizer_tab_order(sizer)