forked from openlp/openlp
Revert a few items plus cleanups
This commit is contained in:
parent
7c4671b676
commit
b4329ff781
@ -637,7 +637,7 @@ def build_background_css(item, width):
|
||||
background = 'background: -webkit-gradient(linear, left top, right top, from({start}), to({end})) ' \
|
||||
'fixed'.format(start=theme.background_start_color, end=theme.background_end_color)
|
||||
else:
|
||||
background = 'background: -webkit-gradient(radial, {width1} 50%%, 100, {width2} 50%%, {width3}, ' \
|
||||
background = 'background: -webkit-gradient(radial, {width1} 50%, 100, {width2} 50%, {width3}, ' \
|
||||
'from({start}), to({end})) fixed'.format(width1=width, width2=width, width3=width,
|
||||
start=theme.background_start_color,
|
||||
end=theme.background_end_color)
|
||||
@ -650,21 +650,22 @@ def build_lyrics_css(item):
|
||||
|
||||
:param item: Service Item containing theme and location information
|
||||
"""
|
||||
# TODO: Verify this before converting to python3
|
||||
style = """
|
||||
.lyricstable {
|
||||
z-index: 5;
|
||||
position: absolute;
|
||||
display: table;
|
||||
{stable}
|
||||
%s
|
||||
}
|
||||
.lyricscell {
|
||||
display: table-cell;
|
||||
word-wrap: break-word;
|
||||
-webkit-transition: opacity 0.4s ease;
|
||||
{lyrics}
|
||||
%s
|
||||
}
|
||||
.lyricsmain {
|
||||
{main}
|
||||
%s
|
||||
}
|
||||
"""
|
||||
theme_data = item.theme_data
|
||||
@ -680,7 +681,7 @@ def build_lyrics_css(item):
|
||||
'{shadow2}px;'.format(theme=theme_data.font_main_shadow_color,
|
||||
shadow1=theme_data.font_main_shadow_size,
|
||||
shadow2=theme_data.font_main_shadow_size)
|
||||
lyrics_css = style.format(stable=lyricstable, lyrics=lyrics, main=lyricsmain)
|
||||
lyrics_css = style %(lyricstable, lyrics, lyricsmain)
|
||||
return lyrics_css
|
||||
|
||||
|
||||
@ -723,8 +724,8 @@ def build_lyrics_format_css(theme_data, width, height):
|
||||
else:
|
||||
padding_bottom = '0'
|
||||
lyrics = '{justify} word-wrap: break-word; ' \
|
||||
'text-align: {align}; vertical-align: {valign}; font-family: {font); ' \
|
||||
'font-size: {size}pt; color: {color}; line-height: {line:d}%%; margin: 0;' \
|
||||
'text-align: {align}; vertical-align: {valign}; font-family: {font}; ' \
|
||||
'font-size: {size}pt; color: {color}; line-height: {line:d}%; margin: 0;' \
|
||||
'padding: 0; padding-bottom: {bottom}; padding-left: {left}px; width: {width}px; ' \
|
||||
'height: {height}px; '.format(justify=justify,
|
||||
align=align,
|
||||
|
@ -43,7 +43,7 @@ class PluginManager(RegistryMixin, OpenLPMixin, RegistryProperties):
|
||||
super(PluginManager, self).__init__(parent)
|
||||
self.log_info('Plugin manager Initialising')
|
||||
self.base_path = os.path.abspath(AppLocation.get_directory(AppLocation.PluginsDir))
|
||||
self.log_debug('Base path {path}'.forma(path=self.base_path))
|
||||
self.log_debug('Base path {path}'.format(path=self.base_path))
|
||||
self.plugins = []
|
||||
self.log_info('Plugin manager Initialised')
|
||||
|
||||
|
@ -62,10 +62,10 @@ class SearchEdit(QtWidgets.QLineEdit):
|
||||
right_padding = self.clear_button.width() + frame_width
|
||||
if hasattr(self, 'menu_button'):
|
||||
left_padding = self.menu_button.width()
|
||||
stylesheet = 'QLineEdit { padding-left:{left}spx; padding-right: {right}px; } '.format(left=left_padding,
|
||||
right=right_padding)
|
||||
stylesheet = 'QLineEdit {{ padding-left:{left}px; padding-right: {right}px; }} '.format(left=left_padding,
|
||||
right=right_padding)
|
||||
else:
|
||||
stylesheet = 'QLineEdit { padding-right: {right}px; } '.format(right=right_padding)
|
||||
stylesheet = 'QLineEdit {{ padding-right: {right}px; }} '.format(right=right_padding)
|
||||
self.setStyleSheet(stylesheet)
|
||||
msz = self.minimumSizeHint()
|
||||
self.setMinimumSize(max(msz.width(), self.clear_button.width() + (frame_width * 2) + 2),
|
||||
|
@ -126,44 +126,44 @@ def get_web_page(url, header=None, update_openlp=False):
|
||||
req.add_header('User-Agent', user_agent)
|
||||
if header:
|
||||
req.add_header(header[0], header[1])
|
||||
log.debug('Downloading URL = {url}'.format(url=url))
|
||||
log.debug('Downloading URL = %s' % url)
|
||||
retries = 0
|
||||
while retries <= CONNECTION_RETRIES:
|
||||
retries += 1
|
||||
time.sleep(0.1)
|
||||
try:
|
||||
page = urllib.request.urlopen(req, timeout=CONNECTION_TIMEOUT)
|
||||
log.debug('Downloaded page {url}'.format(url=page.geturl()))
|
||||
log.debug('Downloaded page {text}'.format(text=page.geturl()))
|
||||
break
|
||||
except urllib.error.URLError as err:
|
||||
log.exception('URLError on {url}'.format(url=url))
|
||||
log.exception('URLError: {reason}'.format(reason=err.reason))
|
||||
log.exception('URLError on {text}'.format(text=url))
|
||||
log.exception('URLError: {text}'.format(text=err.reason))
|
||||
page = None
|
||||
if retries > CONNECTION_RETRIES:
|
||||
raise
|
||||
except socket.timeout:
|
||||
log.exception('Socket timeout: {url}'.format(url=url))
|
||||
log.exception('Socket timeout: {text}'.format(text=url))
|
||||
page = None
|
||||
if retries > CONNECTION_RETRIES:
|
||||
raise
|
||||
except socket.gaierror:
|
||||
log.exception('Socket gaierror: {url}'.format(url=url))
|
||||
log.exception('Socket gaierror: {text}'.format(text=url))
|
||||
page = None
|
||||
if retries > CONNECTION_RETRIES:
|
||||
raise
|
||||
except ConnectionRefusedError:
|
||||
log.exception('ConnectionRefused: {url}'.format(url=url))
|
||||
log.exception('ConnectionRefused: {text}'.format(text=url))
|
||||
page = None
|
||||
if retries > CONNECTION_RETRIES:
|
||||
raise
|
||||
break
|
||||
except ConnectionError:
|
||||
log.exception('Connection error: {url}'.format(urll=url))
|
||||
log.exception('Connection error: {text}'.format(text=url))
|
||||
page = None
|
||||
if retries > CONNECTION_RETRIES:
|
||||
raise
|
||||
except HTTPException:
|
||||
log.exception('HTTPException error: {url}'.format(url=url))
|
||||
log.exception('HTTPException error: {text}'.format(text=url))
|
||||
page = None
|
||||
if retries > CONNECTION_RETRIES:
|
||||
raise
|
||||
@ -173,7 +173,7 @@ def get_web_page(url, header=None, update_openlp=False):
|
||||
if update_openlp:
|
||||
Registry().get('application').process_events()
|
||||
if not page:
|
||||
log.exception('{url} could not be downloaded'.format(url=url))
|
||||
log.exception('{text} could not be downloaded'.format(text=url))
|
||||
return None
|
||||
log.debug(page)
|
||||
return page
|
||||
|
Loading…
Reference in New Issue
Block a user