コード例 #1
0
 def create_body(self, parent):
     width = settings.POPUP_WIDTH - 28
     if self.item.link:
         link = controls.Link(parent, width, self.item.link, self.item.title)
     else:
         link = controls.Text(parent, width, self.item.title)
     link.SetBackgroundColour(wx.WHITE)
     font = link.GetFont()
     font.SetWeight(wx.BOLD)
     font.SetPointSize(12)
     link.SetFont(font)
     text = controls.Text(parent, width, self.item.description)
     text.SetBackgroundColour(wx.WHITE)
     font = text.GetFont()
     font.SetPointSize(10)
     text.SetFont(font)
     sizer = wx.BoxSizer(wx.VERTICAL)
     sizer.AddSpacer(5)
     sizer.Add(link, 0, wx.EXPAND|wx.LEFT|wx.RIGHT, 10)
     sizer.AddSpacer(5)
     sizer.Add(text, 0, wx.EXPAND|wx.LEFT|wx.RIGHT, 10)
     sizer.AddSpacer(10)
     self.bind_links([link])
     self.bind_widgets([text])
     return sizer
コード例 #2
0
    def create_footer(self, parent):
        """[summary]

        Arguments:
            parent {[type]} -- [description]

        Returns:
            [type] -- [description]
        """

        panel = wx.Panel(parent, -1)
        panel.SetBackgroundColour(wx.Colour(*BACKGROUND))
        panel.SetForegroundColour(wx.BLACK)
        first = controls.BitmapLink(panel, popups.COMMAND_FIRST, wx.Bitmap(
            'icons/control_start.png'), wx.Bitmap('icons/control_start_blue.png'))
        previous = controls.BitmapLink(panel, popups.COMMAND_PREVIOUS, wx.Bitmap(
            'icons/control_rewind.png'), wx.Bitmap('icons/control_rewind_blue.png'))
        text = '%s of %s' % (
            self.context['item_index'], self.context['item_count'])
        text = controls.Text(panel, 0, text)
        text.SetBackgroundColour(wx.Colour(*BACKGROUND))
        text.fit_no_wrap()
        next = controls.BitmapLink(panel, popups.COMMAND_NEXT, wx.Bitmap(
            'icons/control_fastforward.png'), wx.Bitmap('icons/control_fastforward_blue.png'))
        last = controls.BitmapLink(panel, popups.COMMAND_LAST, wx.Bitmap(
            'icons/control_end.png'), wx.Bitmap('icons/control_end_blue.png'))
        play = controls.BitmapLink(panel, popups.COMMAND_PLAY, wx.Bitmap(
            'icons/control_play.png'), wx.Bitmap('icons/control_play_blue.png'))
        pause = controls.BitmapLink(panel, popups.COMMAND_PAUSE, wx.Bitmap(
            'icons/control_pause.png'), wx.Bitmap('icons/control_pause_blue.png'))
        widgets = [first, previous, next, last, play, pause]
        self.bind_links(widgets)
        for widget in widgets:
            widget.SetBackgroundColour(wx.Colour(*BACKGROUND))
        sizer = wx.BoxSizer(wx.HORIZONTAL)
        sizer.AddSpacer(10)
        sizer.Add(first, 0, wx.TOP | wx.BOTTOM, 5)
        sizer.AddSpacer(8)
        sizer.Add(previous, 0, wx.TOP | wx.BOTTOM, 5)
        sizer.AddSpacer(8)
        sizer.Add(text, 0, wx.ALIGN_CENTER_VERTICAL | wx.TOP | wx.BOTTOM, 5)
        sizer.AddSpacer(8)
        sizer.Add(next, 0, wx.TOP | wx.BOTTOM, 5)
        sizer.AddSpacer(8)
        sizer.Add(last, 0, wx.TOP | wx.BOTTOM, 5)
        sizer.AddStretchSpacer(1)
        sizer.Add(play, 0, wx.TOP | wx.BOTTOM, 5)
        sizer.AddSpacer(8)
        sizer.Add(pause, 0, wx.TOP | wx.BOTTOM, 5)
        sizer.AddSpacer(10)
        panel.SetSizer(sizer)
        self.bind_widgets([panel, text])

        return panel
コード例 #3
0
 def create_feed(self, parent, icon_width):
     width = settings.POPUP_WIDTH - 64 - icon_width
     if self.item.feed.link:
         link = controls.Link(parent, width, self.item.feed.link, self.item.feed.title)
     else:
         link = controls.Text(parent, width, self.item.feed.title)
     link.SetBackgroundColour(wx.Colour(*BACKGROUND))
     font = link.GetFont()
     font.SetWeight(wx.BOLD)
     link.SetFont(font)
     if self.item.author:
         info = '%s ago by %s' % (self.item.time_since, self.item.author)
     else:
         info = '%s ago' % self.item.time_since
     info = controls.Text(parent, width, info)
     info.SetBackgroundColour(wx.Colour(*BACKGROUND))
     sizer = wx.BoxSizer(wx.VERTICAL)
     sizer.Add(link, 0, wx.EXPAND)
     sizer.Add(info, 0, wx.EXPAND)
     self.bind_links([link])
     self.bind_widgets([info])
     return sizer