Commit aa9943ee authored by Mathias Ettinger's avatar Mathias Ettinger

Removed 'Tools' tab

parent 83806457
......@@ -3534,180 +3534,6 @@ This is the name used when loading probes.</property>
<property name="type">tab</property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="tool_tab">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<widget class="GtkHPaned" id="tools_hpaned">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="position">300</property>
<property name="position_set">True</property>
<child>
<widget class="GtkScrolledWindow" id="scrolledwindow1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">automatic</property>
<property name="vscrollbar_policy">automatic</property>
<child>
<widget class="GtkTreeView" id="tools_selection_tree">
<property name="visible">True</property>
<property name="can_focus">True</property>
</widget>
</child>
</widget>
<packing>
<property name="resize">False</property>
<property name="shrink">True</property>
</packing>
</child>
<child>
<widget class="GtkVPaned" id="vpaned2">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="position">100</property>
<property name="position_set">True</property>
<child>
<widget class="GtkLabel" id="tool_description">
<property name="visible">True</property>
<property name="can_focus">False</property>
</widget>
<packing>
<property name="resize">False</property>
<property name="shrink">True</property>
</packing>
</child>
<child>
<widget class="GtkScrolledWindow" id="tool_config_area">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">automatic</property>
<property name="vscrollbar_policy">automatic</property>
<child>
<placeholder/>
</child>
</widget>
<packing>
<property name="resize">True</property>
<property name="shrink">True</property>
</packing>
</child>
</widget>
<packing>
<property name="resize">True</property>
<property name="shrink">True</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<widget class="GtkHSeparator" id="hseparator2">
<property name="visible">True</property>
<property name="can_focus">False</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="hbox11">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<widget class="GtkHButtonBox" id="config_buttons1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<property name="homogeneous">True</property>
<property name="layout_style">end</property>
<child>
<widget class="GtkButton" id="undo_tool_conf">
<property name="label">gtk-cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_undo_tool_conf_clicked"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="save_tool_conf">
<property name="label">gtk-apply</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_save_tool_conf_clicked"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">6</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
<child>
<widget class="GtkDrawingArea" id="drawingarea8">
<property name="width_request">2</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="padding">6</property>
<property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
</widget>
<packing>
<property name="position">3</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label_tools">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Tools</property>
</widget>
<packing>
<property name="position">3</property>
<property name="tab_fill">False</property>
<property name="type">tab</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">True</property>
......
......@@ -47,7 +47,6 @@ from opensand_manager_gui.view.window_view import WindowView
from opensand_manager_gui.view.conf_event import ConfEvent
from opensand_manager_gui.view.resource_event import ResourceEvent
from opensand_manager_gui.view.run_event import RunEvent
from opensand_manager_gui.view.tool_event import ToolEvent
from opensand_manager_gui.view.event_handler import EventResponseHandler
from opensand_manager_gui.view.popup.infos import error_popup, info_popup, yes_no_popup
from opensand_manager_gui.view.popup.about_dialog import AboutDialog
......@@ -91,12 +90,9 @@ class View(WindowView):
self._eventconf = ConfEvent(self.get_current(),
self._model, self._log,
self._eventresource.update_view)
self._eventtool = ToolEvent(self.get_current(),
self._model, self._log)
self._eventconf.activate(False)
self._eventresource.activate(False)
self._eventtool.activate(False)
status_box = self._ui.get_widget('status_box')
# status_box.modify_bg(gtk.STATE_NORMAL, gtk.gdk.Color(0xffff, 0xffff,
......@@ -112,7 +108,6 @@ class View(WindowView):
'run' : 0,
'conf' : 2,
'resources' : 1,
'tools' : 3,
}
# update the window title
......@@ -134,7 +129,6 @@ class View(WindowView):
self._eventrun,
self._eventconf,
self._eventresource,
self._eventtool,
self._log)
# start event response handler
......@@ -192,8 +186,6 @@ class View(WindowView):
self._eventresource.close()
self._log.debug("View: close run view")
self._eventrun.close()
self._log.debug("View: close tool view")
self._eventtool.close()
self._log.debug("View: closed")
if self._event_response_handler.is_alive():
self._log.debug("Run Event: join response event handler")
......@@ -324,22 +316,6 @@ class View(WindowView):
self._log.warning("error when trying to check if configuration "
"was modified: " + str(msg))
# on tools tab keep page if some tools were modified
if self._current_page == self._pages['tools'] and \
page_num != self._pages['tools']:
#and not self._model.is_running():
# if the save button is sensitive,
# the configuration may have changed
if self._ui.get_widget('save_tool_conf').is_sensitive():
text = "The tools configuration was not saved\n\n" \
"Do you want to save it ?"
ret = yes_no_popup(text, "Save Tools - OpenSAND Manager",
gtk.STOCK_DIALOG_INFO)
if ret == gtk.RESPONSE_YES:
self._eventtool.on_save_tool_conf_clicked()
else:
self._eventtool.on_undo_tool_conf_clicked()
self._current_page = page_num
if page_num == self._pages['run']:
......@@ -349,8 +325,6 @@ class View(WindowView):
self._eventconf.activate(False)
if self._eventresource is not None:
self._eventresource.activate(False)
if self._eventtool is not None:
self._eventtool.activate(False)
elif page_num == self._pages['conf']:
if self._eventrun is not None:
self._eventrun.activate(False)
......@@ -358,8 +332,6 @@ class View(WindowView):
self._eventconf.activate(True)
if self._eventresource is not None:
self._eventresource.activate(False)
if self._eventtool is not None:
self._eventtool.activate(False)
elif page_num == self._pages['resources']:
if self._eventrun is not None:
self._eventrun.activate(False)
......@@ -368,17 +340,6 @@ class View(WindowView):
if self._eventresource is not None:
self._eventresource.activate(True)
self._eventresource.update_view()
if self._eventtool is not None:
self._eventtool.activate(False)
elif page_num == self._pages['tools']:
if self._eventconf is not None:
self._eventconf.activate(False)
if self._eventresource is not None:
self._eventresource.activate(False)
if self._eventrun is not None:
self._eventrun.activate(False)
if self._eventtool is not None:
self._eventtool.activate(True)
def run(self):
""" start gobject loops """
......
......@@ -43,13 +43,12 @@ from opensand_manager_gui.view.popup.progress_dialog import ProgressDialog
class EventResponseHandler(threading.Thread):
""" Get response events from hosts controllers """
def __init__(self, event_manager_response, run_view,
conf_view, resource_view, tool_view, manager_log):
conf_view, resource_view, manager_log):
threading.Thread.__init__(self)
self.setName("EventResponseHandler")
self._run_view = run_view
self._conf_view = conf_view
self._resource_view = resource_view
self._tool_view = tool_view
self._event_manager_response = event_manager_response
self._log = manager_log
self._prog_dialog = None
......
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
#
#
# OpenSAND is an emulation testbed aiming to represent in a cost effective way a
# satellite telecommunication system for research and engineering activities.
#
#
# Copyright © 2019 TAS
# Copyright © 2019 CNES
#
#
# This file is part of the OpenSAND testbed.
#
#
# OpenSAND is free software : you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY, without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see http://www.gnu.org/licenses/.
#
#
# Author: Julien BERNARD / <jbernard@toulouse.viveris.com>
# Author: Joaquin MUGUERZA / <jmuguerza@toulouse.viveris.com>
"""
tool_view.py - the tool tab view
"""
import gtk
import gobject
import threading
from opensand_manager_gui.view.window_view import WindowView
from opensand_manager_gui.view.utils.config_elements import ConfigurationTree
(TEXT, VISIBLE, ACTIVE, ACTIVATABLE) = range(4)
class ToolView(WindowView):
""" Elements of the tool tab """
def __init__(self, parent, model, manager_log):
"""constructor, initialization """
WindowView.__init__(self, parent)
self._model = model
self._log = manager_log
# create the list of hosts
self._hosts_name = []
# the list of tools parameters widgets that changed identified by a name
self._tool_lock = threading.Lock()
# the tools we have selected
self._selected_tools = {}
# the selected tools once the configuration has been saved
self._saved_tools = {}
with gtk.gdk.lock:
# get the description widget
self._desc_txt = self._ui.get_widget('tool_description')
self._desc_txt.set_alignment(0.0, 0.0)
self._desc_txt.set_padding(20, 20)
# get the configuration area and add a vbox because if we directly
# add a widget to the sroll view, once it will be destroyed the
# scroll view will also be destroyed because it won't have
# reference anymore with the vbox we can add the new widget before
# destroying the older
self._config_view = gtk.VBox()
config_area = self._ui.get_widget('tool_config_area')
config_area.add_with_viewport(self._config_view)
self._current_notebook = None
# create the tree for tools selection
treeview = self._ui.get_widget('tools_selection_tree')
self._tree = ConfigurationTree(treeview, 'Tools',
self.on_selection,
self.tool_toggled_cb)
# disable save button
self._ui.get_widget('save_tool_conf').set_sensitive(False)
self._ui.get_widget('undo_tool_conf').set_sensitive(False)
# update the tree immediately
self.update_tree()
def tool_toggled_cb(self, cell, path):
""" defined in tool_event """
pass
def on_selection(self, selection):
""" defined in tool_event """
pass
def update_tree(self):
""" update the tools tree """
self._tool_lock.acquire()
for host in [elt for elt in self._model.get_machines()
if elt.get_name() not in self._hosts_name]:
tools = {}
self._hosts_name.append(host.get_name())
self._selected_tools[host.get_name().lower()] = []
self._saved_tools[host.get_name().lower()] = []
for tool in host.get_tools():
tools[tool.get_name().upper()] = tool.get_state()
gobject.idle_add(self._tree.add_host,
host, tools)
real_names = []
for host in self._model.get_all():
real_names.append(host.get_name())
old_host_names = set(self._hosts_name) - set(real_names)
for host_name in old_host_names:
self._hosts_name.remove(host_name)
del self._selected_tools[host_name.lower()]
del self._saved_tools[host_name.lower()]
gobject.idle_add(self._tree.del_elem, host_name)
self._tool_lock.release()
# continue to refresh
return True
def handle_param_changed(self, source=None, event=None):
""" defined in tool_event """
pass
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment