/share/taluka/panel.py

https://github.com/jhasse/taluka
Python | 39 lines | 14 code | 4 blank | 21 comment | 0 complexity | 7b05fb436a12ad6dc50b2754b427452c MD5 | raw file
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. #
  4. # Copyright (C) 2007 Jan Niklas Hasse <jhasse@gmail.com>
  5. # Jannes Meyer <jannes.meyer@gmail.com>
  6. # Fabian Franzen <flammenvogel@arcor.de>
  7. #
  8. # This file is part of Taluka.
  9. #
  10. # Taluka is free software: you can redistribute it and/or modify
  11. # it under the terms of the GNU General Public License as published by
  12. # the Free Software Foundation, either version 3 of the License, or
  13. # (at your option) any later version.
  14. #
  15. # Taluka is distributed in the hope that it will be useful,
  16. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. # GNU General Public License for more details.
  19. #
  20. # You should have received a copy of the GNU General Public License
  21. # along with Taluka. If not, see <http://www.gnu.org/licenses/>.
  22. import gtk
  23. class Panel(gtk.VBox):
  24. def __init__(self):
  25. super(type(self), self).__init__(self)
  26. self._notebook = gtk.Notebook()
  27. def add_item(self, item, name, image):
  28. hbox = gtk.HBox()
  29. hbox.add(image)
  30. hbox.add(gtk.Label(name))
  31. self._notebook.append_page(item, hbox)
  32. item.show_all()
  33. hbox.show_all()
  34. def activate_item(self, item):
  35. self._notebook.set_current_page(self._notebook.page_num(item))