def tearDownClass(cls) -> None: """Ensure test clear all data.""" finish_testing() db_name = "temp_db" config.set_value("StaticLoader/%s/enabled" % (db_name), False) # Para activar carga estática config.set_value("StaticLoader/%s/dirs" % db_name, [])
def test_mainwindow_global(self) -> None: """Test mainwindow global.""" from PyQt5 import QtWidgets from pineboolib import application import importlib sys_type = systype.SysType() sys_type.installACL("cuarta") acl = pnaccesscontrollists.PNAccessControlLists() acl.init() flapplication.aqApp.set_acl(acl) config.set_value("application/dbadmin_enabled", True) project = application.PROJECT project.main_form = importlib.import_module( "pineboolib.plugins.mainform.eneboo.eneboo") project.main_window = getattr(project.main_form, "mainWindow", None) main_form_ = getattr(project.main_form, "MainForm", None) self.assertTrue(main_form_) self.main_w = main_form_() self.main_w.initScript() self.main_w.show() self.assertTrue(self.main_w) action_1 = self.main_w.findChild(QtWidgets.QAction, "flusers") self.assertTrue(action_1) self.assertFalse(action_1.isVisible())
def grabarValorLocal(self, valor_name: str, value: Union[str, bool]) -> None: """Set local value.""" from pineboolib.core.settings import config if valor_name in ("isDebuggerMode", "dbadmin_enabled"): config.set_value("application/%s" % valor_name, value) else: if valor_name == "maxPixImages" and value is None: value = 600 config.set_value("ebcomportamiento/%s" % valor_name, value)
def setUpClass(cls) -> None: """Ensure pineboo is initialized for testing.""" from pineboolib.core.utils.utils_base import filedir db_name = "temp_db" dirs = [True, filedir("./application/staticloader/tests/fixtures")] config.set_value("StaticLoader/%s/enabled" % (db_name), True) # Para activar carga estática config.set_value("StaticLoader/%s/dirs" % db_name, dirs) init_testing()
def change_profile_dir(self) -> None: """ Change the path where profiles are saved. """ new_dir = QtWidgets.QFileDialog.getExistingDirectory( self._user_interface, self.tr("Carpeta profiles"), self.profile_dir, QtWidgets.QFileDialog.ShowDirsOnly, ) if new_dir and new_dir is not self.profile_dir: config.set_value("ebcomportamiento/profiles_folder", new_dir) self.profile_dir = new_dir ProjectConfig.profile_dir = new_dir self.loadProfiles()
def setUpClass(cls) -> None: """Ensure pineboo is initialized for testing.""" config.set_value("application/isDebuggerMode", True) config.set_value("application/dbadmin_enabled", True) cls.prev_main_window_name = config.value( "ebcomportamiento/main_form_name", "eneboo") config.set_value("ebcomportamiento/main_form_name", "eneboo_mdi") init_testing()
def tearDownClass(cls) -> None: """Ensure this class is finished correctly.""" del application.PROJECT.main_form del application.PROJECT.main_window config.set_value("application/isDebuggerMode", False) config.set_value("application/dbadmin_enabled", False) config.set_value("ebcomportamiento/main_form_name", cls.prev_main_window_name) finish_testing()
def nombre_session(): return get_current_user() pineboolib_app.PROJECT.set_session_function(nombre_session) SQL_CONN = ProjectConfig(database=DATABASES["default"]["NAME"], host=DATABASES["default"]["HOST"], port=DATABASES["default"]["PORT"], type="PostgreSQL (PSYCOPG2)", username=DATABASES["default"]["USER"], password=DATABASES["default"]["PASSWORD"]) if StaticLoader: config.set_value("StaticLoader/%s/enabled" % (DATABASES["default"]["NAME"]), True) # Para activar carga estática config.set_value( "StaticLoader/%s/dirs" % DATABASES["default"]["NAME"], dirs ) # Directorios para carga estatica(Configurar en local.py, Ej: dirs = [True, "/home/modulos/api/scripts", True, "/home/modulos/libreria/scripts"]) config.set_value("ebcomportamiento/SLConsola", True) # Muestra debug por consola config.set_value("application/dbadmin_enabled", True) # para dbadmin (comprobación de mtd's) else: config.set_value( "StaticLoader/%s/enabled" % (DATABASES["default"]["NAME"]), False) # Definir ruta para cache de ficheros en flfiles # config.set_value("ebcomportamiento/temp_dir", "loquesea")