|
|
|
@ -14,8 +14,7 @@
|
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
|
# limitations under the License.
|
|
|
|
|
|
|
|
|
|
from PySide import QtGui, QtCore
|
|
|
|
|
from PySide.QtGui import QLabel, QLineEdit, QCheckBox, QGroupBox, QComboBox
|
|
|
|
|
from calculate.consolegui.qtwrapper import QtGuiWidgets, QtCore
|
|
|
|
|
from calculate.core.client.function import create_obj, listToArrayArray, \
|
|
|
|
|
listToArray
|
|
|
|
|
# import analysis
|
|
|
|
@ -75,9 +74,9 @@ class Table():
|
|
|
|
|
tablevalue = TableValue
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class RadioButton(QtGui.QRadioButton):
|
|
|
|
|
class RadioButton(QtGuiWidgets.QRadioButton):
|
|
|
|
|
def __init__(self, text=None, parent=None):
|
|
|
|
|
QtGui.QRadioButton.__init__(self, text, parent)
|
|
|
|
|
QtGuiWidgets.QRadioButton.__init__(self, text, parent)
|
|
|
|
|
|
|
|
|
|
def set_data(self, data):
|
|
|
|
|
self.data = data
|
|
|
|
@ -86,7 +85,7 @@ class RadioButton(QtGui.QRadioButton):
|
|
|
|
|
return self.data
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class MainFrame(QtGui.QWidget):
|
|
|
|
|
class MainFrame(QtGuiWidgets.QWidget):
|
|
|
|
|
def __init__(self, parent, ClientObj, view, method_name, \
|
|
|
|
|
error_output=True, skip_options=False):
|
|
|
|
|
super(MainFrame, self).__init__(parent)
|
|
|
|
@ -212,12 +211,12 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
debug(10, "CHANGE OFFSET for", self.method_name)
|
|
|
|
|
else:
|
|
|
|
|
debug(10, "SHOW NEW FRAME for", self.method_name)
|
|
|
|
|
self.common_layout = QtGui.QVBoxLayout(self)
|
|
|
|
|
self.common_layout = QtGuiWidgets.QVBoxLayout(self)
|
|
|
|
|
self.common_layout.setAlignment(QtCore.Qt.AlignTop)
|
|
|
|
|
self.common_layout.setContentsMargins(0, 0, 0, 0)
|
|
|
|
|
self.common_layout.setSpacing(0)
|
|
|
|
|
|
|
|
|
|
self.grid = QtGui.QGridLayout()
|
|
|
|
|
self.grid = QtGuiWidgets.QGridLayout()
|
|
|
|
|
self.grid.setSpacing(10)
|
|
|
|
|
self.grid.setColumnStretch(0, 10)
|
|
|
|
|
self.grid.setColumnStretch(1, 17)
|
|
|
|
@ -539,7 +538,7 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
|
|
|
|
|
# self.grid.setSizeConstraint(self.grid.SizeConstraint.SetMinimumSize)
|
|
|
|
|
self.grid.setSizeConstraint(
|
|
|
|
|
QtGui.QLayout.SizeConstraint.SetMaximumSize)
|
|
|
|
|
QtGuiWidgets.QLayout.SizeConstraint.SetMaximumSize)
|
|
|
|
|
# hide expert settings
|
|
|
|
|
|
|
|
|
|
self.grid.setContentsMargins(28, 28, 28, 28)
|
|
|
|
@ -563,16 +562,16 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
self.ClientObj.MainWidget.left_frame.changed_step(
|
|
|
|
|
self.ClientObj.param_objects[self.method_name]['step'])
|
|
|
|
|
if not lastTable:
|
|
|
|
|
self.grid.addItem(QtGui.QSpacerItem(
|
|
|
|
|
0, 0, QtGui.QSizePolicy.Expanding,
|
|
|
|
|
QtGui.QSizePolicy.Expanding),
|
|
|
|
|
self.grid.addItem(QtGuiWidgets.QSpacerItem(
|
|
|
|
|
0, 0, QtGuiWidgets.QSizePolicy.Expanding,
|
|
|
|
|
QtGuiWidgets.QSizePolicy.Expanding),
|
|
|
|
|
x + 1, y, 1, 2)
|
|
|
|
|
|
|
|
|
|
self.common_layout.addLayout(self.grid)
|
|
|
|
|
|
|
|
|
|
# add spacer
|
|
|
|
|
# self.common_layout.addItem(QtGui.QSpacerItem( 0, 0, \
|
|
|
|
|
# QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding))
|
|
|
|
|
# self.common_layout.addItem(QtGuiWidgets.QSpacerItem( 0, 0, \
|
|
|
|
|
# QtGuiWidgets.QSizePolicy.Expanding, QtGuiWidgets.QSizePolicy.Expanding))
|
|
|
|
|
self.update()
|
|
|
|
|
self.ClientObj.app.processEvents()
|
|
|
|
|
self.updateGeometry()
|
|
|
|
@ -706,23 +705,23 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
|
|
|
|
|
self.grid.addWidget(self.label_dict[field.name], x, y)
|
|
|
|
|
|
|
|
|
|
self.view_dict[field.name] = QLineEdit(self)
|
|
|
|
|
self.view_dict[field.name] = QtGuiWidgets.QLineEdit(self)
|
|
|
|
|
if field.value:
|
|
|
|
|
self.view_dict[field.name].setText(field.value)
|
|
|
|
|
if field.type == 'int':
|
|
|
|
|
self.rx = QtCore.QRegExp("^[\d]{1,50}$")
|
|
|
|
|
self.validator = QtGui.QRegExpValidator(self.rx, self)
|
|
|
|
|
self.validator = QtGuiWidgets.QRegExpValidator(self.rx, self)
|
|
|
|
|
self.view_dict[field.name].setValidator(self.validator)
|
|
|
|
|
elif field.type == 'float':
|
|
|
|
|
self.rx = QtCore.QRegExp("^[\d]{1,50}[.][\d]{1,50}$")
|
|
|
|
|
self.validator = QtGui.QRegExpValidator(self.rx, self)
|
|
|
|
|
self.validator = QtGuiWidgets.QRegExpValidator(self.rx, self)
|
|
|
|
|
self.view_dict[field.name].setValidator(self.validator)
|
|
|
|
|
# password input
|
|
|
|
|
elif "password" in field.type:
|
|
|
|
|
self.view_dict[field.name].setEchoMode(QtGui.QLineEdit.Password)
|
|
|
|
|
self.view_dict[field.name].setEchoMode(QtGuiWidgets.QLineEdit.Password)
|
|
|
|
|
|
|
|
|
|
exp = QtGui.QSizePolicy.Policy.Expanding
|
|
|
|
|
pref = QtGui.QSizePolicy.Policy.Preferred
|
|
|
|
|
exp = QtGuiWidgets.QSizePolicy.Policy.Expanding
|
|
|
|
|
pref = QtGuiWidgets.QSizePolicy.Policy.Preferred
|
|
|
|
|
self.view_dict[field.name].setSizePolicy(exp, pref)
|
|
|
|
|
# advanced settings (expert)
|
|
|
|
|
if self.expert:
|
|
|
|
@ -762,7 +761,7 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
def add_element_check(self, field, x, y, brief=False):
|
|
|
|
|
self.error_label_dict[field.name] = ErrorLabel(self)
|
|
|
|
|
|
|
|
|
|
self.label_dict[field.name] = QLabel(field.label, self)
|
|
|
|
|
self.label_dict[field.name] = QtGuiWidgets.QLabel(field.label, self)
|
|
|
|
|
# set disable item if uncompatible
|
|
|
|
|
if field.uncompatible:
|
|
|
|
|
self.label_dict[field.name].setToolTip(field.uncompatible)
|
|
|
|
@ -774,7 +773,7 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
if brief:
|
|
|
|
|
self.view_dict[field.name] = ReadonlyCheckBox(self)
|
|
|
|
|
else:
|
|
|
|
|
self.view_dict[field.name] = QCheckBox(self)
|
|
|
|
|
self.view_dict[field.name] = QtGuiWidgets.QCheckBox(self)
|
|
|
|
|
#self.view_dict[field.name].setStyleSheet(
|
|
|
|
|
# "QCheckBox:hover {background-color:#FFFFFF}")
|
|
|
|
|
|
|
|
|
@ -813,11 +812,11 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
self.view_dict[field.name].setDisabled(True)
|
|
|
|
|
|
|
|
|
|
self.view_dict[field.name].setContentsMargins(0, 0, 0, 0)
|
|
|
|
|
check_widget = QtGui.QLabel(self)
|
|
|
|
|
exp = QtGui.QSizePolicy.Policy.Expanding
|
|
|
|
|
pref = QtGui.QSizePolicy.Policy.Preferred
|
|
|
|
|
check_widget = QtGuiWidgets.QLabel(self)
|
|
|
|
|
exp = QtGuiWidgets.QSizePolicy.Policy.Expanding
|
|
|
|
|
pref = QtGuiWidgets.QSizePolicy.Policy.Preferred
|
|
|
|
|
check_widget.setSizePolicy(exp, pref)
|
|
|
|
|
check_layout = QtGui.QHBoxLayout(check_widget)
|
|
|
|
|
check_layout = QtGuiWidgets.QHBoxLayout(check_widget)
|
|
|
|
|
check_layout.setContentsMargins(0, 0, 0, 0)
|
|
|
|
|
self.view_dict[field.name].setFixedWidth \
|
|
|
|
|
(self.view_dict[field.name].sizeHint().width() + 4)
|
|
|
|
@ -852,7 +851,7 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
return wrapper
|
|
|
|
|
|
|
|
|
|
def add_element_radio(self, field, x, y):
|
|
|
|
|
self.label_dict[field.name] = QLabel(self)
|
|
|
|
|
self.label_dict[field.name] = QtGuiWidgets.QLabel(self)
|
|
|
|
|
if field.uncompatible:
|
|
|
|
|
self.label_dict[field.name].setToolTip(field.uncompatible)
|
|
|
|
|
self.label_dict[field.name].setDisabled(True)
|
|
|
|
@ -863,7 +862,7 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
if field.comments:
|
|
|
|
|
comments = field.comments[0]
|
|
|
|
|
|
|
|
|
|
self.GroupBox = QGroupBox(field.label, self)
|
|
|
|
|
self.GroupBox = QtGuiWidgets.QGroupBox(field.label, self)
|
|
|
|
|
self.GroupBox.setStyleSheet( self.GroupBox.styleSheet() +
|
|
|
|
|
"QGroupBox {"
|
|
|
|
|
'padding-top: 24px; padding-bottom: 0px;'
|
|
|
|
@ -884,8 +883,8 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
'background-color: transparent;'
|
|
|
|
|
'subcontrol-position: top center;'
|
|
|
|
|
'margin-top: 6px;}')
|
|
|
|
|
self.ButGrp_dict[field.name] = QtGui.QButtonGroup(self)
|
|
|
|
|
layout = QtGui.QVBoxLayout(self.GroupBox)
|
|
|
|
|
self.ButGrp_dict[field.name] = QtGuiWidgets.QButtonGroup(self)
|
|
|
|
|
layout = QtGuiWidgets.QVBoxLayout(self.GroupBox)
|
|
|
|
|
radiolist = []
|
|
|
|
|
|
|
|
|
|
if field.value == None:
|
|
|
|
@ -961,7 +960,7 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
choice.append(field.value)
|
|
|
|
|
|
|
|
|
|
# add label
|
|
|
|
|
self.label_dict[field.name] = QLabel(field.label, self)
|
|
|
|
|
self.label_dict[field.name] = QtGuiWidgets.QLabel(field.label, self)
|
|
|
|
|
if field.uncompatible:
|
|
|
|
|
self.label_dict[field.name].setToolTip(field.uncompatible)
|
|
|
|
|
self.label_dict[field.name].setDisabled(True)
|
|
|
|
@ -992,8 +991,8 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
self.ComboBox.currentIndexChanged.connect \
|
|
|
|
|
(combo_checked(self, field.name))
|
|
|
|
|
|
|
|
|
|
exp = QtGui.QSizePolicy.Policy.Expanding
|
|
|
|
|
pref = QtGui.QSizePolicy.Policy.Preferred
|
|
|
|
|
exp = QtGuiWidgets.QSizePolicy.Policy.Expanding
|
|
|
|
|
pref = QtGuiWidgets.QSizePolicy.Policy.Preferred
|
|
|
|
|
self.ComboBox.setSizePolicy(exp, pref)
|
|
|
|
|
self.view_dict[field.name] = self.ComboBox
|
|
|
|
|
if self.expert:
|
|
|
|
@ -1052,7 +1051,7 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
choice.append(field.value)
|
|
|
|
|
|
|
|
|
|
# add label
|
|
|
|
|
self.label_dict[field.name] = QLabel(field.label, self)
|
|
|
|
|
self.label_dict[field.name] = QtGuiWidgets.QLabel(field.label, self)
|
|
|
|
|
if field.uncompatible:
|
|
|
|
|
self.label_dict[field.name].setToolTip(field.uncompatible)
|
|
|
|
|
self.label_dict[field.name].setDisabled(True)
|
|
|
|
@ -1061,7 +1060,7 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
self.ComboBox = QComboWgt(self)
|
|
|
|
|
self.ComboBox.setDuplicatesEnabled(False)
|
|
|
|
|
self.ComboBox.setEditable(True)
|
|
|
|
|
#le = QtGui.QLineEdit(self)
|
|
|
|
|
#le = QtGuiWidgets.QLineEdit(self)
|
|
|
|
|
#le.setStyleSheet('QLineEdit {background:white;margin: 1px;}')
|
|
|
|
|
#self.ComboBox.setLineEdit(le)
|
|
|
|
|
for i in range(0, len(choice)):
|
|
|
|
@ -1080,8 +1079,8 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
if field.value == choice[i]:
|
|
|
|
|
self.ComboBox.setCurrentIndex(i)
|
|
|
|
|
|
|
|
|
|
exp = QtGui.QSizePolicy.Policy.Expanding
|
|
|
|
|
pref = QtGui.QSizePolicy.Policy.Preferred
|
|
|
|
|
exp = QtGuiWidgets.QSizePolicy.Policy.Expanding
|
|
|
|
|
pref = QtGuiWidgets.QSizePolicy.Policy.Preferred
|
|
|
|
|
self.ComboBox.setSizePolicy(exp, pref)
|
|
|
|
|
self.view_dict[field.name] = self.ComboBox
|
|
|
|
|
if self.expert:
|
|
|
|
@ -1133,7 +1132,7 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
comments, add_ability,
|
|
|
|
|
self.expert)
|
|
|
|
|
# add label
|
|
|
|
|
self.label_dict[field.name] = QLabel(field.label, self)
|
|
|
|
|
self.label_dict[field.name] = QtGuiWidgets.QLabel(field.label, self)
|
|
|
|
|
if self.expert:
|
|
|
|
|
if field.default:
|
|
|
|
|
self.expert_list.append(field.name)
|
|
|
|
@ -1218,7 +1217,7 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
# return wrapper
|
|
|
|
|
|
|
|
|
|
def add_element_openfile(self, field, x, y):
|
|
|
|
|
self.label_dict[field.name] = QLabel(field.label, self)
|
|
|
|
|
self.label_dict[field.name] = QtGuiWidgets.QLabel(field.label, self)
|
|
|
|
|
self.grid.addWidget(self.label_dict[field.name], x, y)
|
|
|
|
|
|
|
|
|
|
# field.type in ['file','files','dir']
|
|
|
|
@ -1252,7 +1251,7 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
self.grid.addWidget(self.error_label_dict[field.name], x + 1, y, 1, 2)
|
|
|
|
|
|
|
|
|
|
def add_element_file(self, field, x, y):
|
|
|
|
|
self.label_dict[field.name] = QLabel(field.label, self)
|
|
|
|
|
self.label_dict[field.name] = QtGuiWidgets.QLabel(field.label, self)
|
|
|
|
|
self.grid.addWidget(self.label_dict[field.name], x, y)
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
@ -1437,7 +1436,7 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
reply = show_question(self, text, cursor_pos=True,
|
|
|
|
|
title=_('Calculate Console'))
|
|
|
|
|
|
|
|
|
|
if reply == QtGui.QMessageBox.Yes or not self.changed_expert_list:
|
|
|
|
|
if reply == QtGuiWidgets.QMessageBox.Yes or not self.changed_expert_list:
|
|
|
|
|
for field_name in self.changed_expert_list:
|
|
|
|
|
if field_name not in self.expert_list:
|
|
|
|
|
self.expert_list.append(field_name)
|
|
|
|
@ -1557,7 +1556,7 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
self.ClientObj.process_dict[meth_result[0].message] \
|
|
|
|
|
['name'] = method_name
|
|
|
|
|
self.ClientObj.process_dict[meth_result[0].message] \
|
|
|
|
|
['layout'] = QtGui.QVBoxLayout()
|
|
|
|
|
['layout'] = QtGuiWidgets.QVBoxLayout()
|
|
|
|
|
self.ClientObj.process_dict[meth_result[0].message] \
|
|
|
|
|
['layout'].setAlignment(QtCore.Qt.AlignTop)
|
|
|
|
|
|
|
|
|
@ -1655,8 +1654,8 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
self.add_table_items(table, field, lenColumn, self.table_widget, \
|
|
|
|
|
brief)
|
|
|
|
|
|
|
|
|
|
minimum = QtGui.QSizePolicy.Minimum
|
|
|
|
|
expanding = QtGui.QSizePolicy.Expanding
|
|
|
|
|
minimum = QtGuiWidgets.QSizePolicy.Minimum
|
|
|
|
|
expanding = QtGuiWidgets.QSizePolicy.Expanding
|
|
|
|
|
self.table_widget.setSizePolicy(minimum, expanding)
|
|
|
|
|
|
|
|
|
|
self.view_dict[field.name] = self.table_widget
|
|
|
|
@ -1683,34 +1682,34 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
self.grid.addWidget(self.label_dict[field.name], x, y, 1, 2)
|
|
|
|
|
x += 1
|
|
|
|
|
|
|
|
|
|
widget_for_grid = QtGui.QWidget(self)
|
|
|
|
|
widget_for_grid = QtGuiWidgets.QWidget(self)
|
|
|
|
|
if brief:
|
|
|
|
|
widget_for_grid.setStyleSheet("background: transparent;")
|
|
|
|
|
wfg_layout = QtGui.QVBoxLayout(widget_for_grid)
|
|
|
|
|
wfg_layout = QtGuiWidgets.QVBoxLayout(widget_for_grid)
|
|
|
|
|
wfg_layout.setSpacing(0)
|
|
|
|
|
wfg_layout.setContentsMargins(0, 0, 0, 0)
|
|
|
|
|
# add 2 button if field type = writable
|
|
|
|
|
if field.type == 'writable':
|
|
|
|
|
self.view_dict[field.name].horizontalHeader().setClickable(False)
|
|
|
|
|
|
|
|
|
|
unit_widget = QtGui.QWidget(self)
|
|
|
|
|
unit_layout = QtGui.QHBoxLayout(unit_widget)
|
|
|
|
|
unit_widget = QtGuiWidgets.QWidget(self)
|
|
|
|
|
unit_layout = QtGuiWidgets.QHBoxLayout(unit_widget)
|
|
|
|
|
unit_layout.setContentsMargins(0, 0, 0, 0)
|
|
|
|
|
unit_layout.setSpacing(3)
|
|
|
|
|
|
|
|
|
|
plus_but = QtGui.QPushButton(self)
|
|
|
|
|
plus_but = QtGuiWidgets.QPushButton(self)
|
|
|
|
|
try:
|
|
|
|
|
plus_but.setIcon(QtGui.QIcon.fromTheme('list-add'))
|
|
|
|
|
plus_but.setIcon(QtGuiWidgets.QIcon.fromTheme('list-add'))
|
|
|
|
|
except:
|
|
|
|
|
plus_but.setText('+')
|
|
|
|
|
|
|
|
|
|
plus_but.setToolTip(_('Add a row'))
|
|
|
|
|
plus_but.setFixedWidth(30)
|
|
|
|
|
|
|
|
|
|
self.view_dict[field.name].minus_but = QtGui.QPushButton(self)
|
|
|
|
|
self.view_dict[field.name].minus_but = QtGuiWidgets.QPushButton(self)
|
|
|
|
|
try:
|
|
|
|
|
self.view_dict[field.name].minus_but.setIcon \
|
|
|
|
|
(QtGui.QIcon.fromTheme('list-remove'))
|
|
|
|
|
(QtGuiWidgets.QIcon.fromTheme('list-remove'))
|
|
|
|
|
except:
|
|
|
|
|
self.view_dict[field.name].minus_but.setText('-')
|
|
|
|
|
self.view_dict[field.name].minus_but.setToolTip \
|
|
|
|
@ -1718,18 +1717,18 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
self.view_dict[field.name].minus_but.setFixedWidth(30)
|
|
|
|
|
self.view_dict[field.name].minus_but.setDisabled(True)
|
|
|
|
|
|
|
|
|
|
refresh_but = QtGui.QPushButton(self)
|
|
|
|
|
refresh_but = QtGuiWidgets.QPushButton(self)
|
|
|
|
|
try:
|
|
|
|
|
refresh_but.setIcon(QtGui.QIcon.fromTheme('edit-undo'))
|
|
|
|
|
refresh_but.setIcon(QtGuiWidgets.QIcon.fromTheme('edit-undo'))
|
|
|
|
|
except:
|
|
|
|
|
refresh_but.setText('R')
|
|
|
|
|
|
|
|
|
|
refresh_but.setToolTip(_('Recover the table'))
|
|
|
|
|
refresh_but.setFixedWidth(30)
|
|
|
|
|
|
|
|
|
|
clear_but = QtGui.QPushButton(self)
|
|
|
|
|
clear_but = QtGuiWidgets.QPushButton(self)
|
|
|
|
|
try:
|
|
|
|
|
clear_but.setIcon(QtGui.QIcon.fromTheme('edit-clear'))
|
|
|
|
|
clear_but.setIcon(QtGuiWidgets.QIcon.fromTheme('edit-clear'))
|
|
|
|
|
except:
|
|
|
|
|
clear_but.setText('C')
|
|
|
|
|
|
|
|
|
@ -1773,11 +1772,11 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
|
|
|
|
|
# set width column
|
|
|
|
|
# self.view_dict[field.name].horizontalHeader().resizeSections\
|
|
|
|
|
# (QtGui.QHeaderView.ResizeMode.ResizeToContents)
|
|
|
|
|
# (QtGuiWidgets.QHeaderView.ResizeMode.ResizeToContents)
|
|
|
|
|
|
|
|
|
|
# No Selection
|
|
|
|
|
self.view_dict[field.name].setSelectionMode \
|
|
|
|
|
(QtGui.QAbstractItemView.SelectionMode.NoSelection)
|
|
|
|
|
(QtGuiWidgets.QAbstractItemView.SelectionMode.NoSelection)
|
|
|
|
|
|
|
|
|
|
if field.uncompatible:
|
|
|
|
|
self.label_dict[field.name].setToolTip(field.uncompatible)
|
|
|
|
@ -1809,36 +1808,36 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
col = column + 1
|
|
|
|
|
if not table.values:
|
|
|
|
|
table_widget.setEditTriggers \
|
|
|
|
|
(QtGui.QAbstractItemView.NoEditTriggers)
|
|
|
|
|
(QtGuiWidgets.QAbstractItemView.NoEditTriggers)
|
|
|
|
|
for row in range(len(table.body.stringArray)):
|
|
|
|
|
tablewidgetitem = QtGui.QTableWidgetItem \
|
|
|
|
|
tablewidgetitem = QtGuiWidgets.QTableWidgetItem \
|
|
|
|
|
(table.body.stringArray[row].string[column])
|
|
|
|
|
table_widget.setItem(row, col, tablewidgetitem)
|
|
|
|
|
|
|
|
|
|
elif column > (len(table.values.ChoiceValue) - 1):
|
|
|
|
|
for row in range(len(table.body.stringArray)):
|
|
|
|
|
tablewidgetitem = QtGui.QTableWidgetItem \
|
|
|
|
|
tablewidgetitem = QtGuiWidgets.QTableWidgetItem \
|
|
|
|
|
(table.body.stringArray[row].string[column])
|
|
|
|
|
table_widget.setItem(row, col, tablewidgetitem)
|
|
|
|
|
|
|
|
|
|
table_widget.item(row, col).setFlags(
|
|
|
|
|
QtCore.Qt.ItemIsEditable)
|
|
|
|
|
brush = QtGui.QBrush(
|
|
|
|
|
self.palette().color(QtGui.QPalette.Text))
|
|
|
|
|
brush = QtGuiWidgets.QBrush(
|
|
|
|
|
self.palette().color(QtGuiWidgets.QPalette.Text))
|
|
|
|
|
table_widget.item(row, col).setForeground(brush)
|
|
|
|
|
|
|
|
|
|
elif brief and table.values.ChoiceValue[column].typefield in \
|
|
|
|
|
['combo', 'comboEdit', 'multichoice', \
|
|
|
|
|
'multichoice_add', 'input', 'password']:
|
|
|
|
|
table_widget.setEditTriggers \
|
|
|
|
|
(QtGui.QAbstractItemView.NoEditTriggers)
|
|
|
|
|
(QtGuiWidgets.QAbstractItemView.NoEditTriggers)
|
|
|
|
|
for row in range(len(table.body.stringArray)):
|
|
|
|
|
if table.values.ChoiceValue[column].typefield == \
|
|
|
|
|
'password' and table.body.stringArray \
|
|
|
|
|
[row].string[column]:
|
|
|
|
|
tablewidgetitem = QtGui.QTableWidgetItem('***')
|
|
|
|
|
tablewidgetitem = QtGuiWidgets.QTableWidgetItem('***')
|
|
|
|
|
else:
|
|
|
|
|
tablewidgetitem = QtGui.QTableWidgetItem \
|
|
|
|
|
tablewidgetitem = QtGuiWidgets.QTableWidgetItem \
|
|
|
|
|
(table.body.stringArray[row].string[column])
|
|
|
|
|
table_widget.setItem(row, col, tablewidgetitem)
|
|
|
|
|
|
|
|
|
@ -1856,13 +1855,13 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
if ind < len(ChoiceValue.comments.string):
|
|
|
|
|
val = ChoiceValue.comments.string[ind]
|
|
|
|
|
|
|
|
|
|
tablewidgetitem = QtGui.QTableWidgetItem(val)
|
|
|
|
|
tablewidgetitem = QtGuiWidgets.QTableWidgetItem(val)
|
|
|
|
|
table_widget.setItem(row, col, tablewidgetitem)
|
|
|
|
|
|
|
|
|
|
table_widget.item(row, col).setFlags \
|
|
|
|
|
(QtCore.Qt.ItemIsEditable)
|
|
|
|
|
brush = QtGui.QBrush(
|
|
|
|
|
self.palette().color(QtGui.QPalette.Text))
|
|
|
|
|
brush = QtGuiWidgets.QBrush(
|
|
|
|
|
self.palette().color(QtGuiWidgets.QPalette.Text))
|
|
|
|
|
table_widget.item(row, col).setForeground(brush)
|
|
|
|
|
|
|
|
|
|
elif table.values.ChoiceValue[column].typefield in \
|
|
|
|
@ -1891,13 +1890,13 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
value_dict[choice[i]] = choice[i]
|
|
|
|
|
val = ','.join(map(lambda x: value_dict[x], default))
|
|
|
|
|
|
|
|
|
|
tablewidgetitem = QtGui.QTableWidgetItem(val)
|
|
|
|
|
tablewidgetitem = QtGuiWidgets.QTableWidgetItem(val)
|
|
|
|
|
table_widget.setItem(row, col, tablewidgetitem)
|
|
|
|
|
|
|
|
|
|
table_widget.item(row, col).setFlags \
|
|
|
|
|
(QtCore.Qt.ItemIsEditable)
|
|
|
|
|
brush = QtGui.QBrush(
|
|
|
|
|
self.palette().color(QtGui.QPalette.Text))
|
|
|
|
|
brush = QtGuiWidgets.QBrush(
|
|
|
|
|
self.palette().color(QtGuiWidgets.QPalette.Text))
|
|
|
|
|
table_widget.item(row, col).setForeground(brush)
|
|
|
|
|
|
|
|
|
|
elif table.values.ChoiceValue[column].typefield in \
|
|
|
|
@ -1915,14 +1914,14 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
elif not val and brief:
|
|
|
|
|
data = ''
|
|
|
|
|
val = ''
|
|
|
|
|
tablewidgetitem = QtGui.QTableWidgetItem(val)
|
|
|
|
|
tablewidgetitem = QtGuiWidgets.QTableWidgetItem(val)
|
|
|
|
|
tablewidgetitem.setData(1, data)
|
|
|
|
|
table_widget.setItem(row, col, tablewidgetitem)
|
|
|
|
|
|
|
|
|
|
table_widget.item(row, col).setFlags(
|
|
|
|
|
QtCore.Qt.ItemIsEditable)
|
|
|
|
|
brush = QtGui.QBrush(
|
|
|
|
|
self.palette().color(QtGui.QPalette.Text))
|
|
|
|
|
brush = QtGuiWidgets.QBrush(
|
|
|
|
|
self.palette().color(QtGuiWidgets.QPalette.Text))
|
|
|
|
|
table_widget.item(row, col).setForeground(brush)
|
|
|
|
|
|
|
|
|
|
elif table.values.ChoiceValue[column].typefield in \
|
|
|
|
@ -1930,27 +1929,27 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
for row in range(len(table.body.stringArray)):
|
|
|
|
|
val = table.body.stringArray[row].string[column]
|
|
|
|
|
|
|
|
|
|
tablewidgetitem = QtGui.QTableWidgetItem(val)
|
|
|
|
|
tablewidgetitem = QtGuiWidgets.QTableWidgetItem(val)
|
|
|
|
|
table_widget.setItem(row, col, tablewidgetitem)
|
|
|
|
|
|
|
|
|
|
table_widget.item(row, col).setFlags(
|
|
|
|
|
QtCore.Qt.ItemIsEditable)
|
|
|
|
|
brush = QtGui.QBrush(
|
|
|
|
|
self.palette().color(QtGui.QPalette.Text))
|
|
|
|
|
brush = QtGuiWidgets.QBrush(
|
|
|
|
|
self.palette().color(QtGuiWidgets.QPalette.Text))
|
|
|
|
|
table_widget.item(row, col).setForeground(brush)
|
|
|
|
|
|
|
|
|
|
elif table.values.ChoiceValue[column].typefield == 'password':
|
|
|
|
|
for row in range(len(table.body.stringArray)):
|
|
|
|
|
passwd = table.body.stringArray[row].string[column]
|
|
|
|
|
val = '***' if passwd else ''
|
|
|
|
|
tablewidgetitem = QtGui.QTableWidgetItem(val)
|
|
|
|
|
tablewidgetitem = QtGuiWidgets.QTableWidgetItem(val)
|
|
|
|
|
tablewidgetitem.setData(1, passwd)
|
|
|
|
|
table_widget.setItem(row, col, tablewidgetitem)
|
|
|
|
|
|
|
|
|
|
table_widget.item(row, col).setFlags(
|
|
|
|
|
QtCore.Qt.ItemIsEditable)
|
|
|
|
|
brush = QtGui.QBrush(
|
|
|
|
|
self.palette().color(QtGui.QPalette.Text))
|
|
|
|
|
brush = QtGuiWidgets.QBrush(
|
|
|
|
|
self.palette().color(QtGuiWidgets.QPalette.Text))
|
|
|
|
|
table_widget.item(row, col).setForeground(brush)
|
|
|
|
|
|
|
|
|
|
def add_select_check(self, table):
|
|
|
|
@ -1967,7 +1966,7 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
|
|
|
|
|
for row in range(table.rowCount()):
|
|
|
|
|
if not table.cellWidget(row, 0):
|
|
|
|
|
tablewidgetitem = QtGui.QTableWidgetItem()
|
|
|
|
|
tablewidgetitem = QtGuiWidgets.QTableWidgetItem()
|
|
|
|
|
table.setItem(row, 0, tablewidgetitem)
|
|
|
|
|
# table.item(row, 0).setFlags(QtCore.Qt.ItemIsEditable)
|
|
|
|
|
|
|
|
|
@ -2044,7 +2043,7 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
h += table.rowHeight(row_in_table)
|
|
|
|
|
table.setFixedHeight(h)
|
|
|
|
|
table.horizontalHeader().resizeSections \
|
|
|
|
|
(QtGui.QHeaderView.ResizeMode.ResizeToContents)
|
|
|
|
|
(QtGuiWidgets.QHeaderView.ResizeMode.ResizeToContents)
|
|
|
|
|
table.setColumnWidth(0, 40)
|
|
|
|
|
|
|
|
|
|
############# End add Table
|
|
|
|
@ -2076,10 +2075,10 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
self.grid.addWidget(help_lbl, x, y, 1, 2)
|
|
|
|
|
x += 1
|
|
|
|
|
|
|
|
|
|
# brief_sa = QtGui.QScrollArea(self)
|
|
|
|
|
brief_widget = QtGui.QWidget(self)
|
|
|
|
|
# brief_sa = QtGuiWidgets.QScrollArea(self)
|
|
|
|
|
brief_widget = QtGuiWidgets.QWidget(self)
|
|
|
|
|
|
|
|
|
|
self.brief_grid = QtGui.QGridLayout(brief_widget)
|
|
|
|
|
self.brief_grid = QtGuiWidgets.QGridLayout(brief_widget)
|
|
|
|
|
# self.brief_grid.setContentsMargins(10,10,10,10)
|
|
|
|
|
self.brief_grid.setContentsMargins(0, 0, 0, 0)
|
|
|
|
|
self.brief_grid.setSpacing(10)
|
|
|
|
@ -2094,7 +2093,7 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
brief_widget.setStyleSheet("#Brief_w "
|
|
|
|
|
"{background-color: transparent;}")
|
|
|
|
|
|
|
|
|
|
exp = QtGui.QSizePolicy.Policy.Expanding
|
|
|
|
|
exp = QtGuiWidgets.QSizePolicy.Policy.Expanding
|
|
|
|
|
|
|
|
|
|
expert_brief = ExpertWidget(_('View options'), self)
|
|
|
|
|
expert_brief.setFlat(True)
|
|
|
|
@ -2119,10 +2118,10 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
self.add_image()
|
|
|
|
|
|
|
|
|
|
# add spacer
|
|
|
|
|
self.spacer_item = QtGui.QSpacerItem(0, 0, exp, exp)
|
|
|
|
|
self.spacer_item = QtGuiWidgets.QSpacerItem(0, 0, exp, exp)
|
|
|
|
|
self.grid.addItem(self.spacer_item)
|
|
|
|
|
self.grid.setSizeConstraint \
|
|
|
|
|
(QtGui.QLayout.SizeConstraint.SetMaximumSize)
|
|
|
|
|
(QtGuiWidgets.QLayout.SizeConstraint.SetMaximumSize)
|
|
|
|
|
|
|
|
|
|
self.common_layout.addLayout(self.grid)
|
|
|
|
|
# Show Control Buttons widget
|
|
|
|
@ -2155,7 +2154,7 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
if not Group.fields:
|
|
|
|
|
return grid_x
|
|
|
|
|
# self.group_name_label = LabelWordWrap(Group.name, self)
|
|
|
|
|
GroupBox = QGroupBox(Group.name)
|
|
|
|
|
GroupBox = QtGuiWidgets.QGroupBox(Group.name)
|
|
|
|
|
GroupBox.setObjectName('GroupBoxBrief')
|
|
|
|
|
# brief_widget.setStyleSheet("#Brief_w "
|
|
|
|
|
GroupBox.setStyleSheet(
|
|
|
|
@ -2181,7 +2180,7 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
'margin-top: 6px;}')
|
|
|
|
|
else:
|
|
|
|
|
return grid_x
|
|
|
|
|
gb_layout = QtGui.QGridLayout(GroupBox)
|
|
|
|
|
gb_layout = QtGuiWidgets.QGridLayout(GroupBox)
|
|
|
|
|
|
|
|
|
|
gb_layout.setContentsMargins(10, 10, 10, 10)
|
|
|
|
|
gb_layout.setSpacing(4)
|
|
|
|
@ -2290,8 +2289,8 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
uncompatible_count += 1
|
|
|
|
|
minimum = QtGui.QSizePolicy.Minimum
|
|
|
|
|
maximum = QtGui.QSizePolicy.Maximum
|
|
|
|
|
minimum = QtGuiWidgets.QSizePolicy.Minimum
|
|
|
|
|
maximum = QtGuiWidgets.QSizePolicy.Maximum
|
|
|
|
|
GroupBox.setSizePolicy(minimum, maximum)
|
|
|
|
|
|
|
|
|
|
if uncompatible_count != len(Fields):
|
|
|
|
@ -2403,7 +2402,7 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
debug(10, "SKIP uncompatible", field.name)
|
|
|
|
|
continue
|
|
|
|
|
|
|
|
|
|
if type(self.view_dict[field.name]) == QGroupBox:
|
|
|
|
|
if type(self.view_dict[field.name]) == QtGuiWidgets.QGroupBox:
|
|
|
|
|
if self.ButGrp_dict[field.name].checkedButton():
|
|
|
|
|
param_object[paramname] = (
|
|
|
|
|
self.ButGrp_dict[field.name].checkedButton(
|
|
|
|
@ -2418,7 +2417,7 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
else:
|
|
|
|
|
param_object[paramname] = False
|
|
|
|
|
|
|
|
|
|
elif type(self.view_dict[field.name]) == QCheckBox:
|
|
|
|
|
elif type(self.view_dict[field.name]) == QtGuiWidgets.QCheckBox:
|
|
|
|
|
if self.view_dict[field.name].isTristate():
|
|
|
|
|
if self.view_dict[field.name].checkState() \
|
|
|
|
|
== QtCore.Qt.CheckState.PartiallyChecked:
|
|
|
|
@ -2434,7 +2433,7 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
self.view_dict[field.name].isChecked()
|
|
|
|
|
|
|
|
|
|
elif type(self.view_dict[field.name]) in \
|
|
|
|
|
[QComboBox, QComboWgt]:
|
|
|
|
|
[QtGuiWidgets.QComboBox, QComboWgt]:
|
|
|
|
|
ind = self.view_dict[field.name].currentIndex()
|
|
|
|
|
text = self.view_dict[field.name].currentText()
|
|
|
|
|
choice = []
|
|
|
|
@ -2463,7 +2462,7 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
param_object[paramname] = \
|
|
|
|
|
self.view_dict[field.name].currentText()
|
|
|
|
|
|
|
|
|
|
elif type(self.view_dict[field.name]) == QLineEdit:
|
|
|
|
|
elif type(self.view_dict[field.name]) == QtGuiWidgets.QLineEdit:
|
|
|
|
|
val = self.view_dict[field.name].text() or ''
|
|
|
|
|
param_object[paramname] = self.fix_string_value(val)
|
|
|
|
|
|
|
|
|
@ -2671,7 +2670,7 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
d = self.ClientObj.process_dict[meth_result[0].message]
|
|
|
|
|
d['result'] = meth_result[0]
|
|
|
|
|
d['name'] = self.method_name
|
|
|
|
|
d['layout'] = QtGui.QVBoxLayout()
|
|
|
|
|
d['layout'] = QtGuiWidgets.QVBoxLayout()
|
|
|
|
|
d['layout'].setAlignment(QtCore.Qt.AlignTop)
|
|
|
|
|
|
|
|
|
|
# set new window title
|
|
|
|
@ -2809,38 +2808,38 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
self.highlight_element_error(errorfield)
|
|
|
|
|
|
|
|
|
|
def unhighliht_element_errors(self, field_name):
|
|
|
|
|
if type(self.view_dict[field_name]) in [QGroupBox, SelectList]:
|
|
|
|
|
if type(self.view_dict[field_name]) in [QtGuiWidgets.QGroupBox, SelectList]:
|
|
|
|
|
self.view_dict[field_name].setStyleSheet( \
|
|
|
|
|
self.view_dict[field_name].styleSheet().replace('red', 'gray'))
|
|
|
|
|
elif type(self.view_dict[field_name]) in [SelectedTableWidget]:
|
|
|
|
|
# self.view_dict[field_name].setStyleSheet('QTableWidget { '
|
|
|
|
|
# 'border: 1px solid red;}')
|
|
|
|
|
self.view_dict[field_name].unsetErrorBorder()
|
|
|
|
|
elif type(self.view_dict[field_name]) in [QComboBox]:
|
|
|
|
|
elif type(self.view_dict[field_name]) in [QtGuiWidgets.QComboBox]:
|
|
|
|
|
self.view_dict[field_name].setStyleSheet('QComboBox { '
|
|
|
|
|
'border: 0px solid red;}')
|
|
|
|
|
elif type(self.view_dict[field_name]) in [ComboFileWgt, QComboWgt]:
|
|
|
|
|
self.view_dict[field_name].unsetErrorBorder()
|
|
|
|
|
elif type(self.view_dict[field_name]) == QCheckBox:
|
|
|
|
|
elif type(self.view_dict[field_name]) == QtGuiWidgets.QCheckBox:
|
|
|
|
|
self.view_dict[field_name].setStyleSheet('QCheckBox { '
|
|
|
|
|
'border: 0px solid red;}')
|
|
|
|
|
else:
|
|
|
|
|
self.view_dict[field_name].setStyleSheet("")
|
|
|
|
|
|
|
|
|
|
def highlight_element_error(self, field_name):
|
|
|
|
|
if type(self.view_dict[field_name]) in [QGroupBox, SelectList]:
|
|
|
|
|
if type(self.view_dict[field_name]) in [QtGuiWidgets.QGroupBox, SelectList]:
|
|
|
|
|
self.view_dict[field_name].setStyleSheet( \
|
|
|
|
|
self.view_dict[field_name].styleSheet().replace('gray', 'red'))
|
|
|
|
|
elif type(self.view_dict[field_name]) in [SelectedTableWidget]:
|
|
|
|
|
# self.view_dict[field_name].setStyleSheet('QTableWidget { '
|
|
|
|
|
# 'border: 1px solid red;}')
|
|
|
|
|
self.view_dict[field_name].setErrorBorder()
|
|
|
|
|
elif type(self.view_dict[field_name]) in [QComboBox]:
|
|
|
|
|
elif type(self.view_dict[field_name]) in [QtGuiWidgets.QComboBox]:
|
|
|
|
|
self.view_dict[field_name].setStyleSheet('QComboBox { '
|
|
|
|
|
'border: 1px solid red;}')
|
|
|
|
|
elif type(self.view_dict[field_name]) in [ComboFileWgt, QComboWgt]:
|
|
|
|
|
self.view_dict[field_name].setErrorBorder()
|
|
|
|
|
elif type(self.view_dict[field_name]) == QCheckBox:
|
|
|
|
|
elif type(self.view_dict[field_name]) == QtGuiWidgets.QCheckBox:
|
|
|
|
|
self.view_dict[field_name].setStyleSheet('QCheckBox { '
|
|
|
|
|
'border: 1px solid red;}')
|
|
|
|
|
else:
|
|
|
|
@ -2933,7 +2932,7 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
'''remove value'''
|
|
|
|
|
if self.view_dict[field.name].item(row, i):
|
|
|
|
|
self.view_dict[field.name].item(row, i).setText('')
|
|
|
|
|
elif type(self.view_dict[field.name].cellWidget(row, i)) == QComboBox:
|
|
|
|
|
elif type(self.view_dict[field.name].cellWidget(row, i)) == QtGuiWidgets.QComboBox:
|
|
|
|
|
try:
|
|
|
|
|
self.view_dict[field.name].cellWidget(row, i).setEditText('')
|
|
|
|
|
except:
|
|
|
|
@ -2959,7 +2958,7 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
except Exception, e:
|
|
|
|
|
# _print ('EXCEPT', e)
|
|
|
|
|
pass
|
|
|
|
|
elif type(self.view_dict[field.name].cellWidget(row, i)) == QComboBox:
|
|
|
|
|
elif type(self.view_dict[field.name].cellWidget(row, i)) == QtGuiWidgets.QComboBox:
|
|
|
|
|
for q in (table.body.stringArray):
|
|
|
|
|
try:
|
|
|
|
|
ind = q.string.index(text)
|
|
|
|
|