Beispiel #1
0
    def editor_input(self, text):

        with open('editor_recipe.epi', 'w+') as f:
            f.write(text)

        f_path = os.path.join(os.getcwd(), 'editor_recipe.epi')
        #        print(self.recipe,f_path)

        self.recipe_class = Recipe(self.recipe, f_path)

        self.file_notify.setText('Current recipe: {} (modified)'.format(
            self.recipe))

        # Add corresponding items to each qlistwidgets
        for qlistwidget in self.qlistwidgets:
            qlistwidget.clear()

        recipe_dics = [
            self.recipe_class.reactor_gases,
            self.recipe_class.semiconductor_layers, self.recipe_class.gas_dic,
            self.recipe_class.valve_dic,
            self.recipe_class.reactor_variables_dic
        ]

        for dic, dic_list in zip(recipe_dics, self.qlistwidgets):
            for n in dic.keys():
                item = QListWidgetItem(str(n))
                if n in dic.keys():
                    dic_list.addItem(item)
                else:
                    pass
                item.setSelected(False)

        os.remove(os.path.abspath(f_path))
Beispiel #2
0
    def get_input(self):
        # Clear all variables
        #        self.text_recipe.clear()

        for qlistwidget in self.qlistwidgets:
            qlistwidget.clear()

        # Open the input recipe
        options = QFileDialog.Options()
        options |= QFileDialog.DontUseNativeDialog
        file_line, _ = QFileDialog.getOpenFileName(self,
                                                   'Open file',
                                                   os.path.join(
                                                       os.getcwd(), 'recipes'),
                                                   '(*.epi)',
                                                   options=options)

        self.file_path = os.path.abspath(file_line)

        # Write the recipe to the app text editor
        self.recipe = os.path.basename(self.file_path)

        #        with open(self.file_path,'r') as fo:
        #            text = fo.read()
        Window.global_path = self.file_path
        #            self.got_recipe.emit(text)
        #            TextEditor.text_recipe.setText(text)

        self.recipe_class = Recipe(self.recipe, self.file_path)

        #        print(self.recipe,file_path)
        self.file_notify.setText('Current recipe: {}'.format(self.recipe))

        recipe_dics = [
            self.recipe_class.reactor_gases,
            self.recipe_class.semiconductor_layers, self.recipe_class.gas_dic,
            self.recipe_class.valve_dic,
            self.recipe_class.reactor_variables_dic
        ]

        for dic, dic_list in zip(recipe_dics, self.qlistwidgets):
            for n in dic.keys():
                item = QListWidgetItem(str(n))
                if n in dic.keys():
                    dic_list.addItem(item)
                else:
                    pass
                item.setSelected(False)
Beispiel #3
0
    def __init__(self, parent=None):
        super(Window, self).__init__(parent)

        self.recipe = '000.epi'
        self.recipe_class = Recipe(self.recipe)
        self.file_path = os.path.join(os.getcwd(), 'recipes', self.recipe)
        self.text_editor = RecipeEditor()
        self.text_editor.got_text.connect(self.editor_input)
        self.constants = ConstantsEditor()
        self.constants.got_values.connect(self.change_constants)

        self.left = 20
        self.top = 20
        self.width = 500
        self.height = 500

        self.title = 'MOVPE Recipe'
        self.initUI()
