|
|
|
@ -24,7 +24,7 @@ from more import show_msg, LabelWordWrap, MultipleChoice, SelectTable, \
|
|
|
|
|
ComboFileWgt, PasswordWidget, get_sid, ClientServiceThread, \
|
|
|
|
|
ExpertWidget, ButtonsWidget, show_question, PlusRow, \
|
|
|
|
|
ReadonlyCheckBox, get_view_params, ImageLabel, SelectList, \
|
|
|
|
|
QComboWgt, _print
|
|
|
|
|
QComboWgt, _print, get_system_rgb, ParameterWindow
|
|
|
|
|
from sudsds import WebFault
|
|
|
|
|
from calculate.lib.utils.tools import Sizes
|
|
|
|
|
from SelectTable import SelectedTableWidget
|
|
|
|
@ -124,6 +124,14 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
debug(11, "! method has not brief")
|
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
|
def isMultistep(self):
|
|
|
|
|
"""
|
|
|
|
|
Метод содержит несколько шагов
|
|
|
|
|
:return:
|
|
|
|
|
"""
|
|
|
|
|
steps = self.ClientObj.param_objects[self.method_name]['steps_field']
|
|
|
|
|
return len(steps.tablevalue.head.string) > 1
|
|
|
|
|
|
|
|
|
|
def isBrief(self, step=None):
|
|
|
|
|
"""
|
|
|
|
|
Определяет является ли данный шаг отображением brief
|
|
|
|
@ -212,7 +220,8 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
|
|
|
|
|
self.setObjectName('MainFrame')
|
|
|
|
|
self.setStyleSheet("QWidget#MainFrame "
|
|
|
|
|
"{background-color: #FFFFFF;}")
|
|
|
|
|
"{background-color: %s;}"%
|
|
|
|
|
get_system_rgb(self, ParameterWindow))
|
|
|
|
|
# " QWidget { border: 1px solid blue;}")
|
|
|
|
|
# x = 0 - space for image
|
|
|
|
|
x = 1
|
|
|
|
@ -303,11 +312,11 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
self.buttons = []
|
|
|
|
|
|
|
|
|
|
for Group in self.view.groups.GroupField:
|
|
|
|
|
if Group.name:
|
|
|
|
|
if Group.name and self.isMultistep():
|
|
|
|
|
self.group_name_label = LabelWordWrap(Group.name, self)
|
|
|
|
|
self.group_name_label.setAlignment(QtCore.Qt.AlignLeft)
|
|
|
|
|
self.group_name_label.setStyleSheet("font-size: 16px;"
|
|
|
|
|
"color: #000; font: bold;");
|
|
|
|
|
"font-weight: bold;");
|
|
|
|
|
|
|
|
|
|
self.grid.addWidget(self.group_name_label, x, y, 1, 2)
|
|
|
|
|
x += 1
|
|
|
|
@ -315,7 +324,7 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
if not Group.fields:
|
|
|
|
|
continue
|
|
|
|
|
if cached:
|
|
|
|
|
debug(10, "CACHE DEBUG",self.param_object)
|
|
|
|
|
debug(10, "CACHE DEBUG", self.param_object)
|
|
|
|
|
for field in Group.fields.Field:
|
|
|
|
|
if lastTable:
|
|
|
|
|
self.resize_table(lastTable)
|
|
|
|
@ -335,7 +344,7 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
if field.name in self.changed_expert_list:
|
|
|
|
|
field.default = False
|
|
|
|
|
else:
|
|
|
|
|
boolmapping = {True:'on', False:'off'}
|
|
|
|
|
boolmapping = {True: 'on', False: 'off'}
|
|
|
|
|
field.value = boolmapping.get(value, value)
|
|
|
|
|
if field.name in self.changed_expert_list:
|
|
|
|
|
field.default = False
|
|
|
|
@ -529,7 +538,8 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
# If errors came in parameters
|
|
|
|
|
if self.ClientObj.param_objects[self.method_name]['error']:
|
|
|
|
|
debug(10, "METHOD has errors", self.method_name)
|
|
|
|
|
debug(15, "ERRORS", self.ClientObj.param_objects[self.method_name]['error'])
|
|
|
|
|
debug(15, "ERRORS",
|
|
|
|
|
self.ClientObj.param_objects[self.method_name]['error'])
|
|
|
|
|
self.highlight_errors()
|
|
|
|
|
else:
|
|
|
|
|
debug(10, "METHOD has not errors", self.method_name)
|
|
|
|
@ -756,8 +766,8 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
self.view_dict[field.name] = ReadonlyCheckBox(self)
|
|
|
|
|
else:
|
|
|
|
|
self.view_dict[field.name] = QCheckBox(self)
|
|
|
|
|
self.view_dict[field.name].setStyleSheet(
|
|
|
|
|
"QCheckBox:hover {background-color:#FFFFFF}")
|
|
|
|
|
#self.view_dict[field.name].setStyleSheet(
|
|
|
|
|
# "QCheckBox:hover {background-color:#FFFFFF}")
|
|
|
|
|
|
|
|
|
|
self.view_dict[field.name].setFocusPolicy(QtCore.Qt.NoFocus)
|
|
|
|
|
|
|
|
|
@ -845,27 +855,26 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
comments = field.comments[0]
|
|
|
|
|
|
|
|
|
|
self.GroupBox = QGroupBox(field.label, self)
|
|
|
|
|
self.GroupBox.setStyleSheet("QGroupBox {"
|
|
|
|
|
'padding-top: 24px; padding-bottom: 0px;'
|
|
|
|
|
'padding-left: 5px; padding-right: 5px;'
|
|
|
|
|
'border: 1px solid transparent;'
|
|
|
|
|
'border-top-color: gray;'
|
|
|
|
|
'border-left-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,'
|
|
|
|
|
'stop: 0 gray, stop: 0.7 gray, stop: 1 transparent);'
|
|
|
|
|
|
|
|
|
|
'border-right-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,'
|
|
|
|
|
'stop: 0 gray, stop: 0.7 gray, stop: 1 transparent);'
|
|
|
|
|
|
|
|
|
|
'background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,'
|
|
|
|
|
'stop: 0 #eeeeee, stop: 0.8 transparent, stop: 1 transparent);'
|
|
|
|
|
'border-bottom: 0px;'
|
|
|
|
|
'border-top-left-radius: 4px;'
|
|
|
|
|
'border-top-right-radius: 4px;}'
|
|
|
|
|
|
|
|
|
|
'QGroupBox::title {'
|
|
|
|
|
'background-color: transparent;'
|
|
|
|
|
'subcontrol-position: top center;'
|
|
|
|
|
'margin-top: 6px;}')
|
|
|
|
|
self.GroupBox.setStyleSheet( self.GroupBox.styleSheet() +
|
|
|
|
|
"QGroupBox {"
|
|
|
|
|
'padding-top: 24px; padding-bottom: 0px;'
|
|
|
|
|
'padding-left: 5px; padding-right: 5px;'
|
|
|
|
|
'border: 1px solid gray;'
|
|
|
|
|
'border-left-color: qlineargradient( x1: 0, y1: 0, x2: 0, y2: 1,'
|
|
|
|
|
'stop: 0 gray, stop: 1 transparent);'
|
|
|
|
|
'border-top-color: qlineargradient( x1: 0, y1: 0, x2: 1, y2: 0,'
|
|
|
|
|
'stop: 0 gray, stop: 1 transparent);'
|
|
|
|
|
'border-right: 0px; border-bottom: 0px;'
|
|
|
|
|
'border-top-left-radius: 2px;'
|
|
|
|
|
|
|
|
|
|
'background-color: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 1,'
|
|
|
|
|
'stop: 0 rgba(200, 200, 200,75), stop: 0.5 transparent,'
|
|
|
|
|
'stop: 1 transparent);}'
|
|
|
|
|
|
|
|
|
|
'QGroupBox::title {'
|
|
|
|
|
'background-color: transparent;'
|
|
|
|
|
'subcontrol-position: top center;'
|
|
|
|
|
'margin-top: 6px;}')
|
|
|
|
|
self.ButGrp_dict[field.name] = QtGui.QButtonGroup(self)
|
|
|
|
|
layout = QtGui.QVBoxLayout(self.GroupBox)
|
|
|
|
|
radiolist = []
|
|
|
|
@ -952,7 +961,7 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
for i in range(len(choice)):
|
|
|
|
|
if choice[i] == '---':
|
|
|
|
|
self.ComboBox.setStyleSheet('QComboBox::separator ' \
|
|
|
|
|
'{height : 2px; background: gray;' \
|
|
|
|
|
'{height : 2px; ' #background: gray;' \
|
|
|
|
|
'margin-top: 0 2px 0 2px;}')
|
|
|
|
|
self.ComboBox.insertSeparator(i)
|
|
|
|
|
continue
|
|
|
|
@ -1044,7 +1053,7 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
self.ComboBox.setDuplicatesEnabled(False)
|
|
|
|
|
self.ComboBox.setEditable(True)
|
|
|
|
|
le = QtGui.QLineEdit(self)
|
|
|
|
|
le.setStyleSheet('QLineEdit {background:white;margin: 1px;}')
|
|
|
|
|
#le.setStyleSheet('QLineEdit {background:white;margin: 1px;}')
|
|
|
|
|
self.ComboBox.setLineEdit(le)
|
|
|
|
|
for i in range(0, len(choice)):
|
|
|
|
|
if choice[i] == '---':
|
|
|
|
@ -1465,7 +1474,8 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
if not brief:
|
|
|
|
|
self.collect_object(var_mapper, param_object, method_name)()
|
|
|
|
|
|
|
|
|
|
for k, v in ((k,v) for k,v in var_mapper.items() if k.endswith("!")):
|
|
|
|
|
for k, v in ((k, v) for k, v in var_mapper.items() if
|
|
|
|
|
k.endswith("!")):
|
|
|
|
|
debug(10, "FORCE SET for", k[:-1], v.__repr__())
|
|
|
|
|
mapper = {"on": True, "off": False, "None": None}
|
|
|
|
|
param_object[k[:-1]] = mapper.get(v, v)
|
|
|
|
@ -1507,7 +1517,7 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
else:
|
|
|
|
|
return button_clicked(
|
|
|
|
|
field.value, self.button_variable_mapper[field.name],
|
|
|
|
|
self.error_mapper[field.name], brief)
|
|
|
|
|
self.error_mapper[field.name], brief)
|
|
|
|
|
|
|
|
|
|
def button_clicked_after(self, result, method_name):
|
|
|
|
|
meth_result = []
|
|
|
|
@ -1802,9 +1812,10 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
(table.body.stringArray[row].string[column])
|
|
|
|
|
table_widget.setItem(row, col, tablewidgetitem)
|
|
|
|
|
|
|
|
|
|
table_widget.item(row, col).setFlags \
|
|
|
|
|
(QtCore.Qt.ItemIsEditable)
|
|
|
|
|
brush = QtGui.QBrush(QtCore.Qt.black)
|
|
|
|
|
table_widget.item(row, col).setFlags(
|
|
|
|
|
QtCore.Qt.ItemIsEditable)
|
|
|
|
|
brush = QtGui.QBrush(
|
|
|
|
|
self.palette().color(QtGui.QPalette.Text))
|
|
|
|
|
table_widget.item(row, col).setForeground(brush)
|
|
|
|
|
|
|
|
|
|
elif brief and table.values.ChoiceValue[column].typefield in \
|
|
|
|
@ -1841,7 +1852,8 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
|
|
|
|
|
table_widget.item(row, col).setFlags \
|
|
|
|
|
(QtCore.Qt.ItemIsEditable)
|
|
|
|
|
brush = QtGui.QBrush(QtCore.Qt.black)
|
|
|
|
|
brush = QtGui.QBrush(
|
|
|
|
|
self.palette().color(QtGui.QPalette.Text))
|
|
|
|
|
table_widget.item(row, col).setForeground(brush)
|
|
|
|
|
|
|
|
|
|
elif table.values.ChoiceValue[column].typefield in \
|
|
|
|
@ -1875,7 +1887,8 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
|
|
|
|
|
table_widget.item(row, col).setFlags \
|
|
|
|
|
(QtCore.Qt.ItemIsEditable)
|
|
|
|
|
brush = QtGui.QBrush(QtCore.Qt.black)
|
|
|
|
|
brush = QtGui.QBrush(
|
|
|
|
|
self.palette().color(QtGui.QPalette.Text))
|
|
|
|
|
table_widget.item(row, col).setForeground(brush)
|
|
|
|
|
|
|
|
|
|
elif table.values.ChoiceValue[column].typefield in \
|
|
|
|
@ -1897,9 +1910,10 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
tablewidgetitem.setData(1, data)
|
|
|
|
|
table_widget.setItem(row, col, tablewidgetitem)
|
|
|
|
|
|
|
|
|
|
table_widget.item(row, col).setFlags \
|
|
|
|
|
(QtCore.Qt.ItemIsEditable)
|
|
|
|
|
brush = QtGui.QBrush(QtCore.Qt.black)
|
|
|
|
|
table_widget.item(row, col).setFlags(
|
|
|
|
|
QtCore.Qt.ItemIsEditable)
|
|
|
|
|
brush = QtGui.QBrush(
|
|
|
|
|
self.palette().color(QtGui.QPalette.Text))
|
|
|
|
|
table_widget.item(row, col).setForeground(brush)
|
|
|
|
|
|
|
|
|
|
elif table.values.ChoiceValue[column].typefield in \
|
|
|
|
@ -1910,9 +1924,10 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
tablewidgetitem = QtGui.QTableWidgetItem(val)
|
|
|
|
|
table_widget.setItem(row, col, tablewidgetitem)
|
|
|
|
|
|
|
|
|
|
table_widget.item(row, col).setFlags \
|
|
|
|
|
(QtCore.Qt.ItemIsEditable)
|
|
|
|
|
brush = QtGui.QBrush(QtCore.Qt.black)
|
|
|
|
|
table_widget.item(row, col).setFlags(
|
|
|
|
|
QtCore.Qt.ItemIsEditable)
|
|
|
|
|
brush = QtGui.QBrush(
|
|
|
|
|
self.palette().color(QtGui.QPalette.Text))
|
|
|
|
|
table_widget.item(row, col).setForeground(brush)
|
|
|
|
|
|
|
|
|
|
elif table.values.ChoiceValue[column].typefield == 'password':
|
|
|
|
@ -1923,9 +1938,10 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
tablewidgetitem.setData(1, passwd)
|
|
|
|
|
table_widget.setItem(row, col, tablewidgetitem)
|
|
|
|
|
|
|
|
|
|
table_widget.item(row, col).setFlags \
|
|
|
|
|
(QtCore.Qt.ItemIsEditable)
|
|
|
|
|
brush = QtGui.QBrush(QtCore.Qt.black)
|
|
|
|
|
table_widget.item(row, col).setFlags(
|
|
|
|
|
QtCore.Qt.ItemIsEditable)
|
|
|
|
|
brush = QtGui.QBrush(
|
|
|
|
|
self.palette().color(QtGui.QPalette.Text))
|
|
|
|
|
table_widget.item(row, col).setForeground(brush)
|
|
|
|
|
|
|
|
|
|
def add_select_check(self, table):
|
|
|
|
@ -2039,12 +2055,12 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
_help = self.ClientObj.param_objects \
|
|
|
|
|
[self.method_name]['steps_field'].help
|
|
|
|
|
|
|
|
|
|
group_name_label = LabelWordWrap(group_name, self)
|
|
|
|
|
group_name_label.setStyleSheet("font-size: 16px; color: #000;"
|
|
|
|
|
"font: bold;")
|
|
|
|
|
|
|
|
|
|
self.grid.addWidget(group_name_label, x, y, 1, 2)
|
|
|
|
|
x += 1
|
|
|
|
|
if self.isMultistep():
|
|
|
|
|
group_name_label = LabelWordWrap(group_name, self)
|
|
|
|
|
group_name_label.setStyleSheet("font-size: 16px;" # color: #000;"
|
|
|
|
|
"font: bold;")
|
|
|
|
|
self.grid.addWidget(group_name_label, x, y, 1, 2)
|
|
|
|
|
x += 1
|
|
|
|
|
|
|
|
|
|
if _help:
|
|
|
|
|
help_lbl = LabelWordWrap(_help, self)
|
|
|
|
@ -2133,30 +2149,27 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
GroupBox = QGroupBox(Group.name)
|
|
|
|
|
GroupBox.setObjectName('GroupBoxBrief')
|
|
|
|
|
# brief_widget.setStyleSheet("#Brief_w "
|
|
|
|
|
GroupBox.setStyleSheet('#GroupBoxBrief {'
|
|
|
|
|
'font-weight: bold;'
|
|
|
|
|
'padding-top: 24px; padding-bottom: 0px;'
|
|
|
|
|
'padding-left: 5px; padding-right: 5px;'
|
|
|
|
|
'border: 1px solid transparent;'
|
|
|
|
|
'border-top-color: gray;'
|
|
|
|
|
|
|
|
|
|
'border-left-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,'
|
|
|
|
|
'stop: 0 gray, stop: 0.7 gray, stop: 1 transparent);'
|
|
|
|
|
|
|
|
|
|
'border-right-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,'
|
|
|
|
|
'stop: 0 gray, stop: 0.7 gray, stop: 1 transparent);'
|
|
|
|
|
|
|
|
|
|
'background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,'
|
|
|
|
|
'stop: 0 #eeeeee, stop: 0.8 transparent, stop: 1 transparent);'
|
|
|
|
|
|
|
|
|
|
'border-bottom: 0px;'
|
|
|
|
|
'border-top-left-radius: 4px;'
|
|
|
|
|
'border-top-right-radius: 4px;}'
|
|
|
|
|
|
|
|
|
|
'QGroupBox::title {'
|
|
|
|
|
'background-color: transparent;'
|
|
|
|
|
'subcontrol-position: top center;'
|
|
|
|
|
'margin-top: 6px;}')
|
|
|
|
|
GroupBox.setStyleSheet(
|
|
|
|
|
GroupBox.styleSheet() +
|
|
|
|
|
"#GroupBoxBrief {"
|
|
|
|
|
'padding-top: 24px; padding-bottom: 0px;'
|
|
|
|
|
'padding-left: 5px; padding-right: 5px;'
|
|
|
|
|
'border: 1px solid gray;'
|
|
|
|
|
'border-left-color: qlineargradient( x1: 0, y1: 0, x2: 0, y2: 1,'
|
|
|
|
|
'stop: 0 gray, stop: 1 transparent);'
|
|
|
|
|
'border-top-color: qlineargradient( x1: 0, y1: 0, x2: 1, y2: 0,'
|
|
|
|
|
'stop: 0 gray, stop: 1 transparent);'
|
|
|
|
|
'border-right: 0px; border-bottom: 0px;'
|
|
|
|
|
'border-top-left-radius: 2px;'
|
|
|
|
|
|
|
|
|
|
'background-color: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 1,'
|
|
|
|
|
'stop: 0 rgba(200, 200, 200,75), stop: 0.5 transparent,'
|
|
|
|
|
'stop: 1 transparent);}'
|
|
|
|
|
|
|
|
|
|
'QGroupBox::title {'
|
|
|
|
|
'background-color: transparent;'
|
|
|
|
|
'subcontrol-position: top center;'
|
|
|
|
|
'margin-top: 6px;}')
|
|
|
|
|
else:
|
|
|
|
|
return grid_x
|
|
|
|
|
gb_layout = QtGui.QGridLayout(GroupBox)
|
|
|
|
@ -2477,7 +2490,6 @@ class MainFrame(QtGui.QWidget):
|
|
|
|
|
for fields in self.expert_list:
|
|
|
|
|
param_object[fields] = None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return wrapper
|
|
|
|
|
|
|
|
|
|
def fix_string_value(self, value):
|
|
|
|
|