Fix PEP8 issues

This commit is contained in:
Sean Davis 2016-10-18 06:34:57 -04:00
parent dd46098413
commit 435d45cc23
8 changed files with 49 additions and 39 deletions

View File

@ -19,23 +19,23 @@
# You should have received a copy of the GNU General Public License along # You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>. # with this program. If not, see <http://www.gnu.org/licenses/>.
from locale import gettext as _ import os
import logging import logging
logger = logging.getLogger('mugshot')
from locale import gettext as _
import gi import gi
gi.require_version('Gst', '1.0') gi.require_version('Gst', '1.0')
gi.require_version('Cheese', '3.0') gi.require_version('Cheese', '3.0')
gi.require_version('GtkClutter', '1.0') gi.require_version('GtkClutter', '1.0')
from gi.repository import Gtk, GObject, Gst, GdkPixbuf from gi.repository import Gtk, GObject, Gst, GdkPixbuf # nopep8
from gi.repository import Cheese, Clutter, GtkClutter from gi.repository import Cheese, Clutter, GtkClutter # nopep8
import os from mugshot_lib import helpers # nopep8
from mugshot_lib.CameraDialog import CameraDialog # nopep8
from mugshot_lib import helpers logger = logging.getLogger('mugshot')
from mugshot_lib.CameraDialog import CameraDialog
class CameraBox(GtkClutter.Embed): class CameraBox(GtkClutter.Embed):
@ -95,7 +95,8 @@ class CameraBox(GtkClutter.Embed):
viewport_layout_manager = Clutter.BinLayout() viewport_layout_manager = Clutter.BinLayout()
background_layer = Clutter.Actor.new() background_layer = Clutter.Actor.new()
status, background_layer.props.background_color = Clutter.Color.from_string("Black") status, background_layer.props.background_color = \
Clutter.Color.from_string("Black")
background_layer.props.x = 0 background_layer.props.x = 0
background_layer.props.y = 0 background_layer.props.y = 0
background_layer.props.width = 100 background_layer.props.width = 100
@ -109,7 +110,8 @@ class CameraBox(GtkClutter.Embed):
viewport.add_child(viewport_layout) viewport.add_child(viewport_layout)
viewport.connect("allocation_changed", self.on_stage_resize, viewport_layout, background_layer) viewport.connect("allocation_changed", self.on_stage_resize,
viewport_layout, background_layer)
return video_texture return video_texture

View File

