コード例 #1
0
ファイル: preferences.py プロジェクト: sproaty/whyteboard
    def setup_gui(self):
        sizer = wx.BoxSizer(wx.VERTICAL)        
        self.tabs = wx.Notebook(self)
        
        params = [self.tabs, self.gui, self.config]
        self.tabs.AddPage(General(*params), _("General"))
        self.tabs.AddPage(View(*params), _("View"))
        self.tabs.AddPage(PDF(*params), _("PDF Conversion"))
        
        okay = button(self, wx.ID_OK, _("&OK"), self.on_okay)
        cancel = button(self, wx.ID_CANCEL, _("&Cancel"), self.on_cancel)
        _help = button(self, wx.ID_HELP, _("&Help"), self.on_help)
        okay.SetDefault()
        btnSizer = wx.StdDialogButtonSizer()
        btnSizer.AddButton(okay)
        btnSizer.AddButton(cancel)
        btnSizer.Add(_help, 0, wx.ALIGN_LEFT | wx.LEFT, 10)
        btnSizer.Realize()

        sizer.Add(self.tabs, 2, wx.EXPAND | wx.ALL, 10)
        sizer.Add((10, 10))
        sizer.Add(btnSizer, 0, wx.ALIGN_CENTRE | wx.BOTTOM, 10)
        self.SetSizer(sizer)
        sizer.Layout()
        self.SetFocus()
コード例 #2
0
ファイル: dialogs.py プロジェクト: sproaty/whyteboard
    def __init__(self, parent, gui, method):
        wx.Dialog.__init__(self, gui, title=_("ImageMagick Notification"))
        self.gui = gui
        self.method = method
        self.path = u"C:/Program Files/"

        t = (_("Whyteboard uses ImageMagick to load PDF, SVG and PS files. \nPlease select its installed location."))
        text = wx.StaticText(self, label=t)
        btn = button(self, wx.NewId(), _("Find location..."), self.browse)
        gap = wx.LEFT | wx.TOP | wx.RIGHT

        self.okButton = button(self, wx.ID_OK, _("&OK"), self.ok)
        self.okButton.SetDefault()
        self.cancelButton = button(self, wx.ID_CANCEL, _("&Cancel"), self.cancel)
        btnSizer = wx.StdDialogButtonSizer()
        btnSizer.AddButton(self.okButton)
        btnSizer.AddButton(self.cancelButton)
        btnSizer.Realize()

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(text, 1, gap | wx.EXPAND, 10)
        sizer.Add(btn, 0, gap | wx.ALIGN_CENTRE, 20)
        sizer.Add((10, 20)) # Spacer.
        sizer.Add(btnSizer, 0, wx.BOTTOM | wx.ALIGN_CENTRE, 12)
        self.SetSizer(sizer)
        sizer.Fit(self)
        self.SetFocus()
