コード例 #1
0
ファイル: DefaultSequence.py プロジェクト: szecsi/Gears
    def boot(self, **args) :
        AppData.update(**args)
        self.monitorIndex = AppData.configParams['monitorIndex'][-1][0]
        self.deviceFrameRate = AppData.configParams['deviceFrameRate'][-1][0]
        self.frameRateDivisor = AppData.configParams['frameRateDivisor'][-1][0]
        self.square_field = AppData.configParams['square_field'][-1][0]
        self.field_width_um = AppData.configParams['field_width_um'][-1][0]
        self.field_height_um = AppData.configParams['field_height_um'][-1][0]
        self.field_width_px = AppData.configParams['field_width_px'][-1][0]
        self.field_height_px = AppData.configParams['field_height_px'][-1][0]
        self.field_left_px = AppData.configParams['field_left_px'][-1][0]
        self.field_top_px = AppData.configParams['field_top_px'][-1][0]
        self.electrodeDistance_um = (AppData.configParams['electrodeDistance_um_X'][-1][0], AppData.configParams['electrodeDistance_um_Y'][-1][0])
        self.electrodeOffset_um = (AppData.configParams['electrodeOffset_um_X'][-1][0], AppData.configParams['electrodeOffset_um_Y'][-1][0])
        self.electrodeZone1 = (
            AppData.configParams['electrodeZone1_left'][-1][0],
            AppData.configParams['electrodeZone1_top'][-1][0],
            AppData.configParams['electrodeZone1_right'][-1][0],
            AppData.configParams['electrodeZone1_bottom'][-1][0])
        self.electrodeZone2 = (
            AppData.configParams['electrodeZone2_left'][-1][0],
            AppData.configParams['electrodeZone2_top'][-1][0],
            AppData.configParams['electrodeZone2_right'][-1][0],
            AppData.configParams['electrodeZone2_bottom'][-1][0])
        self.fft_width_px = AppData.configParams['fft_width_px'][-1][0]
        self.fft_height_px = AppData.configParams['fft_height_px'][-1][0]

        self.addChannel('Msr stop',   '\\\\.\\' +  AppData.configParams['msr_stop_port'][-1][0][0], AppData.configParams['msr_stop_port'][-1][0][1])
        self.addChannel('Exp sync',   '\\\\.\\' +  AppData.configParams['exp_sync_port'][-1][0][0], AppData.configParams['exp_sync_port'][-1][0][1])
        self.addChannel('Stim sync',  '\\\\.\\' +  AppData.configParams['stim_sync_port'][-1][0][0], AppData.configParams['stim_sync_port'][-1][0][1])
        self.addChannel('Tick',       '\\\\.\\' +  AppData.configParams['tick_port'][-1][0][0], AppData.configParams['tick_port'][-1][0][1])
        self.onKeySpikeChannel = 'Stim sync'

        if self.square_field :
            self.setSquareOptics()
コード例 #2
0
ファイル: BrowserTree.py プロジェクト: szecsi/Gears
 def configure(self, item):
     path = self.pathFromItem(item)
     AppData.initConfigParams()
     loadParents(path, self.rootPath)
     configDialog = ConfigWindow(os.path.normpath(path))
     configDialog.exec()
コード例 #3
0
ファイル: config.py プロジェクト: szecsi/Gears
import AppData

AppData.update(
    exportRandomsWithHashmarkComments=True,
    exportRandomsChannelCount=3,
    exportRandomsAsReal=True,
    exportRandomsAsBinary=False,
)
コード例 #4
0
def loadSequence(fullpath, browser, openIde):
    from Ide import Ide
    try:
        with warnings.catch_warnings(record=True) as w:
            # Cause all warnings to always be triggered.
            warnings.simplefilter("always")

            AppData.initConfigParams()

            loadParents(os.path.dirname(fullpath), browser.rootPath)

            loader = importlib.machinery.SourceFileLoader(
                "my_module", fullpath)

            my_module = loader.load_module()
            gears.makeCurrent()
            gears.setSequence(my_module.create(None),
                              os.path.basename(fullpath))
            #gears.SetCurrentSurface(browser.surfaceHandle)
            #gears.RenderFrame(600)

            for e in w:
                browser.launcherWindow.warn(e.message)

    except SequenceError as e:
        if not openIde:
            box = QMessageBox(browser)
            horizontalSpacer = QSpacerItem(1000, 0, QSizePolicy.Minimum,
                                           QSizePolicy.Expanding)
            box.setText('Error in sequence file!\n' + e.tb[-1][0] + '(' +
                        str(e.tb[-1][1]) + '):\n in function "' + e.tb[-1][2] +
                        '":\n ' + e.tb[-1][3] + '\n\n' + str(e))
            if e.deepertb:
                box.setDetailedText(''.join(traceback.format_list(e.deepertb)))
            box.setWindowTitle('Error in sequence file ' + fullpath + '!')
            box.setWindowFlags(Qt.Dialog)
            box.addButton("Abort sequence", QMessageBox.RejectRole)
            box.addButton("Open script editor", QMessageBox.AcceptRole)
            box.setDefaultButton(QMessageBox.Abort)
            layout = box.layout()
            layout.addItem(horizontalSpacer, layout.rowCount(), 0, 1,
                           layout.columnCount())
            if box.exec() == QMessageBox.RejectRole:
                openIde = True
        if openIde:
            browser.launcherWindow.ide = Ide(fullpath, browser, e.tb[-1][1])
            browser.launcherWindow.ide.show()
        return False
    except:
        if not openIde:
            exc_type, exc_value, exc_traceback = sys.exc_info()
            formatted_lines = traceback.format_exc().splitlines()
            box = QMessageBox(browser)
            horizontalSpacer = QSpacerItem(1000, 0, QSizePolicy.Minimum,
                                           QSizePolicy.Expanding)
            message = ''
            for l in formatted_lines:
                message += l + '\n'
            box.setText(message)
            box.setWindowTitle('Sequence error!')
            box.setWindowFlags(Qt.Dialog)
            box.addButton("Abort sequence", QMessageBox.RejectRole)
            box.addButton("Open script editor", QMessageBox.AcceptRole)
            box.setDefaultButton(QMessageBox.Abort)
            layout = box.layout()
            layout.addItem(horizontalSpacer, layout.rowCount(), 0, 1,
                           layout.columnCount())
            if box.exec() == QMessageBox.RejectRole:
                openIde = True
        if openIde:
            browser.launcherWindow.ide = Ide(fullpath, browser)
            browser.launcherWindow.ide.show()
        return False

    pathInCalibs = fullpath.replace('Sequences', 'Tonemapping', 1)
    calibFilePattern = pathInCalibs.replace('.pyx', '*_measurement.py', 1)
    calibFiles = glob.glob(calibFilePattern)
    for f in calibFiles:
        cloader = importlib.machinery.SourceFileLoader("c_module", f)
        c_module = cloader.load_module()
        try:
            c_module.apply(gears.getSequence())
        except:
            browser.launcherWindow.warn(
                'Measurement file ' + f +
                ' is no longer valid, as the sequence has been edited. File skipped. Please recalibrate the sequence.'
            )
    calibFilePattern = pathInCalibs.replace('.pyx', '*_tonemap.py', 1)
    calibFiles = glob.glob(calibFilePattern)
    for f in calibFiles:
        cloader = importlib.machinery.SourceFileLoader("c_module", f)
        c_module = cloader.load_module()
        try:
            c_module.apply(gears.getSequence())
        except:
            browser.launcherWindow.warn(
                'Tone mapping file ' + f +
                ' is no longer valid, as the sequence has been edited. File skipped.  Please recalibrate the sequence.'
            )

    if openIde:
        browser.launcherWindow.ide = Ide(fullpath, browser)
        browser.launcherWindow.ide.show()
        return False

    return True
