Remove about dialog, connect the help button.

This commit is contained in:
Sean Davis 2013-07-14 10:32:18 -04:00
parent 9979963941
commit 1e54127eff
8 changed files with 12 additions and 165 deletions

View File

@ -1,49 +0,0 @@
<interface>
<!-- interface-requires about_mugshot_dialog 1.0 -->
<!-- interface-requires gtk+ 3.0 -->
<object class="AboutMugshotDialog" id="about_mugshot_dialog">
<property name="license" translatable="yes"># Copyright (C) 2013 Sean Davis &lt;smd.seandavis@gmail.com&gt;
# 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 &lt;http://www.gnu.org/licenses/&gt;.
</property><property name="copyright" translatable="yes">Copyright (C) 2013 Sean Davis &lt;smd.seandavis@gmail.com&gt;</property><property name="can_focus">False</property>
<property name="border_width">5</property>
<property name="icon">../media/mugshot.svg</property>
<property name="type_hint">normal</property>
<property name="program_name">Mugshot</property>
<property name="authors">Copyright (C) 2013 Sean Davis &lt;smd.seandavis@gmail.com&gt;</property>
<property name="logo">../media/mugshot.svg</property>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="visible">True</property>
<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="dialog-action_area1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="layout_style">end</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
</object>
</interface>

View File

@ -441,6 +441,7 @@
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_help_activate" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>

View File

@ -1,9 +0,0 @@
<glade-catalog name="about_mugshot_dialog" domain="glade-3"
depends="gtk+" version="1.0">
<glade-widget-classes>
<glade-widget-class title="About Mugshot Dialog" name="AboutMugshotDialog"
generic-name="AboutMugshotDialog" parent="GtkAboutDialog"
icon-name="widget-gtk-about-dialog"/>
</glade-widget-classes>
</glade-catalog>

View File

@ -1,33 +0,0 @@
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
### BEGIN LICENSE
# 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/>.
### 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.

View File

@ -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')

View File

@ -1,50 +0,0 @@
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
### BEGIN LICENSE
# 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/>.
### 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)

View File

@ -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.

View File

@ -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()