Beispiel #4
0
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(800, 600)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.random_recipe_button = QtWidgets.QPushButton(self.centralwidget)
        self.random_recipe_button.setGeometry(QtCore.QRect(290, 10, 181, 51))
        self.random_recipe_button.setObjectName("random_recipe_button")
        self.left_group_box = QtWidgets.QGroupBox(self.centralwidget)
        self.left_group_box.setGeometry(QtCore.QRect(10, 70, 311, 491))
        self.left_group_box.setObjectName("left_group_box")
        self.recipe_image = QtWidgets.QLabel(self.left_group_box)
        self.recipe_image.setGeometry(QtCore.QRect(20, 30, 261, 181))
        self.recipe_image.setText("")
        self.recipe_image.setObjectName("recipe_image")
        self.recipe_name_label = QtWidgets.QLabel(self.left_group_box)
        self.recipe_name_label.setGeometry(QtCore.QRect(20, 250, 47, 13))
        self.recipe_name_label.setText("")
        self.recipe_name_label.setObjectName("recipe_name_label")
        self.category_label = QtWidgets.QLabel(self.left_group_box)
        self.category_label.setGeometry(QtCore.QRect(20, 260, 161, 41))
        self.category_label.setText("")
        self.category_label.setObjectName("category_label")
        self.instructions_label = QtWidgets.QLabel(self.centralwidget)
        self.instructions_label.setGeometry(QtCore.QRect(390, 80, 381, 481))
        self.instructions_label.setText("")
        self.instructions_label.setObjectName("instructions_label")
        self.instructions_label.setWordWrap(True)
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 21))
        self.menubar.setObjectName("menubar")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

        self.random_recipe_button.clicked.connect(self.getRecipe)
        self.new_recipe = Recipe()
Beispiel #5
0
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(800, 600)
        QWebEngineSettings.globalSettings().setAttribute(
            QWebEngineSettings.PluginsEnabled, True)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.random_recipe_button = QtWidgets.QPushButton(self.centralwidget)
        self.random_recipe_button.setGeometry(QtCore.QRect(290, 10, 181, 51))
        self.random_recipe_button.setObjectName("random_recipe_button")
        self.left_group_box = QtWidgets.QGroupBox(self.centralwidget)
        self.left_group_box.setGeometry(QtCore.QRect(10, 55, 360, 500))
        self.left_group_box.setObjectName("left_group_box")
        self.verticalLayout = QtWidgets.QVBoxLayout(self.left_group_box)
        self.verticalLayout.setObjectName("verticalLayout")

        #         self.recipe_image = QtWidgets.QLabel(self.left_group_box)
        #         self.recipe_image.setText("")
        #         self.recipe_image.setObjectName("recipe_image")

        self.recipe_image = QtWebEngineWidgets.QWebEngineView()
        self.recipe_image.setObjectName("recipe_image")

        self.verticalLayout.addWidget(self.recipe_image)
        self.recipe_name_label = QtWidgets.QLabel(self.left_group_box)
        self.recipe_name_label.setObjectName("recipe_name_label")
        self.verticalLayout.addWidget(self.recipe_name_label)
        self.category_label = QtWidgets.QLabel(self.left_group_box)
        self.category_label.setObjectName("category_label")
        self.verticalLayout.addWidget(self.category_label)
        self.ingredients_label = QtWidgets.QLabel(self.left_group_box)
        self.ingredients_label.setText("")
        self.ingredients_label.setObjectName("ingredients_label")
        self.verticalLayout.addWidget(self.ingredients_label)

        #self.yt_viewer_label = QtWidgets.QLabel(self.left_group_box)
        #self.yt_viewer_label.setText("")
        #self.yt_viewer_label.setObjectName("yt_viewer_label")

        self.yt_viewer = QtWebEngineWidgets.QWebEngineView()
        self.yt_viewer.setObjectName("yt_viewer")

        self.verticalLayout.addWidget(self.yt_viewer)
        self.instructions_label = QtWidgets.QLabel(self.centralwidget)
        self.instructions_label.setGeometry(QtCore.QRect(390, 80, 381, 481))
        self.instructions_label.setText("")
        self.instructions_label.setObjectName("instructions_label")
        self.instructions_label.setWordWrap(True)
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 21))
        self.menubar.setObjectName("menubar")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

        self.random_recipe_button.clicked.connect(self.getRecipe)
        self.new_recipe = Recipe()
