예제 #1
0
 def switchToCli(self):
     if config.isHtmlTextInstalled:
         config.pluginContext = self.name
         QGuiApplication.instance().setApplicationName(
             "UniqueBible.app CLI")
         config.pluginContext = ""
     else:
         self.displayMessage(
             "CLI feature is not enabled! \n Install module 'html-text' first, by running 'pip3 install html-text'!"
         )
예제 #2
0
    def __init__(self, items=[], checkedItems=[], toolTips=None, *args, **kwargs):
        super().__init__(*args, **kwargs)

        # Set up initial checked items
        self.checkItems = checkedItems

        # Make the combo editable to set a custom text, but readonly
        self.setEditable(True)
        self.lineEdit().setReadOnly(True)
        # Make the lineedit the same color as QPushButton
        palette = QGuiApplication.instance().palette()
        palette.setBrush(QPalette.Base, palette.button())
        self.lineEdit().setPalette(palette)

        # Use custom delegate
        self.setItemDelegate(CheckableComboBox.Delegate())

        # Update the text when an item is toggled
        self.model().dataChanged.connect(self.updateText)

        # Hide and show popup when clicking the line edit
        self.lineEdit().installEventFilter(self)
        self.closeOnLineEditClick = False

        # Prevent popup from closing when clicking on an item
        self.view().viewport().installEventFilter(self)

        # Fill in items
        self.addItems(items, toolTips=toolTips)
예제 #3
0
 def resizeWindow(self, widthFactor, heightFactor):
     availableGeometry = QGuiApplication.instance().desktop(
     ).availableGeometry()
     self.setMinimumWidth(500)
     self.resize(availableGeometry.width() * widthFactor,
                 availableGeometry.height() * heightFactor)