コード例 #5
0
import AppData

AppData.update(
        square_field        =   True,
    )
コード例 #6
0
import AppData

AppData.update(deviceFrameRate=59.94, )
コード例 #7
0
import sys
import os
import atexit
import pathlib
import importlib.machinery

import GearsModule as gears
import AppData
import SequenceLoaderCore

atexit.register(gears.DestroyEnvironment)

AppData.initConfigParams()

filePath = str(pathlib.Path(sys.argv[1]))
fileParentPath = str(pathlib.Path(sys.argv[1]).parent)
rootPath = str(pathlib.Path.cwd().joinpath('Project'))

SequenceLoaderCore.loadParents(fileParentPath, rootPath)

print('Loading SequenceCreator... ', end='')
sequenceCreator = importlib.machinery.SourceFileLoader('my_module',
                                                       filePath).load_module()
print('Done!')

print('Running Create... ', end='')
sequence = sequenceCreator.create(None)
print('Done!')

print('SetSequence... ', end='')
gears.setSequence(sequence, os.path.basename(filePath))
コード例 #8
0
import AppData

AppData.update(
        square_field        =   True,
        fft_width_px        =   64,
        fft_height_px       =   64,
    )
コード例 #9
0
    def initUI(self, cv_impl):
        """Setup the UI for the window.

        Keyword Arguments:
        cv_impl -- Class conforming to the vision implementation interface"""

        # Setup main content area
        mainWidget = QtGui.QFrame(self)
        interactionWidget = QtGui.QFrame(mainWidget)
        mainContent = QtGui.QHBoxLayout()
        interactionContent = QtGui.QVBoxLayout()

        # Setup Gui Elements
        self.data = AppData(self, cv_impl, self.logger, self.testdata)
        self.controlPanel = BarcodeEntry(self.data)
        self.lblBig = BigLabel(self.data, self.logger)
        self.lblSmall = SmallLabel(self.data)
        self.data.setGuiElements(self.controlPanel, self.lblBig, self.lblSmall)
        self.controlPanel.txtBarcode.installEventFilter(self)
        self.fileBrowser = FileBrowser()

        self.lblHint = QtGui.QLabel('')
        self.lblHint.setAlignment(QtCore.Qt.AlignHCenter)
        self.lblHint.setWordWrap(True)
        self.lblHint.setFixedHeight(50)

        self.topPanel = QtGui.QFrame()
        self.topContent = QtGui.QHBoxLayout()
        self.bottomPanel = QtGui.QFrame()
        self.bottomContent = QtGui.QHBoxLayout()

        # Add GUI elements to window
        mainWidget.setLayout(mainContent)
        interactionWidget.setLayout(interactionContent)
        self.bottomPanel.setLayout(self.bottomContent)
        self.topPanel.setLayout(self.topContent)
        self.setCentralWidget(mainWidget)

        interactionContent.addWidget(self.topPanel)
        interactionContent.addWidget(self.lblHint)
        interactionContent.addWidget(self.bottomPanel)
        self.topContent.addStretch(1)
        self.topContent.addWidget(self.lblBig)
        self.topContent.addStretch(1)
        self.bottomContent.addWidget(self.lblSmall)
        self.bottomContent.addWidget(self.controlPanel)
        mainContent.addWidget(interactionWidget)
        mainContent.addWidget(self.fileBrowser)

        # Setup menu bar
        self.buildMenubar(cv_impl)

        # Wire up signals and slots
        self.sigLoadTrayImage.connect(self.data.loadTrayImage)
        self.sigQuitAction.connect(self.data.quit)
        self.sigUndoAction.connect(self.data.undoAction)
        self.sigRedoAction.connect(self.data.redoAction)

        cv_impl.sigScanningModeOn.connect(
            self.controlPanel.txtBarcode.setEnabled)
        cv_impl.sigScanningModeOn.connect(self.actResyncCamera.setEnabled)
        cv_impl.sigRemovedBug.connect(self.data.onBugRemoved)
        cv_impl.sigShowHint.connect(self.lblHint.setText)

        self.data.sigSelectedBox.connect(cv_impl.onEditBoxSelected)
        self.data.sigDeletedBox.connect(cv_impl.onEditBoxDeleted)
        self.data.sigShowHint.connect(self.lblHint.setText)

        self.fileBrowser.sigFileSelected.connect(self.selectTrayImage)

        self.lblBig.sigMousePress.connect(self.data.mousePress)
        self.lblBig.sigMouseMove.connect(self.data.mouseMove)
        self.lblBig.sigMouseRelease.connect(self.data.mouseRelease)
        self.lblBig.sigScroll.connect(self.data.mouseScroll)

        # Finish up window
        self.setAcceptDrops(True)
        self.statusBar().showMessage(C.WINDOW_STATUS_READY)
        self.setGeometry(100, 100, self.originalSize[0], self.originalSize[1])
        self.setWindowTitle(C.WINDOW_TITLE)
        self.show()
        self.raise_()
