Ejemplo n.º 1
0
def main():
    from pymodaq.dashboard import DashBoard
    from pathlib import Path
    from pymodaq.daq_utils.gui_utils.dock import DockArea

    config = Config()
    app = QtWidgets.QApplication(sys.argv)
    if config('style', 'darkstyle'):
        import qdarkstyle
        app.setStyleSheet(qdarkstyle.load_stylesheet())

    win = QtWidgets.QMainWindow()
    area = DockArea()
    win.setCentralWidget(area)
    win.resize(1000, 500)
    win.setWindowTitle('PyMoDAQ Dashboard')

    # win.setVisible(False)
    prog = DashBoard(area)
    file = Path(get_set_preset_path()).joinpath(
        f"{config('presets', 'default_preset_for_logger')}.xml")
    if file.exists():
        prog.set_preset_mode(file)
        prog.load_log_module()
    else:
        msgBox = QtWidgets.QMessageBox()
        msgBox.setText(
            f"The default file specified in the configuration file does not exists!\n"
            f"{file}\n"
            f"Impossible to load the Logger Module")
        msgBox.setStandardButtons(msgBox.Ok)
        ret = msgBox.exec()

    sys.exit(app.exec_())
Ejemplo n.º 2
0
from pathlib import Path

import pymodaq.daq_utils.gui_utils.dock
from pymodaq.daq_utils.config import Config, get_set_preset_path
from pytest import fixture, mark
from pymodaq.daq_utils import daq_utils as utils
from pymodaq.daq_utils.conftests import qtbotskip, main_modules_skip

pytestmark = mark.skipif(qtbotskip, reason='qtbot issues but tested locally')

preset_path = get_set_preset_path()
config = Config()


@fixture
def init_qt(qtbot):
    return qtbot


@fixture
def main(qtbot):
    from qtpy import QtWidgets
    from pymodaq.dashboard import DashBoard
    from pymodaq.daq_scan import DAQ_Scan
    from pymodaq.daq_utils import gui_utils as gutils

    win = QtWidgets.QMainWindow()
    area = pymodaq.daq_utils.gui_utils.dock.DockArea()
    win.setCentralWidget(area)
    win.resize(1000, 500)
    win.setWindowTitle('PyMoDAQ Dashboard')
Ejemplo n.º 3
0
 def test_load_config(self):
     config = load_config()
     config = Config()
     config('style', 'darkstyle')
     assert config('style', 'darkstyle') == config['style']['darkstyle']
Ejemplo n.º 4
0
    except Exception:
        print("Couldn't create the local folder to store logs , presets...")

    # issue on windows when using .NET code within multithreads, this below allows it but requires the
    # pywin32 (pythoncom) package
    if importlib.util.find_spec('clr') is not None:
        try:
            import pythoncom
            pythoncom.CoInitialize()
        except ModuleNotFoundError as e:
            infos = "You have installed plugins requiring the pywin32 package to work correctly," \
                    " please type in *pip install pywin32* and restart PyMoDAQ"
            print(infos)
            logger.warning(infos)

    config = Config(
    )  # to ckeck for config file existence, otherwise create one
    copy_preset()
    logger.info('')
    logger.info('')
    logger.info('************************')
    logger.info('Starting PyMoDAQ modules')
    logger.info('************************')
    logger.info('')
    logger.info('')
    logger.info('************************')
    logger.info(f"Setting Qt backend to: {config['qtbackend']['backend']} ...")
    logger.info('************************')
    set_qt_backend()
    logger.info('')
    logger.info('')
    logger.info('************************')