# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'QtDesigner/main.ui'
#
# Created by: PyQt5 UI code generator 5.12.3
#
# WARNING! All changes made in this file will be lost!


from PyQt5 import QtCore, QtWidgets, QtGui
from multiprocessing import cpu_count
from pathlib import Path

import r2g_gui


def font_(font_size=12, font_file="Ubuntu", italic=False, bold=False):
    """e.g. MainWindow.setFont(font_(10))"""
    font_id = QtGui.QFontDatabase.addApplicationFont(
        "{}/fonts/{}.ttf".format(r2g_gui.__path__[0], font_file)
    )
    font_name = QtGui.QFontDatabase.applicationFontFamilies(font_id)[0]
    font = QtGui.QFont(font_name, font_size)
    if italic:
        font.setItalic(True)
    if bold:
        font.setBold(True)
    return font


class MyQLineEdit(QtWidgets.QLineEdit):
    # clicked = QtCore.pyqtSignal(str)
    FocusInSignal = QtCore.pyqtSignal(str)
    FocusOutSignal = QtCore.pyqtSignal(str)

    def __init__(self, parent, default_value=""):
        super(MyQLineEdit, self).__init__(parent)
        self.default = default_value

    def focusInEvent(self, event):
        self.FocusInSignal.emit(self.default)

    def focusOutEvent(self, event):
        self.FocusOutSignal.emit(self.default)

    # def mousePressEvent(self, event):
    #     self.clicked.emit(self.default)


class MyQPlainTextEdit(QtWidgets.QPlainTextEdit):
    FocusInSignal = QtCore.pyqtSignal(str)
    FocusOutSignal = QtCore.pyqtSignal(str)

    def __init__(self, parent, default_value=""):
        super(MyQPlainTextEdit, self).__init__(parent)
        self.default = default_value

    def focusInEvent(self, event):
        self.FocusInSignal.emit(self.default)

    def focusOutEvent(self, event):
        self.FocusOutSignal.emit(self.default)

    def text(self):
        return self.toPlainText()

    def setText(self, value):
        self.setPlainText(value)


