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>
<signal name="update-preview" handler="on_filechooserdialog_update_preview" swapped="no"/>
<child internal-child="vbox">
<object class="GtkBox" id="filechooserdialog-vbox1">
<object class="GtkBox" id="filechooserdialog_vbox1">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<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="layout_style">end</property>
<child>

View File

@ -33,6 +33,8 @@ from mugshot_lib import helpers
from mugshot_lib.CameraDialog import CameraDialog
Clutter.init(None)
class CameraBox(GtkClutter.Embed):
__gsignals__ = {
'photo-saved': (GObject.SIGNAL_RUN_LAST,
@ -62,7 +64,9 @@ class CameraBox(GtkClutter.Embed):
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)
Cheese.Camera.setup(self.camera, None)
@ -74,7 +78,7 @@ class CameraBox(GtkClutter.Embed):
self.camera.set_device_by_device_node(node)
self.camera.switch_camera_device()
device_monitor=Cheese.CameraDeviceMonitor.new()
device_monitor = Cheese.CameraDeviceMonitor.new()
device_monitor.connect("added", added)
device_monitor.coldplug()
@ -109,7 +113,7 @@ class CameraBox(GtkClutter.Embed):
height = allocation.height
mult = vheight / height
width = round(vwidth / mult,1)
width = round(vwidth / mult, 1)
self.video_texture.set_height(height)
self.video_texture.set_width(width)
@ -149,12 +153,13 @@ class CameraBox(GtkClutter.Embed):
class CameraMugshotDialog(CameraDialog):
"""Camera Capturing Dialog"""
__gtype_name__ = "CameraMugshotDialog"
__gsignals__ = {'apply': (GObject.SIGNAL_RUN_LAST,
GObject.TYPE_NONE,
(GObject.TYPE_STRING,))
}
}
def finish_initializing(self, builder): # pylint: disable=E1002
"""Set up the camera dialog"""

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
class MugshotWindow(Window):
"""Mugshot GtkWindow"""
__gtype_name__ = "MugshotWindow"

View File

@ -37,6 +37,7 @@ from xml.etree.cElementTree import ElementTree
# pylint: disable=R0904
# the many public methods is a feature of Gtk.Builder
class Builder(Gtk.Builder):
''' extra features
connects glade defined handler to default_handler if necessary
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
# apart from the glade widgets
class UiFactory():
''' provides an object with attributes as glade widgets'''
def __init__(self, widget_dict):
"""Initialize the UiFactory."""
self._widget_dict = widget_dict

View File

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

View File

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

View File

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

View File

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

View File

@ -20,7 +20,7 @@ __all__ = [
'project_path_not_found',
'get_data_file',
'get_data_path',
]
]
# Where your project will look for your data (for instance, images and ui
# files). By default, this is ../data, relative your trunk layout
@ -32,6 +32,7 @@ import os
class project_path_not_found(Exception):
"""Raised when we can't find the project directory."""

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\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"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -61,7 +61,7 @@ msgstr ""
msgid "Browse…"
msgstr ""
#: ../data/ui/MugshotWindow.ui.h:9 ../mugshot/MugshotWindow.py:588
#: ../data/ui/MugshotWindow.ui.h:9 ../mugshot/MugshotWindow.py:589
msgid "Mugshot"
msgstr ""
@ -103,80 +103,80 @@ msgstr ""
#. Set the record button to retry, and disable it until the capture
#. finishes.
#: ../mugshot/CameraMugshotDialog.py:232
#: ../mugshot/CameraMugshotDialog.py:237
msgid "Retry"
msgstr ""
#: ../mugshot/MugshotWindow.py:321
#: ../mugshot/MugshotWindow.py:322
msgid "Authentication cancelled."
msgstr ""
#: ../mugshot/MugshotWindow.py:324
#: ../mugshot/MugshotWindow.py:325
msgid "Authentication failed."
msgstr ""
#: ../mugshot/MugshotWindow.py:327
#: ../mugshot/MugshotWindow.py:328
msgid "An error occurred when saving changes."
msgstr ""
#: ../mugshot/MugshotWindow.py:329
#: ../mugshot/MugshotWindow.py:330
msgid "User details were not updated."
msgstr ""
#: ../mugshot/MugshotWindow.py:498
#: ../mugshot/MugshotWindow.py:499
msgid "Update Pidgin buddy icon?"
msgstr ""
#: ../mugshot/MugshotWindow.py:499
#: ../mugshot/MugshotWindow.py:500
msgid "Would you also like to update your Pidgin buddy icon?"
msgstr ""
#: ../mugshot/MugshotWindow.py:589
#: ../mugshot/MugshotWindow.py:590
msgid "Enter your password to change user details."
msgstr ""
#: ../mugshot/MugshotWindow.py:591
#: ../mugshot/MugshotWindow.py:592
msgid ""
"This is a security measure to prevent unwanted updates\n"
"to your personal information."
msgstr ""
#: ../mugshot/MugshotWindow.py:796
#: ../mugshot/MugshotWindow.py:797
msgid "Update LibreOffice user details?"
msgstr ""
#: ../mugshot/MugshotWindow.py:797
#: ../mugshot/MugshotWindow.py:798
msgid "Would you also like to update your user details in LibreOffice?"
msgstr ""
#: ../mugshot_lib/SudoDialog.py:122
#: ../mugshot_lib/SudoDialog.py:124
msgid "Password Required"
msgstr ""
#: ../mugshot_lib/SudoDialog.py:159
#: ../mugshot_lib/SudoDialog.py:161
msgid "Incorrect password... try again."
msgstr ""
#: ../mugshot_lib/SudoDialog.py:169
#: ../mugshot_lib/SudoDialog.py:171
msgid "Password:"
msgstr ""
#. Buttons
#: ../mugshot_lib/SudoDialog.py:180
#: ../mugshot_lib/SudoDialog.py:182
msgid "Cancel"
msgstr ""
#: ../mugshot_lib/SudoDialog.py:183
#: ../mugshot_lib/SudoDialog.py:185
msgid "OK"
msgstr ""
#: ../mugshot_lib/SudoDialog.py:204
#: ../mugshot_lib/SudoDialog.py:206
msgid ""
"Enter your password to\n"
"perform administrative tasks."
msgstr ""
#: ../mugshot_lib/SudoDialog.py:206
#: ../mugshot_lib/SudoDialog.py:208
#, python-format
msgid ""
"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):
"""Command Class to install and update the directory."""
def run(self):
"""Run the setup commands."""
DistUtilsExtra.auto.install_auto.run(self)
@ -197,4 +199,4 @@ DistUtilsExtra.auto.setup(
data_files=[('share/man/man1', ['mugshot.1']),
('share/appdata', ['data/appdata/mugshot.appdata.xml'])],
cmdclass={'install': InstallAndUpdateDataDirectory}
)
)