added python_path and lua_path in GUI preferences.

This commit is contained in:
2026-01-04 17:04:08 +01:00
parent 0459c9ff27
commit 160a1d54fa
8 changed files with 415 additions and 281 deletions

View File

@@ -37,6 +37,7 @@ class TestProcess(Process):
tst_control: TestSetController,
config_files,
defines,
gui_defaults={},
) -> None:
super().__init__()
self.__fname = file_name
@@ -44,6 +45,7 @@ class TestProcess(Process):
self.__tctrl = tst_control
self.__cfgf = config_files
self.__defs = defines
self.__gui_defaults = gui_defaults # default values coming from GUI prefs
self.__exec = False
self.__loaded = False
self.__closed = False
@@ -64,7 +66,11 @@ class TestProcess(Process):
# Load the test file
test_dict, cfg_files = load_test(
self.__fname, test_dir, self.__cfgf, self.__defs
self.__fname,
test_dir,
self.__cfgf,
self.__defs,
self.__gui_defaults,
)
# Backup the global dict in case of restart of the test
@@ -89,6 +95,8 @@ class TestProcess(Process):
# Python & lua functions call subprocess initialization
py_fproc = py_func_call_init(tm.gd("python_path", ""), api_request, 10)
# Lua functions call subprocess initialization
lua_fproc = None
if test_set.isTestTypePresent(cst_type.TYPE_LUA_FUNCTION):
lua_fproc = lua_func_call_init(tm.gd("lua_path", ""), api_request, 10)

View File

@@ -35,6 +35,8 @@ class TestiumSettings():
SettingsLogFont = SettingsItem('logFont', str)
SettingsLogFontSize = SettingsItem('logFontSize', int)
SettingsGitSupported = SettingsItem('logGitSupported', bool)
SettingsPythonPath = SettingsItem('pythonPath', str)
SettingsLuaPath = SettingsItem('luaPath', str)
def __init__(self):
if 'windows' in platform.system().lower():
@@ -256,3 +258,23 @@ class TestiumSettings():
@git_supported.setter
def git_supported(self, value):
self.set_value(self.SettingsGitSupported, value)
# SettingsPythonPath = 'pythonPath'
@property
def python_path(self):
r = self.value(self.SettingsPythonPath, "")
return r
@python_path.setter
def python_path(self, value):
self.set_value(self.SettingsPythonPath, value)
# SettingsLuaPath = 'luaPath'
@property
def lua_path(self):
r = self.value(self.SettingsLuaPath, "")
return r
@lua_path.setter
def lua_path(self, value):
self.set_value(self.SettingsLuaPath, value)

View File

@@ -163,7 +163,7 @@ def _load_test_dict(test_file, variables: dict, no_include: bool = False, raw_in
return d
def load_test(test_file, test_dir, cmdline_pfs, cmdline_defs):
def load_test(test_file, test_dir, cmdline_pfs, cmdline_defs, gui_defaults):
# First step: populate config files without includes considered
test_dict = _load_test_dict(test_file, {}, no_include=True)
_check_test_dict(test_dict)
@@ -177,7 +177,7 @@ def load_test(test_file, test_dir, cmdline_pfs, cmdline_defs):
old_pfs = _config_files_from_test(test_dict, cmdline_pfs)
# Variables updated
gd = update_global(old_pfs, cmdline_defs, silent=True)
gd = update_global(old_pfs, cmdline_defs, gui_defaults, silent=True)
while True:
# Loop to check param files until all param files are identified
@@ -201,7 +201,7 @@ def load_test(test_file, test_dir, cmdline_pfs, cmdline_defs):
break
# Variables updated
gd = update_global(new_pfs, cmdline_defs, silent=False)
gd = update_global(new_pfs, cmdline_defs, gui_defaults, silent=False)
old_pfs = copy.copy(new_pfs)
# Processing (with includes) for complete file loading
@@ -297,11 +297,19 @@ def _check_test_dict(test_dict):
"The tum file has a major problem. The 'main' section could not be found.")
def update_global(config_files, defines, silent=False):
def update_global(config_files, defines, gui_defaults, silent=False):
'''Global dict updated with the content of the config file and a dict provided.
this function returns the resulting dict.
'''
# command line defines are applied first
# GUI preferences applied first
for k, v in gui_defaults.items():
try:
val = ast.literal_eval(v)
except:
val = v
tm.setgd(k, val)
# Then command line defines
for k, v in defines.items():
try:
val = ast.literal_eval(v)

View File

@@ -26,7 +26,7 @@ class Ui_preferenceWindow(object):
def setupUi(self, preferenceWindow):
if not preferenceWindow.objectName():
preferenceWindow.setObjectName(u"preferenceWindow")
preferenceWindow.resize(597, 386)
preferenceWindow.resize(597, 525)
sizePolicy = QSizePolicy(QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
@@ -50,14 +50,14 @@ class Ui_preferenceWindow(object):
self.verticalLayout.setObjectName(u"verticalLayout")
self.scrollArea = QScrollArea(self.tabInterfaceParams)
self.scrollArea.setObjectName(u"scrollArea")
self.scrollArea.setFrameShape(QFrame.NoFrame)
self.scrollArea.setFrameShadow(QFrame.Sunken)
self.scrollArea.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
self.scrollArea.setHorizontalScrollBarPolicy(Qt.ScrollBarAsNeeded)
self.scrollArea.setFrameShape(QFrame.Shape.NoFrame)
self.scrollArea.setFrameShadow(QFrame.Shadow.Sunken)
self.scrollArea.setVerticalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
self.scrollArea.setHorizontalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAsNeeded)
self.scrollArea.setWidgetResizable(True)
self.scrollAreaWidgetContents = QWidget()
self.scrollAreaWidgetContents.setObjectName(u"scrollAreaWidgetContents")
self.scrollAreaWidgetContents.setGeometry(QRect(0, -9, 557, 152))
self.scrollAreaWidgetContents.setGeometry(QRect(0, 0, 557, 210))
self.formLayout = QFormLayout(self.scrollAreaWidgetContents)
self.formLayout.setObjectName(u"formLayout")
self.label_4 = QLabel(self.scrollAreaWidgetContents)
@@ -72,7 +72,7 @@ class Ui_preferenceWindow(object):
sizePolicy1.setVerticalStretch(0)
sizePolicy1.setHeightForWidth(self.checkDocPane.sizePolicy().hasHeightForWidth())
self.checkDocPane.setSizePolicy(sizePolicy1)
self.checkDocPane.setLayoutDirection(Qt.RightToLeft)
self.checkDocPane.setLayoutDirection(Qt.LayoutDirection.RightToLeft)
self.formLayout.setWidget(0, QFormLayout.ItemRole.FieldRole, self.checkDocPane)
@@ -85,7 +85,7 @@ class Ui_preferenceWindow(object):
self.checkLogPane.setObjectName(u"checkLogPane")
sizePolicy1.setHeightForWidth(self.checkLogPane.sizePolicy().hasHeightForWidth())
self.checkLogPane.setSizePolicy(sizePolicy1)
self.checkLogPane.setLayoutDirection(Qt.RightToLeft)
self.checkLogPane.setLayoutDirection(Qt.LayoutDirection.RightToLeft)
self.formLayout.setWidget(1, QFormLayout.ItemRole.FieldRole, self.checkLogPane)
@@ -98,7 +98,7 @@ class Ui_preferenceWindow(object):
self.checkBoxTest.setObjectName(u"checkBoxTest")
sizePolicy1.setHeightForWidth(self.checkBoxTest.sizePolicy().hasHeightForWidth())
self.checkBoxTest.setSizePolicy(sizePolicy1)
self.checkBoxTest.setLayoutDirection(Qt.RightToLeft)
self.checkBoxTest.setLayoutDirection(Qt.LayoutDirection.RightToLeft)
self.formLayout.setWidget(2, QFormLayout.ItemRole.FieldRole, self.checkBoxTest)
@@ -111,7 +111,7 @@ class Ui_preferenceWindow(object):
self.checkShowTime.setObjectName(u"checkShowTime")
sizePolicy1.setHeightForWidth(self.checkShowTime.sizePolicy().hasHeightForWidth())
self.checkShowTime.setSizePolicy(sizePolicy1)
self.checkShowTime.setLayoutDirection(Qt.RightToLeft)
self.checkShowTime.setLayoutDirection(Qt.LayoutDirection.RightToLeft)
self.formLayout.setWidget(3, QFormLayout.ItemRole.FieldRole, self.checkShowTime)
@@ -124,7 +124,7 @@ class Ui_preferenceWindow(object):
self.checkDblClick.setObjectName(u"checkDblClick")
sizePolicy1.setHeightForWidth(self.checkDblClick.sizePolicy().hasHeightForWidth())
self.checkDblClick.setSizePolicy(sizePolicy1)
self.checkDblClick.setLayoutDirection(Qt.RightToLeft)
self.checkDblClick.setLayoutDirection(Qt.LayoutDirection.RightToLeft)
self.formLayout.setWidget(4, QFormLayout.ItemRole.FieldRole, self.checkDblClick)
@@ -160,10 +160,12 @@ class Ui_preferenceWindow(object):
sizePolicy2.setVerticalStretch(0)
sizePolicy2.setHeightForWidth(self.scrollArea_2.sizePolicy().hasHeightForWidth())
self.scrollArea_2.setSizePolicy(sizePolicy2)
self.scrollArea_2.setFrameShape(QFrame.Shape.NoFrame)
self.scrollArea_2.setVerticalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
self.scrollArea_2.setWidgetResizable(True)
self.scrollAreaWidgetContents_2 = QWidget()
self.scrollAreaWidgetContents_2.setObjectName(u"scrollAreaWidgetContents_2")
self.scrollAreaWidgetContents_2.setGeometry(QRect(0, 0, 555, 141))
self.scrollAreaWidgetContents_2.setGeometry(QRect(0, 0, 557, 210))
sizePolicy3 = QSizePolicy(QSizePolicy.Policy.Preferred, QSizePolicy.Policy.Expanding)
sizePolicy3.setHorizontalStretch(0)
sizePolicy3.setVerticalStretch(0)
@@ -171,25 +173,10 @@ class Ui_preferenceWindow(object):
self.scrollAreaWidgetContents_2.setSizePolicy(sizePolicy3)
self.formLayout_2 = QFormLayout(self.scrollAreaWidgetContents_2)
self.formLayout_2.setObjectName(u"formLayout_2")
self.label = QLabel(self.scrollAreaWidgetContents_2)
self.label.setObjectName(u"label")
sizePolicy4 = QSizePolicy(QSizePolicy.Policy.Preferred, QSizePolicy.Policy.MinimumExpanding)
sizePolicy4.setHorizontalStretch(0)
sizePolicy4.setVerticalStretch(0)
sizePolicy4.setHeightForWidth(self.label.sizePolicy().hasHeightForWidth())
self.label.setSizePolicy(sizePolicy4)
self.formLayout_2.setWidget(0, QFormLayout.ItemRole.LabelRole, self.label)
self.horizontalLayout = QHBoxLayout()
self.horizontalLayout.setObjectName(u"horizontalLayout")
self.editDefaultLogPath = QLineEdit(self.scrollAreaWidgetContents_2)
self.editDefaultLogPath.setObjectName(u"editDefaultLogPath")
sizePolicy5 = QSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum)
sizePolicy5.setHorizontalStretch(0)
sizePolicy5.setVerticalStretch(0)
sizePolicy5.setHeightForWidth(self.editDefaultLogPath.sizePolicy().hasHeightForWidth())
self.editDefaultLogPath.setSizePolicy(sizePolicy5)
self.horizontalLayout.addWidget(self.editDefaultLogPath)
@@ -199,21 +186,12 @@ class Ui_preferenceWindow(object):
self.horizontalLayout.addWidget(self.butLogPath)
self.formLayout_2.setLayout(0, QFormLayout.ItemRole.FieldRole, self.horizontalLayout)
self.label_2 = QLabel(self.scrollAreaWidgetContents_2)
self.label_2.setObjectName(u"label_2")
sizePolicy4.setHeightForWidth(self.label_2.sizePolicy().hasHeightForWidth())
self.label_2.setSizePolicy(sizePolicy4)
self.formLayout_2.setWidget(1, QFormLayout.ItemRole.LabelRole, self.label_2)
self.formLayout_2.setLayout(1, QFormLayout.ItemRole.FieldRole, self.horizontalLayout)
self.horizontalLayout_2 = QHBoxLayout()
self.horizontalLayout_2.setObjectName(u"horizontalLayout_2")
self.editDefaultReportPath = QLineEdit(self.scrollAreaWidgetContents_2)
self.editDefaultReportPath.setObjectName(u"editDefaultReportPath")
sizePolicy5.setHeightForWidth(self.editDefaultReportPath.sizePolicy().hasHeightForWidth())
self.editDefaultReportPath.setSizePolicy(sizePolicy5)
self.horizontalLayout_2.addWidget(self.editDefaultReportPath)
@@ -223,24 +201,79 @@ class Ui_preferenceWindow(object):
self.horizontalLayout_2.addWidget(self.butReportPath)
self.formLayout_2.setLayout(1, QFormLayout.ItemRole.FieldRole, self.horizontalLayout_2)
self.formLayout_2.setLayout(2, QFormLayout.ItemRole.FieldRole, self.horizontalLayout_2)
self.horizontalLayout_4 = QHBoxLayout()
self.horizontalLayout_4.setObjectName(u"horizontalLayout_4")
self.checkGitSupported = QCheckBox(self.scrollAreaWidgetContents_2)
self.checkGitSupported.setObjectName(u"checkGitSupported")
self.checkGitSupported.setLayoutDirection(Qt.LayoutDirection.RightToLeft)
self.horizontalLayout_4.addWidget(self.checkGitSupported)
self.formLayout_2.setLayout(4, QFormLayout.ItemRole.FieldRole, self.horizontalLayout_4)
self.horizontalLayout_3 = QHBoxLayout()
self.horizontalLayout_3.setObjectName(u"horizontalLayout_3")
self.editPythonPath = QLineEdit(self.scrollAreaWidgetContents_2)
self.editPythonPath.setObjectName(u"editPythonPath")
self.horizontalLayout_3.addWidget(self.editPythonPath)
self.butPythonPath = QToolButton(self.scrollAreaWidgetContents_2)
self.butPythonPath.setObjectName(u"butPythonPath")
self.horizontalLayout_3.addWidget(self.butPythonPath)
self.formLayout_2.setLayout(6, QFormLayout.ItemRole.FieldRole, self.horizontalLayout_3)
self.label = QLabel(self.scrollAreaWidgetContents_2)
self.label.setObjectName(u"label")
self.formLayout_2.setWidget(1, QFormLayout.ItemRole.LabelRole, self.label)
self.label_2 = QLabel(self.scrollAreaWidgetContents_2)
self.label_2.setObjectName(u"label_2")
self.formLayout_2.setWidget(2, QFormLayout.ItemRole.LabelRole, self.label_2)
self.label_11 = QLabel(self.scrollAreaWidgetContents_2)
self.label_11.setObjectName(u"label_11")
self.formLayout_2.setWidget(6, QFormLayout.ItemRole.LabelRole, self.label_11)
self.labelgit = QLabel(self.scrollAreaWidgetContents_2)
self.labelgit.setObjectName(u"labelgit")
self.formLayout_2.setWidget(2, QFormLayout.ItemRole.LabelRole, self.labelgit)
self.formLayout_2.setWidget(4, QFormLayout.ItemRole.LabelRole, self.labelgit)
self.checkGitSupported = QCheckBox(self.scrollAreaWidgetContents_2)
self.checkGitSupported.setObjectName(u"checkGitSupported")
self.checkGitSupported.setLayoutDirection(Qt.RightToLeft)
self.horizontalLayout_5 = QHBoxLayout()
self.horizontalLayout_5.setObjectName(u"horizontalLayout_5")
self.editLuaPath = QLineEdit(self.scrollAreaWidgetContents_2)
self.editLuaPath.setObjectName(u"editLuaPath")
self.formLayout_2.setWidget(2, QFormLayout.ItemRole.FieldRole, self.checkGitSupported)
self.horizontalLayout_5.addWidget(self.editLuaPath)
self.butLuaPath = QToolButton(self.scrollAreaWidgetContents_2)
self.butLuaPath.setObjectName(u"butLuaPath")
self.horizontalLayout_5.addWidget(self.butLuaPath)
self.formLayout_2.setLayout(7, QFormLayout.ItemRole.FieldRole, self.horizontalLayout_5)
self.label_12 = QLabel(self.scrollAreaWidgetContents_2)
self.label_12.setObjectName(u"label_12")
self.formLayout_2.setWidget(7, QFormLayout.ItemRole.LabelRole, self.label_12)
self.scrollArea_2.setWidget(self.scrollAreaWidgetContents_2)
self.verticalLayout_3.addWidget(self.scrollArea_2)
self.verticalSpacer_2 = QSpacerItem(20, 40, QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Expanding)
self.verticalSpacer_2 = QSpacerItem(0, 0, QSizePolicy.Policy.Minimum, QSizePolicy.Policy.MinimumExpanding)
self.verticalLayout_3.addItem(self.verticalSpacer_2)
@@ -251,31 +284,36 @@ class Ui_preferenceWindow(object):
self.verticalLayout_4.setObjectName(u"verticalLayout_4")
self.scrollArea_3 = QScrollArea(self.tabLog)
self.scrollArea_3.setObjectName(u"scrollArea_3")
sizePolicy5.setHeightForWidth(self.scrollArea_3.sizePolicy().hasHeightForWidth())
self.scrollArea_3.setSizePolicy(sizePolicy5)
sizePolicy4 = QSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum)
sizePolicy4.setHorizontalStretch(0)
sizePolicy4.setVerticalStretch(0)
sizePolicy4.setHeightForWidth(self.scrollArea_3.sizePolicy().hasHeightForWidth())
self.scrollArea_3.setSizePolicy(sizePolicy4)
self.scrollArea_3.setFrameShape(QFrame.Shape.NoFrame)
self.scrollArea_3.setVerticalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
self.scrollArea_3.setWidgetResizable(True)
self.scrollAreaWidgetContents_3 = QWidget()
self.scrollAreaWidgetContents_3.setObjectName(u"scrollAreaWidgetContents_3")
self.scrollAreaWidgetContents_3.setGeometry(QRect(0, 0, 555, 72))
self.scrollAreaWidgetContents_3.setGeometry(QRect(0, 0, 557, 77))
self.gridLayout = QGridLayout(self.scrollAreaWidgetContents_3)
self.gridLayout.setObjectName(u"gridLayout")
self.label_8 = QLabel(self.scrollAreaWidgetContents_3)
self.label_8.setObjectName(u"label_8")
sizePolicy6 = QSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Preferred)
sizePolicy6.setHorizontalStretch(0)
sizePolicy6.setVerticalStretch(0)
sizePolicy6.setHeightForWidth(self.label_8.sizePolicy().hasHeightForWidth())
self.label_8.setSizePolicy(sizePolicy6)
sizePolicy5 = QSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Preferred)
sizePolicy5.setHorizontalStretch(0)
sizePolicy5.setVerticalStretch(0)
sizePolicy5.setHeightForWidth(self.label_8.sizePolicy().hasHeightForWidth())
self.label_8.setSizePolicy(sizePolicy5)
self.gridLayout.addWidget(self.label_8, 0, 0, 1, 1)
self.font_choice = QFontComboBox(self.scrollAreaWidgetContents_3)
self.font_choice.setObjectName(u"font_choice")
sizePolicy7 = QSizePolicy(QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Fixed)
sizePolicy7.setHorizontalStretch(0)
sizePolicy7.setVerticalStretch(0)
sizePolicy7.setHeightForWidth(self.font_choice.sizePolicy().hasHeightForWidth())
self.font_choice.setSizePolicy(sizePolicy7)
sizePolicy6 = QSizePolicy(QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Fixed)
sizePolicy6.setHorizontalStretch(0)
sizePolicy6.setVerticalStretch(0)
sizePolicy6.setHeightForWidth(self.font_choice.sizePolicy().hasHeightForWidth())
self.font_choice.setSizePolicy(sizePolicy6)
self.gridLayout.addWidget(self.font_choice, 0, 1, 1, 1)
@@ -305,7 +343,7 @@ class Ui_preferenceWindow(object):
self.buttonBox = QDialogButtonBox(preferenceWindow)
self.buttonBox.setObjectName(u"buttonBox")
self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel|QDialogButtonBox.Ok)
self.buttonBox.setStandardButtons(QDialogButtonBox.StandardButton.Cancel|QDialogButtonBox.StandardButton.Ok)
self.verticalLayout_2.addWidget(self.buttonBox)
@@ -336,12 +374,16 @@ class Ui_preferenceWindow(object):
self.label_10.setText(QCoreApplication.translate("preferenceWindow", u"Icons theme", None))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tabInterfaceParams), QCoreApplication.translate("preferenceWindow", u"Interface parameters", None))
self.label.setText(QCoreApplication.translate("preferenceWindow", u"Default log files path", None))
self.butLogPath.setText(QCoreApplication.translate("preferenceWindow", u"...", None))
self.label_2.setText(QCoreApplication.translate("preferenceWindow", u"Default reports path", None))
self.butReportPath.setText(QCoreApplication.translate("preferenceWindow", u"...", None))
self.labelgit.setText(QCoreApplication.translate("preferenceWindow", u"git supported", None))
self.checkGitSupported.setText("")
self.butPythonPath.setText(QCoreApplication.translate("preferenceWindow", u"...", None))
self.label.setText(QCoreApplication.translate("preferenceWindow", u"Default log files path", None))
self.label_2.setText(QCoreApplication.translate("preferenceWindow", u"Default reports path", None))
self.label_11.setText(QCoreApplication.translate("preferenceWindow", u"Python Path", None))
self.labelgit.setText(QCoreApplication.translate("preferenceWindow", u"git supported", None))
self.butLuaPath.setText(QCoreApplication.translate("preferenceWindow", u"...", None))
self.label_12.setText(QCoreApplication.translate("preferenceWindow", u"Lua Path", None))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tabTestParams), QCoreApplication.translate("preferenceWindow", u"Tests parameters", None))
self.label_8.setText(QCoreApplication.translate("preferenceWindow", u"Font", None))
self.label_9.setText(QCoreApplication.translate("preferenceWindow", u"Font size", None))

View File

@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>597</width>
<height>386</height>
<height>525</height>
</rect>
</property>
<property name="sizePolicy">
@@ -45,16 +45,16 @@
<item>
<widget class="QScrollArea" name="scrollArea">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
<enum>QFrame::Shape::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
<enum>QFrame::Shadow::Sunken</enum>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
<enum>Qt::ScrollBarPolicy::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAsNeeded</enum>
<enum>Qt::ScrollBarPolicy::ScrollBarAsNeeded</enum>
</property>
<property name="widgetResizable">
<bool>true</bool>
@@ -63,9 +63,9 @@
<property name="geometry">
<rect>
<x>0</x>
<y>-9</y>
<y>0</y>
<width>557</width>
<height>152</height>
<height>210</height>
</rect>
</property>
<layout class="QFormLayout" name="formLayout">
@@ -85,7 +85,7 @@
</sizepolicy>
</property>
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
<enum>Qt::LayoutDirection::RightToLeft</enum>
</property>
<property name="text">
<string/>
@@ -108,7 +108,7 @@
</sizepolicy>
</property>
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
<enum>Qt::LayoutDirection::RightToLeft</enum>
</property>
<property name="text">
<string/>
@@ -131,7 +131,7 @@
</sizepolicy>
</property>
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
<enum>Qt::LayoutDirection::RightToLeft</enum>
</property>
<property name="text">
<string/>
@@ -154,7 +154,7 @@
</sizepolicy>
</property>
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
<enum>Qt::LayoutDirection::RightToLeft</enum>
</property>
<property name="text">
<string/>
@@ -177,7 +177,7 @@
</sizepolicy>
</property>
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
<enum>Qt::LayoutDirection::RightToLeft</enum>
</property>
<property name="text">
<string/>
@@ -215,7 +215,7 @@
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@@ -240,6 +240,12 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>QFrame::Shape::NoFrame</enum>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarPolicy::ScrollBarAlwaysOff</enum>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
@@ -248,8 +254,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>555</width>
<height>141</height>
<width>557</width>
<height>210</height>
</rect>
</property>
<property name="sizePolicy">
@@ -259,30 +265,10 @@
</sizepolicy>
</property>
<layout class="QFormLayout" name="formLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Default log files path</string>
</property>
</widget>
</item>
<item row="0" column="1">
<item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLineEdit" name="editDefaultLogPath">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
<widget class="QLineEdit" name="editDefaultLogPath"/>
</item>
<item>
<widget class="QToolButton" name="butLogPath">
@@ -293,30 +279,10 @@
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Default reports path</string>
</property>
</widget>
</item>
<item row="1" column="1">
<item row="2" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLineEdit" name="editDefaultReportPath">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
<widget class="QLineEdit" name="editDefaultReportPath"/>
</item>
<item>
<widget class="QToolButton" name="butReportPath">
@@ -327,20 +293,80 @@
</item>
</layout>
</item>
<item row="4" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QCheckBox" name="checkGitSupported">
<property name="layoutDirection">
<enum>Qt::LayoutDirection::RightToLeft</enum>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item row="6" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLineEdit" name="editPythonPath"/>
</item>
<item>
<widget class="QToolButton" name="butPythonPath">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Default log files path</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Default reports path</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_11">
<property name="text">
<string>Python Path</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="labelgit">
<property name="text">
<string>git supported</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="checkGitSupported">
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<item row="7" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLineEdit" name="editLuaPath"/>
</item>
<item>
<widget class="QToolButton" name="butLuaPath">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_12">
<property name="text">
<string/>
<string>Lua Path</string>
</property>
</widget>
</item>
@@ -351,12 +377,15 @@
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Policy::MinimumExpanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
@@ -376,6 +405,12 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>QFrame::Shape::NoFrame</enum>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarPolicy::ScrollBarAlwaysOff</enum>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
@@ -384,8 +419,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>555</width>
<height>72</height>
<width>557</width>
<height>77</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
@@ -436,10 +471,10 @@
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
<enum>QSizePolicy::Policy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@@ -456,7 +491,7 @@
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
<set>QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::Ok</set>
</property>
</widget>
</item>

View File

@@ -1,161 +1,177 @@
from PySide6.QtCore import (Slot, Qt)
from PySide6.QtWidgets import (QDialog, QFileDialog)
from PySide6.QtGui import (QFont)
from PySide6.QtCore import Slot, Qt
from PySide6.QtWidgets import QDialog, QFileDialog
from PySide6.QtGui import QFont
from main_win.preference_win.preference_core_win import Ui_preferenceWindow
import interpreter.utils.settings as prefs
class PrefWindow(QDialog):
def __init__(self, parent=None):
super().__init__(parent)
self.ui = Ui_preferenceWindow()
self.ui.setupUi(self)
self.setModal = (True)
self.setModal = True
self.ui.buttonBox.accepted.connect(self.on_buttOKPressed)
self.ui.buttonBox.rejected.connect(self.on_buttCancelPressed)
self.finished.connect(self.on_finishedPressed)
self.ui.butLogPath.triggered.connect(self.on_butLogPath_pressed)
self.ui.butReportPath.triggered.connect(self.on_butReportPath_pressed)
self.ui.butPythonPath.triggered.connect(self.on_butPythonPath_pressed)
self.ui.butLuaPath.triggered.connect(self.on_butLuaPath_pressed)
self.elements = {
prefs.settings.SettingsHideDocPane: {
'type': 'bool',
'widget': self.ui.checkDocPane,
'value': prefs.settings.hide_doc_pane,
'default': False,
'changed': False,
"type": "bool",
"widget": self.ui.checkDocPane,
"value": prefs.settings.hide_doc_pane,
"default": False,
"changed": False,
},
prefs.settings.SettingsHideLogPane: {
'type': 'bool',
'widget': self.ui.checkLogPane,
'value': prefs.settings.hide_log_pane,
'default': False,
'changed': False,
"type": "bool",
"widget": self.ui.checkLogPane,
"value": prefs.settings.hide_log_pane,
"default": False,
"changed": False,
},
prefs.settings.SettingsShowCheckboxes: {
'type': 'bool',
'widget': self.ui.checkBoxTest,
'value': prefs.settings.show_checkboxes,
'default': False,
'changed': False,
"type": "bool",
"widget": self.ui.checkBoxTest,
"value": prefs.settings.show_checkboxes,
"default": False,
"changed": False,
},
prefs.settings.SettingsShowTimeColumn: {
'type': 'bool',
'widget': self.ui.checkShowTime,
'value': prefs.settings.show_time_column,
'default': False,
'changed': False,
"type": "bool",
"widget": self.ui.checkShowTime,
"value": prefs.settings.show_time_column,
"default": False,
"changed": False,
},
prefs.settings.SettingsLogPath: {
'type': 'text',
'widget': self.ui.editDefaultLogPath,
'value': prefs.settings.log_path,
'default': '$(test_directory)',
'changed': False,
"type": "text",
"widget": self.ui.editDefaultLogPath,
"value": prefs.settings.log_path,
"default": "$(test_directory)",
"changed": False,
},
prefs.settings.SettingsReportPath: {
'type' : 'text',
'widget': self.ui.editDefaultReportPath,
'value': prefs.settings.report_path,
'default': '$(test_directory)',
'changed': False,
"type": "text",
"widget": self.ui.editDefaultReportPath,
"value": prefs.settings.report_path,
"default": "$(test_directory)",
"changed": False,
},
prefs.settings.SettingsDblClickEnabled: {
'type' : 'bool',
'widget': self.ui.checkDblClick,
'value': prefs.settings.dbl_click_enabled,
'default': False,
'changed': False,
"type": "bool",
"widget": self.ui.checkDblClick,
"value": prefs.settings.dbl_click_enabled,
"default": False,
"changed": False,
},
prefs.settings.SettingsIconsTheme: {
'type' : 'combo',
'widget': self.ui.choiceIconsTheme,
'value': prefs.settings.icons_theme,
'default': 0,
'changed': False,
"type": "combo",
"widget": self.ui.choiceIconsTheme,
"value": prefs.settings.icons_theme,
"default": 0,
"changed": False,
},
prefs.settings.SettingsLogFont: {
'type' : 'font',
'widget': self.ui.font_choice,
'value': prefs.settings.log_font,
'default': 'Monospace',
'changed': False,
"type": "font",
"widget": self.ui.font_choice,
"value": prefs.settings.log_font,
"default": "Monospace",
"changed": False,
},
prefs.settings.SettingsLogFontSize: {
'type' : 'int',
'widget': self.ui.font_size,
'value': prefs.settings.log_font_size,
'default': 8,
'changed': False,
"type": "int",
"widget": self.ui.font_size,
"value": prefs.settings.log_font_size,
"default": 8,
"changed": False,
},
prefs.settings.SettingsGitSupported: {
'type' : 'bool',
'widget': self.ui.checkGitSupported,
'value': prefs.settings.git_supported,
'default': True,
'changed': False,
}
"type": "bool",
"widget": self.ui.checkGitSupported,
"value": prefs.settings.git_supported,
"default": True,
"changed": False,
},
prefs.settings.SettingsPythonPath: {
"type": "text",
"widget": self.ui.editPythonPath,
"value": prefs.settings.python_path,
"default": "",
"changed": False,
},
prefs.settings.SettingsLuaPath: {
"type": "text",
"widget": self.ui.editLuaPath,
"value": prefs.settings.lua_path,
"default": "",
"changed": False,
},
}
self.restore_prefs()
def store_prefs(self):
for k, v in self.elements.items():
self.elements[k]['changed'] = False
if v['type'] == 'bool':
val = v['widget'].isChecked()
if self.elements[k]['value'] != val:
self.elements[k]['value'] = val
self.elements[k]['changed'] = True
self.elements[k]["changed"] = False
if v["type"] == "bool":
val = v["widget"].isChecked()
if self.elements[k]["value"] != val:
self.elements[k]["value"] = val
self.elements[k]["changed"] = True
if v['type'] == 'text':
val = v['widget'].text()
if self.elements[k]['value'] != val:
self.elements[k]['value'] = val
self.elements[k]['changed'] = True
if v["type"] == "text":
val = v["widget"].text()
if self.elements[k]["value"] != val:
self.elements[k]["value"] = val
self.elements[k]["changed"] = True
if v['type'] == 'font':
val = v['widget'].currentFont().toString()
if self.elements[k]['value'] != val:
self.elements[k]['value'] = val
self.elements[k]['changed'] = True
if v["type"] == "font":
val = v["widget"].currentFont().toString()
if self.elements[k]["value"] != val:
self.elements[k]["value"] = val
self.elements[k]["changed"] = True
if v['type'] == 'int':
val = int(v['widget'].value())
if self.elements[k]['value'] != val:
self.elements[k]['value'] = val
self.elements[k]['changed'] = True
if v["type"] == "int":
val = int(v["widget"].value())
if self.elements[k]["value"] != val:
self.elements[k]["value"] = val
self.elements[k]["changed"] = True
if v['type'] == 'combo':
val = int(v['widget'].currentIndex())
if self.elements[k]['value'] != val:
self.elements[k]['value'] = val
self.elements[k]['changed'] = True
if v["type"] == "combo":
val = int(v["widget"].currentIndex())
if self.elements[k]["value"] != val:
self.elements[k]["value"] = val
self.elements[k]["changed"] = True
if self.elements[k]['changed']:
prefs.settings.set_value(k, v['value'])
if self.elements[k]["changed"]:
prefs.settings.set_value(k, v["value"])
prefs.settings.sync()
def restore_prefs(self):
for k, v in self.elements.items():
v['value'] = prefs.settings.value(k, v['default'])
if v['type'] == 'bool':
v['widget'].setChecked(v['value'])
elif v['type'] == 'text':
v['widget'].setText(self.elements[k]['value'])
elif v['type'] == 'font':
v["value"] = prefs.settings.value(k, v["default"])
if v["type"] == "bool":
v["widget"].setChecked(v["value"])
elif v["type"] == "text":
v["widget"].setText(self.elements[k]["value"])
elif v["type"] == "font":
f = QFont()
f.fromString(self.elements[k]['value'])
v['widget'].setCurrentFont(f)
elif v['type'] == 'int':
v['widget'].setValue(self.elements[k]['value'])
elif v['type'] == 'combo':
v['widget'].setCurrentIndex(self.elements[k]['value'])
f.fromString(self.elements[k]["value"])
v["widget"].setCurrentFont(f)
elif v["type"] == "int":
v["widget"].setValue(self.elements[k]["value"])
elif v["type"] == "combo":
v["widget"].setCurrentIndex(self.elements[k]["value"])
def isChanged(self, setting):
return self.elements[setting]['changed']
return self.elements[setting]["changed"]
@Slot()
def on_buttOKPressed(self):
@@ -173,14 +189,38 @@ class PrefWindow(QDialog):
@Slot()
def on_butReportPath_pressed(self):
path = QFileDialog.getExistingDirectory(self, "Select the default report directory",
self.ui.editDefaultReportPath.text())
path = QFileDialog.getExistingDirectory(
self,
caption="Select the default report directory",
dir=self.ui.editDefaultReportPath.text(),
)
if path:
self.ui.editDefaultReportPath.setText(path)
@Slot()
def on_butLogPath_pressed(self):
path = QFileDialog.getExistingDirectory(self, "Select the default log directory",
self.ui.editDefaultLogPath.text())
path = QFileDialog.getExistingDirectory(
self,
caption="Select the default log directory",
dir=self.ui.editDefaultLogPath.text(),
)
if path:
self.ui.editDefaultLogPath.setText(path)
@Slot()
def on_butPythonPath_pressed(self):
path, _ = QFileDialog.getOpenFileName(
self,
caption="Select the python interpreter",
dir=self.ui.editPythonPath.text(),
)
if path:
self.ui.editPythonPath.setText(path)
@Slot()
def on_butLuaPath_pressed(self):
path, _ = QFileDialog.getOpenFileName(
self, caption="Select the lua interpreter", dir=self.ui.editLuaPath.text()
)
if path:
self.ui.editLuaPath.setText(path)

