From 13a7b38ffbfa9e004e2872cf98fa6588b2e1230a Mon Sep 17 00:00:00 2001 From: Tom Date: Fri, 6 Apr 2012 16:24:54 +0200 Subject: evaluation windows integrated --- Src/PyCatcher/GUI/catcher_main.glade | 15 +++++++++++++++ Src/PyCatcher/src/pyCatcherController.py | 18 ++++++++++++++++-- Src/PyCatcher/src/pyCatcherModel.py | 2 +- Src/PyCatcher/src/pyCatcherView.py | 28 ++++++++++++++++++++++++++-- 4 files changed, 58 insertions(+), 5 deletions(-) (limited to 'Src') 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 @@ + + False + ICDS + 341 + 256 + False + + + True + False + gtk-missing-image + + + False 5 @@ -468,6 +482,7 @@ Evaluation True utilities-system-monitor + False 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() -- cgit v1.2.3-55-g7522