Beispiel #6
0
class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(800, 600)
        QWebEngineSettings.globalSettings().setAttribute(
            QWebEngineSettings.PluginsEnabled, True)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.random_recipe_button = QtWidgets.QPushButton(self.centralwidget)
        self.random_recipe_button.setGeometry(QtCore.QRect(290, 10, 181, 51))
        self.random_recipe_button.setObjectName("random_recipe_button")
        self.left_group_box = QtWidgets.QGroupBox(self.centralwidget)
        self.left_group_box.setGeometry(QtCore.QRect(10, 55, 360, 500))
        self.left_group_box.setObjectName("left_group_box")
        self.verticalLayout = QtWidgets.QVBoxLayout(self.left_group_box)
        self.verticalLayout.setObjectName("verticalLayout")

        #         self.recipe_image = QtWidgets.QLabel(self.left_group_box)
        #         self.recipe_image.setText("")
        #         self.recipe_image.setObjectName("recipe_image")

        self.recipe_image = QtWebEngineWidgets.QWebEngineView()
        self.recipe_image.setObjectName("recipe_image")

        self.verticalLayout.addWidget(self.recipe_image)
        self.recipe_name_label = QtWidgets.QLabel(self.left_group_box)
        self.recipe_name_label.setObjectName("recipe_name_label")
        self.verticalLayout.addWidget(self.recipe_name_label)
        self.category_label = QtWidgets.QLabel(self.left_group_box)
        self.category_label.setObjectName("category_label")
        self.verticalLayout.addWidget(self.category_label)
        self.ingredients_label = QtWidgets.QLabel(self.left_group_box)
        self.ingredients_label.setText("")
        self.ingredients_label.setObjectName("ingredients_label")
        self.verticalLayout.addWidget(self.ingredients_label)

        #self.yt_viewer_label = QtWidgets.QLabel(self.left_group_box)
        #self.yt_viewer_label.setText("")
        #self.yt_viewer_label.setObjectName("yt_viewer_label")

        self.yt_viewer = QtWebEngineWidgets.QWebEngineView()
        self.yt_viewer.setObjectName("yt_viewer")

        self.verticalLayout.addWidget(self.yt_viewer)
        self.instructions_label = QtWidgets.QLabel(self.centralwidget)
        self.instructions_label.setGeometry(QtCore.QRect(390, 80, 381, 481))
        self.instructions_label.setText("")
        self.instructions_label.setObjectName("instructions_label")
        self.instructions_label.setWordWrap(True)
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 21))
        self.menubar.setObjectName("menubar")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

        self.random_recipe_button.clicked.connect(self.getRecipe)
        self.new_recipe = Recipe()

    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
        self.random_recipe_button.setText(
            _translate("MainWindow", "Get New Random Recipe!"))
        self.left_group_box.setTitle(_translate("MainWindow", "GroupBox"))
        self.recipe_name_label.setText(_translate("MainWindow", "Here"))
        self.category_label.setText(_translate("MainWindow", "Here"))

    def getRecipe(self):
        self.new_recipe.getNewRecipe()

        # Set name of recipe
        self.recipe_name_label.setText(self.new_recipe.get_name())

        self.category_label.setText(self.new_recipe.get_category())
        self.instructions_label.setText(self.new_recipe.get_instructions())

        # Set up YT video
        yt_vid_url = self.new_recipe.get_yt_url()
        s = """<iframe width="300" height="300" src="https://www.youtube.com/embed/{}?rel=0&amp;showinfo=0" frameborder="0" allowfullscreen></iframe>""".format(
            yt_vid_url[len(yt_vid_url) - 11:])
        base_url = "local"
        self.yt_viewer.setHtml(s, QUrl(base_url))

        # Set recipe thumbnail
        self.recipe_image.load(QtCore.QUrl(self.new_recipe.get_thumbnail()))
        #self.recipe_image.setPixmap(QtGui.QPixmap(self.new_recipe.get_thumbnail()))

        self.recipe_image.adjustSize()
        self.recipe_name_label.adjustSize()
        self.category_label.adjustSize()
        self.instructions_label.adjustSize()
        self.yt_viewer.adjustSize()

        ingredients = ""
        ingredients_list = self.new_recipe.get_ingredients_list()
        measures_list = self.new_recipe.get_measures_list()
        for i in range(len(ingredients_list)):
            ingredients += measures_list[i] + " " + ingredients_list[i] + "\n"

        self.ingredients_label.setText(ingredients)
