Commit 0c5f506c authored by Philipp Hörist's avatar Philipp Hörist

Fix some pylint errors

parent 870fe1a4
Pipeline #4322 passed with stages
in 2 minutes and 46 seconds
......@@ -363,14 +363,23 @@ class Preferences(Gtk.ApplicationWindow):
create_av_combobox('audio_output', AudioOutputManager().get_devices())
create_av_combobox('video_input', VideoInputManager().get_devices())
create_av_combobox('video_framerate', {_('Default'): '',
'15fps': '15/1', '10fps': '10/1', '5fps': '5/1',
'2.5fps': '5/2'}, 'video_framerate', key=lambda x: -1 if \
not x[1] else float(x[0][:-3]))
create_av_combobox('video_size', {_('Default'): '',
'800x600': '800x600', '640x480': '640x480',
'320x240': '320x240'}, 'video_size', key=lambda x: -1 if \
not x[1] else int(x[0][:3]))
create_av_combobox(
'video_framerate',
{_('Default'): '',
'15fps': '15/1',
'10fps': '10/1',
'5fps': '5/1',
'2.5fps': '5/2'},
'video_framerate',
key=lambda x: -1 if not x[1] else float(x[0][:-3]))
create_av_combobox(
'video_size',
{_('Default'): '',
'800x600': '800x600',
'640x480': '640x480',
'320x240': '320x240'},
'video_size',
key=lambda x: -1 if not x[1] else int(x[0][:3]))
st = app.config.get('video_see_self')
self._ui.video_see_self_checkbutton.set_active(st)
......@@ -378,13 +387,22 @@ class Preferences(Gtk.ApplicationWindow):
label = self._ui.selected_video_output
sink, widget, name = self.setup_video_output()
if sink is None:
log.error('Failed to obtain a working Gstreamer GTK+ sink, video support will be disabled')
log.error('Failed to obtain a working Gstreamer GTK+ sink, '
'video support will be disabled')
self._ui.video_input_combobox.set_sensitive(False)
label.set_markup(_('<span color="red" font-weight="bold">Unavailable</span>, video support will be disabled'))
label.set_markup(
_('<span color="red" font-weight="bold">'
'Unavailable</span>, video support will be disabled'))
return
label.set_markup(
{'gtkglsink': _('<span color="green" font-weight="bold">OpenGL</span> accelerated'),
'gtksink': _('<span color="yellow" font-weight="bold">Unaccelerated</span>')}[name])
text = ''
if name == 'gtkglsink':
text = _('<span color="green" font-weight="bold">'
'OpenGL</span> accelerated')
elif name == 'gtksink':
text = _('<span color="yellow" font-weight="bold">'
'Unaccelerated</span>')
label.set_markup(text)
if self.av_pipeline is None:
self.av_pipeline = Gst.Pipeline.new('preferences-pipeline')
else:
......@@ -403,14 +421,18 @@ class Preferences(Gtk.ApplicationWindow):
self.av_src.link(self.av_sink)
self.av_pipeline.set_state(Gst.State.PLAYING)
else:
# Parsing the pipeline stored in video_input_device failed, let’s try the default one.
# Parsing the pipeline stored in video_input_device failed,
# let’s try the default one.
self.av_src = Gst.ElementFactory.make('autovideosrc', None)
if self.av_src is None:
log.error('Failed to obtain a working Gstreamer source, video will be disabled.')
log.error('Failed to obtain a working Gstreamer source,'
' video will be disabled.')
self._ui.video_input_combobox.set_sensitive(False)
return
# Great, this succeeded, let’s store it back into the config and use it.
# We’ve made autovideosrc the first element in the combobox so we can pick index 0 without worry.
# Great, this succeeded, let’s store it back into the
# config and use it. We’ve made autovideosrc the first
# element in the combobox so we can pick index 0 without
# worry.
combobox = self._ui.video_input_combobox
combobox.set_active(0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment