diff --git a/src/testium/interpreter/process.py b/src/testium/interpreter/process.py index 9432d3b..84d5b6b 100644 --- a/src/testium/interpreter/process.py +++ b/src/testium/interpreter/process.py @@ -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) diff --git a/src/testium/interpreter/utils/settings.py b/src/testium/interpreter/utils/settings.py index fddaeb8..9f46ff2 100644 --- a/src/testium/interpreter/utils/settings.py +++ b/src/testium/interpreter/utils/settings.py @@ -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) \ No newline at end of file diff --git a/src/testium/interpreter/utils/test_init.py b/src/testium/interpreter/utils/test_init.py index aebf58e..b1d3af7 100644 --- a/src/testium/interpreter/utils/test_init.py +++ b/src/testium/interpreter/utils/test_init.py @@ -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) diff --git a/src/testium/main_win/preference_win/preference_core_win.py b/src/testium/main_win/preference_win/preference_core_win.py index 9171227..baeedc6 100644 --- a/src/testium/main_win/preference_win/preference_core_win.py +++ b/src/testium/main_win/preference_win/preference_core_win.py @@ -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)) diff --git a/src/testium/main_win/preference_win/preference_core_win.ui b/src/testium/main_win/preference_win/preference_core_win.ui index 948c9e1..d863d50 100644 --- a/src/testium/main_win/preference_win/preference_core_win.ui +++ b/src/testium/main_win/preference_win/preference_core_win.ui @@ -7,7 +7,7 @@ 0 0 597 - 386 + 525 @@ -45,16 +45,16 @@ - QFrame::NoFrame + QFrame::Shape::NoFrame - QFrame::Sunken + QFrame::Shadow::Sunken - Qt::ScrollBarAlwaysOff + Qt::ScrollBarPolicy::ScrollBarAlwaysOff - Qt::ScrollBarAsNeeded + Qt::ScrollBarPolicy::ScrollBarAsNeeded true @@ -63,9 +63,9 @@ 0 - -9 + 0 557 - 152 + 210 @@ -85,7 +85,7 @@ - Qt::RightToLeft + Qt::LayoutDirection::RightToLeft @@ -108,7 +108,7 @@ - Qt::RightToLeft + Qt::LayoutDirection::RightToLeft @@ -131,7 +131,7 @@ - Qt::RightToLeft + Qt::LayoutDirection::RightToLeft @@ -154,7 +154,7 @@ - Qt::RightToLeft + Qt::LayoutDirection::RightToLeft @@ -177,7 +177,7 @@ - Qt::RightToLeft + Qt::LayoutDirection::RightToLeft @@ -215,7 +215,7 @@ - Qt::Vertical + Qt::Orientation::Vertical @@ -240,6 +240,12 @@ 0 + + QFrame::Shape::NoFrame + + + Qt::ScrollBarPolicy::ScrollBarAlwaysOff + true @@ -248,8 +254,8 @@ 0 0 - 555 - 141 + 557 + 210 @@ -259,30 +265,10 @@ - - - - - 0 - 0 - - - - Default log files path - - - - + - - - - 0 - 0 - - - + @@ -293,30 +279,10 @@ - - - - - 0 - 0 - - - - Default reports path - - - - + - - - - 0 - 0 - - - + @@ -327,20 +293,80 @@ + + + + + + Qt::LayoutDirection::RightToLeft + + + + + + + + + + + + + + + + + ... + + + + + + + + + Default log files path + + + + + + Default reports path + + + + + + + Python Path + + + + git supported - - - - Qt::RightToLeft - + + + + + + + + + ... + + + + + + + - + Lua Path @@ -351,12 +377,15 @@ - Qt::Vertical + Qt::Orientation::Vertical + + + QSizePolicy::Policy::MinimumExpanding - 20 - 40 + 0 + 0 @@ -376,6 +405,12 @@ 0 + + QFrame::Shape::NoFrame + + + Qt::ScrollBarPolicy::ScrollBarAlwaysOff + true @@ -384,8 +419,8 @@ 0 0 - 555 - 72 + 557 + 77 @@ -436,10 +471,10 @@ - Qt::Vertical + Qt::Orientation::Vertical - QSizePolicy::Expanding + QSizePolicy::Policy::Expanding @@ -456,7 +491,7 @@ - QDialogButtonBox::Cancel|QDialogButtonBox::Ok + QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::Ok diff --git a/src/testium/main_win/preference_win/preference_win.py b/src/testium/main_win/preference_win/preference_win.py index 81598b2..bb5c89a 100644 --- a/src/testium/main_win/preference_win/preference_win.py +++ b/src/testium/main_win/preference_win/preference_win.py @@ -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) diff --git a/src/testium/main_win/test_run/test_run.py b/src/testium/main_win/test_run/test_run.py index 6acafc8..9ad0480 100644 --- a/src/testium/main_win/test_run/test_run.py +++ b/src/testium/main_win/test_run/test_run.py @@ -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) diff --git a/src/testium/main_win/testium_win.py b/src/testium/main_win/testium_win.py index 5b15f38..58b5cc0 100755 --- a/src/testium/main_win/testium_win.py +++ b/src/testium/main_win/testium_win.py @@ -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():