Pythonize glade, PEP8

This commit is contained in:
Sean Davis 2015-08-31 22:31:02 -04:00
parent 413f8c2af9
commit 90f2978a08
12 changed files with 77 additions and 59 deletions

View File

@ -657,12 +657,12 @@
<property name="use_preview_label">False</property> <property name="use_preview_label">False</property>
<signal name="update-preview" handler="on_filechooserdialog_update_preview" swapped="no"/> <signal name="update-preview" handler="on_filechooserdialog_update_preview" swapped="no"/>
<child internal-child="vbox"> <child internal-child="vbox">
<object class="GtkBox" id="filechooserdialog-vbox1"> <object class="GtkBox" id="filechooserdialog_vbox1">
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="spacing">2</property> <property name="spacing">2</property>
<child internal-child="action_area"> <child internal-child="action_area">
<object class="GtkButtonBox" id="filechooserdialog-action_area1"> <object class="GtkButtonBox" id="filechooserdialog_action_area1">
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="layout_style">end</property> <property name="layout_style">end</property>
<child> <child>

View File

@ -33,6 +33,8 @@ from mugshot_lib import helpers
from mugshot_lib.CameraDialog import CameraDialog from mugshot_lib.CameraDialog import CameraDialog
Clutter.init(None) Clutter.init(None)
class CameraBox(GtkClutter.Embed): class CameraBox(GtkClutter.Embed):
__gsignals__ = { __gsignals__ = {
'photo-saved': (GObject.SIGNAL_RUN_LAST, 'photo-saved': (GObject.SIGNAL_RUN_LAST,
@ -62,7 +64,9 @@ class CameraBox(GtkClutter.Embed):
self.video_texture = Clutter.Texture.new() self.video_texture = Clutter.Texture.new()
self.layout_manager.pack(self.video_texture, expand=True, x_fill=False, y_fill=False, x_align=Clutter.BoxAlignment.CENTER, y_align=Clutter.BoxAlignment.CENTER) self.layout_manager.pack(
self.video_texture, expand=True, x_fill=False, y_fill=False,
x_align=Clutter.BoxAlignment.CENTER, y_align=Clutter.BoxAlignment.CENTER)
self.camera = Cheese.Camera.new(self.video_texture, None, 100, 100) self.camera = Cheese.Camera.new(self.video_texture, None, 100, 100)
Cheese.Camera.setup(self.camera, None) Cheese.Camera.setup(self.camera, None)
@ -149,6 +153,7 @@ class CameraBox(GtkClutter.Embed):
class CameraMugshotDialog(CameraDialog): class CameraMugshotDialog(CameraDialog):
"""Camera Capturing Dialog""" """Camera Capturing Dialog"""
__gtype_name__ = "CameraMugshotDialog" __gtype_name__ = "CameraMugshotDialog"
__gsignals__ = {'apply': (GObject.SIGNAL_RUN_LAST, __gsignals__ = {'apply': (GObject.SIGNAL_RUN_LAST,

View File

@ -160,6 +160,7 @@ def menu_position(self, menu, data=None, something_else=None):
# See mugshot_lib.Window.py for more details about how this class works # See mugshot_lib.Window.py for more details about how this class works
class MugshotWindow(Window): class MugshotWindow(Window):
"""Mugshot GtkWindow""" """Mugshot GtkWindow"""
__gtype_name__ = "MugshotWindow" __gtype_name__ = "MugshotWindow"

View File

@ -37,6 +37,7 @@ from xml.etree.cElementTree import ElementTree
# pylint: disable=R0904 # pylint: disable=R0904
# the many public methods is a feature of Gtk.Builder # the many public methods is a feature of Gtk.Builder
class Builder(Gtk.Builder): class Builder(Gtk.Builder):
''' extra features ''' extra features
connects glade defined handler to default_handler if necessary connects glade defined handler to default_handler if necessary
auto connects widget to handler with matching name or alias auto connects widget to handler with matching name or alias
@ -164,7 +165,9 @@ class Builder(Gtk.Builder):
# this class deliberately does not provide any public interfaces # this class deliberately does not provide any public interfaces
# apart from the glade widgets # apart from the glade widgets
class UiFactory(): class UiFactory():
''' provides an object with attributes as glade widgets''' ''' provides an object with attributes as glade widgets'''
def __init__(self, widget_dict): def __init__(self, widget_dict):
"""Initialize the UiFactory.""" """Initialize the UiFactory."""
self._widget_dict = widget_dict self._widget_dict = widget_dict

View File

@ -24,6 +24,7 @@ from . helpers import get_builder
class CameraDialog(Gtk.Dialog): class CameraDialog(Gtk.Dialog):
"""Camera Dialog""" """Camera Dialog"""
__gtype_name__ = "CameraDialog" __gtype_name__ = "CameraDialog"

View File

@ -89,6 +89,7 @@ def env_spawn(command, timeout):
class SudoDialog(Gtk.Dialog): class SudoDialog(Gtk.Dialog):
''' '''
Creates a new SudoDialog. This is a replacement for using gksudo which Creates a new SudoDialog. This is a replacement for using gksudo which
provides additional flexibility when performing sudo commands. provides additional flexibility when performing sudo commands.
@ -108,6 +109,7 @@ class SudoDialog(Gtk.Dialog):
- REJECT: Password invalid. - REJECT: Password invalid.
- ACCEPT: Password valid. - ACCEPT: Password valid.
''' '''
def __init__(self, title=None, parent=None, icon=None, message=None, def __init__(self, title=None, parent=None, icon=None, message=None,
name=None, retries=-1): name=None, retries=-1):
"""Initialize the SudoDialog.""" """Initialize the SudoDialog."""

View File

@ -26,6 +26,7 @@ from . helpers import get_builder, show_uri
class Window(Gtk.Window): class Window(Gtk.Window):
"""This class is meant to be subclassed by MugshotWindow. It provides """This class is meant to be subclassed by MugshotWindow. It provides
common functions and some boilerplate.""" common functions and some boilerplate."""
__gtype_name__ = "Window" __gtype_name__ = "Window"

View File

@ -54,7 +54,9 @@ def get_media_file(media_file_name):
class NullHandler(logging.Handler): class NullHandler(logging.Handler):
"""Handle NULL""" """Handle NULL"""
def emit(self, record): def emit(self, record):
"""Do not emit anything.""" """Do not emit anything."""
pass pass

View File

@ -32,6 +32,7 @@ import os
class project_path_not_found(Exception): class project_path_not_found(Exception):
"""Raised when we can't find the project directory.""" """Raised when we can't find the project directory."""

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: 2015-08-29 22:19-0400\n" "POT-Creation-Date: 2015-08-31 22:28-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:588 #: ../data/ui/MugshotWindow.ui.h:9 ../mugshot/MugshotWindow.py:589
msgid "Mugshot" msgid "Mugshot"
msgstr "" msgstr ""
@ -103,80 +103,80 @@ 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:232 #: ../mugshot/CameraMugshotDialog.py:237
msgid "Retry" msgid "Retry"
msgstr "" msgstr ""
#: ../mugshot/MugshotWindow.py:321 #: ../mugshot/MugshotWindow.py:322
msgid "Authentication cancelled." msgid "Authentication cancelled."
msgstr "" msgstr ""
#: ../mugshot/MugshotWindow.py:324 #: ../mugshot/MugshotWindow.py:325
msgid "Authentication failed." msgid "Authentication failed."
msgstr "" msgstr ""
#: ../mugshot/MugshotWindow.py:327 #: ../mugshot/MugshotWindow.py:328
msgid "An error occurred when saving changes." msgid "An error occurred when saving changes."
msgstr "" msgstr ""
#: ../mugshot/MugshotWindow.py:329 #: ../mugshot/MugshotWindow.py:330
msgid "User details were not updated." msgid "User details were not updated."
msgstr "" msgstr ""
#: ../mugshot/MugshotWindow.py:498 #: ../mugshot/MugshotWindow.py:499
msgid "Update Pidgin buddy icon?" msgid "Update Pidgin buddy icon?"
msgstr "" msgstr ""
#: ../mugshot/MugshotWindow.py:499 #: ../mugshot/MugshotWindow.py:500
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:589 #: ../mugshot/MugshotWindow.py:590
msgid "Enter your password to change user details." msgid "Enter your password to change user details."
msgstr "" msgstr ""
#: ../mugshot/MugshotWindow.py:591 #: ../mugshot/MugshotWindow.py:592
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:796 #: ../mugshot/MugshotWindow.py:797
msgid "Update LibreOffice user details?" msgid "Update LibreOffice user details?"
msgstr "" msgstr ""
#: ../mugshot/MugshotWindow.py:797 #: ../mugshot/MugshotWindow.py:798
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 ""
#: ../mugshot_lib/SudoDialog.py:122 #: ../mugshot_lib/SudoDialog.py:124
msgid "Password Required" msgid "Password Required"
msgstr "" msgstr ""
#: ../mugshot_lib/SudoDialog.py:159 #: ../mugshot_lib/SudoDialog.py:161
msgid "Incorrect password... try again." msgid "Incorrect password... try again."
msgstr "" msgstr ""
#: ../mugshot_lib/SudoDialog.py:169 #: ../mugshot_lib/SudoDialog.py:171
msgid "Password:" msgid "Password:"
msgstr "" msgstr ""
#. Buttons #. Buttons
#: ../mugshot_lib/SudoDialog.py:180 #: ../mugshot_lib/SudoDialog.py:182
msgid "Cancel" msgid "Cancel"
msgstr "" msgstr ""
#: ../mugshot_lib/SudoDialog.py:183 #: ../mugshot_lib/SudoDialog.py:185
msgid "OK" msgid "OK"
msgstr "" msgstr ""
#: ../mugshot_lib/SudoDialog.py:204 #: ../mugshot_lib/SudoDialog.py:206
msgid "" msgid ""
"Enter your password to\n" "Enter your password to\n"
"perform administrative tasks." "perform administrative tasks."
msgstr "" msgstr ""
#: ../mugshot_lib/SudoDialog.py:206 #: ../mugshot_lib/SudoDialog.py:208
#, python-format #, python-format
msgid "" msgid ""
"The application '%s' lets you\n" "The application '%s' lets you\n"

View File

@ -132,7 +132,9 @@ write_appdata_file("data/appdata/mugshot.appdata.xml.in")
class InstallAndUpdateDataDirectory(DistUtilsExtra.auto.install_auto): class InstallAndUpdateDataDirectory(DistUtilsExtra.auto.install_auto):
"""Command Class to install and update the directory.""" """Command Class to install and update the directory."""
def run(self): def run(self):
"""Run the setup commands.""" """Run the setup commands."""
DistUtilsExtra.auto.install_auto.run(self) DistUtilsExtra.auto.install_auto.run(self)