Beispiel #7
0
class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(800, 600)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.random_recipe_button = QtWidgets.QPushButton(self.centralwidget)
        self.random_recipe_button.setGeometry(QtCore.QRect(290, 10, 181, 51))
        self.random_recipe_button.setObjectName("random_recipe_button")
        self.left_group_box = QtWidgets.QGroupBox(self.centralwidget)
        self.left_group_box.setGeometry(QtCore.QRect(10, 70, 311, 491))
        self.left_group_box.setObjectName("left_group_box")
        self.recipe_image = QtWidgets.QLabel(self.left_group_box)
        self.recipe_image.setGeometry(QtCore.QRect(20, 30, 261, 181))
        self.recipe_image.setText("")
        self.recipe_image.setObjectName("recipe_image")
        self.recipe_name_label = QtWidgets.QLabel(self.left_group_box)
        self.recipe_name_label.setGeometry(QtCore.QRect(20, 250, 47, 13))
        self.recipe_name_label.setText("")
        self.recipe_name_label.setObjectName("recipe_name_label")
        self.category_label = QtWidgets.QLabel(self.left_group_box)
        self.category_label.setGeometry(QtCore.QRect(20, 260, 161, 41))
        self.category_label.setText("")
        self.category_label.setObjectName("category_label")
        self.instructions_label = QtWidgets.QLabel(self.centralwidget)
        self.instructions_label.setGeometry(QtCore.QRect(390, 80, 381, 481))
        self.instructions_label.setText("")
        self.instructions_label.setObjectName("instructions_label")
        self.instructions_label.setWordWrap(True)
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 21))
        self.menubar.setObjectName("menubar")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

        self.random_recipe_button.clicked.connect(self.getRecipe)
        self.new_recipe = Recipe()

    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
        self.random_recipe_button.setText(
            _translate("MainWindow", "Get New Random Recipe!"))
        self.left_group_box.setTitle(_translate("MainWindow", "GroupBox"))

    def getRecipe(self):
        self.new_recipe.getNewRecipe()

        # Set name of recipe
        self.recipe_name_label.setText(self.new_recipe.get_name())

        self.category_label.setText(self.new_recipe.get_category())
        self.instructions_label.setText(self.new_recipe.get_instructions())

        # Set recipe thumbnail
        self.recipe_image.setPixmap(
            QtGui.QPixmap(self.new_recipe.get_thumbnail()))

        self.recipe_name_label.adjustSize()
        self.category_label.adjustSize()
        self.instructions_label.adjustSize()