@ -30,7 +30,6 @@ import dbus
from gi.repository import Gtk, GdkPixbuf, GLib, Gio # pylint: disable=E0611 from gi.repository import Gtk, GdkPixbuf, GLib, Gio # pylint: disable=E0611
import logging import logging
logger = logging.getLogger('mugshot')
from mugshot_lib import Window, SudoDialog, AccountsServiceAdapter, helpers from mugshot_lib import Window, SudoDialog, AccountsServiceAdapter, helpers
@ -39,6 +38,8 @@ try:
except: except:
pass pass
logger = logging.getLogger('mugshot')
username = GLib.get_user_name() username = GLib.get_user_name()
home = GLib.get_home_dir() home = GLib.get_home_dir()
libreoffice_prefs = os.path.join(GLib.get_user_config_dir(), 'libreoffice', libreoffice_prefs = os.path.join(GLib.get_user_config_dir(), 'libreoffice',
@ -296,7 +297,8 @@ class MugshotWindow(Window):
if filename and os.path.exists(filename): if filename and os.path.exists(filename):
try: try:
pixbuf = GdkPixbuf.Pixbuf.new_from_file(filename) pixbuf = GdkPixbuf.Pixbuf.new_from_file(filename)
scaled = pixbuf.scale_simple(128, 128, GdkPixbuf.InterpType.HYPER) scaled = pixbuf.scale_simple(128, 128,
GdkPixbuf.InterpType.HYPER)
self.user_image.set_from_pixbuf(scaled) self.user_image.set_from_pixbuf(scaled)
# Show "Remove" menu item. # Show "Remove" menu item.
self.menuitem1.set_visible(True) self.menuitem1.set_visible(True)
@ -429,7 +431,8 @@ class MugshotWindow(Window):
# Update AccountsService profile image # Update AccountsService profile image
if self.accounts_service.available(): if self.accounts_service.available():
logger.debug('Photo updated, saving AccountsService profile image.') logger.debug(
'Photo updated, saving AccountsService profile image.')
self.accounts_service.set_icon_file(self.updated_image) self.accounts_service.set_icon_file(self.updated_image)
# Update Pidgin buddy icon # Update Pidgin buddy icon

View File

@ -46,7 +46,7 @@ def main():
# Run the application. # Run the application.
window = MugshotWindow.MugshotWindow() window = MugshotWindow.MugshotWindow()
window.show() window.show()
# Allow application shutdown with Ctrl-C in terminal # Allow application shutdown with Ctrl-C in terminal
signal.signal(signal.SIGINT, signal.SIG_DFL) signal.signal(signal.SIGINT, signal.SIG_DFL)
Gtk.main() Gtk.main()

View File

@ -18,17 +18,20 @@
'''Enhances builder connections, provides object to access glade objects''' '''Enhances builder connections, provides object to access glade objects'''
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import GObject, Gtk # pylint: disable=E0611
import inspect import inspect
import functools import functools
import logging import logging
logger = logging.getLogger('mugshot_lib')
from xml.etree.cElementTree import ElementTree from xml.etree.cElementTree import ElementTree
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import GObject, Gtk # pylint: disable=E0611 # nopep8
logger = logging.getLogger('mugshot_lib')
# this module is big so uses some conventional prefixes and postfixes # this module is big so uses some conventional prefixes and postfixes
# *s list, except self.widgets is a dictionary # *s list, except self.widgets is a dictionary
# *_dict dictionary # *_dict dictionary

View File

@ -18,10 +18,11 @@
from gi.repository import Gtk # pylint: disable=E0611 from gi.repository import Gtk # pylint: disable=E0611
import logging import logging
logger = logging.getLogger('mugshot_lib')
from . helpers import get_builder from . helpers import get_builder
logger = logging.getLogger('mugshot_lib')
class CameraDialog(Gtk.Dialog): class CameraDialog(Gtk.Dialog):

View File

@ -16,14 +16,15 @@
# You should have received a copy of the GNU General Public License along # You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>. # with this program. If not, see <http://www.gnu.org/licenses/>.
from gi.repository import Gio, Gtk # pylint: disable=E0611
import logging
logger = logging.getLogger('mugshot_lib')
import os import os
import logging
from gi.repository import Gio, Gtk # pylint: disable=E0611
from . helpers import get_builder, show_uri from . helpers import get_builder, show_uri
logger = logging.getLogger('mugshot_lib')
class Window(Gtk.Window): class Window(Gtk.Window):

View File

@ -16,6 +16,8 @@
# You should have received a copy of the GNU General Public License along # You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>. # with this program. If not, see <http://www.gnu.org/licenses/>.
import os
__all__ = [ __all__ = [
'project_path_not_found', 'project_path_not_found',
'get_data_file', 'get_data_file',
@ -28,8 +30,6 @@ __mugshot_data_directory__ = '../data/'
__license__ = 'GPL-3+' __license__ = 'GPL-3+'
__version__ = '0.3.1' __version__ = '0.3.1'
import os
class project_path_not_found(Exception): class project_path_not_found(Exception):

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-10-18 00:02-0400\n" "POT-Creation-Date: 2016-10-18 06:34-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -61,7 +61,7 @@ msgstr ""
msgid "Browse…" msgid "Browse…"
msgstr "" msgstr ""
#: ../data/ui/MugshotWindow.ui.h:9 ../mugshot/MugshotWindow.py:563 #: ../data/ui/MugshotWindow.ui.h:9 ../mugshot/MugshotWindow.py:566
msgid "Mugshot" msgid "Mugshot"
msgstr "" msgstr ""
@ -103,49 +103,49 @@ msgstr ""
#. Set the record button to retry, and disable it until the capture #. Set the record button to retry, and disable it until the capture
#. finishes. #. finishes.
#: ../mugshot/CameraMugshotDialog.py:266 #: ../mugshot/CameraMugshotDialog.py:268
msgid "Retry" msgid "Retry"
msgstr "" msgstr ""
#: ../mugshot/MugshotWindow.py:341 #: ../mugshot/MugshotWindow.py:343
msgid "Authentication cancelled." msgid "Authentication cancelled."
msgstr "" msgstr ""
#: ../mugshot/MugshotWindow.py:344 #: ../mugshot/MugshotWindow.py:346
msgid "Authentication failed." msgid "Authentication failed."
msgstr "" msgstr ""
#: ../mugshot/MugshotWindow.py:347 #: ../mugshot/MugshotWindow.py:349
msgid "An error occurred when saving changes." msgid "An error occurred when saving changes."
msgstr "" msgstr ""
#: ../mugshot/MugshotWindow.py:349 #: ../mugshot/MugshotWindow.py:351
msgid "User details were not updated." msgid "User details were not updated."
msgstr "" msgstr ""
#: ../mugshot/MugshotWindow.py:450 #: ../mugshot/MugshotWindow.py:453
msgid "Update Pidgin buddy icon?" msgid "Update Pidgin buddy icon?"
msgstr "" msgstr ""
#: ../mugshot/MugshotWindow.py:451 #: ../mugshot/MugshotWindow.py:454
msgid "Would you also like to update your Pidgin buddy icon?" msgid "Would you also like to update your Pidgin buddy icon?"
msgstr "" msgstr ""
#: ../mugshot/MugshotWindow.py:564 #: ../mugshot/MugshotWindow.py:567
msgid "Enter your password to change user details." msgid "Enter your password to change user details."
msgstr "" msgstr ""
#: ../mugshot/MugshotWindow.py:566 #: ../mugshot/MugshotWindow.py:569
msgid "" msgid ""
"This is a security measure to prevent unwanted updates\n" "This is a security measure to prevent unwanted updates\n"
"to your personal information." "to your personal information."
msgstr "" msgstr ""
#: ../mugshot/MugshotWindow.py:817 #: ../mugshot/MugshotWindow.py:820
msgid "Update LibreOffice user details?" msgid "Update LibreOffice user details?"
msgstr "" msgstr ""
#: ../mugshot/MugshotWindow.py:818 #: ../mugshot/MugshotWindow.py:821
msgid "Would you also like to update your user details in LibreOffice?" msgid "Would you also like to update your user details in LibreOffice?"
msgstr "" msgstr ""