| 1 | # Copyright (C) 2007 Adriano Monteiro Marques |
|---|
| 2 | # |
|---|
| 3 | # Author: Guilherme Polo <ggpolo@gmail.com> |
|---|
| 4 | # |
|---|
| 5 | # This program is free software; you can redistribute it and/or modify |
|---|
| 6 | # it under the terms of the GNU General Public License as published by |
|---|
| 7 | # the Free Software Foundation; either version 2 of the License, or |
|---|
| 8 | # (at your option) any later version. |
|---|
| 9 | # |
|---|
| 10 | # This program is distributed in the hope that it will be useful, |
|---|
| 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 13 | # GNU General Public License for more details. |
|---|
| 14 | # |
|---|
| 15 | # You should have received a copy of the GNU General Public License |
|---|
| 16 | # along with this program; if not, write to the Free Software |
|---|
| 17 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
|---|
| 18 | # USA |
|---|
| 19 | |
|---|
| 20 | """ |
|---|
| 21 | Network Inventory About window. |
|---|
| 22 | """ |
|---|
| 23 | |
|---|
| 24 | import os |
|---|
| 25 | import gtk |
|---|
| 26 | |
|---|
| 27 | from higwidgets.higwindows import HIGWindow |
|---|
| 28 | from higwidgets.higboxes import HIGVBox, HIGHBox |
|---|
| 29 | from higwidgets.higbuttons import HIGButton |
|---|
| 30 | |
|---|
| 31 | from umitCore.I18N import _ |
|---|
| 32 | from umitCore.Paths import Path, VERSION |
|---|
| 33 | from umitInventory import __author__, __version__, __copyright__ |
|---|
| 34 | |
|---|
| 35 | pixmaps_dir = Path.pixmaps_dir |
|---|
| 36 | if pixmaps_dir: |
|---|
| 37 | logo = os.path.join(pixmaps_dir, 'logo.png') |
|---|
| 38 | else: |
|---|
| 39 | logo = None |
|---|
| 40 | |
|---|
| 41 | class About(HIGWindow): |
|---|
| 42 | def __init__(self): |
|---|
| 43 | HIGWindow.__init__(self) |
|---|
| 44 | |
|---|
| 45 | self.lbl_program_version = gtk.Label( |
|---|
| 46 | ("<span size='30000' weight='heavy'>UMIT %s</span>" % VERSION) + |
|---|
| 47 | ("\n<span size='10000' weight='heavy'>Network Inventory ") + |
|---|
| 48 | _("Build") + (" %s</span>" % __version__)) |
|---|
| 49 | |
|---|
| 50 | self.lbl_program_description = gtk.Label( |
|---|
| 51 | _("UMIT Network Inventory and UMIT Scheduler are UMIT\n") + |
|---|
| 52 | _("extensions developed by") + (" %s\n" % __author__) + |
|---|
| 53 | _("and was sponsored by Google during the Summer of Code " |
|---|
| 54 | "2007.\nThanks Google!")) |
|---|
| 55 | |
|---|
| 56 | self.lbl_copyright = gtk.Label("<small>%s</small>" % __copyright__) |
|---|
| 57 | self.logo_img = gtk.Image() |
|---|
| 58 | self.logo_img.set_from_file(logo) |
|---|
| 59 | self.btn_close = HIGButton(stock=gtk.STOCK_CLOSE) |
|---|
| 60 | |
|---|
| 61 | self.btn_close.connect('clicked', lambda x, y=None:self.destroy()) |
|---|
| 62 | |
|---|
| 63 | self.__set_props() |
|---|
| 64 | self.__do_layout() |
|---|
| 65 | |
|---|
| 66 | |
|---|
| 67 | def __set_props(self): |
|---|
| 68 | """ |
|---|
| 69 | Set widget properties. |
|---|
| 70 | """ |
|---|
| 71 | self.set_title(_("About UMIT Network Inventory")) |
|---|
| 72 | self.set_position(gtk.WIN_POS_CENTER) |
|---|
| 73 | self.lbl_program_version.set_use_markup(True) |
|---|
| 74 | self.lbl_copyright.set_use_markup(True) |
|---|
| 75 | self.lbl_program_description.set_justify(gtk.JUSTIFY_CENTER) |
|---|
| 76 | |
|---|
| 77 | self.lbl_copyright.set_selectable(True) |
|---|
| 78 | self.lbl_program_description.set_selectable(True) |
|---|
| 79 | self.lbl_program_version.set_selectable(True) |
|---|
| 80 | |
|---|
| 81 | |
|---|
| 82 | def __do_layout(self): |
|---|
| 83 | """ |
|---|
| 84 | Layout window widgets. |
|---|
| 85 | """ |
|---|
| 86 | main_vbox = HIGVBox() |
|---|
| 87 | btns_box = HIGHBox() |
|---|
| 88 | |
|---|
| 89 | main_vbox.pack_start(self.logo_img) |
|---|
| 90 | main_vbox.pack_start(self.lbl_program_version) |
|---|
| 91 | main_vbox.pack_start(self.lbl_program_description) |
|---|
| 92 | main_vbox.pack_start(self.lbl_copyright) |
|---|
| 93 | |
|---|
| 94 | btns_box.pack_end(self.btn_close) |
|---|
| 95 | main_vbox._pack_noexpand_nofill(btns_box) |
|---|
| 96 | |
|---|
| 97 | self.btn_close.grab_focus() |
|---|
| 98 | |
|---|
| 99 | self.add(main_vbox) |
|---|