Beispiel #8
0
class Window(QMainWindow):

    #    got_recipe = QtCore.pyqtSignal(list)
    global_path = None

    def __init__(self, parent=None):
        super(Window, self).__init__(parent)

        self.recipe = '000.epi'
        self.recipe_class = Recipe(self.recipe)
        self.file_path = os.path.join(os.getcwd(), 'recipes', self.recipe)
        self.text_editor = RecipeEditor()
        self.text_editor.got_text.connect(self.editor_input)
        self.constants = ConstantsEditor()
        self.constants.got_values.connect(self.change_constants)

        self.left = 20
        self.top = 20
        self.width = 500
        self.height = 500

        self.title = 'MOVPE Recipe'
        self.initUI()

    def initUI(self):
        self.setWindowTitle(self.title)
        self.setGeometry(self.left, self.top, self.width, self.height)

        self.file_notify = QLabel('Select a recipe', self)

        self.recipe_button = QPushButton('Recipe folder')
        self.recipe_button.clicked.connect(self.get_input)

        self.b_reactor = QPushButton('Reactor gases')
        self.b_reactor.clicked.connect(self.plot_reactor)

        self.b_reactor_pro = QPushButton('Reactor properties')
        self.b_reactor_pro.clicked.connect(self.plot_reactor_properties)

        self.b_sc_layers = QPushButton('Semiconductor layers')
        self.b_sc_layers.clicked.connect(self.plot_semiconductor)

        self.b_gas = QPushButton('Gases')
        self.b_gas.clicked.connect(self.plot_gases)

        self.b_valves = QPushButton('Valves')
        self.b_valves.clicked.connect(self.plot_valves)

        #        self.text_recipe = QTextEdit(self)

        self.b_any = QPushButton('Plot all highlighted items')
        self.b_any.clicked.connect(self.plot_any)

        self.qlistwidget_reactor_gas = QListWidget()
        self.qlistwidget_reactor_gas.setSelectionMode(
            QAbstractItemView.MultiSelection)
        self.qlistwidget_reactor_gas.itemSelectionChanged.connect(
            self.select_reactor_gas)

        self.qlistwidget_sc_gas = QListWidget()
        self.qlistwidget_sc_gas.setSelectionMode(
            QAbstractItemView.MultiSelection)
        self.qlistwidget_sc_gas.itemSelectionChanged.connect(
            self.select_sc_gas)

        self.qlistwidget_gas = QListWidget()
        self.qlistwidget_gas.setSelectionMode(QAbstractItemView.MultiSelection)
        self.qlistwidget_gas.itemSelectionChanged.connect(self.select_gas)

        self.qlistwidget_valve = QListWidget()
        self.qlistwidget_valve.setSelectionMode(
            QAbstractItemView.MultiSelection)
        self.qlistwidget_valve.itemSelectionChanged.connect(self.select_valve)

        self.qlistwidget_reactor_prop = QListWidget()
        self.qlistwidget_reactor_prop.setSelectionMode(
            QAbstractItemView.MultiSelection)
        self.qlistwidget_reactor_prop.itemSelectionChanged.connect(
            self.select_reactor_prop)

        self.qlistwidgets = [
            self.qlistwidget_reactor_gas, self.qlistwidget_sc_gas,
            self.qlistwidget_gas, self.qlistwidget_valve,
            self.qlistwidget_reactor_prop
        ]
        #        self.functions = [self.select_reactor_gas,self.select_sc_gas,
        #                          self.select_gas,self.select_valve,
        #                          self.select_reactor_prop]

        mainMenu = self.menuBar()
        excel = mainMenu.addMenu('Excel')
        excel_a = excel.addAction('Reactor gases')
        excel_a.triggered.connect(self.excel_reactor)
        excel_b = excel.addAction('Semiconductor layers')
        excel_b.triggered.connect(self.excel_semiconductor)
        excel_c = excel.addAction('All gases')
        excel_c.triggered.connect(self.excel_gases)
        excel_d = excel.addAction('All valves')
        excel_d.triggered.connect(self.excel_valves)
        excel_e = excel.addAction('Reactor properties')
        excel_e.triggered.connect(self.excel_reactor_properties)
        excel_f = excel.addAction('Highlighted gases')
        excel_f.triggered.connect(self.excel_any)

        tools = mainMenu.addMenu('Tools')
        semiconductor_a = tools.addAction('Draw semiconductor')
        semiconductor_a.triggered.connect(self.draw_semiconductor)
        semiconductor_b = tools.addAction('Draw semiconductor 2')
        semiconductor_b.triggered.connect(self.draw_semiconductor_2)
        editor = tools.addAction('Recipe Editor')
        editor.triggered.connect(self.open_editor)
        constants = tools.addAction('Gas constants')
        constants.triggered.connect(self.open_constants)

        #        for listwidget in self.qlistwidgets:
        #            listwidget.setMinimumWidth(listwidget.sizeHintForColumn(0))

        # set the layout
        wid = QWidget(self)
        self.setCentralWidget(wid)
        layout = QGridLayout()
        wid.setLayout(layout)

        layout.addWidget(self.recipe_button, 0, 0, 1, 5)
        layout.addWidget(self.file_notify, 1, 1)

        layout.addWidget(self.b_reactor, 2, 0)
        layout.addWidget(self.qlistwidget_reactor_gas, 3, 0)

        layout.addWidget(self.b_sc_layers, 2, 1)
        layout.addWidget(self.qlistwidget_sc_gas, 3, 1)

        layout.addWidget(self.b_gas, 2, 2)
        layout.addWidget(self.qlistwidget_gas, 3, 2)

        layout.addWidget(self.b_valves, 2, 3)
        layout.addWidget(self.qlistwidget_valve, 3, 3)

        layout.addWidget(self.b_reactor_pro, 2, 4)
        layout.addWidget(self.qlistwidget_reactor_prop, 3, 4)

        layout.addWidget(self.b_any, 5, 0, 6, 5)