コード例 #3
0
ファイル: dialogs.py プロジェクト: sproaty/whyteboard
    def __init__(self, gui, name, method, style, args):
        wx.Dialog.__init__(self, gui, title=_("Save File?"))
        self.gui = gui
        self.method = method
        self.args = args
        logger.debug("Prompting for save, with method %s and arguments %s", method, args)

        warning = wx.ArtProvider.GetBitmap(wx.ART_WARNING, wx.ART_CMN_DIALOG)
        bmp = wx.StaticBitmap(self, bitmap=warning)
        btnSizer = wx.StdDialogButtonSizer()
        mainSizer = wx.BoxSizer(wx.VERTICAL)
        iconSizer = wx.BoxSizer(wx.HORIZONTAL)
        textSizer = wx.BoxSizer(wx.VERTICAL)
        container = wx.BoxSizer(wx.HORIZONTAL)

        top_message = wx.StaticText(self, label=_('Save changes to "%s" before closing?') % name)
        bottom_message = wx.StaticText(self, label=self.get_time())

        font = create_bold_font()
        font.SetPointSize(font.GetPointSize() + 1)
        top_message.SetFont(font)

        if not self.gui.util.filename:
            saveButton = button(self, wx.ID_SAVE, _("Save &As..."), self.okay)
        else:
            saveButton = button(self, wx.ID_SAVE, _("&Save"), self.okay)

        if style == wx.YES_NO | wx.CANCEL:
            cancelButton = wx.Button(self, wx.ID_CANCEL, _("&Cancel"))
            btnSizer.AddButton(cancelButton)

        noButton = button(self, wx.ID_NO, _("&Don't Save"), self.no)
        saveButton.SetDefault()

        btnSizer.AddButton(noButton)
        btnSizer.AddButton(saveButton)
        btnSizer.Realize()
        iconSizer.Add(bmp, 0)

        textSizer.Add(top_message)
        textSizer.Add((10, 10))
        textSizer.Add(bottom_message)

        container.Add(iconSizer, 0, wx.LEFT, 15)
        container.Add((15, -1))
        container.Add(textSizer, 1, wx.RIGHT, 15)
        container.Layout()

        mainSizer.Add((10, 15))
        mainSizer.Add(container, wx.ALL, 30)
        mainSizer.Add((10, 10))
        mainSizer.Add(btnSizer, 0, wx.TOP | wx.BOTTOM | wx.ALIGN_CENTRE, 15)

        self.SetSizerAndFit(mainSizer)
        self.SetFocus()
        self.SetAutoLayout(True)
        fix_std_sizer_tab_order(btnSizer)
コード例 #4
0
ファイル: preferences.py プロジェクト: sproaty/whyteboard
    def setup_gui(self):
        self.im_result = None
        self.sizer.Add(label(self, _("Conversion Quality:")), 0, wx.ALL, 15)
        
        buttons = {'highest': _("Highest"),
                   'high': _("High"),
                   'normal': _("Normal")}

        for key, value in buttons.items():
            btn = wx.RadioButton(self, label=value)
            self.sizer.Add(btn, 0, wx.LEFT, 30)
            self.sizer.Add((10, 5))
            method = lambda evt, x=key: self.on_quality(evt, x)
            btn.Bind(wx.EVT_RADIOBUTTON, method)
            
            if self.config.convert_quality() == key:
                btn.SetValue(True)

        note = wx.StaticText(self, label=wordwrap(_("Note: Higher quality takes longer to convert"), 350, wx.ClientDC(self.gui)))
        self.sizer.Add((10, 10))
        self.sizer.Add(note, 0, wx.LEFT | wx.BOTTOM, 30)

        if os.name == "nt":
            self.im_button = button(self, wx.NewId(), "", self.on_im)
            self.set_im_button()

            self.sizer.Add(label(self, _("ImageMagick Location")), 0, wx.LEFT, 15)
            self.sizer.Add((10, 15))
            self.sizer.Add(self.im_button, 0, wx.LEFT, 30)
コード例 #5
0
ファイル: dialogs.py プロジェクト: sproaty/whyteboard
    def __init__(self, gui):
        wx.Dialog.__init__(self, gui, title=_("History Player"), size=(225, 140))
        self.gui = gui
        self.looping = False
        self.paused = False

        self.playButton = bitmap_button(self, get_image_path(u"icons", u"play"), self.play, True, True)
        self.pauseButton = bitmap_button(self, get_image_path(u"icons", u"pause"), self.pause, True, True)
        self.stopButton = bitmap_button(self, get_image_path(u"icons", u"stop"), self.stop, True, True)
        closeButton = button(self, wx.ID_CANCEL, _("&Close"), self.on_close)
        closeButton.SetDefault()

        sizer = wx.BoxSizer(wx.VERTICAL)
        historySizer = wx.BoxSizer(wx.HORIZONTAL)
        historySizer.Add(self.playButton, 0, wx.ALL, 2)
        historySizer.Add(self.pauseButton, 0, wx.ALL, 2)
        historySizer.Add(self.stopButton, 0, wx.ALL, 2)

        sizer.Add(historySizer, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 13)
        sizer.Add((10, 5))
        sizer.Add(closeButton, 0, wx.ALIGN_CENTRE | wx.BOTTOM, 13)
        self.SetSizer(sizer)
        self.SetEscapeId(closeButton.GetId())
        self.SetFocus()
        self.toggle_buttons()

        self.Bind(wx.EVT_CLOSE, self.on_close)
コード例 #6
0
ファイル: dialogs.py プロジェクト: sproaty/whyteboard
    def __init__(self, gui):
        wx.Dialog.__init__(self, gui, title=_("Send Feedback"))

        t_lbl = wx.StaticText(self, label=_("Your Feedback:"))
        email_label = wx.StaticText(self, label=_("E-mail Address"))
        self.feedback = wx.TextCtrl(self, size=(350, 250), style=wx.TE_MULTILINE)
        self.email = wx.TextCtrl(self)

        cancel_b = wx.Button(self, wx.ID_CANCEL, _("&Cancel"))
        send_b = button(self, wx.ID_OK, _("Send &Feedback"), self.submit)
        send_b.SetDefault()
        btnSizer = wx.StdDialogButtonSizer()
        btnSizer.AddButton(send_b)
        btnSizer.AddButton(cancel_b)
        btnSizer.Realize()

        font = create_bold_font()
        t_lbl.SetFont(font)
        email_label.SetFont(font)

        vsizer = wx.BoxSizer(wx.VERTICAL)
        vsizer.Add((10, 10))
        vsizer.Add(t_lbl, 0, wx.LEFT | wx.RIGHT, 10)
        vsizer.Add(self.feedback, 0, wx.EXPAND | wx.ALL, 10)
        vsizer.Add((10, 10))
        vsizer.Add(email_label, 0, wx.ALL, 10)
        vsizer.Add(self.email, 0, wx.EXPAND | wx.LEFT | wx.RIGHT, 10)
        vsizer.Add((10, 10))
        vsizer.Add(btnSizer, 0, wx.TOP | wx.BOTTOM | wx.ALIGN_CENTRE, 15)

        self.SetSizerAndFit(vsizer)
        self.SetFocus()
        self.SetAutoLayout(True)
コード例 #7
0
ファイル: dialogs.py プロジェクト: sproaty/whyteboard
    def setup_gui(self):        
        fontBtn = button(self, wx.NewId(), _("Select Font"), self.on_font)
        self.colourBtn = wx.ColourPickerCtrl(self)
        self.okButton = wx.Button(self, wx.ID_OK, _("&OK"))
        self.cancelButton = wx.Button(self, wx.ID_CANCEL, _("&Cancel"))
        self.colourBtn.SetColour(self.colour)

        font_colour_sizer = wx.BoxSizer(wx.HORIZONTAL)
        font_colour_sizer.Add(fontBtn, 0, wx.RIGHT, 5)
        font_colour_sizer.Add(self.colourBtn, 0)
        btnSizer = wx.StdDialogButtonSizer()
        btnSizer.AddButton(self.okButton)
        btnSizer.AddButton(self.cancelButton)
        btnSizer.Realize()
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.ctrl, 1, wx.LEFT | wx.TOP | wx.RIGHT | wx.EXPAND, 10)
        sizer.Add(font_colour_sizer, 0, wx.ALIGN_RIGHT | wx.RIGHT | wx.LEFT | wx.TOP, 10)
        sizer.Add((10, 10))  # Spacer.
        sizer.Add(btnSizer, 0, wx.BOTTOM | wx.ALIGN_CENTRE, 10)
        self.SetSizer(sizer)
        
        self.okButton.SetDefault()        
        fix_std_sizer_tab_order(btnSizer)
        self.set_focus()
        
        self.Bind(wx.EVT_COLOURPICKER_CHANGED, self.on_colour, self.colourBtn)
        self.Bind(wx.EVT_TEXT, self.update_canvas, self.ctrl)

        ac = [(wx.ACCEL_CTRL, wx.WXK_RETURN, self.okButton.GetId())]
        tbl = wx.AcceleratorTable(ac)
        self.SetAcceleratorTable(tbl)
