"Fossies" - the Fresh Open Source Software Archive 
Member "radialnet/gui/Application.py" (3 Mar 2008, 3653 Bytes) of package /linux/privat/old/radialnet-0.44.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style:
standard) with prefixed line numbers.
Alternatively you can here
view or
download the uninterpreted source code file.
1 # vim: set fileencoding=utf-8 :
2
3 # Copyright (C) 2008 Insecure.Com LLC.
4 #
5 # Author(s): João Paulo de Souza Medeiros <ignotus21@gmail.com>
6 #
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
11 #
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
16 #
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
21 import gtk
22 import bestwidgets as bw
23
24 from util.integration import make_graph_from_nmap_parser
25 from core.Info import INFO
26 from core.XMLHandler import XMLReader
27 from gui.ControlWidget import ControlWidget, ControlFisheye
28 from gui.Toolbar import Toolbar
29 from gui.Image import Pixmaps
30 from gui.RadialNet import *
31
32
33 DIMENSION = (640, 480)
34
35
36
37 class Application(bw.BWMainWindow):
38 """
39 """
40 def __init__(self):
41 """
42 """
43 bw.BWMainWindow.__init__(self)
44 self.set_default_size(DIMENSION[0], DIMENSION[1])
45
46 self.set_icon(Pixmaps().get_pixbuf('logo'))
47
48 self.__create_widgets()
49
50
51 def __create_widgets(self):
52 """
53 """
54 self.__hbox = bw.BWHBox(spacing=0)
55 self.__vbox = bw.BWVBox(spacing=0)
56
57 self.__radialnet = RadialNet(LAYOUT_WEIGHTED)
58 self.__control = ControlWidget(self.__radialnet)
59 self.__fisheye = ControlFisheye(self.__radialnet)
60 self.__toolbar = Toolbar(self.__radialnet,
61 self,
62 self.__control,
63 self.__fisheye)
64 self.__statusbar = bw.BWStatusbar()
65
66 self.__hbox.bw_pack_start_expand_fill(self.__radialnet)
67 self.__hbox.bw_pack_start_noexpand_nofill(self.__control)
68
69 self.__vbox.bw_pack_start_noexpand_nofill(self.__toolbar)
70 self.__vbox.bw_pack_start_expand_fill(self.__hbox)
71 self.__vbox.bw_pack_start_noexpand_nofill(self.__fisheye)
72 self.__vbox.bw_pack_start_noexpand_nofill(self.__statusbar)
73
74 self.add(self.__vbox)
75 self.set_title(" ".join([INFO['name'], INFO['version']]))
76 self.set_position(gtk.WIN_POS_CENTER)
77 self.show_all()
78 self.connect('destroy', gtk.main_quit)
79
80 self.__radialnet.set_no_show_all(True)
81 self.__control.set_no_show_all(True)
82 self.__fisheye.set_no_show_all(True)
83
84 self.__radialnet.hide()
85 self.__control.hide()
86 self.__fisheye.hide()
87 self.__toolbar.disable_controls()
88
89
90 def parse_nmap_xml_file(self, file):
91 """
92 """
93 try:
94
95 self.__parser = XMLReader(file)
96 self.__parser.parse()
97
98 except:
99
100 text = 'It is not possible open file: %s.' % file
101
102 alert = bw.BWAlertDialog(self,
103 primary_text='Error opening file.',
104 secondary_text=text)
105
106 alert.show_all()
107
108 return False
109
110 self.__radialnet.set_empty()
111 self.__radialnet.set_graph(make_graph_from_nmap_parser(self.__parser))
112 self.__radialnet.show()
113
114 self.__toolbar.enable_controls()
115
116 return True
117
118
119 def start(self):
120 """
121 """
122 gtk.main()