From 1e54127effe12539941648597c79c8a3c28ba937 Mon Sep 17 00:00:00 2001 From: Sean Davis Date: Sun, 14 Jul 2013 10:32:18 -0400 Subject: [PATCH] Remove about dialog, connect the help button. --- data/ui/AboutMugshotDialog.ui | 49 ------------------------------- data/ui/MugshotWindow.ui | 1 + data/ui/about_mugshot_dialog.xml | 9 ------ mugshot/AboutMugshotDialog.py | 33 --------------------- mugshot/MugshotWindow.py | 3 -- mugshot_lib/AboutDialog.py | 50 -------------------------------- mugshot_lib/Window.py | 14 +-------- tests/test_example.py | 18 +++++++----- 8 files changed, 12 insertions(+), 165 deletions(-) delete mode 100644 data/ui/AboutMugshotDialog.ui delete mode 100644 data/ui/about_mugshot_dialog.xml delete mode 100644 mugshot/AboutMugshotDialog.py delete mode 100644 mugshot_lib/AboutDialog.py diff --git a/data/ui/AboutMugshotDialog.ui b/data/ui/AboutMugshotDialog.ui deleted file mode 100644 index 3f3e70f..0000000 --- a/data/ui/AboutMugshotDialog.ui +++ /dev/null @@ -1,49 +0,0 @@ - - - - - # Copyright (C) 2013 Sean Davis <smd.seandavis@gmail.com> -# This program is free software: you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 3, as published -# by the Free Software Foundation. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranties of -# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR -# PURPOSE. See the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program. If not, see <http://www.gnu.org/licenses/>. -Copyright (C) 2013 Sean Davis <smd.seandavis@gmail.com>False - 5 - ../media/mugshot.svg - normal - Mugshot - Copyright (C) 2013 Sean Davis <smd.seandavis@gmail.com> - ../media/mugshot.svg - - - True - False - vertical - 2 - - - True - False - end - - - False - True - end - 0 - - - - - - - - - \ No newline at end of file diff --git a/data/ui/MugshotWindow.ui b/data/ui/MugshotWindow.ui index 4aadafa..0a881ce 100644 --- a/data/ui/MugshotWindow.ui +++ b/data/ui/MugshotWindow.ui @@ -441,6 +441,7 @@ True True True + False diff --git a/data/ui/about_mugshot_dialog.xml b/data/ui/about_mugshot_dialog.xml deleted file mode 100644 index fd40754..0000000 --- a/data/ui/about_mugshot_dialog.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - diff --git a/mugshot/AboutMugshotDialog.py b/mugshot/AboutMugshotDialog.py deleted file mode 100644 index 5ef2d6a..0000000 --- a/mugshot/AboutMugshotDialog.py +++ /dev/null @@ -1,33 +0,0 @@ -# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- -### BEGIN LICENSE -# Copyright (C) 2013 Sean Davis -# This program is free software: you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 3, as published -# by the Free Software Foundation. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranties of -# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR -# PURPOSE. See the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program. If not, see . -### END LICENSE - -from locale import gettext as _ - -import logging -logger = logging.getLogger('mugshot') - -from mugshot_lib.AboutDialog import AboutDialog - -# See mugshot_lib.AboutDialog.py for more details about how this class works. -class AboutMugshotDialog(AboutDialog): - __gtype_name__ = "AboutMugshotDialog" - - def finish_initializing(self, builder): # pylint: disable=E1002 - """Set up the about dialog""" - super(AboutMugshotDialog, self).finish_initializing(builder) - - # Code for other initialization actions should be added here. - diff --git a/mugshot/MugshotWindow.py b/mugshot/MugshotWindow.py index 9cb7ba4..d028982 100644 --- a/mugshot/MugshotWindow.py +++ b/mugshot/MugshotWindow.py @@ -31,7 +31,6 @@ import logging logger = logging.getLogger('mugshot') from mugshot_lib import Window -from mugshot.AboutMugshotDialog import AboutMugshotDialog username = os.getlogin() home = os.path.expanduser('~') @@ -99,8 +98,6 @@ class MugshotWindow(Window): """Set up the main window""" super(MugshotWindow, self).finish_initializing(builder) - self.AboutDialog = AboutMugshotDialog - # User Image widgets self.image_button = builder.get_object('image_button') self.user_image = builder.get_object('user_image') diff --git a/mugshot_lib/AboutDialog.py b/mugshot_lib/AboutDialog.py deleted file mode 100644 index 0cb879d..0000000 --- a/mugshot_lib/AboutDialog.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- -### BEGIN LICENSE -# Copyright (C) 2013 Sean Davis -# This program is free software: you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 3, as published -# by the Free Software Foundation. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranties of -# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR -# PURPOSE. See the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program. If not, see . -### END LICENSE - -### DO NOT EDIT THIS FILE ### - -from gi.repository import Gtk # pylint: disable=E0611 - -from . helpers import get_builder - -class AboutDialog(Gtk.AboutDialog): - __gtype_name__ = "AboutDialog" - - def __new__(cls): - """Special static method that's automatically called by Python when - constructing a new instance of this class. - - Returns a fully instantiated AboutDialog object. - """ - builder = get_builder('AboutMugshotDialog') - new_object = builder.get_object("about_mugshot_dialog") - new_object.finish_initializing(builder) - return new_object - - def finish_initializing(self, builder): - """Called while initializing this instance in __new__ - - finish_initalizing should be called after parsing the ui definition - and creating a AboutDialog object with it in order - to finish initializing the start of the new AboutMugshotDialog - instance. - - Put your initialization code in here and leave __init__ undefined. - """ - # Get a reference to the builder and set up the signals. - self.builder = builder - self.ui = builder.get_ui(self) - diff --git a/mugshot_lib/Window.py b/mugshot_lib/Window.py index b007584..1d25162 100644 --- a/mugshot_lib/Window.py +++ b/mugshot_lib/Window.py @@ -58,25 +58,13 @@ class Window(Gtk.Window): # Get a reference to the builder and set up the signals. self.builder = builder self.ui = builder.get_ui(self, True) - self.AboutDialog = None # class self.settings = Gio.Settings("apps.mugshot") self.settings.connect('changed', self.on_preferences_changed) - def on_mnu_contents_activate(self, widget, data=None): + def on_help_activate(self, widget, data=None): show_uri(self, "ghelp:%s" % get_help_uri()) - def on_mnu_about_activate(self, widget, data=None): - """Display the about box for mugshot.""" - if self.AboutDialog is not None: - about = self.AboutDialog() # pylint: disable=E1102 - response = about.run() - about.destroy() - - def on_mnu_close_activate(self, widget, data=None): - """Signal handler for closing the MugshotWindow.""" - self.destroy() - def on_destroy(self, widget, data=None): """Called when the MugshotWindow is closed.""" # Clean up code for saving application state should be added here. diff --git a/tests/test_example.py b/tests/test_example.py index 390fe5f..d4efca3 100644 --- a/tests/test_example.py +++ b/tests/test_example.py @@ -20,18 +20,20 @@ import os.path import unittest sys.path.insert(0, os.path.realpath(os.path.join(os.path.dirname(__file__), ".."))) -from mugshot import AboutMugshotDialog +#from mugshot import AboutMugshotDialog class TestExample(unittest.TestCase): def setUp(self): - self.AboutMugshotDialog_members = [ - 'AboutDialog', 'AboutMugshotDialog', 'gettext', 'logger', 'logging'] + pass + # Keeping the below items for reference later. + #self.AboutMugshotDialog_members = [ + #'AboutDialog', 'AboutMugshotDialog', 'gettext', 'logger', 'logging'] - def test_AboutMugshotDialog_members(self): - all_members = dir(AboutMugshotDialog) - public_members = [x for x in all_members if not x.startswith('_')] - public_members.sort() - self.assertEqual(self.AboutMugshotDialog_members, public_members) + #def test_AboutMugshotDialog_members(self): + # all_members = dir(AboutMugshotDialog) + # public_members = [x for x in all_members if not x.startswith('_')] + # public_members.sort() + # self.assertEqual(self.AboutMugshotDialog_members, public_members) if __name__ == '__main__': unittest.main()