Esempio n. 1
0
    def __init__(self, label, value=0, first=True):
        super(SpinBox, self).__init__(label, first)
        self.spinBox = QtWidgets.QSpinBox()
        self.spinBox.setButtonSymbols(QtWidgets.QAbstractSpinBox.NoButtons)
        self.spinBox.setValue(value)
        self.spinBox.setMaximumSize(50, 20)
        self.spinBox.setRange(-99999, 99999)

        self.layout.addWidget(self.spinBox)
Esempio n. 2
0
    def __init__(self, label, value=0, first=True):
        super(SliderBox, self).__init__(label, first)

        self.spinBox = QtWidgets.QSpinBox()
        self.spinBox.setButtonSymbols(QtWidgets.QAbstractSpinBox.NoButtons)
        self.spinBox.setValue(value)

        self.slider = QtWidgets.QSlider()
        self.slider.setOrientation(QtCore.Qt.Horizontal)
        self.slider.setValue(value)

        self.slider.valueChanged.connect(self.spinBox.setValue)

        self.layout.addWidget(self.spinBox)
        self.layout.addWidget(self.slider)
Esempio n. 3
0
    def __init__(self, cpu_config=None, gpu_config=None, parent=None):
        super(_DeviceWidget, self).__init__(parent=parent)

        self.cpu_config = cpu_config
        self.gpu_config = gpu_config

        if gpu_config:
            self.device_name_label = QtWidgets.QLabel(self)
            self.device_name_label.setText('GPU "{}"'.format(gpu_config.gpu_info.name))

            self.main_layout = QtWidgets.QHBoxLayout(self)
            self.main_layout.addWidget(self.device_name_label)

            self.main_layout.addStretch()

            self.is_enabled_check_box = QtWidgets.QCheckBox(self)
            self.is_enabled_check_box.setChecked(gpu_config.is_enabled)
            self.is_enabled_check_box.stateChanged.connect(self.on_gpu_update)
            self.main_layout.addWidget(self.is_enabled_check_box)

        elif cpu_config:
            self.name_container_widget = QtWidgets.QWidget(self)
            self.name_container_layout = QtWidgets.QHBoxLayout(self.name_container_widget)
            self.name_container_layout.setContentsMargins(0, 0, 0, 0)

            self.name_label = QtWidgets.QLabel(self.name_container_widget)
            self.name_label.setText('CPU')
            self.name_container_layout.addWidget(self.name_label)

            self.name_container_layout.addStretch()

            is_cpu_enabled = cpu_config.num_active_threads > 0

            self.is_enabled_check_box = QtWidgets.QCheckBox(self.name_container_widget)
            self.is_enabled_check_box.setChecked(is_cpu_enabled)
            self.is_enabled_check_box.stateChanged.connect(self.on_cpu_enabled_update)
            self.name_container_layout.addWidget(self.is_enabled_check_box)

            self.num_threads_container_widget = QtWidgets.QWidget(self)
            self.num_threads_container_layout = QtWidgets.QHBoxLayout(self.num_threads_container_widget)
            self.num_threads_container_layout.setContentsMargins(0, 0, 0, 0)

            self.num_threads_label = QtWidgets.QLabel(self.num_threads_container_widget)
            self.num_threads_label.setText('Number of Threads')
            self.num_threads_container_layout.addWidget(self.num_threads_label)

            self.num_threads_container_layout.addStretch()

            self.num_threads_spin_box = QtWidgets.QSpinBox(self.num_threads_container_widget)
            self.num_threads_spin_box.setValue(cpu_config.num_active_threads)
            self.num_threads_spin_box.setRange(1, cpu_config.cpu_info.numThreads)
            self.num_threads_spin_box.valueChanged.connect(self.on_cpu_num_threads_update)
            if not is_cpu_enabled:
                self.num_threads_container_widget.hide()
            self.num_threads_container_layout.addWidget(self.num_threads_spin_box)

            self.main_layout = QtWidgets.QVBoxLayout(self)
            self.main_layout.addWidget(self.name_container_widget)
            self.main_layout.addWidget(self.num_threads_container_widget)

        self.main_layout.setContentsMargins(
            self.main_layout.contentsMargins().left() // 2,
            self.main_layout.contentsMargins().top() // 4,
            self.main_layout.contentsMargins().right() // 2,
            self.main_layout.contentsMargins().bottom() // 4)
Esempio n. 4
0
    def setupUi(self, SearcherSettings, width, height, animated):
        self.width = width
        self.height = height
        self.animated = animated

        SearcherSettings.setObjectName("SearcherSettings")
        SearcherSettings.setWindowModality(QtCore.Qt.NonModal)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred,
                                           QtWidgets.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            SearcherSettings.sizePolicy().hasHeightForWidth())
        SearcherSettings.setSizePolicy(sizePolicy)
        SearcherSettings.setMinimumSize(QtCore.QSize(width, height))
        SearcherSettings.setBaseSize(QtCore.QSize(0, 0))

        self.gridLayout = QtWidgets.QGridLayout(SearcherSettings)
        self.gridLayout.setContentsMargins(-1, -1, -1, -1)
        self.gridLayout.setObjectName("gridLayout")
        self.verticallayout = QtWidgets.QVBoxLayout()
        self.verticallayout.setObjectName("verticalLayout")
        self.verticallayout.setSpacing(10)

        # ------------------------------------------------- headerrow
        # NOTE headerrow --------------------------------------------
        self.headerrow = QtWidgets.QHBoxLayout()
        self.headerrow.setObjectName("headerrow")

        self.projectTitle = QtWidgets.QLabel(SearcherSettings)
        font = QtGui.QFont()
        font.setPointSize(15)
        self.projectTitle.setFont(font)
        self.projectTitle.setAlignment(QtCore.Qt.AlignCenter)
        self.projectTitle.setObjectName("projectTitle")
        self.headerrow.addWidget(self.projectTitle)

        spaceritem = QtWidgets.QSpacerItem(40, 20,
                                           QtWidgets.QSizePolicy.Expanding,
                                           QtWidgets.QSizePolicy.Minimum)
        self.headerrow.addItem(spaceritem)

        self.animatedsettings_chk = QtWidgets.QCheckBox(SearcherSettings)
        self.animatedsettings_chk.setLayoutDirection(QtCore.Qt.RightToLeft)
        self.animatedsettings_chk.setObjectName("animatedsettings_chk")
        self.headerrow.addWidget(self.animatedsettings_chk)

        self.windowsize_chk = QtWidgets.QCheckBox(SearcherSettings)
        self.windowsize_chk.setLayoutDirection(QtCore.Qt.RightToLeft)
        self.windowsize_chk.setObjectName("windowsize_chk")
        self.headerrow.addWidget(self.windowsize_chk)
        self.verticallayout.addLayout(self.headerrow)

        self.line = QtWidgets.QFrame(SearcherSettings)
        self.line.setFrameShape(QtWidgets.QFrame.HLine)
        self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
        self.line.setObjectName("line")
        self.verticallayout.addWidget(self.line)

        # ------------------------------------------------- secondrow
        # NOTE Second Row -------------------------------------------
        self.secondrow = QtWidgets.QHBoxLayout()
        self.secondrow.setObjectName("secondrow")

        # self.lang_cbox = QtWidgets.QComboBox(SearcherSettings)
        # self.lang_cbox.setObjectName("lang_cbox")
        # self.lang_cbox.addItem("")
        # self.secondrow.addWidget(self.lang_cbox)

        spaceritem = QtWidgets.QSpacerItem(40, 20,
                                           QtWidgets.QSizePolicy.Expanding,
                                           QtWidgets.QSizePolicy.Minimum)
        self.secondrow.addItem(spaceritem)

        self.maxresults_lbl = QtWidgets.QLabel(SearcherSettings)
        self.maxresults_lbl.setObjectName("maxresults_lbl")
        self.secondrow.addWidget(self.maxresults_lbl)
        self.maxresults_txt = QtWidgets.QSpinBox(SearcherSettings)
        self.maxresults_txt.setMinimum(1)
        self.maxresults_txt.setMaximum(9999)
        self.maxresults_txt.setObjectName("maxresults_txt")
        self.secondrow.addWidget(self.maxresults_txt)

        self.inmemory_chk = QtWidgets.QCheckBox(SearcherSettings)
        self.inmemory_chk.setLayoutDirection(QtCore.Qt.RightToLeft)
        self.inmemory_chk.setTristate(False)
        self.inmemory_chk.setObjectName("inmemory_chk")
        self.secondrow.addWidget(self.inmemory_chk)

        self.verticallayout.addLayout(self.secondrow)

        # -------------------------------------------------- thirdrow
        # NOTE Third Row --------------------------------------------
        self.thirdrow = QtWidgets.QHBoxLayout()
        self.thirdrow.setObjectName("thirdrow")

        self.defaulthotkey_lbl = QtWidgets.QLabel(SearcherSettings)
        self.defaulthotkey_lbl.setObjectName("defaulthotkey_lbl")
        self.thirdrow.addWidget(self.defaulthotkey_lbl)

        self.defaulthotkey_txt = QtWidgets.QLineEdit(SearcherSettings)
        self.defaulthotkey_txt.setToolTip("")
        self.defaulthotkey_txt.setReadOnly(True)
        self.defaulthotkey_txt.setObjectName("defaulthotkey_txt")
        self.thirdrow.addWidget(self.defaulthotkey_txt)

        self.hotkey_icon = QtWidgets.QToolButton(SearcherSettings)
        self.hotkey_icon.setPopupMode(QtWidgets.QToolButton.InstantPopup)
        self.hotkey_icon.setObjectName("hotkey_icon")
        self.thirdrow.addWidget(self.hotkey_icon)
        self.verticallayout.addLayout(self.thirdrow)

        # ------------------------------------------------- fourthrow
        # NOTE Fourth Row -------------------------------------------
        self.fourthrow = QtWidgets.QHBoxLayout()
        self.fourthrow.setObjectName("fourthrow")

        self.dbpath_lbl = QtWidgets.QLabel(SearcherSettings)
        self.dbpath_lbl.setObjectName("dbpath_lbl")
        self.fourthrow.addWidget(self.dbpath_lbl)

        self.databasepath_txt = QtWidgets.QLineEdit(SearcherSettings)
        self.databasepath_txt.setObjectName("databasepath_txt")
        self.fourthrow.addWidget(self.databasepath_txt)

        self.dbpath_icon = QtWidgets.QToolButton(SearcherSettings)
        self.dbpath_icon.setObjectName("dbpath_icon")
        self.fourthrow.addWidget(self.dbpath_icon)

        self.verticallayout.addLayout(self.fourthrow)

        # -------------------------------------------------- fifthrow
        # NOTE Fifth Row --------------------------------------------
        self.fifthrow = QtWidgets.QHBoxLayout()
        self.fifthrow.setObjectName("fifthrow")

        # self.maint_lbl = QtWidgets.QLabel(SearcherSettings)
        # self.maint_lbl.setObjectName("maint_lbl")
        # self.fifthrow.addWidget(self.maint_lbl)

        # self.metrics_chk = QtWidgets.QCheckBox(SearcherSettings)
        # self.metrics_chk.setLayoutDirection(QtCore.Qt.RightToLeft)
        # self.metrics_chk.setTristate(False)
        # self.metrics_chk.setObjectName("metrics_chk")
        # self.fifthrow.addWidget(self.metrics_chk)

        # self.cleardata_btn = QtWidgets.QPushButton(SearcherSettings)
        # self.cleardata_btn.setObjectName("cleardata_btn")
        # self.fifthrow.addWidget(self.cleardata_btn)

        # self.verticallayout.addLayout(self.fifthrow)

        # ---------------------------------------------------- Spacer
        self.line2 = QtWidgets.QFrame(SearcherSettings)
        self.line2.setFrameShape(QtWidgets.QFrame.HLine)
        self.line2.setFrameShadow(QtWidgets.QFrame.Sunken)
        self.line2.setObjectName("line2")
        self.verticallayout.addWidget(self.line2)
        # ---------------------------------------------------- Spacer

        # -------------------------------------------------- sixthrow
        # NOTE Sixth Row --------------------------------------------
        self.sixthrow = QtWidgets.QHBoxLayout()
        self.sixthrow.setObjectName("sixthrow")

        self.about_btn = QtWidgets.QToolButton(SearcherSettings)
        self.about_btn.setObjectName("about")
        self.sixthrow.addWidget(self.about_btn)

        self.bug_btn = QtWidgets.QToolButton(SearcherSettings)
        self.bug_btn.setObjectName("bugreport")
        self.sixthrow.addWidget(self.bug_btn)

        self.theme_btn = QtWidgets.QToolButton(SearcherSettings)
        self.theme_btn.setObjectName("theme")
        self.sixthrow.addWidget(self.theme_btn)

        spacerItem1 = QtWidgets.QSpacerItem(40, 25,
                                            QtWidgets.QSizePolicy.Expanding,
                                            QtWidgets.QSizePolicy.Fixed)
        self.sixthrow.addItem(spacerItem1)

        self.metrics_chk = QtWidgets.QCheckBox(SearcherSettings)
        self.metrics_chk.setLayoutDirection(QtCore.Qt.RightToLeft)
        self.metrics_chk.setTristate(False)
        self.metrics_chk.setObjectName("metrics_chk")
        self.sixthrow.addWidget(self.metrics_chk)

        self.debuglevel_cbx = QtWidgets.QComboBox(SearcherSettings)
        self.debuglevel_cbx.setObjectName("debuglevel_cbx")
        self.sixthrow.addWidget(self.debuglevel_cbx)

        self.debugflag_chk = QtWidgets.QCheckBox(SearcherSettings)
        self.debugflag_chk.setLayoutDirection(QtCore.Qt.RightToLeft)
        self.debugflag_chk.setObjectName("debugflag_chk")
        self.sixthrow.addWidget(self.debugflag_chk)

        self.discard_btn = QtWidgets.QPushButton(SearcherSettings)
        self.discard_btn.setObjectName("discard_btn")
        self.sixthrow.addWidget(self.discard_btn)

        self.save_btn = QtWidgets.QPushButton(SearcherSettings)
        self.save_btn.setObjectName("save_btn")
        self.sixthrow.addWidget(self.save_btn)

        self.verticallayout.addLayout(self.sixthrow)

        if not self.animated:
            self.gridLayout.addLayout(self.verticallayout, 1, 0, 1, 1)

        # -----------------------------------------------------------
        self.retranslateUi(SearcherSettings)
        QtCore.QMetaObject.connectSlotsByName(SearcherSettings)