コード例 #10
0
class MainWindow(QtGui.QMainWindow):

    originalSize = (964, 486)
    sigLoadTrayImage = QtCore.Signal(str, str)
    sigUndoAction = QtCore.Signal()
    sigRedoAction = QtCore.Signal()
    sigQuitAction = QtCore.Signal()

    def __init__(self, cv_impl, logger, testdata):
        """Main window constructor.

        Keyword Arguments:
        cv_impl -- Class conforming to the vision implementation interface
        logger -- InteractionLogger instance"""

        super(MainWindow, self).__init__()
        self.logger = logger
        self.testdata = testdata
        self.cvImpl = cv_impl
        cv_impl.setMainWindow(self)
        self.initUI(cv_impl)

        # Initialize cursors that will be used
        self.normalCursor = QtGui.QCursor(QtCore.Qt.ArrowCursor)
        self.dragCursor = QtGui.QCursor(QtCore.Qt.DragLinkCursor)

    def initUI(self, cv_impl):
        """Setup the UI for the window.

        Keyword Arguments:
        cv_impl -- Class conforming to the vision implementation interface"""

        # Setup main content area
        mainWidget = QtGui.QFrame(self)
        interactionWidget = QtGui.QFrame(mainWidget)
        mainContent = QtGui.QHBoxLayout()
        interactionContent = QtGui.QVBoxLayout()

        # Setup Gui Elements
        self.data = AppData(self, cv_impl, self.logger, self.testdata)
        self.controlPanel = BarcodeEntry(self.data)
        self.lblBig = BigLabel(self.data, self.logger)
        self.lblSmall = SmallLabel(self.data)
        self.data.setGuiElements(self.controlPanel, self.lblBig, self.lblSmall)
        self.controlPanel.txtBarcode.installEventFilter(self)
        self.fileBrowser = FileBrowser()

        self.lblHint = QtGui.QLabel('')
        self.lblHint.setAlignment(QtCore.Qt.AlignHCenter)
        self.lblHint.setWordWrap(True)
        self.lblHint.setFixedHeight(50)

        self.topPanel = QtGui.QFrame()
        self.topContent = QtGui.QHBoxLayout()
        self.bottomPanel = QtGui.QFrame()
        self.bottomContent = QtGui.QHBoxLayout()

        # Add GUI elements to window
        mainWidget.setLayout(mainContent)
        interactionWidget.setLayout(interactionContent)
        self.bottomPanel.setLayout(self.bottomContent)
        self.topPanel.setLayout(self.topContent)
        self.setCentralWidget(mainWidget)

        interactionContent.addWidget(self.topPanel)
        interactionContent.addWidget(self.lblHint)
        interactionContent.addWidget(self.bottomPanel)
        self.topContent.addStretch(1)
        self.topContent.addWidget(self.lblBig)
        self.topContent.addStretch(1)
        self.bottomContent.addWidget(self.lblSmall)
        self.bottomContent.addWidget(self.controlPanel)
        mainContent.addWidget(interactionWidget)
        mainContent.addWidget(self.fileBrowser)

        # Setup menu bar
        self.buildMenubar(cv_impl)

        # Wire up signals and slots
        self.sigLoadTrayImage.connect(self.data.loadTrayImage)
        self.sigQuitAction.connect(self.data.quit)
        self.sigUndoAction.connect(self.data.undoAction)
        self.sigRedoAction.connect(self.data.redoAction)

        cv_impl.sigScanningModeOn.connect(
            self.controlPanel.txtBarcode.setEnabled)
        cv_impl.sigScanningModeOn.connect(self.actResyncCamera.setEnabled)
        cv_impl.sigRemovedBug.connect(self.data.onBugRemoved)
        cv_impl.sigShowHint.connect(self.lblHint.setText)

        self.data.sigSelectedBox.connect(cv_impl.onEditBoxSelected)
        self.data.sigDeletedBox.connect(cv_impl.onEditBoxDeleted)
        self.data.sigShowHint.connect(self.lblHint.setText)

        self.fileBrowser.sigFileSelected.connect(self.selectTrayImage)

        self.lblBig.sigMousePress.connect(self.data.mousePress)
        self.lblBig.sigMouseMove.connect(self.data.mouseMove)
        self.lblBig.sigMouseRelease.connect(self.data.mouseRelease)
        self.lblBig.sigScroll.connect(self.data.mouseScroll)

        # Finish up window
        self.setAcceptDrops(True)
        self.statusBar().showMessage(C.WINDOW_STATUS_READY)
        self.setGeometry(100, 100, self.originalSize[0], self.originalSize[1])
        self.setWindowTitle(C.WINDOW_TITLE)
        self.show()
        self.raise_()

    def buildMenubar(self, cv_impl):
        """Build the application menus.

        cv_impl -- vision implementation"""

        menubar = QtGui.QMenuBar()

        # File menu
        fileMenu = QtGui.QMenu(menubar)
        fileMenu.setTitle(C.MENU_TEXT[0][0])
        fileMenu.addAction(
            C.MENU_TEXT[0][1][0],
            self.selectTrayImage).setShortcut(QtGui.QKeySequence.Open)

        # Recent files submenu
        recentMenu = fileMenu.addMenu(C.MENU_TEXT[0][1][1])
        if os.path.isfile(C.FILENAME_RECENT_LOADS):
            with open(C.FILENAME_RECENT_LOADS, 'r') as recent_file:
                for path in recent_file.readlines():
                    fname = os.path.split(path)[1]
                    recentMenu.addAction(
                        fname, partial(self.selectTrayImage, path[0:-1]))
        fileMenu.addSeparator()

        # Save and Quit
        fileMenu.addAction(
            C.MENU_TEXT[0][1][2],
            self.data.exportToCSV).setShortcut(QtGui.QKeySequence.Save)
        fileMenu.addAction(
            C.MENU_TEXT[0][1][3],
            self.sigQuitAction.emit).setShortcut(QtGui.QKeySequence.Quit)

        # Edit menu
        editMenu = QtGui.QMenu(menubar)
        editMenu.setTitle(C.MENU_TEXT[1][0])
        editMenu.addAction(
            C.MENU_TEXT[1][1][0],
            self.sigUndoAction.emit).setShortcut(QtGui.QKeySequence.Undo)
        editMenu.addAction(
            C.MENU_TEXT[1][1][1],
            self.sigRedoAction.emit).setShortcut(QtGui.QKeySequence.Redo)

        # Image menu
        imageMenu = QtGui.QMenu(menubar)
        imageMenu.setTitle(C.MENU_TEXT[2][0])
        imageMenu.addAction(C.MENU_TEXT[2][1][0], cv_impl.resetTrayArea)
        self.actResyncCamera = imageMenu.addAction(
            C.MENU_TEXT[2][1][1], cv_impl.refreshCamera)
        self.actResyncCamera.setDisabled(True)

        # Finish set up
        menubar.addMenu(fileMenu)
        menubar.addMenu(editMenu)
        menubar.addMenu(imageMenu)
        self.setMenuBar(menubar)

    def resizeEvent(self, ev):
        """Called when the window is resized.

        Keyword Arguments:
        ev -- PySIde.QtGui.QResizeEvent"""

        h = ev.size().height()
        w = ev.size().width()
        self.logger.log('WINDOW resized to (%d, %d)' % (w, h), 1)
        (oldW, oldH) = self.originalSize
        scale = (float(w)/oldW, float(h)/oldH)
        # self.lblBig.newResizeScale(scale)
        # self.lblSmall.newResizeScale(scale)

    def closeEvent(self, event):
        """Called when someone tries to quit the application.

        Keyword Arguments:
        event -- PySide.QtGui.QCloseEvent"""

        self.data.quit()

    @QtCore.Slot()
    def selectTrayImage(self, fname=None):
        """Load the tray image.

        Keyword Arguments:
        fname -- path of the file to load. If not specified then a file load
            dialog is shows to the user"""

        # If no filename provided, show file load dialog
        if fname is None:
            fname, _ = QtGui.QFileDialog.getOpenFileName(
                self, C.OPENDIALOG_TITLE, '.')

        # Extract filename, directory path, and associated csv filename
        if fname != '':
            self.logger.log('LOAD by File menu', 1)
            (self.currentPath, self.imageFilename) = os.path.split(fname)
            csvfile = changeExtension(self.imageFilename, 'csv')
            csvfile = os.path.join(self.currentPath, csvfile)

            # Boradcast that user has loaded a file
            self.sigLoadTrayImage.emit(fname, csvfile)

            # Update recent files data
            recent_files = []
            if os.path.isfile(C.FILENAME_RECENT_LOADS):
                with open(C.FILENAME_RECENT_LOADS, 'r') as recent_file:
                    for line in recent_file.readlines():
                        recent_files.append(line[0:-1])

            recent_files.insert(0, fname)
            recent_files = dedup_list(recent_files)

            with open(C.FILENAME_RECENT_LOADS, 'w') as recent_file:
                for f in recent_files:
                    recent_file.write(f+'\n')

            # Reload file browser
            self.fileBrowser.refresh(self.currentPath, self.imageFilename)

    def dragEnterEvent(self, ev):
        """Called when the user drags something into the window.

        Keyword Arguments:
        ev -- PySide.QtGui.QDragEnterEvent"""

        if ev.mimeData().hasUrls():
            ev.accept()
            self.setCursor(self.dragCursor)

    def dragLeaveEvent(self, ev):
        """Called when the user drags something out of the window.

        Keyword Arguments:
        ev -- PySide.QtGui.QDragLeaveEvent"""

        self.setCursor(self.normalCursor)

    def dropEvent(self, ev):
        """Called when the user drags and drops something into the window.

        Keyword Arguments:
        ev -- PySide.QtGui.QDropEvent"""

        self.setCursor(self.normalCursor)

        # If the mimetype is correct, try to load the image
        if ev.mimeData().hasUrls():
            self.logger.log('LOAD by drag and drop', 1)
            self.selectTrayImage(ev.mimeData().urls()[0].toLocalFile())

    def eventFilter(self, obj, event):
        """Event filter designed to capture undo events directed towards the
        barcode QLineEdit, and redirect it to the entire window.

        Keyword Arguments:
        obj -- PySide.QtCore.QObject
        event -- PySide.QtCore.QEvent"""

        if obj == self.controlPanel.txtBarcode\
                and event.type() == QtCore.QEvent.Type.ShortcutOverride:
            if event.matches(QtGui.QKeySequence.Undo) or\
                    event.matches(QtGui.QKeySequence.Redo):
                self.logger.log('KEY capture undo/redo from txtBarcode', 1)
                return True
        return QtGui.QMainWindow.eventFilter(self, obj, event)
