- bug fixes in error.py - add from * to raise statements - fix py35 compatibility - finalize omit_unchanged_within feature - fix follwup bug (missing Param.override) in proxy.py Change-Id: I621c01a0d5e1ec6696fb06f39666f3316fb53649
68 lines
3.0 KiB
Python
68 lines
3.0 KiB
Python
# -*- coding: utf-8 -*-
|
|
# *****************************************************************************
|
|
#
|
|
# This program 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 2 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, write to the Free Software Foundation, Inc.,
|
|
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
#
|
|
# Module authors:
|
|
# Sandra Seger <sandra.seger@frm2.tum.de>
|
|
#
|
|
# *****************************************************************************
|
|
|
|
from secop.gui.cfg_editor.utils import loadUi
|
|
from secop.gui.qt import QHBoxLayout, QSizePolicy, QSpacerItem, Qt, QWidget
|
|
|
|
|
|
class NodeDisplay(QWidget):
|
|
def __init__(self, file_path=None, parent=None):
|
|
super().__init__(parent)
|
|
loadUi(self, 'node_display.ui')
|
|
self.saved = bool(file_path)
|
|
self.created = self.tree_widget.set_file(file_path)
|
|
self.tree_widget.save_status_changed.connect(self.change_save_status)
|
|
self.tree_widget.currentItemChanged.connect(self.set_scroll_area)
|
|
self.scroll_area_layout.setAlignment(Qt.AlignTop)
|
|
self.set_scroll_area(self.tree_widget.get_selected_item(), None)
|
|
self.splitter.setSizes([1, 1])
|
|
|
|
def change_save_status(self, saved):
|
|
self.saved = saved
|
|
|
|
def set_scroll_area(self, current, previous):
|
|
self.remove_all_from_scroll_area(self.scroll_area_layout)
|
|
self.scroll_area_layout.addWidget(current.widget)
|
|
for index in range(0, current.childCount()):
|
|
child_layout = QHBoxLayout()
|
|
spacer = QSpacerItem(30, 0, QSizePolicy.Fixed,
|
|
QSizePolicy.Minimum)
|
|
child_layout.addSpacerItem(spacer)
|
|
child_layout.addWidget(current.child(index).widget)
|
|
self.scroll_area_layout.addLayout(child_layout)
|
|
for sub_index in range(0, current.child(index).childCount()):
|
|
sub_child_layout = QHBoxLayout()
|
|
sub_spacer = QSpacerItem(60, 0, QSizePolicy.Fixed,
|
|
QSizePolicy.Minimum)
|
|
sub_child_layout.addSpacerItem(sub_spacer)
|
|
sub_child_layout.addWidget(
|
|
current.child(index).child(sub_index).widget)
|
|
self.scroll_area_layout.addLayout(sub_child_layout)
|
|
|
|
def remove_all_from_scroll_area(self, layout):
|
|
for index in range(layout.count()-1, -1, -1):
|
|
item = layout.itemAt(index)
|
|
if item.widget():
|
|
item.widget().setParent(None)
|
|
elif item.layout():
|
|
self.remove_all_from_scroll_area(item.layout())
|