コード例 #8
0
ファイル: dialogs.py プロジェクト: sproaty/whyteboard
    def __init__(self, gui, cache):
        wx.Dialog.__init__(self, gui, title=_("PDF Cache Viewer"), size=(650, 300),
                           style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)
        self.cache = cache
        self.files = cache.entries()
        self.original_files = dict(cache.entries())
        self.list = WhyteboardList(self)
        self.SetSizeHints(450, 300)

        label = wx.StaticText(self, label=_("Whyteboard will load these files from its cache instead of re-converting them"))
        sizer = wx.BoxSizer(wx.VERTICAL)
        bsizer = wx.BoxSizer(wx.HORIZONTAL)

        self.deleteBtn = bitmap_button(self, get_image_path(u"icons", u"delete"), self.on_remove, False)
        self.deleteBtn.SetToolTipString(_("Remove cached item"))
        bsizer.Add(self.deleteBtn, 0, wx.RIGHT, 5)

        okButton = button(self, wx.ID_OK, _("&OK"), self.ok)
        cancelButton = button(self, wx.ID_CANCEL, _("&Cancel"), lambda x: self.Close())
        cancelButton.SetDefault()
        btnSizer = wx.StdDialogButtonSizer()
        btnSizer.AddButton(okButton)
        btnSizer.AddButton(cancelButton)
        btnSizer.Realize()

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(label, 0, wx.ALL, 15)
        sizer.Add((10, 5))
        sizer.Add(bsizer, 0, wx.LEFT | wx.EXPAND, 10)
        sizer.Add((10, 5))
        sizer.Add(self.list, 1, wx.LEFT | wx.RIGHT | wx.EXPAND, 10)
        sizer.Add((10, 5))
        sizer.Add(btnSizer, 0, wx.TOP | wx.BOTTOM | wx.ALIGN_CENTRE, 15)
        self.SetSizer(sizer)
        self.populate()
        self.check_buttons()
        self.SetEscapeId(cancelButton.GetId())
        self.SetFocus()

        self.Bind(wx.EVT_LIST_ITEM_SELECTED, lambda x: self.check_buttons())
        self.Bind(wx.EVT_LIST_ITEM_DESELECTED, lambda x: self.check_buttons())

        ac = [(wx.ACCEL_NORMAL, wx.WXK_DELETE, self.deleteBtn.GetId())]
        tbl = wx.AcceleratorTable(ac)
        self.list.SetAcceleratorTable(tbl)
        self.Bind(wx.EVT_CHAR_HOOK, self.delete_key)
コード例 #9
0
ファイル: dialogs.py プロジェクト: sproaty/whyteboard
    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)
コード例 #10
0
ファイル: preferences.py プロジェクト: sproaty/whyteboard
    def setup_gui(self):
        self.buttons = []
        self.grid = wx.GridSizer(cols=3, hgap=2, vgap=2)

        translated = [i[1] for i in meta.languages]
        translated.sort()
        self.lang = wx.ComboBox(self, choices=translated, style=wx.CB_READONLY, size=(240, 30))
        self.lang.Layout()
        self.lang.SetValue(_(self.config.language()))

        colours = []
        for x in range(1, 10):
            col = self.config.colour(x)
            colours.append([int(c) for c in col])

        for x, colour in enumerate(colours):
            method = lambda evt, _id = x: self.on_colour(evt, _id)
            b = wx.BitmapButton(self, bitmap=create_colour_bitmap(colour))
            self.buttons.append(b)
            self.grid.Add(b, 0)
            b.Bind(wx.EVT_BUTTON, method)

        self.fontBtn = button(self, wx.NewId(), _("Select Font"), self.on_font)
        font = wx.SystemSettings.GetFont(wx.SYS_SYSTEM_FONT)
        self.font = font  # the correct font, w/ right size
        self.size = font.GetPointSize()  # size to use regardless of font

        if self.config.default_font():
            f = wx.FFont(1, wx.FONTFAMILY_DEFAULT)
            f.SetNativeFontInfoFromString(self.config.default_font())
            self.font = f
            self.fontBtn.SetFont(f)
            self.fontBtn.SetLabel(self.config.default_font())
            if os.name == "nt":
                self.font_label(f)

            f = wx.FFont(1, wx.FONTFAMILY_DEFAULT)
            f.SetNativeFontInfoFromString(self.config.default_font())
            f.SetPointSize(self.size)
            self.fontBtn.SetFont(f)
        else:
            if os.name == "nt":
                self.font_label(self.font)
            else:
                self.fontBtn.SetLabel(self.fontBtn.GetFont().GetNativeFontInfoDesc())

        self.sizer.Add(label(self, _("Choose Your Language:")), 0, wx.ALL, 15)
        self.sizer.Add(self.lang, 0, wx.LEFT, 30)
        self.sizer.Add((10, 15))
        self.sizer.Add(label(self, _("Choose Your Custom Colors:")), 0, wx.ALL, 15)
        self.sizer.Add(self.grid, 0, wx.LEFT | wx.BOTTOM, 30)
        self.sizer.Add(label(self, _("Default Font:")), 0, wx.LEFT, 15)
        self.sizer.Add((10, 15))
        self.sizer.Add(self.fontBtn, 0, wx.LEFT, 30)
        
        self.lang.Bind(wx.EVT_COMBOBOX, self.on_lang)
