コード例 #1
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)
コード例 #2
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)
コード例 #3
0
ファイル: dialogs.py プロジェクト: sproaty/whyteboard
 def make_button(self, filename, tooltip, event_handler):
     btn = bitmap_button(self, get_image_path(u"icons", filename), event_handler, False)
     btn.SetToolTipString(tooltip)
     return btn