#        layout.addWidget(self.text_recipe,11,0,12,5)

#        dialog = TextEditor(self)
#        dialog.show()

    def get_input(self):
        # Clear all variables
        #        self.text_recipe.clear()

        for qlistwidget in self.qlistwidgets:
            qlistwidget.clear()

        # Open the input recipe
        options = QFileDialog.Options()
        options |= QFileDialog.DontUseNativeDialog
        file_line, _ = QFileDialog.getOpenFileName(self,
                                                   'Open file',
                                                   os.path.join(
                                                       os.getcwd(), 'recipes'),
                                                   '(*.epi)',
                                                   options=options)

        self.file_path = os.path.abspath(file_line)

        # Write the recipe to the app text editor
        self.recipe = os.path.basename(self.file_path)

        #        with open(self.file_path,'r') as fo:
        #            text = fo.read()
        Window.global_path = self.file_path
        #            self.got_recipe.emit(text)
        #            TextEditor.text_recipe.setText(text)

        self.recipe_class = Recipe(self.recipe, self.file_path)

        #        print(self.recipe,file_path)
        self.file_notify.setText('Current recipe: {}'.format(self.recipe))

        recipe_dics = [
            self.recipe_class.reactor_gases,
            self.recipe_class.semiconductor_layers, self.recipe_class.gas_dic,
            self.recipe_class.valve_dic,
            self.recipe_class.reactor_variables_dic
        ]

        for dic, dic_list in zip(recipe_dics, self.qlistwidgets):
            for n in dic.keys():
                item = QListWidgetItem(str(n))
                if n in dic.keys():
                    dic_list.addItem(item)
                else:
                    pass
                item.setSelected(False)

    def open_editor(self):
        #        dialog = TextEditor()
        self.text_editor.show()

    def open_constants(self):
        self.constants.show()

    def editor_input(self, text):

        with open('editor_recipe.epi', 'w+') as f:
            f.write(text)

        f_path = os.path.join(os.getcwd(), 'editor_recipe.epi')
        #        print(self.recipe,f_path)

        self.recipe_class = Recipe(self.recipe, f_path)

        self.file_notify.setText('Current recipe: {} (modified)'.format(
            self.recipe))

        # Add corresponding items to each qlistwidgets
        for qlistwidget in self.qlistwidgets:
            qlistwidget.clear()

        recipe_dics = [
            self.recipe_class.reactor_gases,
            self.recipe_class.semiconductor_layers, self.recipe_class.gas_dic,
            self.recipe_class.valve_dic,
            self.recipe_class.reactor_variables_dic
        ]

        for dic, dic_list in zip(recipe_dics, self.qlistwidgets):
            for n in dic.keys():
                item = QListWidgetItem(str(n))
                if n in dic.keys():
                    dic_list.addItem(item)
                else:
                    pass
                item.setSelected(False)

        os.remove(os.path.abspath(f_path))

    def select_sc_gas(self):
        selected_items = self.qlistwidget_sc_gas.selectedItems()
        selected_gases_dict = {
            item.text(): self.recipe_class.semiconductor_layers[item.text()]
            for item in selected_items
        }
        return selected_gases_dict

    def select_reactor_gas(self):
        selected_items = self.qlistwidget_reactor_gas.selectedItems()
        selected_gases_dict = {
            item.text(): self.recipe_class.reactor_gases[item.text()]
            for item in selected_items
        }
        return selected_gases_dict

    def select_gas(self):
        selected_items = self.qlistwidget_gas.selectedItems()
        selected_gases_dict = {
            item.text(): self.recipe_class.gas_dic[item.text()]
            for item in selected_items
        }
        return selected_gases_dict

    def select_valve(self):
        selected_items = self.qlistwidget_valve.selectedItems()
        selected_gases_dict = {
            item.text(): self.recipe_class.valve_dic[item.text()]
            for item in selected_items
        }
        return selected_gases_dict

    def select_reactor_prop(self):
        selected_items = self.qlistwidget_reactor_prop.selectedItems()
        selected_gases_dict = {
            item.text(): self.recipe_class.reactor_variables_dic[item.text()]
            for item in selected_items
        }
        return selected_gases_dict

    def plot_reactor(self):
        return self.recipe_class.plot_dict(self.select_reactor_gas(),
                                           'Reactor gases: ')

    def plot_semiconductor(self):
        return self.recipe_class.plot_dict(self.select_sc_gas(),
                                           'Semiconductor layers: ')

    def plot_reactor_properties(self):
        return self.recipe_class.plot_dict(self.select_reactor_prop(),
                                           'Reactor properties: ')

    def plot_gases(self):
        return self.recipe_class.plot_dict(self.select_gas(), 'Gas flows: ')

    def plot_valves(self):
        return self.recipe_class.plot_dict(self.select_valve(),
                                           'Lines and Runs: ')

    def plot_any(self):
        #        r_dict = self.select_reactor_gas()
        r_dict = {
            "{}_r".format(key): value
            for (key, value) in self.select_reactor_gas().items()
        }
        s_dict = {
            "{}_s".format(key): value
            for (key, value) in self.select_sc_gas().items()
        }
        my_dict = {
            **self.select_gas(),
            **self.select_valve(),
            **r_dict,
            **s_dict,
            **self.select_reactor_prop()
        }
        return self.recipe_class.plot_dict(my_dict, 'Selected flows: ')

    def excel_reactor(self):
        return self.recipe_class.write_excel(self.recipe_class.reactor_gases(),
                                             'reactor_gases')

    def excel_semiconductor(self):
        return self.recipe_class.write_excel(
            self.recipe_class.semiconductor_layers(), 'semiconductor_layers')

    def excel_gases(self):
        return self.recipe_class.write_excel(self.recipe_class.gas_dic(),
                                             'gas_flows')

    def excel_valves(self):
        return self.recipe_class.write_excel(self.recipe_class.valve_dic(),
                                             'lines_runs')

    def excel_reactor_properties(self):
        return self.recipe_class.write_excel(
            self.recipe_class.reactor_variables_dic(), 'reactor_properties')

    def excel_any(self):
        r_dict = {
            "{}_r".format(key): value
            for (key, value) in self.select_reactor_gas().items()
        }
        s_dict = {
            "{}_s".format(key): value
            for (key, value) in self.select_sc_gas().items()
        }
        my_dict = {
            **self.select_gas(),
            **self.select_valve(),
            **r_dict,
            **s_dict,
            **self.select_reactor_prop()
        }
        return self.recipe_class.write_excel(my_dict, 'selected_flows')

    def draw_semiconductor(self):
        return self.recipe_class.draw_semiconductor(real_semiconductor=True)

    def draw_semiconductor_2(self):
        return self.recipe_class.draw_semiconductor(real_semiconductor=False)

    def change_constants(self, values):
        self.recipe_class.TMGa_constant = values[0]  #self.constants.TMGa
        self.recipe_class.TEGa_constant = values[1]  #self.constants.TEGa
        self.recipe_class.TMAl_constant = values[2]  #self.constants.TMAl
        self.recipe_class.TMIn_constant = values[3]  #self.constants.TMIn