コード例 #11
0
import AppData

AppData.update(
    square_field=True,
    exportRandomsWithHashmarkComments=True,
    exportRandomsChannelCount=1,
    exportRandomsAsReal=False,
    exportRandomsAsBinary=True,
    fft_width_px=1024,
    fft_height_px=1024,
)
コード例 #12
0
import AppData

AppData.update(square_field=False, )
コード例 #13
0
    def setupUi(self, MainWindow):
        super().setupUi(MainWindow)
        only_int = (self.nMeroTelefNicoLineEdit, self.phoneNumberLineEdit)
        for i in only_int:
            i.setValidator(QIntValidator())



        self.config_file_error_dialog = Config_error_dialog(MainWindow)

        self.data = AppData.Add(self.config_file_error)

        #dialogs
        self._3dpricing_dialog = QDialog(MainWindow)
        _3dpricing_dialog.Ui_Dialog().setupUi(self._3dpricing_dialog)
        self.licence_dialog = QDialog(MainWindow)
        licence_dialog.Ui_Dialog().setupUi(self.licence_dialog)
        self.source_code_dialog = QDialog(MainWindow)
        source_code_dialog.Ui_Dialog().setupUi(self.source_code_dialog)


        self.init_dialog = Init_window(parent= MainWindow, add_object = self.data, mainw = self)
        self.settings_window = Settings_window(add_object = self.data, mainW = self, parent = MainWindow)

        #CreateOrderUI
        '''impresoras en el combobox'''
        self.current_printers_CreateOrderUI = ()
        '''carretes en el combobox'''
        self.current_filaments_CreateOrderUI = ()
        '''clientes en el combobox'''
        self.current_customers_CreateOrderUI = ()
        self.current_materials_CreateOrderUI = ()

        #AddItemUI
        self.current_materials_AddItemsUI = ()
    
        #EditDeleteUI
        self.current_materials_EditDeleteUI = ()
        self.current_printers_EditDeleteUI = ()
        self.current_customers_EditDeleteUI = ()
        self.current_filaments_EditDeleteUI = ()



        self.item_to_clear_addItem = {\
            'spinBox':(self.spinBox, self.consumoDeElectricidadSpinBox, self.costoDelCarreteSpinBox,\
                self.spinBox_2),
            'textEdit':(self.nameLineEdit, self.nameLineEdit_2, self.nameLineEdit_3, self.lastNameLineEdit, self.phoneNumberLineEdit),
            'comboBox':(self.materialComboBox_3)}

        self.items_to_clear_createOrder = {\
            'spinBox':(self.spinBox_4, self.spinBox_5, self.spinBox_6, self.slicing_time_SpinBox,\
                self.setUpPrinterSpinBox,self.removerImpresiNSpinBox, self.spinBox_9),
            'textEdit':(self.textEdit),\
            'comboBox':(self.customers_comboBox, self.materialComboBox, self.prippComboBox)}

        self.items_to_clear_editDelete ={\
            'spinBox':(self.costoDeElectricidadSpinBox, self.cambiarCostoDeElectricidadASpinBox, self.iDSpinBox_2,\
                self.spinBox_3, self.consumoElCtricoPorDefectoSpinBox, self.costoDeUsoDepreciaciNDoubleSpinBox),
            'textEdit':(self.nombreLineEdit_3, self.apellidoLineEdit, self.nMeroTelefNicoLineEdit, self.nombreLineEdit),
            'comboBox':(self.materialComboBox_9,self.impresoraComboBox, self.clienteComboBox, self.impresoraComboBox_2\
                ),
            }
        self.connect_all()


        self.refreshUI()
        self.stackedWidget.setCurrentIndex(0)
        self.stackedWidget_3.setCurrentIndex(0)
        self.stackedWidget_2.setCurrentIndex(1)