|
|
|
@ -14,7 +14,7 @@
|
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
|
# limitations under the License.
|
|
|
|
|
|
|
|
|
|
from calculate.consolegui.qtwrapper import QtGuiWidgets, QtCore
|
|
|
|
|
from calculate.consolegui import qt
|
|
|
|
|
from calculate.core.client.function import create_obj, listToArrayArray, \
|
|
|
|
|
listToArray
|
|
|
|
|
# import analysis
|
|
|
|
@ -48,13 +48,13 @@ def get_size_by_type(sizetype, size):
|
|
|
|
|
return str(int(size) / k)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class CallMethod(QtCore.QThread):
|
|
|
|
|
class CallMethod(qt.QThread):
|
|
|
|
|
'''For using page_offset and page_count'''
|
|
|
|
|
collect_sig = QtCore.Signal()
|
|
|
|
|
call_meth_sig = QtCore.Signal()
|
|
|
|
|
collect_sig = qt.Signal()
|
|
|
|
|
call_meth_sig = qt.Signal()
|
|
|
|
|
|
|
|
|
|
def __init__(self, parent):
|
|
|
|
|
QtCore.QThread.__init__(self, parent)
|
|
|
|
|
qt.QThread.__init__(self, parent)
|
|
|
|
|
|
|
|
|
|
def run(self):
|
|
|
|
|
self.collect_sig.emit()
|
|
|
|
@ -74,9 +74,9 @@ class Table():
|
|
|
|
|
tablevalue = TableValue
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class RadioButton(QtGuiWidgets.QRadioButton):
|
|
|
|
|
class RadioButton(qt.QRadioButton):
|
|
|
|
|
def __init__(self, text=None, parent=None):
|
|
|
|
|
QtGuiWidgets.QRadioButton.__init__(self, text, parent)
|
|
|
|
|
qt.QRadioButton.__init__(self, text, parent)
|
|
|
|
|
|
|
|
|
|
def set_data(self, data):
|
|
|
|
|
self.data = data
|
|
|
|
@ -85,7 +85,7 @@ class RadioButton(QtGuiWidgets.QRadioButton):
|
|
|
|
|
return self.data
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class MainFrame(QtGuiWidgets.QWidget):
|
|
|
|
|
class MainFrame(qt.QWidget):
|
|
|
|
|
def __init__(self, parent, ClientObj, view, method_name, \
|
|
|
|
|
error_output=True, skip_options=False):
|
|
|
|
|
super(MainFrame, self).__init__(parent)
|
|
|
|
@ -111,7 +111,7 @@ class MainFrame(QtGuiWidgets.QWidget):
|
|
|
|
|
self.buttons = []
|
|
|
|
|
|
|
|
|
|
# for clear memory after closed this window
|
|
|
|
|
self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
|
|
|
|
|
self.setAttribute(qt.Qt.WA_DeleteOnClose)
|
|
|
|
|
# icon_visible(ClientObj.MainWidget, 'Methods', True)
|
|
|
|
|
icon_visible(ClientObj.MainWidget, 'Back', True)
|
|
|
|
|
|
|
|
|
@ -163,8 +163,14 @@ class MainFrame(QtGuiWidgets.QWidget):
|
|
|
|
|
debug(11, "! not brief page because has not steps field label")
|
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
|
add_standart_button = QtCore.Signal(object, int, int, bool, str)
|
|
|
|
|
add_custom_button = QtCore.Signal(object, int, int, bool, str)
|
|
|
|
|
add_standart_button_signal = qt.Signal(object, int, int, bool, str)
|
|
|
|
|
add_custom_button_signal = qt.Signal(object, int, int, bool, str)
|
|
|
|
|
|
|
|
|
|
def add_standart_button(self, group, x, y, brief=False, next_label=""):
|
|
|
|
|
self.add_standart_button_signal.emit(group, x, y, brief, next_label)
|
|
|
|
|
|
|
|
|
|
def add_custom_button(self, group, x, y, brief=False, next_label=""):
|
|
|
|
|
self.add_custom_button_signal.emit(group, x, y, brief, next_label)
|
|
|
|
|
|
|
|
|
|
def init_params(self, params, method_name):
|
|
|
|
|
if method_name not in params:
|
|
|
|
@ -211,12 +217,12 @@ class MainFrame(QtGuiWidgets.QWidget):
|
|
|
|
|
debug(10, "CHANGE OFFSET for", self.method_name)
|
|
|
|
|
else:
|
|
|
|
|
debug(10, "SHOW NEW FRAME for", self.method_name)
|
|
|
|
|
self.common_layout = QtGuiWidgets.QVBoxLayout(self)
|
|
|
|
|
self.common_layout.setAlignment(QtCore.Qt.AlignTop)
|
|
|
|
|
self.common_layout = qt.QVBoxLayout(self)
|
|
|
|
|
self.common_layout.setAlignment(qt.Qt.AlignTop)
|
|
|
|
|
self.common_layout.setContentsMargins(0, 0, 0, 0)
|
|
|
|
|
self.common_layout.setSpacing(0)
|
|
|
|
|
|
|
|
|
|
self.grid = QtGuiWidgets.QGridLayout()
|
|
|
|
|
self.grid = qt.QGridLayout()
|
|
|
|
|
self.grid.setSpacing(10)
|
|
|
|
|
self.grid.setColumnStretch(0, 10)
|
|
|
|
|
self.grid.setColumnStretch(1, 17)
|
|
|
|
@ -322,7 +328,7 @@ class MainFrame(QtGuiWidgets.QWidget):
|
|
|
|
|
groupname = " "
|
|
|
|
|
fontsize = "1px"
|
|
|
|
|
self.group_name_label = LabelWordWrap(groupname, self)
|
|
|
|
|
self.group_name_label.setAlignment(QtCore.Qt.AlignLeft)
|
|
|
|
|
self.group_name_label.setAlignment(qt.Qt.AlignLeft)
|
|
|
|
|
self.group_name_label.setStyleSheet("font-size: %s;"
|
|
|
|
|
"font-weight: bold;"%fontsize);
|
|
|
|
|
|
|
|
|
@ -526,21 +532,18 @@ class MainFrame(QtGuiWidgets.QWidget):
|
|
|
|
|
debug(10, "METHOD has next button", self.method_name)
|
|
|
|
|
|
|
|
|
|
if not add_button_flag:
|
|
|
|
|
self.add_standart_button.connect(
|
|
|
|
|
self.add_standart_button_signal.connect(
|
|
|
|
|
self._parent.control_button.add_standart_button)
|
|
|
|
|
debug(10, "ADD STANDARD BUTTONS (no brief) (Next name)",
|
|
|
|
|
self.method_name)
|
|
|
|
|
self.add_standart_button.emit(Group, x, y, None, None)
|
|
|
|
|
self.add_standart_button(Group, x, y)
|
|
|
|
|
else:
|
|
|
|
|
self.add_custom_button.connect(
|
|
|
|
|
self.add_custom_button_signal.connect(
|
|
|
|
|
self._parent.control_button.add_custom_button)
|
|
|
|
|
self.add_custom_button.emit(Group, x, y, None, None)
|
|
|
|
|
self.add_custom_button(Group, x, y)
|
|
|
|
|
|
|
|
|
|
# self.grid.setSizeConstraint(self.grid.SizeConstraint.SetMinimumSize)
|
|
|
|
|
self.grid.setSizeConstraint(
|
|
|
|
|
QtGuiWidgets.QLayout.SizeConstraint.SetMaximumSize)
|
|
|
|
|
self.grid.setSizeConstraint(qt.QLayout.SetMaximumSize)
|
|
|
|
|
# hide expert settings
|
|
|
|
|
|
|
|
|
|
self.grid.setContentsMargins(28, 28, 28, 28)
|
|
|
|
|
|
|
|
|
|
# If errors came in parameters
|
|
|
|
@ -562,16 +565,16 @@ class MainFrame(QtGuiWidgets.QWidget):
|
|
|
|
|
self.ClientObj.MainWidget.left_frame.changed_step(
|
|
|
|
|
self.ClientObj.param_objects[self.method_name]['step'])
|
|
|
|
|
if not lastTable:
|
|
|
|
|
self.grid.addItem(QtGuiWidgets.QSpacerItem(
|
|
|
|
|
0, 0, QtGuiWidgets.QSizePolicy.Expanding,
|
|
|
|
|
QtGuiWidgets.QSizePolicy.Expanding),
|
|
|
|
|
self.grid.addItem(qt.QSpacerItem(
|
|
|
|
|
0, 0, qt.QSizePolicy.Expanding,
|
|
|
|
|
qt.QSizePolicy.Expanding),
|
|
|
|
|
x + 1, y, 1, 2)
|
|
|
|
|
|
|
|
|
|
self.common_layout.addLayout(self.grid)
|
|
|
|
|
|
|
|
|
|
# add spacer
|
|
|
|
|
# self.common_layout.addItem(QtGuiWidgets.QSpacerItem( 0, 0, \
|
|
|
|
|
# QtGuiWidgets.QSizePolicy.Expanding, QtGuiWidgets.QSizePolicy.Expanding))
|
|
|
|
|
# self.common_layout.addItem(qt.QSpacerItem( 0, 0, \
|
|
|
|
|
# qt.QSizePolicy.Expanding, qt.QSizePolicy.Expanding))
|
|
|
|
|
self.update()
|
|
|
|
|
self.ClientObj.app.processEvents()
|
|
|
|
|
self.updateGeometry()
|
|
|
|
@ -705,23 +708,23 @@ class MainFrame(QtGuiWidgets.QWidget):
|
|
|
|
|
|
|
|
|
|
self.grid.addWidget(self.label_dict[field.name], x, y)
|
|
|
|
|
|
|
|
|
|
self.view_dict[field.name] = QtGuiWidgets.QLineEdit(self)
|
|
|
|
|
self.view_dict[field.name] = qt.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 = QtGuiWidgets.QRegExpValidator(self.rx, self)
|
|
|
|
|
self.rx = qt.QRegExp("^[\d]{1,50}$")
|
|
|
|
|
self.validator = qt.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 = QtGuiWidgets.QRegExpValidator(self.rx, self)
|
|
|
|
|
self.rx = qt.QRegExp("^[\d]{1,50}[.][\d]{1,50}$")
|
|
|
|
|
self.validator = qt.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(QtGuiWidgets.QLineEdit.Password)
|
|
|
|
|
self.view_dict[field.name].setEchoMode(qt.QLineEdit.Password)
|
|
|
|
|
|
|
|
|
|
exp = QtGuiWidgets.QSizePolicy.Policy.Expanding
|
|
|
|
|
pref = QtGuiWidgets.QSizePolicy.Policy.Preferred
|
|
|
|
|
exp = qt.QSizePolicy.Expanding
|
|
|
|
|
pref = qt.QSizePolicy.Preferred
|
|
|
|
|
self.view_dict[field.name].setSizePolicy(exp, pref)
|
|
|
|
|
# advanced settings (expert)
|
|
|
|
|
if self.expert:
|
|
|
|
@ -761,7 +764,7 @@ class MainFrame(QtGuiWidgets.QWidget):
|
|
|
|
|
def add_element_check(self, field, x, y, brief=False):
|
|
|
|
|
self.error_label_dict[field.name] = ErrorLabel(self)
|
|
|
|
|
|
|
|
|
|
self.label_dict[field.name] = QtGuiWidgets.QLabel(field.label, self)
|
|
|
|
|
self.label_dict[field.name] = qt.QLabel(field.label, self)
|
|
|
|
|
# set disable item if uncompatible
|
|
|
|
|
if field.uncompatible:
|
|
|
|
|
self.label_dict[field.name].setToolTip(field.uncompatible)
|
|
|
|
@ -773,30 +776,28 @@ class MainFrame(QtGuiWidgets.QWidget):
|
|
|
|
|
if brief:
|
|
|
|
|
self.view_dict[field.name] = ReadonlyCheckBox(self)
|
|
|
|
|
else:
|
|
|
|
|
self.view_dict[field.name] = QtGuiWidgets.QCheckBox(self)
|
|
|
|
|
self.view_dict[field.name] = qt.QCheckBox(self)
|
|
|
|
|
#self.view_dict[field.name].setStyleSheet(
|
|
|
|
|
# "QCheckBox:hover {background-color:#FFFFFF}")
|
|
|
|
|
|
|
|
|
|
self.view_dict[field.name].setFocusPolicy(QtCore.Qt.NoFocus)
|
|
|
|
|
self.view_dict[field.name].setFocusPolicy(qt.Qt.NoFocus)
|
|
|
|
|
|
|
|
|
|
if field.element.lower() == 'check_tristate' or self.expert:
|
|
|
|
|
self.view_dict[field.name].setTristate()
|
|
|
|
|
if field.value == 'on':
|
|
|
|
|
self.view_dict[field.name].setCheckState(QtCore.Qt.CheckState. \
|
|
|
|
|
self.view_dict[field.name].setCheckState(qt.Qt. \
|
|
|
|
|
Checked)
|
|
|
|
|
elif field.value == 'off':
|
|
|
|
|
self.view_dict[field.name].setCheckState(QtCore.Qt.CheckState. \
|
|
|
|
|
self.view_dict[field.name].setCheckState(qt.Qt. \
|
|
|
|
|
Unchecked)
|
|
|
|
|
elif field.value == 'auto':
|
|
|
|
|
self.view_dict[field.name].setCheckState(QtCore.Qt.CheckState. \
|
|
|
|
|
PartiallyChecked)
|
|
|
|
|
self.view_dict[field.name].setCheckState(qt.Qt.PartiallyChecked)
|
|
|
|
|
else:
|
|
|
|
|
if field.value == 'on':
|
|
|
|
|
self.view_dict[field.name].setChecked(True)
|
|
|
|
|
if self.expert:
|
|
|
|
|
if field.default and not field.name in self.error_fields_name:
|
|
|
|
|
self.view_dict[field.name].setCheckState(QtCore.Qt.CheckState. \
|
|
|
|
|
PartiallyChecked)
|
|
|
|
|
self.view_dict[field.name].setCheckState(qt.Qt.PartiallyChecked)
|
|
|
|
|
if field.default:
|
|
|
|
|
self.expert_list.append(field.name)
|
|
|
|
|
else:
|
|
|
|
@ -812,11 +813,11 @@ class MainFrame(QtGuiWidgets.QWidget):
|
|
|
|
|
self.view_dict[field.name].setDisabled(True)
|
|
|
|
|
|
|
|
|
|
self.view_dict[field.name].setContentsMargins(0, 0, 0, 0)
|
|
|
|
|
check_widget = QtGuiWidgets.QLabel(self)
|
|
|
|
|
exp = QtGuiWidgets.QSizePolicy.Policy.Expanding
|
|
|
|
|
pref = QtGuiWidgets.QSizePolicy.Policy.Preferred
|
|
|
|
|
check_widget = qt.QLabel(self)
|
|
|
|
|
exp = qt.QSizePolicy.Expanding
|
|
|
|
|
pref = qt.QSizePolicy.Preferred
|
|
|
|
|
check_widget.setSizePolicy(exp, pref)
|
|
|
|
|
check_layout = QtGuiWidgets.QHBoxLayout(check_widget)
|
|
|
|
|
check_layout = qt.QHBoxLayout(check_widget)
|
|
|
|
|
check_layout.setContentsMargins(0, 0, 0, 0)
|
|
|
|
|
self.view_dict[field.name].setFixedWidth \
|
|
|
|
|
(self.view_dict[field.name].sizeHint().width() + 4)
|
|
|
|
@ -825,7 +826,7 @@ class MainFrame(QtGuiWidgets.QWidget):
|
|
|
|
|
check_layout.addWidget(self.view_dict[field.name])
|
|
|
|
|
check_widget.setFixedHeight \
|
|
|
|
|
(self.view_dict[field.name].size().height())
|
|
|
|
|
check_layout.setAlignment(QtCore.Qt.AlignLeft)
|
|
|
|
|
check_layout.setAlignment(qt.Qt.AlignLeft)
|
|
|
|
|
|
|
|
|
|
if brief:
|
|
|
|
|
self.brief_grid.addWidget(check_widget, x, y + 1)
|
|
|
|
@ -843,7 +844,7 @@ class MainFrame(QtGuiWidgets.QWidget):
|
|
|
|
|
def changed_expert_check(self, field_name):
|
|
|
|
|
def wrapper():
|
|
|
|
|
if self.view_dict[field_name].checkState() == \
|
|
|
|
|
QtCore.Qt.CheckState.PartiallyChecked:
|
|
|
|
|
qt.Qt.PartiallyChecked:
|
|
|
|
|
self.add_expert(field_name)
|
|
|
|
|
else:
|
|
|
|
|
self.remove_expert(field_name)
|
|
|
|
@ -851,7 +852,7 @@ class MainFrame(QtGuiWidgets.QWidget):
|
|
|
|
|
return wrapper
|
|
|
|
|
|
|
|
|
|
def add_element_radio(self, field, x, y):
|
|
|
|
|
self.label_dict[field.name] = QtGuiWidgets.QLabel(self)
|
|
|
|
|
self.label_dict[field.name] = qt.QLabel(self)
|
|
|
|
|
if field.uncompatible:
|
|
|
|
|
self.label_dict[field.name].setToolTip(field.uncompatible)
|
|
|
|
|
self.label_dict[field.name].setDisabled(True)
|
|
|
|
@ -862,7 +863,7 @@ class MainFrame(QtGuiWidgets.QWidget):
|
|
|
|
|
if field.comments:
|
|
|
|
|
comments = field.comments[0]
|
|
|
|
|
|
|
|
|
|
self.GroupBox = QtGuiWidgets.QGroupBox(field.label, self)
|
|
|
|
|
self.GroupBox = qt.QGroupBox(field.label, self)
|
|
|
|
|
self.GroupBox.setStyleSheet( self.GroupBox.styleSheet() +
|
|
|
|
|
"QGroupBox {"
|
|
|
|
|
'padding-top: 24px; padding-bottom: 0px;'
|
|
|
|
@ -883,8 +884,8 @@ class MainFrame(QtGuiWidgets.QWidget):
|
|
|
|
|
'background-color: transparent;'
|
|
|
|
|
'subcontrol-position: top center;'
|
|
|
|
|
'margin-top: 6px;}')
|
|
|
|
|
self.ButGrp_dict[field.name] = QtGuiWidgets.QButtonGroup(self)
|
|
|
|
|
layout = QtGuiWidgets.QVBoxLayout(self.GroupBox)
|
|
|
|
|
self.ButGrp_dict[field.name] = qt.QButtonGroup(self)
|
|
|
|
|
layout = qt.QVBoxLayout(self.GroupBox)
|
|
|
|
|
radiolist = []
|
|
|
|
|
|
|
|
|
|
if field.value == None:
|
|
|
|
@ -892,7 +893,7 @@ class MainFrame(QtGuiWidgets.QWidget):
|
|
|
|
|
|
|
|
|
|
for i in range(0, len(choice)):
|
|
|
|
|
radio_but = RadioButton(self)
|
|
|
|
|
radio_but.setFocusPolicy(QtCore.Qt.NoFocus)
|
|
|
|
|
radio_but.setFocusPolicy(qt.Qt.NoFocus)
|
|
|
|
|
if choice[i] == None:
|
|
|
|
|
choice[i] = ''
|
|
|
|
|
try:
|
|
|
|
@ -960,7 +961,7 @@ class MainFrame(QtGuiWidgets.QWidget):
|
|
|
|
|
choice.append(field.value)
|
|
|
|
|
|
|
|
|
|
# add label
|
|
|
|
|
self.label_dict[field.name] = QtGuiWidgets.QLabel(field.label, self)
|
|
|
|
|
self.label_dict[field.name] = qt.QLabel(field.label, self)
|
|
|
|
|
if field.uncompatible:
|
|
|
|
|
self.label_dict[field.name].setToolTip(field.uncompatible)
|
|
|
|
|
self.label_dict[field.name].setDisabled(True)
|
|
|
|
@ -991,8 +992,8 @@ class MainFrame(QtGuiWidgets.QWidget):
|
|
|
|
|
self.ComboBox.currentIndexChanged.connect \
|
|
|
|
|
(combo_checked(self, field.name))
|
|
|
|
|
|
|
|
|
|
exp = QtGuiWidgets.QSizePolicy.Policy.Expanding
|
|
|
|
|
pref = QtGuiWidgets.QSizePolicy.Policy.Preferred
|
|
|
|
|
exp = qt.QSizePolicy.Expanding
|
|
|
|
|
pref = qt.QSizePolicy.Preferred
|
|
|
|
|
self.ComboBox.setSizePolicy(exp, pref)
|
|
|
|
|
self.view_dict[field.name] = self.ComboBox
|
|
|
|
|
if self.expert:
|
|
|
|
@ -1051,7 +1052,7 @@ class MainFrame(QtGuiWidgets.QWidget):
|
|
|
|
|
choice.append(field.value)
|
|
|
|
|
|
|
|
|
|
# add label
|
|
|
|
|
self.label_dict[field.name] = QtGuiWidgets.QLabel(field.label, self)
|
|
|
|
|
self.label_dict[field.name] = qt.QLabel(field.label, self)
|
|
|
|
|
if field.uncompatible:
|
|
|
|
|
self.label_dict[field.name].setToolTip(field.uncompatible)
|
|
|
|
|
self.label_dict[field.name].setDisabled(True)
|
|
|
|
@ -1060,7 +1061,7 @@ class MainFrame(QtGuiWidgets.QWidget):
|
|
|
|
|
self.ComboBox = QComboWgt(self)
|
|
|
|
|
self.ComboBox.setDuplicatesEnabled(False)
|
|
|
|
|
self.ComboBox.setEditable(True)
|
|
|
|
|
#le = QtGuiWidgets.QLineEdit(self)
|
|
|
|
|
#le = qt.QLineEdit(self)
|
|
|
|
|
#le.setStyleSheet('QLineEdit {background:white;margin: 1px;}')
|
|
|
|
|
#self.ComboBox.setLineEdit(le)
|
|
|
|
|
for i in range(0, len(choice)):
|
|
|
|
@ -1079,8 +1080,8 @@ class MainFrame(QtGuiWidgets.QWidget):
|
|
|
|
|
if field.value == choice[i]:
|
|
|
|
|
self.ComboBox.setCurrentIndex(i)
|
|
|
|
|
|
|
|
|
|
exp = QtGuiWidgets.QSizePolicy.Policy.Expanding
|
|
|
|
|
pref = QtGuiWidgets.QSizePolicy.Policy.Preferred
|
|
|
|
|
exp = qt.QSizePolicy.Expanding
|
|
|
|
|
pref = qt.QSizePolicy.Preferred
|
|
|
|
|
self.ComboBox.setSizePolicy(exp, pref)
|
|
|
|
|
self.view_dict[field.name] = self.ComboBox
|
|
|
|
|
if self.expert:
|
|
|
|
@ -1132,7 +1133,7 @@ class MainFrame(QtGuiWidgets.QWidget):
|
|
|
|
|
comments, add_ability,
|
|
|
|
|
self.expert)
|
|
|
|
|
# add label
|
|
|
|
|
self.label_dict[field.name] = QtGuiWidgets.QLabel(field.label, self)
|
|
|
|
|
self.label_dict[field.name] = qt.QLabel(field.label, self)
|
|
|
|
|
if self.expert:
|
|
|
|
|
if field.default:
|
|
|
|
|
self.expert_list.append(field.name)
|
|
|
|
@ -1217,7 +1218,7 @@ class MainFrame(QtGuiWidgets.QWidget):
|
|
|
|
|
# return wrapper
|
|
|
|
|
|
|
|
|
|
def add_element_openfile(self, field, x, y):
|
|
|
|
|
self.label_dict[field.name] = QtGuiWidgets.QLabel(field.label, self)
|
|
|
|
|
self.label_dict[field.name] = qt.QLabel(field.label, self)
|
|
|
|
|
self.grid.addWidget(self.label_dict[field.name], x, y)
|
|
|
|
|
|
|
|
|
|
# field.type in ['file','files','dir']
|
|
|
|
@ -1251,7 +1252,7 @@ class MainFrame(QtGuiWidgets.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] = QtGuiWidgets.QLabel(field.label, self)
|
|
|
|
|
self.label_dict[field.name] = qt.QLabel(field.label, self)
|
|
|
|
|
self.grid.addWidget(self.label_dict[field.name], x, y)
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
@ -1362,7 +1363,7 @@ class MainFrame(QtGuiWidgets.QWidget):
|
|
|
|
|
self.view_dict[field.name].clicked.connect(
|
|
|
|
|
self.set_disabled_expert(field.name, False))
|
|
|
|
|
|
|
|
|
|
expert_signal = QtCore.Signal()
|
|
|
|
|
expert_signal = qt.Signal()
|
|
|
|
|
|
|
|
|
|
def set_disabled_expert(self, field_name, disabled=True):
|
|
|
|
|
def wrapper():
|
|
|
|
@ -1436,7 +1437,7 @@ class MainFrame(QtGuiWidgets.QWidget):
|
|
|
|
|
reply = show_question(self, text, cursor_pos=True,
|
|
|
|
|
title=_('Calculate Console'))
|
|
|
|
|
|
|
|
|
|
if reply == QtGuiWidgets.QMessageBox.Yes or not self.changed_expert_list:
|
|
|
|
|
if reply == qt.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)
|
|
|
|
@ -1556,9 +1557,9 @@ class MainFrame(QtGuiWidgets.QWidget):
|
|
|
|
|
self.ClientObj.process_dict[meth_result[0].message] \
|
|
|
|
|
['name'] = method_name
|
|
|
|
|
self.ClientObj.process_dict[meth_result[0].message] \
|
|
|
|
|
['layout'] = QtGuiWidgets.QVBoxLayout()
|
|
|
|
|
['layout'] = qt.QVBoxLayout()
|
|
|
|
|
self.ClientObj.process_dict[meth_result[0].message] \
|
|
|
|
|
['layout'].setAlignment(QtCore.Qt.AlignTop)
|
|
|
|
|
['layout'].setAlignment(qt.Qt.AlignTop)
|
|
|
|
|
|
|
|
|
|
# set new window title
|
|
|
|
|
if self.ClientObj.method_names.has_key(method_name):
|
|
|
|
@ -1654,8 +1655,8 @@ class MainFrame(QtGuiWidgets.QWidget):
|
|
|
|
|
self.add_table_items(table, field, lenColumn, self.table_widget, \
|
|
|
|
|
brief)
|
|
|
|
|
|
|
|
|
|
minimum = QtGuiWidgets.QSizePolicy.Minimum
|
|
|
|
|
expanding = QtGuiWidgets.QSizePolicy.Expanding
|
|
|
|
|
minimum = qt.QSizePolicy.Minimum
|
|
|
|
|
expanding = qt.QSizePolicy.Expanding
|
|
|
|
|
self.table_widget.setSizePolicy(minimum, expanding)
|
|
|
|
|
|
|
|
|
|
self.view_dict[field.name] = self.table_widget
|
|
|
|
@ -1682,34 +1683,34 @@ class MainFrame(QtGuiWidgets.QWidget):
|
|
|
|
|
self.grid.addWidget(self.label_dict[field.name], x, y, 1, 2)
|
|
|
|
|
x += 1
|
|
|
|
|
|
|
|
|
|
widget_for_grid = QtGuiWidgets.QWidget(self)
|
|
|
|
|
widget_for_grid = qt.QWidget(self)
|
|
|
|
|
if brief:
|
|
|
|
|
widget_for_grid.setStyleSheet("background: transparent;")
|
|
|
|
|
wfg_layout = QtGuiWidgets.QVBoxLayout(widget_for_grid)
|
|
|
|
|
wfg_layout = qt.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 = QtGuiWidgets.QWidget(self)
|
|
|
|
|
unit_layout = QtGuiWidgets.QHBoxLayout(unit_widget)
|
|
|
|
|
unit_widget = qt.QWidget(self)
|
|
|
|
|
unit_layout = qt.QHBoxLayout(unit_widget)
|
|
|
|
|
unit_layout.setContentsMargins(0, 0, 0, 0)
|
|
|
|
|
unit_layout.setSpacing(3)
|
|
|
|
|
|
|
|
|
|
plus_but = QtGuiWidgets.QPushButton(self)
|
|
|
|
|
plus_but = qt.QPushButton(self)
|
|
|
|
|
try:
|
|
|
|
|
plus_but.setIcon(QtGuiWidgets.QIcon.fromTheme('list-add'))
|
|
|
|
|
plus_but.setIcon(qt.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 = QtGuiWidgets.QPushButton(self)
|
|
|
|
|
self.view_dict[field.name].minus_but = qt.QPushButton(self)
|
|
|
|
|
try:
|
|
|
|
|
self.view_dict[field.name].minus_but.setIcon \
|
|
|
|
|
(QtGuiWidgets.QIcon.fromTheme('list-remove'))
|
|
|
|
|
(qt.QIcon.fromTheme('list-remove'))
|
|
|
|
|
except:
|
|
|
|
|
self.view_dict[field.name].minus_but.setText('-')
|
|
|
|
|
self.view_dict[field.name].minus_but.setToolTip \
|
|
|
|
@ -1717,18 +1718,18 @@ class MainFrame(QtGuiWidgets.QWidget):
|
|
|
|
|
self.view_dict[field.name].minus_but.setFixedWidth(30)
|
|
|
|
|
self.view_dict[field.name].minus_but.setDisabled(True)
|
|
|
|
|
|
|
|
|
|
refresh_but = QtGuiWidgets.QPushButton(self)
|
|
|
|
|
refresh_but = qt.QPushButton(self)
|
|
|
|
|
try:
|
|
|
|
|
refresh_but.setIcon(QtGuiWidgets.QIcon.fromTheme('edit-undo'))
|
|
|
|
|
refresh_but.setIcon(qt.QIcon.fromTheme('edit-undo'))
|
|
|
|
|
except:
|
|
|
|
|
refresh_but.setText('R')
|
|
|
|
|
|
|
|
|
|
refresh_but.setToolTip(_('Recover the table'))
|
|
|
|
|
refresh_but.setFixedWidth(30)
|
|
|
|
|
|
|
|
|
|
clear_but = QtGuiWidgets.QPushButton(self)
|
|
|
|
|
clear_but = qt.QPushButton(self)
|
|
|
|
|
try:
|
|
|
|
|
clear_but.setIcon(QtGuiWidgets.QIcon.fromTheme('edit-clear'))
|
|
|
|
|
clear_but.setIcon(qt.QIcon.fromTheme('edit-clear'))
|
|
|
|
|
except:
|
|
|
|
|
clear_but.setText('C')
|
|
|
|
|
|
|
|
|
@ -1751,7 +1752,7 @@ class MainFrame(QtGuiWidgets.QWidget):
|
|
|
|
|
unit_layout.addWidget(refresh_but)
|
|
|
|
|
unit_layout.addWidget(clear_but)
|
|
|
|
|
|
|
|
|
|
unit_layout.setAlignment(QtCore.Qt.AlignLeft)
|
|
|
|
|
unit_layout.setAlignment(qt.Qt.AlignLeft)
|
|
|
|
|
wfg_layout.addWidget(unit_widget)
|
|
|
|
|
# self.grid.addWidget(unit_widget, x, y)
|
|
|
|
|
# x +=1
|
|
|
|
@ -1770,13 +1771,9 @@ class MainFrame(QtGuiWidgets.QWidget):
|
|
|
|
|
else:
|
|
|
|
|
self.view_dict[field.name].hideColumn(0)
|
|
|
|
|
|
|
|
|
|
# set width column
|
|
|
|
|
# self.view_dict[field.name].horizontalHeader().resizeSections\
|
|
|
|
|
# (QtGuiWidgets.QHeaderView.ResizeMode.ResizeToContents)
|
|
|
|
|
|
|
|
|
|
# No Selection
|
|
|
|
|
self.view_dict[field.name].setSelectionMode \
|
|
|
|
|
(QtGuiWidgets.QAbstractItemView.SelectionMode.NoSelection)
|
|
|
|
|
self.view_dict[field.name].setSelectionMode(
|
|
|
|
|
qt.QAbstractItemView.NoSelection)
|
|
|
|
|
|
|
|
|
|
if field.uncompatible:
|
|
|
|
|
self.label_dict[field.name].setToolTip(field.uncompatible)
|
|
|
|
@ -1808,36 +1805,36 @@ class MainFrame(QtGuiWidgets.QWidget):
|
|
|
|
|
col = column + 1
|
|
|
|
|
if not table.values:
|
|
|
|
|
table_widget.setEditTriggers \
|
|
|
|
|
(QtGuiWidgets.QAbstractItemView.NoEditTriggers)
|
|
|
|
|
(qt.QAbstractItemView.NoEditTriggers)
|
|
|
|
|
for row in range(len(table.body.stringArray)):
|
|
|
|
|
tablewidgetitem = QtGuiWidgets.QTableWidgetItem \
|
|
|
|
|
tablewidgetitem = qt.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 = QtGuiWidgets.QTableWidgetItem \
|
|
|
|
|
tablewidgetitem = qt.QTableWidgetItem \
|
|
|
|
|
(table.body.stringArray[row].string[column])
|
|
|
|
|
table_widget.setItem(row, col, tablewidgetitem)
|
|
|
|
|
|
|
|
|
|
table_widget.item(row, col).setFlags(
|
|
|
|
|
QtCore.Qt.ItemIsEditable)
|
|
|
|
|
brush = QtGuiWidgets.QBrush(
|
|
|
|
|
self.palette().color(QtGuiWidgets.QPalette.Text))
|
|
|
|
|
qt.Qt.ItemIsEditable)
|
|
|
|
|
brush = qt.QBrush(
|
|
|
|
|
self.palette().color(qt.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 \
|
|
|
|
|
(QtGuiWidgets.QAbstractItemView.NoEditTriggers)
|
|
|
|
|
(qt.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 = QtGuiWidgets.QTableWidgetItem('***')
|
|
|
|
|
tablewidgetitem = qt.QTableWidgetItem('***')
|
|
|
|
|
else:
|
|
|
|
|
tablewidgetitem = QtGuiWidgets.QTableWidgetItem \
|
|
|
|
|
tablewidgetitem = qt.QTableWidgetItem \
|
|
|
|
|
(table.body.stringArray[row].string[column])
|
|
|
|
|
table_widget.setItem(row, col, tablewidgetitem)
|
|
|
|
|
|
|
|
|
@ -1855,13 +1852,13 @@ class MainFrame(QtGuiWidgets.QWidget):
|
|
|
|
|
if ind < len(ChoiceValue.comments.string):
|
|
|
|
|
val = ChoiceValue.comments.string[ind]
|
|
|
|
|
|
|
|
|
|
tablewidgetitem = QtGuiWidgets.QTableWidgetItem(val)
|
|
|
|
|
tablewidgetitem = qt.QTableWidgetItem(val)
|
|
|
|
|
table_widget.setItem(row, col, tablewidgetitem)
|
|
|
|
|
|
|
|
|
|
table_widget.item(row, col).setFlags \
|
|
|
|
|
(QtCore.Qt.ItemIsEditable)
|
|
|
|
|
brush = QtGuiWidgets.QBrush(
|
|
|
|
|
self.palette().color(QtGuiWidgets.QPalette.Text))
|
|
|
|
|
(qt.Qt.ItemIsEditable)
|
|
|
|
|
brush = qt.QBrush(
|
|
|
|
|
self.palette().color(qt.QPalette.Text))
|
|
|
|
|
table_widget.item(row, col).setForeground(brush)
|
|
|
|
|
|
|
|
|
|
elif table.values.ChoiceValue[column].typefield in \
|
|
|
|
@ -1890,13 +1887,13 @@ class MainFrame(QtGuiWidgets.QWidget):
|
|
|
|
|
value_dict[choice[i]] = choice[i]
|
|
|
|
|
val = ','.join(map(lambda x: value_dict[x], default))
|
|
|
|
|
|
|
|
|
|
tablewidgetitem = QtGuiWidgets.QTableWidgetItem(val)
|
|
|
|
|
tablewidgetitem = qt.QTableWidgetItem(val)
|
|
|
|
|
table_widget.setItem(row, col, tablewidgetitem)
|
|
|
|
|
|
|
|
|
|
table_widget.item(row, col).setFlags \
|
|
|
|
|
(QtCore.Qt.ItemIsEditable)
|
|
|
|
|
brush = QtGuiWidgets.QBrush(
|
|
|
|
|
self.palette().color(QtGuiWidgets.QPalette.Text))
|
|
|
|
|
(qt.Qt.ItemIsEditable)
|
|
|
|
|
brush = qt.QBrush(
|
|
|
|
|
self.palette().color(qt.QPalette.Text))
|
|
|
|
|
table_widget.item(row, col).setForeground(brush)
|
|
|
|
|
|
|
|
|
|
elif table.values.ChoiceValue[column].typefield in \
|
|
|
|
@ -1914,14 +1911,14 @@ class MainFrame(QtGuiWidgets.QWidget):
|
|
|
|
|
elif not val and brief:
|
|
|
|
|
data = ''
|
|
|
|
|
val = ''
|
|
|
|
|
tablewidgetitem = QtGuiWidgets.QTableWidgetItem(val)
|
|
|
|
|
tablewidgetitem = qt.QTableWidgetItem(val)
|
|
|
|
|
tablewidgetitem.setData(1, data)
|
|
|
|
|
table_widget.setItem(row, col, tablewidgetitem)
|
|
|
|
|
|
|
|
|
|
table_widget.item(row, col).setFlags(
|
|
|
|
|
QtCore.Qt.ItemIsEditable)
|
|
|
|
|
brush = QtGuiWidgets.QBrush(
|
|
|
|
|
self.palette().color(QtGuiWidgets.QPalette.Text))
|
|
|
|
|
qt.Qt.ItemIsEditable)
|
|
|
|
|
brush = qt.QBrush(
|
|
|
|
|
self.palette().color(qt.QPalette.Text))
|
|
|
|
|
table_widget.item(row, col).setForeground(brush)
|
|
|
|
|
|
|
|
|
|
elif table.values.ChoiceValue[column].typefield in \
|
|
|
|
@ -1929,27 +1926,27 @@ class MainFrame(QtGuiWidgets.QWidget):
|
|
|
|
|
for row in range(len(table.body.stringArray)):
|
|
|
|
|
val = table.body.stringArray[row].string[column]
|
|
|
|
|
|
|
|
|
|
tablewidgetitem = QtGuiWidgets.QTableWidgetItem(val)
|
|
|
|
|
tablewidgetitem = qt.QTableWidgetItem(val)
|
|
|
|
|
table_widget.setItem(row, col, tablewidgetitem)
|
|
|
|
|
|
|
|
|
|
table_widget.item(row, col).setFlags(
|
|
|
|
|
QtCore.Qt.ItemIsEditable)
|
|
|
|
|
brush = QtGuiWidgets.QBrush(
|
|
|
|
|
self.palette().color(QtGuiWidgets.QPalette.Text))
|
|
|
|
|
qt.Qt.ItemIsEditable)
|
|
|
|
|
brush = qt.QBrush(
|
|
|
|
|
self.palette().color(qt.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 = QtGuiWidgets.QTableWidgetItem(val)
|
|
|
|
|
tablewidgetitem = qt.QTableWidgetItem(val)
|
|
|
|
|
tablewidgetitem.setData(1, passwd)
|
|
|
|
|
table_widget.setItem(row, col, tablewidgetitem)
|
|
|
|
|
|
|
|
|
|
table_widget.item(row, col).setFlags(
|
|
|
|
|
QtCore.Qt.ItemIsEditable)
|
|
|
|
|
brush = QtGuiWidgets.QBrush(
|
|
|
|
|
self.palette().color(QtGuiWidgets.QPalette.Text))
|
|
|
|
|
qt.Qt.ItemIsEditable)
|
|
|
|
|
brush = qt.QBrush(
|
|
|
|
|
self.palette().color(qt.QPalette.Text))
|
|
|
|
|
table_widget.item(row, col).setForeground(brush)
|
|
|
|
|
|
|
|
|
|
def add_select_check(self, table):
|
|
|
|
@ -1966,9 +1963,9 @@ class MainFrame(QtGuiWidgets.QWidget):
|
|
|
|
|
|
|
|
|
|
for row in range(table.rowCount()):
|
|
|
|
|
if not table.cellWidget(row, 0):
|
|
|
|
|
tablewidgetitem = QtGuiWidgets.QTableWidgetItem()
|
|
|
|
|
tablewidgetitem = qt.QTableWidgetItem()
|
|
|
|
|
table.setItem(row, 0, tablewidgetitem)
|
|
|
|
|
# table.item(row, 0).setFlags(QtCore.Qt.ItemIsEditable)
|
|
|
|
|
# table.item(row, 0).setFlags(qt.Qt.ItemIsEditable)
|
|
|
|
|
|
|
|
|
|
ch = CentralCheckBox(self.table_widget, False, ind_col=True)
|
|
|
|
|
ch.setToolTip(_('Delete the row'))
|
|
|
|
@ -1981,7 +1978,7 @@ class MainFrame(QtGuiWidgets.QWidget):
|
|
|
|
|
def plus_row(self, table, field):
|
|
|
|
|
def wrapper():
|
|
|
|
|
self.PlusWgt = PlusRow(self, table, field)
|
|
|
|
|
self.PlusWgt.setAttribute(QtCore.Qt.WA_ShowModal)
|
|
|
|
|
self.PlusWgt.setWindowModality(qt.Qt.WindowModal)
|
|
|
|
|
self.PlusWgt.show()
|
|
|
|
|
|
|
|
|
|
return wrapper
|
|
|
|
@ -1991,7 +1988,7 @@ class MainFrame(QtGuiWidgets.QWidget):
|
|
|
|
|
if not item.column():
|
|
|
|
|
return
|
|
|
|
|
self.PlusWgt = PlusRow(self, table, field, True, item.row())
|
|
|
|
|
self.PlusWgt.setAttribute(QtCore.Qt.WA_ShowModal)
|
|
|
|
|
self.PlusWgt.setWindowModality(qt.Qt.WindowModal)
|
|
|
|
|
self.PlusWgt.show()
|
|
|
|
|
|
|
|
|
|
return wrapper
|
|
|
|
@ -2042,8 +2039,8 @@ class MainFrame(QtGuiWidgets.QWidget):
|
|
|
|
|
for row_in_table in range(table.rowCount()):
|
|
|
|
|
h += table.rowHeight(row_in_table)
|
|
|
|
|
table.setFixedHeight(h)
|
|
|
|
|
table.horizontalHeader().resizeSections \
|
|
|
|
|
(QtGuiWidgets.QHeaderView.ResizeMode.ResizeToContents)
|
|
|
|
|
table.horizontalHeader().resizeSections(
|
|
|
|
|
qt.QHeaderView.ResizeToContents)
|
|
|
|
|
table.setColumnWidth(0, 40)
|
|
|
|
|
|
|
|
|
|
############# End add Table
|
|
|
|
@ -2075,10 +2072,10 @@ class MainFrame(QtGuiWidgets.QWidget):
|
|
|
|
|
self.grid.addWidget(help_lbl, x, y, 1, 2)
|
|
|
|
|
x += 1
|
|
|
|
|
|
|
|
|
|
# brief_sa = QtGuiWidgets.QScrollArea(self)
|
|
|
|
|
brief_widget = QtGuiWidgets.QWidget(self)
|
|
|
|
|
# brief_sa = qt.QScrollArea(self)
|
|
|
|
|
brief_widget = qt.QWidget(self)
|
|
|
|
|
|
|
|
|
|
self.brief_grid = QtGuiWidgets.QGridLayout(brief_widget)
|
|
|
|
|
self.brief_grid = qt.QGridLayout(brief_widget)
|
|
|
|
|
# self.brief_grid.setContentsMargins(10,10,10,10)
|
|
|
|
|
self.brief_grid.setContentsMargins(0, 0, 0, 0)
|
|
|
|
|
self.brief_grid.setSpacing(10)
|
|
|
|
@ -2093,7 +2090,7 @@ class MainFrame(QtGuiWidgets.QWidget):
|
|
|
|
|
brief_widget.setStyleSheet("#Brief_w "
|
|
|
|
|
"{background-color: transparent;}")
|
|
|
|
|
|
|
|
|
|
exp = QtGuiWidgets.QSizePolicy.Policy.Expanding
|
|
|
|
|
exp = qt.QSizePolicy.Expanding
|
|
|
|
|
|
|
|
|
|
expert_brief = ExpertWidget(_('View options'), self)
|
|
|
|
|
expert_brief.setFlat(True)
|
|
|
|
@ -2109,19 +2106,18 @@ class MainFrame(QtGuiWidgets.QWidget):
|
|
|
|
|
|
|
|
|
|
debug(10, "ADD STANDARD BUTTONS (brief) (%s)" % next_button_text,
|
|
|
|
|
self.method_name)
|
|
|
|
|
self.add_standart_button.connect(
|
|
|
|
|
self.add_standart_button_signal.connect(
|
|
|
|
|
self._parent.control_button.add_standart_button)
|
|
|
|
|
self.add_standart_button.emit(GroupField[-1], x, y, True, \
|
|
|
|
|
self.add_standart_button(GroupField[-1], x, y, True, \
|
|
|
|
|
next_button_text)
|
|
|
|
|
|
|
|
|
|
# add image
|
|
|
|
|
self.add_image()
|
|
|
|
|
|
|
|
|
|
# add spacer
|
|
|
|
|
self.spacer_item = QtGuiWidgets.QSpacerItem(0, 0, exp, exp)
|
|
|
|
|
self.spacer_item = qt.QSpacerItem(0, 0, exp, exp)
|
|
|
|
|
self.grid.addItem(self.spacer_item)
|
|
|
|
|
self.grid.setSizeConstraint \
|
|
|
|
|
(QtGuiWidgets.QLayout.SizeConstraint.SetMaximumSize)
|
|
|
|
|
self.grid.setSizeConstraint(qt.QLayout.SetMaximumSize)
|
|
|
|
|
|
|
|
|
|
self.common_layout.addLayout(self.grid)
|
|
|
|
|
# Show Control Buttons widget
|
|
|
|
@ -2154,7 +2150,7 @@ class MainFrame(QtGuiWidgets.QWidget):
|
|
|
|
|
if not Group.fields:
|
|
|
|
|
return grid_x
|
|
|
|
|
# self.group_name_label = LabelWordWrap(Group.name, self)
|
|
|
|
|
GroupBox = QtGuiWidgets.QGroupBox(Group.name)
|
|
|
|
|
GroupBox = qt.QGroupBox(Group.name)
|
|
|
|
|
GroupBox.setObjectName('GroupBoxBrief')
|
|
|
|
|
# brief_widget.setStyleSheet("#Brief_w "
|
|
|
|
|
GroupBox.setStyleSheet(
|
|
|
|
@ -2180,7 +2176,7 @@ class MainFrame(QtGuiWidgets.QWidget):
|
|
|
|
|
'margin-top: 6px;}')
|
|
|
|
|
else:
|
|
|
|
|
return grid_x
|
|
|
|
|
gb_layout = QtGuiWidgets.QGridLayout(GroupBox)
|
|
|
|
|
gb_layout = qt.QGridLayout(GroupBox)
|
|
|
|
|
|
|
|
|
|
gb_layout.setContentsMargins(10, 10, 10, 10)
|
|
|
|
|
gb_layout.setSpacing(4)
|
|
|
|
@ -2289,8 +2285,8 @@ class MainFrame(QtGuiWidgets.QWidget):
|
|
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
uncompatible_count += 1
|
|
|
|
|
minimum = QtGuiWidgets.QSizePolicy.Minimum
|
|
|
|
|
maximum = QtGuiWidgets.QSizePolicy.Maximum
|
|
|
|
|
minimum = qt.QSizePolicy.Minimum
|
|
|
|
|
maximum = qt.QSizePolicy.Maximum
|
|
|
|
|
GroupBox.setSizePolicy(minimum, maximum)
|
|
|
|
|
|
|
|
|
|
if uncompatible_count != len(Fields):
|
|
|
|
@ -2402,7 +2398,7 @@ class MainFrame(QtGuiWidgets.QWidget):
|
|
|
|
|
debug(10, "SKIP uncompatible", field.name)
|
|
|
|
|
continue
|
|
|
|
|
|
|
|
|
|
if type(self.view_dict[field.name]) == QtGuiWidgets.QGroupBox:
|
|
|
|
|
if type(self.view_dict[field.name]) == qt.QGroupBox:
|
|
|
|
|
if self.ButGrp_dict[field.name].checkedButton():
|
|
|
|
|
param_object[paramname] = (
|
|
|
|
|
self.ButGrp_dict[field.name].checkedButton(
|
|
|
|
@ -2417,13 +2413,13 @@ class MainFrame(QtGuiWidgets.QWidget):
|
|
|
|
|
else:
|
|
|
|
|
param_object[paramname] = False
|
|
|
|
|
|
|
|
|
|
elif type(self.view_dict[field.name]) == QtGuiWidgets.QCheckBox:
|
|
|
|
|
elif type(self.view_dict[field.name]) == qt.QCheckBox:
|
|
|
|
|
if self.view_dict[field.name].isTristate():
|
|
|
|
|
if self.view_dict[field.name].checkState() \
|
|
|
|
|
== QtCore.Qt.CheckState.PartiallyChecked:
|
|
|
|
|
== qt.Qt.PartiallyChecked:
|
|
|
|
|
param_object[paramname] = None
|
|
|
|
|
elif self.view_dict[field.name].checkState() \
|
|
|
|
|
== QtCore.Qt.CheckState.Checked:
|
|
|
|
|
== qt.Qt.Checked:
|
|
|
|
|
param_object[paramname] = True
|
|
|
|
|
else:
|
|
|
|
|
param_object[paramname] = False
|
|
|
|
@ -2433,7 +2429,7 @@ class MainFrame(QtGuiWidgets.QWidget):
|
|
|
|
|
self.view_dict[field.name].isChecked()
|
|
|
|
|
|
|
|
|
|
elif type(self.view_dict[field.name]) in \
|
|
|
|
|
[QtGuiWidgets.QComboBox, QComboWgt]:
|
|
|
|
|
[qt.QComboBox, QComboWgt]:
|
|
|
|
|
ind = self.view_dict[field.name].currentIndex()
|
|
|
|
|
text = self.view_dict[field.name].currentText()
|
|
|
|
|
choice = []
|
|
|
|
@ -2462,7 +2458,7 @@ class MainFrame(QtGuiWidgets.QWidget):
|
|
|
|
|
param_object[paramname] = \
|
|
|
|
|
self.view_dict[field.name].currentText()
|
|
|
|
|
|
|
|
|
|
elif type(self.view_dict[field.name]) == QtGuiWidgets.QLineEdit:
|
|
|
|
|
elif type(self.view_dict[field.name]) == qt.QLineEdit:
|
|
|
|
|
val = self.view_dict[field.name].text() or ''
|
|
|
|
|
param_object[paramname] = self.fix_string_value(val)
|
|
|
|
|
|
|
|
|
@ -2670,8 +2666,8 @@ class MainFrame(QtGuiWidgets.QWidget):
|
|
|
|
|
d = self.ClientObj.process_dict[meth_result[0].message]
|
|
|
|
|
d['result'] = meth_result[0]
|
|
|
|
|
d['name'] = self.method_name
|
|
|
|
|
d['layout'] = QtGuiWidgets.QVBoxLayout()
|
|
|
|
|
d['layout'].setAlignment(QtCore.Qt.AlignTop)
|
|
|
|
|
d['layout'] = qt.QVBoxLayout()
|
|
|
|
|
d['layout'].setAlignment(qt.Qt.AlignTop)
|
|
|
|
|
|
|
|
|
|
# set new window title
|
|
|
|
|
temp = self.ClientObj._parent.windowTitle().split('-')
|
|
|
|
@ -2700,8 +2696,8 @@ class MainFrame(QtGuiWidgets.QWidget):
|
|
|
|
|
|
|
|
|
|
return wrapper
|
|
|
|
|
|
|
|
|
|
left_check_step = QtCore.Signal(str, int)
|
|
|
|
|
left_check_step_after = QtCore.Signal()
|
|
|
|
|
left_check_step = qt.Signal(str, int)
|
|
|
|
|
left_check_step_after = qt.Signal()
|
|
|
|
|
|
|
|
|
|
def refresh_view(self, step=0, expert=False, from_left_frame=False):
|
|
|
|
|
"""
|
|
|
|
@ -2808,38 +2804,38 @@ class MainFrame(QtGuiWidgets.QWidget):
|
|
|
|
|
self.highlight_element_error(errorfield)
|
|
|
|
|
|
|
|
|
|
def unhighliht_element_errors(self, field_name):
|
|
|
|
|
if type(self.view_dict[field_name]) in [QtGuiWidgets.QGroupBox, SelectList]:
|
|
|
|
|
if type(self.view_dict[field_name]) in [qt.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 [QtGuiWidgets.QComboBox]:
|
|
|
|
|
elif type(self.view_dict[field_name]) in [qt.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]) == QtGuiWidgets.QCheckBox:
|
|
|
|
|
elif type(self.view_dict[field_name]) == qt.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 [QtGuiWidgets.QGroupBox, SelectList]:
|
|
|
|
|
if type(self.view_dict[field_name]) in [qt.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 [QtGuiWidgets.QComboBox]:
|
|
|
|
|
elif type(self.view_dict[field_name]) in [qt.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]) == QtGuiWidgets.QCheckBox:
|
|
|
|
|
elif type(self.view_dict[field_name]) == qt.QCheckBox:
|
|
|
|
|
self.view_dict[field_name].setStyleSheet('QCheckBox { '
|
|
|
|
|
'border: 1px solid red;}')
|
|
|
|
|
else:
|
|
|
|
@ -2923,8 +2919,7 @@ class MainFrame(QtGuiWidgets.QWidget):
|
|
|
|
|
if type(self.view_dict[field.name].cellWidget(row, col)) == \
|
|
|
|
|
CentralCheckBox:
|
|
|
|
|
self.view_dict[field.name].cellWidget(row, col). \
|
|
|
|
|
setCheckState(QtCore.Qt.CheckState. \
|
|
|
|
|
PartiallyChecked)
|
|
|
|
|
setCheckState(qt.Qt.PartiallyChecked)
|
|
|
|
|
|
|
|
|
|
return wrapper
|
|
|
|
|
|
|
|
|
@ -2932,7 +2927,7 @@ class MainFrame(QtGuiWidgets.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)) == QtGuiWidgets.QComboBox:
|
|
|
|
|
elif type(self.view_dict[field.name].cellWidget(row, i)) == qt.QComboBox:
|
|
|
|
|
try:
|
|
|
|
|
self.view_dict[field.name].cellWidget(row, i).setEditText('')
|
|
|
|
|
except:
|
|
|
|
@ -2958,7 +2953,7 @@ class MainFrame(QtGuiWidgets.QWidget):
|
|
|
|
|
except Exception, e:
|
|
|
|
|
# _print ('EXCEPT', e)
|
|
|
|
|
pass
|
|
|
|
|
elif type(self.view_dict[field.name].cellWidget(row, i)) == QtGuiWidgets.QComboBox:
|
|
|
|
|
elif type(self.view_dict[field.name].cellWidget(row, i)) == qt.QComboBox:
|
|
|
|
|
for q in (table.body.stringArray):
|
|
|
|
|
try:
|
|
|
|
|
ind = q.string.index(text)
|
|
|
|
|