summaryrefslogtreecommitdiffstats
path: root/Src
diff options
context:
space:
mode:
authorTom2012-04-06 16:24:54 +0200
committerTom2012-04-06 16:24:54 +0200
commit13a7b38ffbfa9e004e2872cf98fa6588b2e1230a (patch)
tree5a7dc4a0813c1da4d3759fb45ed427970ff33361 /Src
parentadded appendix 1 and 2 (diff)
downloadimsi-catcher-detection-13a7b38ffbfa9e004e2872cf98fa6588b2e1230a.tar.gz
imsi-catcher-detection-13a7b38ffbfa9e004e2872cf98fa6588b2e1230a.tar.xz
imsi-catcher-detection-13a7b38ffbfa9e004e2872cf98fa6588b2e1230a.zip
evaluation windows integrated
Diffstat (limited to 'Src')
-rw-r--r--Src/PyCatcher/GUI/catcher_main.glade15
-rw-r--r--Src/PyCatcher/src/pyCatcherController.py18
-rw-r--r--Src/PyCatcher/src/pyCatcherModel.py2
-rw-r--r--Src/PyCatcher/src/pyCatcherView.py28
4 files changed, 58 insertions, 5 deletions
diff --git a/Src/PyCatcher/GUI/catcher_main.glade b/Src/PyCatcher/GUI/catcher_main.glade
index bb38205..09ed4ec 100644
--- a/Src/PyCatcher/GUI/catcher_main.glade
+++ b/Src/PyCatcher/GUI/catcher_main.glade
@@ -16,6 +16,20 @@
</object>
</child>
</object>
+ <object class="GtkWindow" id="evaluation_window">
+ <property name="can_focus">False</property>
+ <property name="title" translatable="yes">ICDS</property>
+ <property name="default_width">341</property>
+ <property name="default_height">256</property>
+ <property name="has_resize_grip">False</property>
+ <child>
+ <object class="GtkImage" id="evaluation_image">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-missing-image</property>
+ </object>
+ </child>
+ </object>
<object class="GtkDialog" id="evaluators_window">
<property name="can_focus">False</property>
<property name="border_width">5</property>
@@ -468,6 +482,7 @@
<property name="label" translatable="yes">Evaluation</property>
<property name="use_underline">True</property>
<property name="icon_name">utilities-system-monitor</property>
+ <signal name="clicked" handler="_on_evaluation_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
diff --git a/Src/PyCatcher/src/pyCatcherController.py b/Src/PyCatcher/src/pyCatcherController.py
index 1de5f6e..114ea8a 100644
--- a/Src/PyCatcher/src/pyCatcherController.py
+++ b/Src/PyCatcher/src/pyCatcherController.py
@@ -6,7 +6,7 @@ from pyCatcherView import PyCatcherGUI
from filters import ARFCNFilter,ProviderFilter, BandFilter900
from evaluators import EvaluatorSelect, BayesEvaluator, ConservativeEvaluator, WeightedEvaluator
from rules import ProviderRule, ARFCNMappingRule, CountryMappingRule, LACMappingRule, UniqueCellIDRule, \
- LACMedianRule, NeighbourhoodStructureRule, PureNeighbourhoodRule, FullyDiscoveredNeighbourhoodsRule
+ LACMedianRule, NeighbourhoodStructureRule, PureNeighbourhoodRule, FullyDiscoveredNeighbourhoodsRule, RuleResult
import pickle
class PyCatcherController:
@@ -124,4 +124,18 @@ class PyCatcherController:
def trigger_redraw(self):
dotcode = self._base_station_list.get_dot_code(self.band_filter, self._filters)
if dotcode != 'digraph bsnetwork { }':
- self._gui.load_dot(dotcode) \ No newline at end of file
+ self._gui.load_dot(dotcode)
+ result = RuleResult.IGNORE
+ at_least_warning = False
+ for item in self._base_station_list._get_filtered_list(self.band_filter, self._filters):
+ if item.evaluation == 'Ignore':
+ pass
+ if item.evaluation == 'Ok' and not at_least_warning:
+ result = RuleResult.OK
+ elif item.evaluation == 'Warning':
+ result = RuleResult.WARNING
+ at_least_warning = True
+ elif item.evaluation == 'Critical':
+ result = RuleResult.CRITICAL
+ break
+ self._gui.set_image(result) \ No newline at end of file
diff --git a/Src/PyCatcher/src/pyCatcherModel.py b/Src/PyCatcher/src/pyCatcherModel.py
index 37a311d..bf4be14 100644
--- a/Src/PyCatcher/src/pyCatcherModel.py
+++ b/Src/PyCatcher/src/pyCatcherModel.py
@@ -116,7 +116,7 @@ class BaseStationInformationList:
for neighbour in station.get_neighbour_arfcn():
code += str(station.arfcn) + r' -> ' + str(neighbour) + r'; '
#TODO: make printing the source a fixed option
- print preamble + code + postamble
+ #print preamble + code + postamble
return preamble + code + postamble
def refill_store(self, store, band_filter, filters=None):
diff --git a/Src/PyCatcher/src/pyCatcherView.py b/Src/PyCatcher/src/pyCatcherView.py
index a5be2e7..6cb33a4 100644
--- a/Src/PyCatcher/src/pyCatcherView.py
+++ b/Src/PyCatcher/src/pyCatcherView.py
@@ -3,6 +3,7 @@ import gtk
from xdot import DotWidget
import datetime
import time
+from rules import RuleResult
class PyCatcherGUI:
@@ -19,7 +20,15 @@ class PyCatcherGUI:
self._detail_window = self._builder.get_object('detail_view')
self._rules_window = self._builder.get_object('rules_window')
self._evaluators_window = self._builder.get_object('evaluators_window')
-
+ self._evaluation_window = self._builder.get_object('evaluation_window')
+ self._evaluation_image = self._builder.get_object('evaluation_image')
+
+ self._ok_image = gtk.gdk.pixbuf_new_from_file('../GUI/Images/ok.png')
+ self._warning_image = gtk.gdk.pixbuf_new_from_file('../GUI/Images/warning.png')
+ self._critical_image = gtk.gdk.pixbuf_new_from_file('../GUI/Images/critical.png')
+ self._plain_image = gtk.gdk.pixbuf_new_from_file('../GUI/Images/plain.png')
+ self.set_image(RuleResult.IGNORE)
+
self._catcher_controller = catcher_controller
self._bs_tree_view = self._builder.get_object('tv_stations')
@@ -46,7 +55,19 @@ class PyCatcherGUI:
self._log_buffer = log_view.get_buffer()
self._log_buffer.insert(self._log_buffer.get_end_iter(),self._utf8conv("-- Log execution on " + datetime.datetime.now().strftime("%A, %d. %B %Y %I:%M %p") + " --\n\n"))
- self._main_window.show()
+ self._main_window.show()
+
+ def set_image(self, status):
+ pixbuf = self._plain_image
+ if status == RuleResult.OK:
+ pixbuf = self._ok_image
+ elif status == RuleResult.WARNING:
+ pixbuf = self._warning_image
+ elif status == RuleResult.CRITICAL:
+ pixbuf = self._critical_image
+ width, height = self._evaluation_window.get_size()
+ pixbuf = pixbuf.scale_simple(width, height, gtk.gdk.INTERP_BILINEAR)
+ self._evaluation_image.set_from_pixbuf(pixbuf)
def _add_column(self, name, index):
column = gtk.TreeViewColumn(name, gtk.CellRendererText(), text=index)
@@ -127,6 +148,9 @@ class PyCatcherGUI:
def _on_filter_clicked(self,widget):
self._filter_window.show()
+ def _on_evaluation_clicked(self,widget):
+ self._evaluation_window.show()
+
def _on_filter_close_clicked(self, widget):
self._update_filters()
self._filter_window.hide()