コード例 #11
0
ファイル: dialogs.py プロジェクト: sproaty/whyteboard
    def __init__(self, parent, license):
        wx.Dialog.__init__(self, parent, title=_("License"), size=(500, 400),
                           style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)
        self.SetMinSize((400, 300))
        self.SetIcon(icon.GetIcon())
        close = button(self, wx.ID_CANCEL, _("&Close"), lambda evt: self.Destroy())

        ctrl = wx.TextCtrl(self, style=wx.TE_READONLY | wx.TE_MULTILINE)
        ctrl.SetValue(license)

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(ctrl, 1, wx.EXPAND | wx.ALL, 10)
        sizer.Add(close, flag=wx.ALIGN_RIGHT | wx.RIGHT | wx.BOTTOM, border=10)
        self.SetSizer(sizer)
        self.Layout()
        self.Show()

#----------------------------------------------------------------------
コード例 #12
0
ファイル: dialogs.py プロジェクト: sproaty/whyteboard
    def __init__(self, parent, info):
        wx.Dialog.__init__(self, parent, title=_("About Whyteboard"))

        image = wx.StaticBitmap(self, bitmap=icon.GetBitmap())
        name = wx.StaticText(self, label="%s %s" % (info.Name, info.Version))
        description = wx.StaticText(self, label=info.Description)
        copyright = wx.StaticText(self, label=info.Copyright)
        url = HyperLinkCtrl(self, label=info.WebSite[0], URL=info.WebSite[1])

        font = create_bold_font()
        font.SetPointSize(18)
        name.SetFont(font)

        btnSizer = wx.BoxSizer(wx.HORIZONTAL)
        buttons = {_("C&redits"): (wx.ID_ABOUT, wx.LEFT | wx.RIGHT,
                                   lambda evt: CreditsDialog(self, info)),
                  _("&License"): (wx.ID_ANY, wx.RIGHT,
                                   lambda evt: LicenseDialog(self, info.License)),
                  _("&Close"): (wx.ID_CANCEL, wx.RIGHT,
                                   lambda evt: self.Destroy())}

        for label, values in buttons.items():
            btn = button(self, values[0], label, values[2])
            btnSizer.Add(btn, flag=wx.CENTER | values[1], border=5)

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(image, flag=wx.CENTER | wx.TOP | wx.BOTTOM, border=5)
        sizer.Add(name, flag=wx.CENTER | wx.BOTTOM, border=10)
        sizer.Add(description, flag=wx.CENTER | wx.BOTTOM, border=10)
        sizer.Add(copyright, flag=wx.CENTER | wx.BOTTOM, border=10)
        sizer.Add(url, flag=wx.CENTER | wx.BOTTOM, border=15)
        sizer.Add(btnSizer, flag=wx.CENTER | wx.BOTTOM, border=5)

        container = wx.BoxSizer(wx.VERTICAL)
        container.Add(sizer, flag=wx.ALL, border=10)
        self.SetSizerAndFit(container)
        self.Centre()
        self.Show(True)