class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.setEnabled(True)
        MainWindow.resize(1060, 760)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(MainWindow.sizePolicy().hasHeightForWidth())
        MainWindow.setSizePolicy(sizePolicy)
        MainWindow.setMinimumSize(QtCore.QSize(1060, 760))
        MainWindow.setMaximumSize(QtCore.QSize(1060, 760))
        MainWindow.setFont(font_(10))
        logo = QtGui.QIcon()
        logo.addPixmap(
            QtGui.QPixmap("{}/images/logo.png".format(r2g_gui.__path__[0])), QtGui.QIcon.Normal, QtGui.QIcon.Off
        )
        MainWindow.setWindowIcon(logo)
        MainWindow.setStyleSheet("")
        MainWindow.setDocumentMode(False)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.aligning_box = QtWidgets.QGroupBox(self.centralwidget)
        self.aligning_box.setEnabled(True)
        self.aligning_box.setGeometry(QtCore.QRect(20, 10, 471, 391))
        font = QtGui.QFont()
        font.setPointSize(12)
        self.aligning_box.setFont(font)
        self.aligning_box.setObjectName("aligning_box")
        self.line_4 = QtWidgets.QFrame(self.aligning_box)
        self.line_4.setGeometry(QtCore.QRect(20, 690, 431, 16))
        self.line_4.setFrameShape(QtWidgets.QFrame.HLine)
        self.line_4.setFrameShadow(QtWidgets.QFrame.Sunken)
        self.line_4.setObjectName("line_4")
        font = QtGui.QFont()
        font.setPointSize(10)
        self.query_file = MyQLineEdit(self.aligning_box)
        self.query_file.setGeometry(QtCore.QRect(20, 190, 341, 23))
        self.query_file.setObjectName("query_file")
        self.query_file.setFont(font)
        self.sra = QtWidgets.QLineEdit(self.aligning_box)
        self.sra.setGeometry(QtCore.QRect(20, 270, 431, 23))
        self.sra.setFont(font_(10))
        self.sra.setObjectName("sra")
        self.query = MyQPlainTextEdit(self.aligning_box, ">Gene_1\nATGCATGC")
        self.query.setGeometry(QtCore.QRect(20, 70, 431, 81))
        self.query.setFont(font_(10, "UbuntuMono"))
        self.query.viewport().setProperty("cursor", QtGui.QCursor(QtCore.Qt.IBeamCursor))
        self.query.setMouseTracking(True)
        self.query.setFocusPolicy(QtCore.Qt.ClickFocus)
        self.query.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
        self.query.setTabChangesFocus(True)
        self.query.setOverwriteMode(False)
        self.query.setObjectName("query")
        self.program = QtWidgets.QComboBox(self.aligning_box)
        self.program.setGeometry(QtCore.QRect(20, 350, 431, 31))
        self.program.setFont(font_(10))
        self.program.setObjectName("program")
        self.program.addItem("")
        self.program.addItem("")
        self.program.addItem("")
        self.program.addItem("")
        self.program.addItem("")
        self.line_1 = QtWidgets.QFrame(self.aligning_box)
        self.line_1.setGeometry(QtCore.QRect(20, 300, 431, 16))
        self.line_1.setFrameShape(QtWidgets.QFrame.HLine)
        self.line_1.setFrameShadow(QtWidgets.QFrame.Sunken)
        self.line_1.setObjectName("line_1")
        self.lbl_sra = QtWidgets.QLabel(self.aligning_box)
        self.lbl_sra.setGeometry(QtCore.QRect(20, 240, 431, 21))
        self.lbl_sra.setFont(font_(12))
        self.lbl_sra.setObjectName("lbl_sra")
        self.line_0 = QtWidgets.QFrame(self.aligning_box)
        self.line_0.setGeometry(QtCore.QRect(20, 220, 431, 16))
        self.line_0.setFrameShape(QtWidgets.QFrame.HLine)
        self.line_0.setFrameShadow(QtWidgets.QFrame.Sunken)
        self.line_0.setObjectName("line_0")
        self.lbl_program = QtWidgets.QLabel(self.aligning_box)
        self.lbl_program.setGeometry(QtCore.QRect(20, 320, 431, 21))
        self.lbl_program.setFont(font_(12))
        self.lbl_program.setObjectName("lbl_program")
        self.lbl_queryfile = QtWidgets.QLabel(self.aligning_box)
        self.lbl_queryfile.setGeometry(QtCore.QRect(20, 160, 301, 21))
        self.lbl_queryfile.setFont(font_(12))
        self.lbl_queryfile.setObjectName("lbl_queryfile")
        self.browser_file_button = QtWidgets.QToolButton(self.aligning_box)
        self.browser_file_button.setGeometry(QtCore.QRect(377, 190, 71, 21))
        self.browser_file_button.setFont(font_(10))
        self.browser_file_button.setObjectName("browser_file_button")
        self.lbl_query = QtWidgets.QLabel(self.aligning_box)
        self.lbl_query.setGeometry(QtCore.QRect(20, 40, 301, 21))
        self.lbl_query.setFont(font_(12))
        self.lbl_query.setObjectName("lbl_query")
        self.lbl_query_len = QtWidgets.QLabel(self.aligning_box)
        self.lbl_query_len.setGeometry(QtCore.QRect(248, 40, 201, 21))
        self.lbl_query_len.setText("")
        self.lbl_query_len.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
        self.lbl_query_len.setObjectName("lbl_query_len")
        self.submit = QtWidgets.QPushButton(self.centralwidget)
        self.submit.setGeometry(QtCore.QRect(950, 670, 91, 31))
        start_icon = QtGui.QIcon()
        start_icon.addPixmap(
            QtGui.QPixmap("{}/images/start.png".format(r2g_gui.__path__[0])), QtGui.QIcon.Normal, QtGui.QIcon.Off
        )
        self.submit.setFont(font_(14, "Ubuntu", italic=True))
        self.submit.setAccessibleName("")
        self.submit.setStyleSheet("")
        self.submit.setIcon(start_icon)
        self.submit.setDefault(False)
        self.submit.setFlat(False)
        self.submit.setObjectName("submit")
        self.assembling_box = QtWidgets.QGroupBox(self.centralwidget)
        self.assembling_box.setGeometry(QtCore.QRect(20, 410, 471, 291))
        self.assembling_box.setFont(font_())
        self.assembling_box.setObjectName("assembling_box")
        self.cut = MyQLineEdit(self.assembling_box, "80,20")
        self.cut.setGeometry(QtCore.QRect(230, 30, 221, 23))
        self.cut.setFont(font_(10))
        self.cut.setInputMask("")
        self.cut.setMaxLength(5)
        self.cut.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
        self.cut.setObjectName("cut")
        self.min_contig = MyQLineEdit(self.assembling_box, "200")
        self.min_contig.setGeometry(QtCore.QRect(230, 160, 221, 23))
        self.min_contig.setFont(font_(10))
        self.min_contig.setInputMask("")
        self.min_contig.setMaxLength(5)
        self.min_contig.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
        self.min_contig.setObjectName("min_contig")
        self.lbl_gb = QtWidgets.QLabel(self.assembling_box)
        self.lbl_gb.setGeometry(QtCore.QRect(400, 260, 41, 31))
        self.lbl_gb.setFont(font_(10))
        self.lbl_gb.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
        self.lbl_gb.setObjectName("lbl_gb")
        self.stage = QtWidgets.QComboBox(self.assembling_box)
        self.stage.setGeometry(QtCore.QRect(230, 220, 221, 23))
        self.stage.setFont(font_(10))
        self.stage.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
        self.stage.setObjectName("stage")
        self.stage.addItem("")
        self.stage.addItem("")
        self.stage.addItem("")
        self.stage.addItem("")
        self.stage.addItem("")
        self.trim_para = QtWidgets.QLineEdit(self.assembling_box)
        self.trim_para.setGeometry(QtCore.QRect(230, 190, 221, 23))
        self.trim_para.setFont(font_(10))
        self.trim_para.setInputMask("")
        self.trim_para.setText("")
        self.trim_para.setMaxLength(5)
        self.trim_para.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter)
        self.trim_para.setObjectName("trim_para")
        self.lbl_maxtarget = QtWidgets.QLabel(self.assembling_box)
        self.lbl_maxtarget.setGeometry(QtCore.QRect(-10, 60, 201, 21))
        self.lbl_maxtarget.setFont(font_(12))
        self.lbl_maxtarget.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
        self.lbl_maxtarget.setObjectName("lbl_maxtarget")
        self.evalue = MyQLineEdit(self.assembling_box, "1e-3")
        self.evalue.setGeometry(QtCore.QRect(230, 90, 221, 23))
        self.evalue.setFont(font_(10))
        self.evalue.setAutoFillBackground(False)
        self.evalue.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
        self.evalue.setObjectName("evalue")
        self.lbl_stage = QtWidgets.QLabel(self.assembling_box)
        self.lbl_stage.setGeometry(QtCore.QRect(130, 220, 61, 21))
        self.lbl_stage.setFont(font_(12))
        self.lbl_stage.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
        self.lbl_stage.setObjectName("lbl_stage")
        self.lbl_trimpara = QtWidgets.QLabel(self.assembling_box)
        self.lbl_trimpara.setGeometry(QtCore.QRect(40, 190, 151, 21))
        self.lbl_trimpara.setFont(font_(12))
        self.lbl_trimpara.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
        self.lbl_trimpara.setObjectName("lbl_trimpara")
        self.filter = QtWidgets.QCheckBox(self.assembling_box)
        self.filter.setEnabled(True)
        self.filter.setGeometry(QtCore.QRect(260, 120, 191, 21))
        self.filter.setFont(font_())
        self.filter.setChecked(True)
        self.filter.setObjectName("filter")
        self.cpu = MyQLineEdit(self.assembling_box, str(cpu_count()))
        self.cpu.setGeometry(QtCore.QRect(90, 260, 71, 23))
        self.cpu.setFont(font_(10))
        self.cpu.setFocusPolicy(QtCore.Qt.ClickFocus)
        # self.cpu.setInputMask("99999")
        self.cpu.setText(str(cpu_count()))
        self.cpu.setMaxLength(5)
        self.cpu.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
        self.cpu.setObjectName("cpu")
        self.line_3 = QtWidgets.QFrame(self.assembling_box)
        self.line_3.setGeometry(QtCore.QRect(20, 140, 431, 16))
        self.line_3.setFrameShape(QtWidgets.QFrame.HLine)
        self.line_3.setFrameShadow(QtWidgets.QFrame.Sunken)
        self.line_3.setObjectName("line_3")
        self.max_memory = MyQLineEdit(self.assembling_box, "4")
        self.max_memory.setGeometry(QtCore.QRect(350, 260, 71, 23))
        self.max_memory.setFont(font_(10))
        self.max_memory.setFocusPolicy(QtCore.Qt.StrongFocus)
        # self.max_memory.setInputMask("99999")
        self.max_memory.setText("4")
        self.max_memory.setMaxLength(5)
        self.max_memory.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
        self.max_memory.setObjectName("max_memory")
        self.trim = QtWidgets.QCheckBox(self.assembling_box)
        self.trim.setGeometry(QtCore.QRect(30, 190, 16, 21))
        self.trim.setFont(font_(12))
        self.trim.setText("")
        self.trim.setChecked(True)
        self.trim.setObjectName("trim")
        self.lbl_evalue = QtWidgets.QLabel(self.assembling_box)
        self.lbl_evalue.setGeometry(QtCore.QRect(30, 90, 161, 21))
        self.lbl_evalue.setFont(font_(12))
        self.lbl_evalue.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
        self.lbl_evalue.setObjectName("lbl_evalue")
        self.lbl_cut = QtWidgets.QLabel(self.assembling_box)
        self.lbl_cut.setGeometry(QtCore.QRect(20, 30, 171, 21))
        self.lbl_cut.setFont(font_(12))
        self.lbl_cut.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
        self.lbl_cut.setObjectName("lbl_cut")
        self.lbl_cpu = QtWidgets.QLabel(self.assembling_box)
        self.lbl_cpu.setGeometry(QtCore.QRect(20, 260, 51, 21))
        self.lbl_cpu.setFont(font_(12))
        self.lbl_cpu.setLayoutDirection(QtCore.Qt.LeftToRight)
        self.lbl_cpu.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
        self.lbl_cpu.setObjectName("lbl_cpu")
        self.lbl_mem = QtWidgets.QLabel(self.assembling_box)
        self.lbl_mem.setGeometry(QtCore.QRect(210, 260, 121, 21))
        self.lbl_mem.setFont(font_(12))
        self.lbl_mem.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
        self.lbl_mem.setObjectName("lbl_mem")
        self.max_num_seq = MyQLineEdit(self.assembling_box, "500")
        self.max_num_seq.setGeometry(QtCore.QRect(230, 60, 221, 23))
        self.max_num_seq.setFont(font_(10))
        self.max_num_seq.setInputMask("")
        self.max_num_seq.setMaxLength(5)
        self.max_num_seq.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
        self.max_num_seq.setObjectName("max_num_seq")
        self.lbl_filter = QtWidgets.QLabel(self.assembling_box)
        self.lbl_filter.setGeometry(QtCore.QRect(140, 120, 51, 21))
        self.lbl_filter.setFont(font_(12))
        self.lbl_filter.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
        self.lbl_filter.setObjectName("lbl_filter")
        self.lbl_mincontig = QtWidgets.QLabel(self.assembling_box)
        self.lbl_mincontig.setGeometry(QtCore.QRect(-10, 160, 201, 21))
        self.lbl_mincontig.setFont(font_(12))
        self.lbl_mincontig.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
        self.lbl_mincontig.setObjectName("lbl_mincontig")
        self.output_box = QtWidgets.QGroupBox(self.centralwidget)
        self.output_box.setEnabled(False)
        self.output_box.setGeometry(QtCore.QRect(520, 190, 521, 461))
        self.output_box.setFont(font_())
        self.output_box.setObjectName("output_box")
        self.output_log = QtWidgets.QTextBrowser(self.output_box)
        self.output_log.setEnabled(False)
        self.output_log.setGeometry(QtCore.QRect(20, 40, 481, 401))
        self.output_log.setFont(font_(10, "UbuntuMono"))
        self.output_log.viewport().setProperty("cursor", QtGui.QCursor(QtCore.Qt.IBeamCursor))
        self.output_log.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
        self.output_log.setOpenExternalLinks(True)
        self.output_log.setObjectName("output_log")
        self.reset = QtWidgets.QPushButton(self.centralwidget)
        self.reset.setGeometry(QtCore.QRect(520, 670, 71, 23))
        self.reset.setFont(font_(10))
        self.reset.setObjectName("reset")
        self.reset.setEnabled(False)
        self.undo = QtWidgets.QPushButton(self.centralwidget)
        self.undo.setGeometry(QtCore.QRect(600, 670, 71, 23))
        self.undo.setFont(font_(10))
        self.undo.setObjectName("undo")
        self.undo.setHidden(True)
        MainWindow.setCentralWidget(self.centralwidget)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 1060, 20))
        self.menubar.setObjectName("menubar")
        self.menuFile = QtWidgets.QMenu(self.menubar)
        self.menuFile.setObjectName("menuFile")
        self.menuHelp = QtWidgets.QMenu(self.menubar)
        self.menuHelp.setObjectName("menuHelp")
        MainWindow.setMenuBar(self.menubar)
        self.actionExport_parameters = QtWidgets.QAction(MainWindow)
        # self.actionExport_parameters.setEnabled(False)
        self.actionExport_parameters.setFont(font_())
        self.actionExport_parameters.setObjectName("actionExport_parameters")
        self.actionImport_parameters = QtWidgets.QAction(MainWindow)
        self.actionImport_parameters.setFont(font_())
        self.actionImport_parameters.setObjectName("actionImport_parameters")
        self.actionExit = QtWidgets.QAction(MainWindow)
        self.actionExit.setFont(font_())
        self.actionExit.setObjectName("actionExit")
        self.actionAbout = QtWidgets.QAction(MainWindow)
        self.actionAbout.setFont(font_())
        self.actionAbout.setObjectName("actionAbout")
        self.actionAbout_r2g = QtWidgets.QAction(MainWindow)
        self.actionAbout_r2g.setFont(font_())
        self.actionAbout_r2g.setObjectName("actionAbout_r2g")
        self.actionRestore_to_defaults = QtWidgets.QAction(MainWindow)
        self.actionRestore_to_defaults.setFont(font_())
        self.actionRestore_to_defaults.setObjectName("actionRestore_to_defaults")
        self.actionRestore_to_defaults.setEnabled(False)
        self.actionUndo = QtWidgets.QAction(MainWindow)
        self.actionUndo.setEnabled(False)
        self.actionUndo.setFont(font_())
        self.actionUndo.setObjectName("actionUndo")
        self.actionUpdate_the_r2g_engine = QtWidgets.QAction(MainWindow)
        self.actionUpdate_the_r2g_engine.setFont(font_())
        self.actionUpdate_the_r2g_engine.setObjectName("actionUpdate_the_r2g_engine")
        self.menuFile.addAction(self.actionExport_parameters)
        self.menuFile.addAction(self.actionImport_parameters)
        self.menuFile.addSeparator()
        self.menuFile.addAction(self.actionRestore_to_defaults)
        self.menuFile.addAction(self.actionUndo)
        self.menuFile.addSeparator()
        self.menuFile.addAction(self.actionExit)
        self.menuHelp.addAction(self.actionAbout)
        self.menuHelp.addSeparator()
        self.menuHelp.addAction(self.actionAbout_r2g)
        self.menuHelp.addAction(self.actionUpdate_the_r2g_engine)
        self.menubar.addAction(self.menuFile.menuAction())
        self.menubar.addAction(self.menuHelp.menuAction())
        self.results_box = QtWidgets.QGroupBox(self.centralwidget)
        self.results_box.setGeometry(QtCore.QRect(520, 10, 521, 171))
        self.results_box.setFont(font_())
        self.results_box.setObjectName("results_box")
        self.browser_outputdir_button = QtWidgets.QToolButton(self.results_box)
        self.browser_outputdir_button.setGeometry(QtCore.QRect(430, 130, 71, 21))
        self.browser_outputdir_button.setFont(font_(10))
        self.browser_outputdir_button.setObjectName("browser_outputdir_button")
        self.outputdir = QtWidgets.QLineEdit(self.results_box)
        self.outputdir.setGeometry(QtCore.QRect(20, 130, 391, 23))
        self.outputdir.setFont(font_(10))
        self.outputdir.setObjectName("outputdir")
        self.lbl_outputdir = QtWidgets.QLabel(self.results_box)
        self.lbl_outputdir.setGeometry(QtCore.QRect(20, 100, 311, 21))
        self.lbl_outputdir.setFont(font_(12))
        self.lbl_outputdir.setObjectName("lbl_outputdir")
        self.results = QtWidgets.QLineEdit(self.results_box)
        self.results.setGeometry(QtCore.QRect(20, 60, 481, 23))
        self.results.setFont(font_(10))
        self.results.setObjectName("results")
        self.lbl_results = QtWidgets.QLabel(self.results_box)
        self.lbl_results.setGeometry(QtCore.QRect(20, 30, 311, 21))
        self.lbl_results.setFont(font_(12))
        self.lbl_results.setObjectName("lbl_results")
        self.lbl_mode = QtWidgets.QLabel()
        self.lbl_mode.setText("Docker engine: checking.")
        self.statusbar.addPermanentWidget(self.lbl_mode)

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

    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "Reads to Genes"))
        self.aligning_box.setTitle(_translate("MainWindow", "Aligning"))
        self.query.setPlainText(_translate("MainWindow", ">Gene_1\nATGCATGC"))
        self.program.setItemText(0, _translate("MainWindow", "blastn - megablast (highly similar sequences)"))
        self.program.setItemText(1, _translate("MainWindow", "blastn - discontiguous megablast (more dissimiliar sequences)"))
        self.program.setItemText(2, _translate("MainWindow", "blastn (nucleotide against nucleotide, return somewhat similar sequences)"))
        self.program.setItemText(3, _translate("MainWindow", "tblastn (protein against nucleotide)"))
        self.program.setItemText(4, _translate("MainWindow", "tblastx (translated nucleotide against translated nucleotide)"))
        self.lbl_sra.setText(_translate("MainWindow", "SRA Experiments (SRX) or SRA runs (SRR):"))
        self.lbl_program.setText(_translate("MainWindow", "Program:"))
        self.lbl_queryfile.setText(_translate("MainWindow", "Or, upload a file in FASTA format:"))
        self.browser_file_button.setText(_translate("MainWindow", "browse"))
        self.lbl_query.setText(_translate("MainWindow", "Enter FASTA sequence(s):"))
        self.submit.setText(_translate("MainWindow", "Start!"))
        self.assembling_box.setTitle(_translate("MainWindow", "Assembling"))
        self.cut.setText(_translate("MainWindow", "80,20"))
        self.min_contig.setText(_translate("MainWindow", "200"))
        self.lbl_gb.setText(_translate("MainWindow", "Gb"))
        self.stage.setItemText(0, _translate("MainWindow", "butterfly (the final step)"))
        self.stage.setItemText(1, _translate("MainWindow", "chrysalis"))
        self.stage.setItemText(2, _translate("MainWindow", "inchworm"))
        self.stage.setItemText(3, _translate("MainWindow", "jellyfish"))
        self.stage.setItemText(4, _translate("MainWindow", "no trinity"))
        self.lbl_maxtarget.setText(_translate("MainWindow", "Max target sequences:"))
        self.evalue.setText(_translate("MainWindow", "1e-3"))
        self.lbl_stage.setText(_translate("MainWindow", "Stage:"))
        self.lbl_trimpara.setText(_translate("MainWindow", "Trim parameters:"))
        self.filter.setText(_translate("MainWindow", "Low complexity regions"))
        self.lbl_evalue.setText(_translate("MainWindow", "Expect threshold:"))
        self.lbl_cut.setText(_translate("MainWindow", "Fragment, overlap:"))
        self.lbl_cpu.setText(_translate("MainWindow", "CPU:"))
        self.lbl_mem.setText(_translate("MainWindow", "Max memory:"))
        self.max_num_seq.setText(_translate("MainWindow", "500"))
        self.lbl_filter.setText(_translate("MainWindow", "Filter:"))
        self.lbl_mincontig.setText(_translate("MainWindow", "Min contig length (bp):"))
        self.output_box.setTitle(_translate("MainWindow", "Output logs"))
        self.reset.setText(_translate("MainWindow", "Reset"))
        self.undo.setText(_translate("MainWindow", "Undo"))
        self.menuFile.setTitle(_translate("MainWindow", "File"))
        self.menuHelp.setTitle(_translate("MainWindow", "Help"))
        self.actionExport_parameters.setText(_translate("MainWindow", "Export parameters..."))
        self.actionImport_parameters.setText(_translate("MainWindow", "Import parameters..."))
        self.actionExit.setText(_translate("MainWindow", "Exit"))
        self.actionAbout.setText(_translate("MainWindow", "R2g help"))
        self.actionAbout_r2g.setText(_translate("MainWindow", "About r2g"))
        self.actionRestore_to_defaults.setText(_translate("MainWindow", "Restore to defaults"))
        self.actionUndo.setText(_translate("MainWindow", "Undo"))
        self.actionUpdate_the_r2g_engine.setText(_translate("MainWindow", "Update the r2g engine"))
        self.results_box.setTitle(_translate("MainWindow", "Results"))
        self.browser_outputdir_button.setText(_translate("MainWindow", "browse"))
        self.lbl_outputdir.setText(_translate("MainWindow", "The directory where stores results:"))
        self.outputdir.setText(_translate("MainWindow", str(Path.home())))  # Python >= 3.5
        self.results.setText(_translate("MainWindow", "r2g_results"))
        self.lbl_results.setText(_translate("MainWindow", "The name of results:"))
        self.actionExport_parameters.setShortcut(_translate("MainWindow", "Ctrl+E"))
        self.actionImport_parameters.setShortcut(_translate("MainWindow", "Ctrl+I"))
        self.actionExit.setShortcut(_translate("MainWindow", "Ctrl+Q"))