View File

@@ -2,41 +2,6 @@ from time import sleep
import importlib
from PySide6.QtCore import (Signal, QThread)
# class ThreadTestRun(QThread):
# def __init__(
# self,
# test_proc: TestProcess,
# status_thread,
# tst_ctrl: TestSetController,
# debug=False,
# ):
# super().__init__(None)
# self._test_proc = test_proc
# self._tst_ctrl = tst_ctrl
# self._debug = debug
# self._status_thread = status_thread
# if debug:
# self.debugpy = importlib.import_module("debugpy")
# def run(self):
# if self._debug:
# self.debugpy.debug_this_thread()
# # start tests
# try:
# self._test_set.execute()
# except:
# print(traceback.format_exc())
# # raise
# self._status_thread.stop()
# if self._status_thread.isRunning():
# self._status_thread.wait()
# def stop(self):
# if self.isRunning():
# self._tst_ctrl.control("stop")
class ThreadTestStatus(QThread):
statusToBeUpdated = Signal(dict)

View File

@@ -974,6 +974,19 @@ class MainWindow(QMainWindow, Ui_MainWindow):
else:
return fullFileName
def defaults_for_process(self):
d = {}
pp = prefs.settings.python_path
if pp != "":
d["python_path"] = pp
pp = prefs.settings.lua_path
if pp != "":
d["lua_path"] = pp
return d
def loadTestSetFile(self, file_name):
"""Load the tests:
return True if it succeeds, False otherwise.
@@ -998,6 +1011,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self.ts_controller,
self.config_files,
self.defines,
self.defaults_for_process(),
)
self.test_proc.start()
while self.test_proc.is_alive():