~tomasgroth/openlp/portable-path

« back to all changes in this revision

Viewing changes to openlp/core/lib/theme.py

  • Committer: Tomas Groth
  • Date: 2019-04-30 19:02:42 UTC
  • mfrom: (2829.2.32 openlp)
  • Revision ID: tomasgroth@yahoo.dk-20190430190242-6zwjk8724tyux70m
trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
###############################################################################
5
5
# OpenLP - Open Source Lyrics Projection                                      #
6
6
# --------------------------------------------------------------------------- #
7
 
# Copyright (c) 2008-2018 OpenLP Developers                                   #
 
7
# Copyright (c) 2008-2019 OpenLP Developers                                   #
8
8
# --------------------------------------------------------------------------- #
9
9
# This program is free software; you can redistribute it and/or modify it     #
10
10
# under the terms of the GNU General Public License as published by the Free  #
31
31
from openlp.core.common.applocation import AppLocation
32
32
from openlp.core.common.json import OpenLPJsonDecoder, OpenLPJsonEncoder
33
33
from openlp.core.display.screens import ScreenList
34
 
from openlp.core.lib import str_to_bool, get_text_file_string
 
34
from openlp.core.lib import get_text_file_string, str_to_bool
 
35
 
35
36
 
36
37
log = logging.getLogger(__name__)
37
38
 
45
46
    Image = 2
46
47
    Transparent = 3
47
48
    Video = 4
 
49
    Stream = 5
48
50
 
49
51
    @staticmethod
50
52
    def to_string(background_type):
61
63
            return 'transparent'
62
64
        elif background_type == BackgroundType.Video:
63
65
            return 'video'
 
66
        elif background_type == BackgroundType.Stream:
 
67
            return 'stream'
64
68
 
65
69
    @staticmethod
66
70
    def from_string(type_string):
77
81
            return BackgroundType.Transparent
78
82
        elif type_string == 'video':
79
83
            return BackgroundType.Video
 
84
        elif type_string == 'stream':
 
85
            return BackgroundType.Stream
80
86
 
81
87
 
82
88
class BackgroundGradientType(object):
197
203
        Set the header and footer size into the current primary screen.
198
204
        10 px on each side is removed to allow for a border.
199
205
        """
200
 
        current_screen = ScreenList().current
 
206
        current_screen_geometry = ScreenList().current.display_geometry
201
207
        self.font_main_y = 0
202
 
        self.font_main_width = current_screen['size'].width() - 20
203
 
        self.font_main_height = current_screen['size'].height() * 9 / 10
204
 
        self.font_footer_width = current_screen['size'].width() - 20
205
 
        self.font_footer_y = current_screen['size'].height() * 9 / 10
206
 
        self.font_footer_height = current_screen['size'].height() / 10
 
208
        self.font_main_width = current_screen_geometry.width() - 20
 
209
        self.font_main_height = current_screen_geometry.height() * 9 / 10
 
210
        self.font_footer_width = current_screen_geometry.width() - 20
 
211
        self.font_footer_y = current_screen_geometry.height() * 9 / 10
 
212
        self.font_footer_height = current_screen_geometry.height() / 10
207
213
 
208
214
    def load_theme(self, theme, theme_path=None):
209
215
        """