1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- 2### BEGIN LICENSE 3# Copyright (c) 2012, Peter Levi <peterlevi@peterlevi.com> 4# This program is free software: you can redistribute it and/or modify it 5# under the terms of the GNU General Public License version 3, as published 6# by the Free Software Foundation. 7# 8# This program is distributed in the hope that it will be useful, but 9# WITHOUT ANY WARRANTY; without even the implied warranties of 10# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR 11# PURPOSE. See the GNU General Public License for more details. 12# 13# You should have received a copy of the GNU General Public License along 14# with this program. If not, see <http://www.gnu.org/licenses/>. 15### END LICENSE 16 17from gi.repository import Gtk # pylint: disable=E0611 18 19from variety.profile import get_profile_wm_class 20 21from .helpers import get_builder 22 23 24class AboutDialog(Gtk.AboutDialog): 25 __gtype_name__ = "AboutDialog" 26 27 def __new__(cls): 28 """Special static method that's automatically called by Python when 29 constructing a new instance of this class. 30 31 Returns a fully instantiated AboutDialog object. 32 """ 33 builder = get_builder("AboutVarietyDialog") 34 new_object = builder.get_object("about_variety_dialog") 35 new_object.finish_initializing(builder) 36 return new_object 37 38 def finish_initializing(self, builder): 39 """Called while initializing this instance in __new__ 40 41 finish_initalizing should be called after parsing the ui definition 42 and creating a AboutDialog object with it in order 43 to finish initializing the start of the new AboutVarietyDialog 44 instance. 45 46 Put your initialization code in here and leave __init__ undefined. 47 """ 48 # Get a reference to the builder and set up the signals. 49 self.builder = builder 50 self.ui = builder.get_ui(self) 51 self.set_wmclass(get_profile_wm_class(), get_profile_wm_class()) 52