def initPopup(self): self.dialog = Plasma.Dialog() self.dialog.setWindowFlags(Qt.Popup) self.updateTheme() self.popup = Popup(self.dialog, self) self.popup.init() self.dialog.resize(self.popup.size())
def showModalWidget(self, mainWidget): #mainWidget.widgetClose.connect(self.destroyMessageOverlay) if self.messageOverlay: return if self.messageDialog: return corona = self.scene() mainWidget.adjustSize() hint = mainWidget.preferredSize() if (hint.height() > self.widget.size().height()) or ( hint.width() > self.widget.size().width()): ## either a collapsed popup in h/v form factor or just too small, ## so show it in a dialog associated with ourselves #pass if (corona): corona.addOffscreenWidget(mainWidget) if (self.messageDialog): pass else: self.messageDialog = Plasma.Dialog() self.messageDialog.setGraphicsWidget(mainWidget) mainWidget.setParentItem(self.messageDialog.graphicsWidget()) else: self.messageOverlay = self.createMessageOverlay() self.formatOverlay() self.messageOverlay.opacity = 0.8 mainWidget.setParentItem(self.messageOverlay) l = QGraphicsLinearLayout(self.messageOverlay) l.addItem(mainWidget) if self.messageDialog: pos = self.geometry().topLeft().toPoint() if (corona): pos = corona.popupPosition(self.applet, self.messageDialog.size()) self.messageDialog.move(pos) #self.locationToDirection(self.location()) self.messageDialog.animatedShow(Plasma.Direction(0)) self.hidePopup() else: self.messageOverlay.show()