Exemple #1
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)
Exemple #2
0
    def setupUi(self, Searcher, animated):
        self.animated = animated
        Searcher.setObjectName("Searcher")
        Searcher.setWindowModality(QtCore.Qt.NonModal)
        Searcher.setStyleSheet(
            u"background-color: rgb(42,42,42); border: 0px solid black")

        self.mainlayout = QtWidgets.QVBoxLayout()
        self.gridLayout = QtWidgets.QGridLayout()
        self.gridLayout.setSpacing(0)
        self.gridLayout.setContentsMargins(0, 0, 0, 0)

        self.verticalLayout = QtWidgets.QVBoxLayout()
        self.verticalLayout.setSpacing(0)

        self.titlerow = QtWidgets.QHBoxLayout()
        self.titlerow.setSpacing(5)

        self.titlespacer1 = QtWidgets.QSpacerItem(
            8, 0, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum)

        # ------------------------------------------ Header
        # NOTE Header -------------------------------------
        self.searcherlbl = QtWidgets.QLabel("Searcher")
        font = QtGui.QFont()
        font.setPointSize(15)
        self.searcherlbl.setFont(font)
        self.searcherlbl.setAlignment(QtCore.Qt.AlignCenter)

        self.titlespacer2 = QtWidgets.QSpacerItem(
            40, 30, QtWidgets.QSizePolicy.Expanding,
            QtWidgets.QSizePolicy.Minimum)

        self.expander = QtWidgets.QToolButton()
        self.expander.setObjectName("expander")

        self.metricpos = QtWidgets.QToolButton()
        self.metricpos.setObjectName("metricpos")

        self.contexttoggle = QtWidgets.QPushButton()
        self.contexttoggle.setObjectName("contexttoggle")

        self.helpButton = HelpButton.HelpButton("main", la.TT_MW['helpButton'],
                                                16, Searcher)
        self.helpButton.setObjectName("helpButton")

        self.pinwindow_btn = QtWidgets.QToolButton()
        self.pinwindow_btn.setObjectName("pinwindow")

        self.opensettings_btn = QtWidgets.QToolButton()
        self.opensettings_btn.setObjectName("opensettingstool")

        self.titlespacer3 = QtWidgets.QSpacerItem(
            8, 0, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum)

        # ----------------------------------- Search Filter
        # NOTE Search Filter ------------------------------
        self.searchrow = QtWidgets.QHBoxLayout()
        self.searchrow.setSpacing(0)
        self.frame = QtWidgets.QFrame()
        searchframe_details = QtWidgets.QSizePolicy(
            QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred)
        searchframe_details.setHorizontalStretch(0)
        searchframe_details.setVerticalStretch(0)
        searchframe_details.setHeightForWidth(
            self.frame.sizePolicy().hasHeightForWidth())
        self.frame.setSizePolicy(searchframe_details)
        self.frame.setMinimumSize(QtCore.QSize(20, 20))
        self.frame.setMaximumSize(QtCore.QSize(500, 200))
        self.frame.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.frame.setFrameShadow(QtWidgets.QFrame.Plain)
        self.frame.setStyleSheet(
            u"background-color: rgb(19, 19, 19); color: rgb(19, 19, 19);")
        self.searchfilter_btn = QtWidgets.QToolButton(self.frame)
        self.searchfilter_btn.setObjectName("searchfilter")
        self.searchfilter_btn.setGeometry(QtCore.QRect(0, 0, 36, 36))
        self.searchfilter_btn.setBaseSize(QtCore.QSize(30, 30))
        self.searchfilter_btn.setStyleSheet(
            u"background-color: rgb(19, 19, 19);")
        self.searchfilter_btn.setArrowType(QtCore.Qt.NoArrow)
        self.searchfilter_btn.setParent(self.frame)

        # -------------------------------------- Search Box
        # NOTE Search Box ---------------------------------
        self.searchbox_txt = QtWidgets.QLineEdit()
        self.searchbox_txt.setObjectName("searchbox")
        searchbox_details = QtWidgets.QSizePolicy(
            QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        searchbox_details.setHorizontalStretch(99)
        searchbox_details.setVerticalStretch(0)
        # searchbox_details.setHeightForWidth(
        #     self.searchbox_txt.sizePolicy().hasHeightForWidth())
        self.searchbox_txt.setSizePolicy(searchbox_details)
        self.searchbox_txt.setMinimumSize(QtCore.QSize(50, 0))
        self.searchbox_txt.setMouseTracking(False)
        self.searchbox_txt.setStyleSheet(u"background-color: rgb(19, 19, 19);")
        self.searchbox_txt.setFrame(False)

        # ------------------------------------ Results Tree
        # NOTE Results Tree -------------------------------
        self.searchresults_tree = QtWidgets.QTreeWidget()
        self.searchresults_tree.setObjectName("searchresultstree")

        # Header ---------
        __qtreewidgetitem = QtWidgets.QTreeWidgetItem()
        __qtreewidgetitem.setText(0, u"1")
        resultstree_header = QtGui.QFont()
        resultstree_header.setPointSize(9)
        __qtreewidgetitem.setFont(0, resultstree_header)
        self.searchresults_tree.setHeaderItem(__qtreewidgetitem)

        resultstree_details = QtWidgets.QSizePolicy(
            QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Expanding)
        resultstree_details.setHorizontalStretch(0)
        resultstree_details.setVerticalStretch(0)
        self.searchresults_tree.setSizePolicy(resultstree_details)

        resultstree_font = QtGui.QFont()
        resultstree_font.setPointSize(9)
        self.searchresults_tree.setFont(resultstree_font)

        self.searchresults_tree.setMouseTracking(False)
        self.searchresults_tree.setFocusPolicy(QtCore.Qt.NoFocus)
        self.searchresults_tree.setFrameShadow(QtWidgets.QFrame.Sunken)
        self.searchresults_tree.setLineWidth(0)

        self.searchresults_tree.setSizeAdjustPolicy(
            QtWidgets.QAbstractScrollArea.AdjustToContents)
        self.searchresults_tree.setAlternatingRowColors(True)
        self.searchresults_tree.setSelectionMode(
            QtWidgets.QAbstractItemView.SingleSelection)
        self.searchresults_tree.setSelectionBehavior(
            QtWidgets.QAbstractItemView.SelectRows)

        # -------------------------------------- Info Panel
        # NOTE Info Panel ---------------------------------
        self.infobar = QtWidgets.QHBoxLayout()
        self.infobar.setObjectName("infobar")
        self.infobargrid = QtWidgets.QGridLayout()
        self.infobargrid.setObjectName("infobargrid")

        # -------------------------------------- Info Panel
        # NOTE Info Panel ---------------------------------
        self.info_lbl = QtWidgets.QLabel()
        self.infolbl_font = QtGui.QFont()
        self.infolbl_font.setPointSize(9)
        self.infolbl_font.setBold(False)
        self.infolbl_font.setWeight(40)
        self.info_lbl.setFont(self.infolbl_font)
        self.info_lbl.setStyleSheet(
            u"background-color: rgba(11, 11, 11, 0); border-bottom: 1px solid rgb(100, 100, 100);"
        )
        self.info_lbl.setMargin(3)
        self.info_lbl.setIndent(5)

        # -------------------------------------- Info Panel
        # NOTE Info Panel ---------------------------------
        self.overlay = overlayLabel(self.info_lbl)
        self.overlay.setFont(self.infolbl_font)
        self.overlay.setStyleSheet(
            u"background-color: rgb(11, 11, 11); border-bottom: 1px solid rgb(100, 100, 100); "
        )
        self.overlay.setMargin(3)
        self.overlay.setIndent(5)

        # -------------------------------------- Info Panel
        # NOTE Info Panel ---------------------------------
        self.treetotal_lbl = QtWidgets.QLabel()
        self.treetotal_lbl.setObjectName("treetotal_lbl")
        # Size ----------
        treetotal_size = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum,
                                               QtWidgets.QSizePolicy.Preferred)
        treetotal_size.setHorizontalStretch(0)
        treetotal_size.setVerticalStretch(0)
        treetotal_size.setHeightForWidth(
            self.treetotal_lbl.sizePolicy().hasHeightForWidth())
        self.treetotal_lbl.setSizePolicy(treetotal_size)
        self.treetotal_lbl.setMinimumSize(QtCore.QSize(160, 0))
        self.treetotal_lbl.setAlignment(QtCore.Qt.AlignRight
                                        | QtCore.Qt.AlignTrailing
                                        | QtCore.Qt.AlignVCenter)

        # Style ---------
        self.treetotallbl_font = QtGui.QFont()
        self.treetotallbl_font.setPointSize(9)
        self.treetotallbl_font.setBold(False)
        self.treetotallbl_font.setWeight(50)
        self.treetotal_lbl.setFont(self.treetotallbl_font)
        self.treetotal_lbl.setStyleSheet(
            u"background-color: rgb(11, 11, 11); border-bottom: 1px solid rgb(100, 100, 100); "
        )
        self.treetotal_lbl.setMargin(3)
        self.treetotal_lbl.setIndent(5)

        # ------------------------------------------ Layout
        # NOTE Layout -------------------------------------
        self.titlerow.addItem(self.titlespacer1)
        self.titlerow.addWidget(self.searcherlbl)
        self.titlerow.addItem(self.titlespacer2)
        self.titlerow.addWidget(self.expander)
        self.titlerow.addWidget(self.metricpos)
        self.titlerow.addWidget(self.contexttoggle)
        self.titlerow.addWidget(self.helpButton)
        self.titlerow.addWidget(self.pinwindow_btn)
        self.titlerow.addWidget(self.opensettings_btn)
        self.titlerow.addItem(self.titlespacer3)
        self.verticalLayout.addLayout(self.titlerow)

        # self.searchrow.addWidget(self.frame)
        self.searchgrid = QtWidgets.QGridLayout()
        self.searchgrid.addWidget(self.frame, 1, 0, 1, 1)
        self.searchgrid.addWidget(self.searchfilter_btn, 1, 0, 1, 1)
        self.searchgrid.addWidget(self.searchbox_txt, 1, 1, 1, 1)
        self.searchrow.addLayout(self.searchgrid)
        self.verticalLayout.addLayout(self.searchrow)

        self.verticalLayout.addWidget(self.searchresults_tree)
        self.gridLayout.addLayout(self.verticalLayout, 1, 0, 1, 1)

        self.infobargrid.addWidget(self.overlay, 1, 0, 1, 1)
        self.infobargrid.addWidget(self.info_lbl, 1, 0, 1, 1)
        self.infobargrid.addWidget(self.treetotal_lbl, 1, 1, 1, 1)
        self.infobar.addLayout(self.infobargrid)
        self.gridLayout.addLayout(self.infobar, 3, 0, 1, 1)

        self.mainlayout.setContentsMargins(0, 0, 0, 0)

        # --------------------------------------- ResizeHandles
        # NOTE ResizeHandles ----------------------------------
        self.leftresize = QtWidgets.QSizeGrip(self.info_lbl)
        self.leftresize.setObjectName("resizeleft")
        self.leftresize.setMaximumSize(QtCore.QSize(25, 25))
        self.leftresize.setStyleSheet(
            u"color: rgba(0, 0, 0, 0); background-color: rgba(0, 0, 0, 0);")
        pos = self.info_lbl.mapToGlobal(QtCore.QPoint(-3, 0))
        self.leftresize.setGeometry(pos.x(), pos.y(), self.leftresize.width(),
                                    self.leftresize.height())

        self.rightresize = QtWidgets.QSizeGrip(self.treetotal_lbl)
        self.rightresize.setMaximumSize(QtCore.QSize(25, 25))
        self.rightresize.setObjectName("resizeright")
        self.rightresize.setStyleSheet(
            u"color: rgba(0, 0, 0, 0); background-color: rgba(0, 0, 0, 0);")
        pos = self.treetotal_lbl.mapToGlobal(QtCore.QPoint(138, 0))
        self.rightresize.setGeometry(pos.x(), pos.y(),
                                     self.rightresize.width(),
                                     self.rightresize.height())
        self.vlayout = self.gridLayout