| 1 | # -*- coding: utf-8 -*- |
|---|
| 2 | # Copyright (C) 2008 Adriano Monteiro Marques. |
|---|
| 3 | # |
|---|
| 4 | # Author: Luis A. Bastiao Silva <luis.kop@gmail.com> |
|---|
| 5 | # |
|---|
| 6 | # This program is free software; you can redistribute it and/or modify |
|---|
| 7 | # it under the terms of the GNU General Public License as published by |
|---|
| 8 | # the Free Software Foundation; either version 2 of the License, or |
|---|
| 9 | # (at your option) any later version. |
|---|
| 10 | # |
|---|
| 11 | # This program is distributed in the hope that it will be useful, |
|---|
| 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 14 | # GNU General Public License for more details. |
|---|
| 15 | # |
|---|
| 16 | # You should have received a copy of the GNU General Public License |
|---|
| 17 | # along with this program; if not, write to the Free Software |
|---|
| 18 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 19 | |
|---|
| 20 | |
|---|
| 21 | import gtk |
|---|
| 22 | |
|---|
| 23 | from umitGUI.radialnet.RadialNet import * |
|---|
| 24 | from umitGUI.radialnet.GraphBuilder import GraphBuilder |
|---|
| 25 | from umitGUI.radialnet.ControlWidget import ControlWidget, ControlFisheye |
|---|
| 26 | from umitGUI.radialnet.Toolbar import Toolbar |
|---|
| 27 | |
|---|
| 28 | from higwidgets.higboxes import HIGVBox, HIGHBox |
|---|
| 29 | |
|---|
| 30 | from umitCore.I18N import _ |
|---|
| 31 | |
|---|
| 32 | |
|---|
| 33 | class ScanMapperPage(HIGVBox): |
|---|
| 34 | def __init__(self): |
|---|
| 35 | HIGVBox.__init__(self) |
|---|
| 36 | self.__parser = None |
|---|
| 37 | self.__radialnet = None |
|---|
| 38 | self.__created = False |
|---|
| 39 | |
|---|
| 40 | def create_widgets(self): |
|---|
| 41 | if self.__created: |
|---|
| 42 | self.update_graph() |
|---|
| 43 | return |
|---|
| 44 | |
|---|
| 45 | self.set_spacing(0) |
|---|
| 46 | self.__hbox = HIGHBox(spacing=0) |
|---|
| 47 | |
|---|
| 48 | |
|---|
| 49 | # Create RadialNet |
|---|
| 50 | self.__radialnet = RadialNet(LAYOUT_WEIGHTED) |
|---|
| 51 | self.__radialnet.set_no_show_all(True) |
|---|
| 52 | |
|---|
| 53 | self.__radialnet.set_empty() |
|---|
| 54 | self.update_graph() |
|---|
| 55 | self.__radialnet.show() |
|---|
| 56 | |
|---|
| 57 | |
|---|
| 58 | # Create Controlors |
|---|
| 59 | |
|---|
| 60 | |
|---|
| 61 | self.__control = ControlWidget(self.__radialnet) |
|---|
| 62 | self.__fisheye = ControlFisheye(self.__radialnet) |
|---|
| 63 | self.__toolbar = Toolbar(self.__radialnet, |
|---|
| 64 | self, |
|---|
| 65 | self.__control, |
|---|
| 66 | self.__fisheye) |
|---|
| 67 | |
|---|
| 68 | |
|---|
| 69 | |
|---|
| 70 | self.__hbox._pack_expand_fill(self.__radialnet) |
|---|
| 71 | self.__hbox._pack_noexpand_nofill(self.__control) |
|---|
| 72 | |
|---|
| 73 | self._pack_noexpand_nofill(self.__toolbar) |
|---|
| 74 | self._pack_expand_fill(self.__hbox) |
|---|
| 75 | |
|---|
| 76 | self.show_all() |
|---|
| 77 | self.__created = True |
|---|
| 78 | def update_graph(self): |
|---|
| 79 | self.__graph = GraphBuilder() |
|---|
| 80 | self.__graph.make(self.__parser) |
|---|
| 81 | self.__radialnet.set_graph(self.__graph) |
|---|
| 82 | def set_parse(self, parse): |
|---|
| 83 | self.__parser = parse |
|---|
| 84 | if self.__radialnet!=None: |
|---|
| 85 | self.__radialnet.set_graph(self.__graph) |
|---|