コード例 #13
0
ファイル: dialogs.py プロジェクト: sproaty/whyteboard
    def __init__(self, gui):
        wx.Dialog.__init__(self, gui, title=_("Updates"), size=(250, 150))
        self.gui = gui
        self.updater = Updater()
        self.downloaded_byte_count = 0
        wx.CallAfter(self.check)  # show the dialog *then* check server

        self.text = wx.StaticText(self, label=_("Connecting to server..."), size=(-1, 80))
        cancel = wx.Button(self, wx.ID_CANCEL, _("&Cancel"))
        self.btn = button(self, wx.ID_OK, _("Update"), self.update)
        self.btn.Enable(False)
        btnSizer = wx.StdDialogButtonSizer()
        btnSizer.AddButton(cancel)
        btnSizer.AddButton(self.btn)
        btnSizer.Realize()

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.text, 0, wx.LEFT | wx.TOP | wx.RIGHT, 10)
        sizer.Add(btnSizer, 0, wx.ALIGN_CENTRE)
        sizer.Add((1, 5))        
        self.SetSizer(sizer)
        
        self.SetFocus()
コード例 #14
0
ファイル: dialogs.py プロジェクト: sproaty/whyteboard
    def __init__(self, gui, title, cancellable=False):
        """Defines a gauge and a timer which updates the gauge."""
        wx.Dialog.__init__(self, gui, title=title, style=wx.CAPTION)
        self.gui = gui
        self.timer = wx.Timer(self)
        self.gauge = wx.Gauge(self, range=100, size=(180, 30))
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.gauge, 0, wx.ALL, 10)

        if cancellable:
            cancel = button(self, wx.ID_CANCEL, _("&Cancel"), self.on_cancel)
            cancel.SetDefault()
            btnSizer = wx.StdDialogButtonSizer()
            btnSizer.AddButton(cancel)
            btnSizer.Realize()
            sizer.Add(btnSizer, 0, wx.ALIGN_CENTER | wx.TOP | wx.BOTTOM, 10)

        self.SetSizer(sizer)
        sizer.Fit(self)
        self.SetFocus()

        self.Bind(wx.EVT_TIMER, self.on_timer, self.timer)
        self.timer.Start(95)
コード例 #15
0
ファイル: dialogs.py プロジェクト: sproaty/whyteboard
    def __init__(self, parent, info):
        wx.Dialog.__init__(self, parent, title=_("Credits"), size=(475, 320),
                           style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)
        self.SetIcon(icon.GetIcon())
        self.SetMinSize((300, 200))
        notebook = wx.Notebook(self)
        close = button(self, wx.ID_CANCEL, _("&Close"), lambda evt: self.Destroy())
        close.SetDefault()

        labels = [_("Written by"), _("Translated by")]
        texts = [info.Developers, info.Translators]

        for label, text in zip(labels, texts):
            btn = wx.TextCtrl(notebook, style=wx.TE_READONLY | wx.TE_MULTILINE)
            btn.SetValue(u"\n".join(text))
            notebook.AddPage(btn, text=label)

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(notebook, 1, wx.EXPAND | wx.ALL, 10)
        sizer.Add(close, flag=wx.ALIGN_RIGHT | wx.RIGHT | wx.BOTTOM, border=10)
        self.SetSizer(sizer)
        self.Layout()
        self.Show()
