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'!" )
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)
def resizeWindow(self, widthFactor, heightFactor): availableGeometry = QGuiApplication.instance().desktop( ).availableGeometry() self.setMinimumWidth(500) self.resize(availableGeometry.width() * widthFactor, availableGeometry.height() * heightFactor)