Exemplo n.º 1
0
    def __init__(self, config, app):
        super(XkcdBrowser, self).__init__()

        self._app = app

        self._current_comic = None
        self._current_data = None

        self._downloader = XkcdDownloader(config['cache_dir'])

        self._theme = mytheme = theme.get('plugins/xkcd')
        self._heading = pygame.font.Font(datafiles.get(mytheme['font']),
                                         mytheme['heading_size'])

        self._padding = mytheme.get('padding', 5)
        self._frame_y = self._padding * 2 + self._heading.get_linesize()
        self._frame_x = self._padding

        screen_w, screen_h = app.screen.get_size()

        frame_height = screen_h - self._frame_y - self._padding * 2 - self._heading.get_linesize(
        )
        font = pygame.font.Font(datafiles.get(mytheme['font']),
                                mytheme['font_size'])
        frame_height -= 3 * font.get_linesize() + self._padding

        self._scrollable_frame = widgets.ScrollableImage(
            (screen_w - 2 * self._frame_x, frame_height))

        self._caption_y = self._frame_y + frame_height + self._padding
        self._caption_x = self._padding
        self._caption_frame = widgets.TextBox(
            (screen_w - 2 * self._padding, screen_h -
             (self._frame_y + frame_height + self._padding * 2)),
            theme_path='/plugins/xkcd')
Exemplo n.º 2
0
    def __init__(self, app, config):
        super(Clock, self).__init__()
        self._app = app
        self._theme = theme.get('plugins/clock')
        self._font = pygame.font.Font(datafiles.get(self._theme['font']),
                                      self._theme['font_size'])

        self._format = config['format']
Exemplo n.º 3
0
    def __init__(self, text, icon, theme):
        self.text = text

        if icon:
            self.icon = pygame.image.load(icon)
        else:
            self.icon = None

        self.font = pygame.font.Font(datafiles.get(theme['font']),
                                     theme['font_size'])
        self.theme = theme
Exemplo n.º 4
0
    def __init__(self, theme, populator, length_calc=None):
        super(ListView, self).__init__()

        self.theme = theme
        self.font = pygame.font.Font(datafiles.get(theme['font']),
                                     theme['font_size'])

        self.top = 0
        self._selected = 0

        self._populator = populator
        self._length_calc = length_calc
        self.hilight_callback = None
Exemplo n.º 5
0
    def __init__(self, size, align=constants.CENTER, theme_path='/', text=None):
        super(TextBox, self).__init__()

        self._w, self._h = size

        self._align = align
        self._surface = util.alphaSurface(*size)
        self._theme = theme.get(theme_path)
        self._text = None
        self._font = pygame.font.Font(datafiles.get(self._theme['font']), self._theme['font_size'])

        if text:
            self.setText(text)
Exemplo n.º 6
0
    def __init__(self, title, top_path, app):
        super(FileBrowser, self).__init__()
        self._top_path = os.path.realpath(top_path)
        self._path = os.path.realpath(top_path)

        self._title = title
        self._app = app

        self.theme = theme.get('filebrowser')
        self._font = pygame.font.Font(datafiles.get(self.theme['font']), self.theme['font_size'])
        self._font.set_bold(True)

        self._listview = widgets.ListView(theme.get('filebrowser/listview'), self._getDisplayList, self._getListLength)

        self.go('.')

        self._scrollbar = widgets.ScrollBar(theme.get('filebrowser/scrollbar'), self._listview.size()[1])
Exemplo n.º 7
0
    def __init__(self, app, cmd, path, theme):
        super(ProcessRunner, self).__init__()

        self._pid = None
        self._app = app
        self._cmd = cmd
        self._path = path

        self._theme = theme
        self._font = pygame.font.Font(datafiles.get(self._theme['font']),
                                      self._theme['font_size'])
        self._clock = pygame.time.Clock()

        self._should_fullscreen = app.getFullscreen()
        logging.debug("ProcessRunner starts, _should_fullscreen is %s" %
                      self._should_fullscreen)

        self._process_dead = False
        self._old_sig = signal.signal(signal.SIGCHLD, self.processExit)
Exemplo n.º 8
0
 def __init__(self, config, app):
     super(HelloWorld, self).__init__()
     self._img = pygame.image.load(datafiles.get('icon_porn.png'))
     self._app = app
Exemplo n.º 9
0
 def __init__(self, background=None):
     if not background:
         background = datafiles.get('bg-gloomy-720p.jpg')
     self._bg = pygame.image.load(background)
Exemplo n.º 10
0
    def makeButton(self, label):
        icon = datafiles.get('icon_%s.png' % label.lower())
        if not os.path.isfile(icon):
            icon = None

        return widgets.Button(label, icon, theme.get('menu/button'))