コード例 #16
0
ファイル: dialogs.py プロジェクト: sproaty/whyteboard
    def __init__(self, gui):
        """
        Initialise and populate the listbox
        """
        wx.Dialog.__init__(self, gui, title=_("Shape Viewer"), size=(550, 400),
                           style=wx.DEFAULT_DIALOG_STYLE | wx.MINIMIZE_BOX |
                           wx.MAXIMIZE_BOX | wx.RESIZE_BORDER | wx.WANTS_CHARS)
        self.gui = gui
        self.count = 0
        self.shapes = list(self.gui.canvas.shapes)
        self.SetSizeHints(550, 400)

        label = wx.StaticText(self, label=_("Shapes at the top of the list are drawn over shapes at the bottom"))
        sizer = wx.BoxSizer(wx.VERTICAL)
        bsizer = wx.BoxSizer(wx.HORIZONTAL)
        nextprevsizer = wx.BoxSizer(wx.HORIZONTAL)

        self.moveUp = self.make_button(u"move-up", _("Move Shape Up"), self.on_up)
        self.moveTop = self.make_button(u"move-top", _("Move Shape To Top"), self.on_top)
        self.moveDown = self.make_button(u"move-down", _("Move Shape Down"), self.on_down)
        self.moveBottom = self.make_button(u"move-bottom", _("Move Shape To Bottom"), self.on_bottom)
        self.deleteBtn = self.make_button(u"delete", _("Delete Shape"), self.on_delete)
        self.prev = self.make_button(u"prev_sheet", _("Previous Sheet"), self.on_prev)
        self.next = self.make_button(u"next_sheet", _("Next Sheet"), self.on_next)

        self.pages = wx.ComboBox(self, size=(125, 25), style=wx.CB_READONLY)
        self.list = WhyteboardList(self)
        self.list.InsertColumn(0, _("Position"))
        self.list.InsertColumn(1, _("Type"))
        self.list.InsertColumn(2, _("Thickness"))
        self.list.InsertColumn(3, _("Color"))
        self.list.InsertColumn(4, _("Properties"))

        bsizer.AddMany([(self.moveTop, 0, wx.RIGHT, 5), (self.moveUp, 0, wx.RIGHT, 5), 
                        (self.moveDown, 0, wx.RIGHT, 5), (self.moveBottom, 0, wx.RIGHT, 5),
                        (self.deleteBtn, 0, wx.RIGHT, 5)])
        nextprevsizer.Add(self.prev, 0, wx.RIGHT, 5)
        nextprevsizer.Add(self.next)

        bsizer.Add((1, 1), 1, wx.EXPAND)  # align to the right
        bsizer.Add(nextprevsizer, 0, wx.RIGHT, 10)
        bsizer.Add(self.pages, 0, wx.RIGHT | wx.ALIGN_CENTER_VERTICAL, 10)

        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(label, 0, wx.ALL, 15)
        sizer.Add((10, 5))
        sizer.Add(bsizer, 0, wx.LEFT | wx.EXPAND, 10)
        sizer.Add((10, 15))
        sizer.Add(self.list, 1, wx.LEFT | wx.RIGHT | wx.EXPAND, 10)
        sizer.Add((10, 5))
        sizer.Add(btnSizer, 0, wx.TOP | wx.BOTTOM | wx.ALIGN_CENTRE, 15)
        self.SetSizer(sizer)
        self.populate()
        self.Fit()
        self.SetFocus()
        self.SetEscapeId(cancelButton.GetId())

        self.pages.Bind(wx.EVT_COMBOBOX, self.on_change_sheet)
        self.Bind(wx.EVT_CLOSE, self.on_close)

        ac = [(wx.ACCEL_NORMAL, wx.WXK_DELETE, self.deleteBtn.GetId())]
        tbl = wx.AcceleratorTable(ac)
        self.list.SetAcceleratorTable(tbl)
        self.Bind(wx.EVT_CHAR_HOOK, self.delete_key)

        pub.subscribe(self.sheet_rename, 'sheet.rename')
        pub.subscribe(self.update, 'update_shape_viewer')

        ids = [self.moveUp.GetId(), self.moveTop.GetId(), self.moveDown.GetId(),
               self.moveBottom.GetId(), self.deleteBtn.GetId(), self.prev.GetId(), self.next.GetId()]

        [self.Bind(wx.EVT_UPDATE_UI, self.update_buttons, id=x) for x in ids]