class DropdownMenu(QtWidgets.QWidget): def __init__(self, parent): super(DropdownMenu, self).__init__(parent) self.installEventFilter(self) self.setWindowFlags(QtCore.Qt.FramelessWindowHint) self.setMaximumSize(120, 120) self.setMinimumSize(120, 120) self.screenshotButton = QRightClickButton(self) self.screenshotButton.setGeometry(QtCore.QRect(0, 60, 60, 60)) self.screenshotButton.setObjectName("screenshotButton") self.fileTransferButton = QtWidgets.QPushButton(self) self.fileTransferButton.setGeometry(QtCore.QRect(60, 60, 60, 60)) self.fileTransferButton.setObjectName("fileTransferButton") self.smileyButton = QtWidgets.QPushButton(self) self.smileyButton.setGeometry(QtCore.QRect(0, 0, 60, 60)) self.stickerButton = QtWidgets.QPushButton(self) self.stickerButton.setGeometry(QtCore.QRect(60, 0, 60, 60)) pixmap = QtGui.QPixmap(util.curr_directory() + '/images/file.png') icon = QtGui.QIcon(pixmap) self.fileTransferButton.setIcon(icon) self.fileTransferButton.setIconSize(QtCore.QSize(50, 50)) pixmap = QtGui.QPixmap(util.curr_directory() + '/images/screenshot.png') icon = QtGui.QIcon(pixmap) self.screenshotButton.setIcon(icon) self.screenshotButton.setIconSize(QtCore.QSize(50, 60)) pixmap = QtGui.QPixmap(util.curr_directory() + '/images/smiley.png') icon = QtGui.QIcon(pixmap) self.smileyButton.setIcon(icon) self.smileyButton.setIconSize(QtCore.QSize(50, 50)) pixmap = QtGui.QPixmap(util.curr_directory() + '/images/sticker.png') icon = QtGui.QIcon(pixmap) self.stickerButton.setIcon(icon) self.stickerButton.setIconSize(QtCore.QSize(55, 55)) self.screenshotButton.setToolTip(QtWidgets.QApplication.translate("MenuWindow", "Send screenshot")) self.fileTransferButton.setToolTip(QtWidgets.QApplication.translate("MenuWindow", "Send file")) self.smileyButton.setToolTip(QtWidgets.QApplication.translate("MenuWindow", "Add smiley")) self.stickerButton.setToolTip(QtWidgets.QApplication.translate("MenuWindow", "Send sticker")) self.fileTransferButton.clicked.connect(parent.send_file) self.screenshotButton.clicked.connect(parent.send_screenshot) self.screenshotButton.rightClicked.connect(lambda: parent.send_screenshot(True)) self.smileyButton.clicked.connect(parent.send_smiley) self.stickerButton.clicked.connect(parent.send_sticker) def leaveEvent(self, event): self.close() def eventFilter(self, obj, event): if event.type() == QtCore.QEvent.WindowDeactivate: self.close() return False
def __init__(self, parent): super(DropdownMenu, self).__init__(parent) self.installEventFilter(self) self.setWindowFlags(QtCore.Qt.FramelessWindowHint) self.setMaximumSize(180, 120) self.setMinimumSize(180, 120) self.screenshotButton = QRightClickButton(self) self.screenshotButton.setGeometry(QtCore.QRect(0, 60, 60, 60)) self.screenshotButton.setObjectName("screenshotButton") self.fileTransferButton = QtGui.QPushButton(self) self.fileTransferButton.setGeometry(QtCore.QRect(60, 60, 60, 60)) self.fileTransferButton.setObjectName("fileTransferButton") self.audioMessageButton = QtGui.QPushButton(self) self.audioMessageButton.setGeometry(QtCore.QRect(120, 60, 60, 60)) self.smileyButton = QtGui.QPushButton(self) self.smileyButton.setGeometry(QtCore.QRect(0, 0, 60, 60)) self.videoMessageButton = QtGui.QPushButton(self) self.videoMessageButton.setGeometry(QtCore.QRect(120, 0, 60, 60)) self.stickerButton = QtGui.QPushButton(self) self.stickerButton.setGeometry(QtCore.QRect(60, 0, 60, 60)) pixmap = QtGui.QPixmap(util.curr_directory() + '/images/file.png') icon = QtGui.QIcon(pixmap) self.fileTransferButton.setIcon(icon) self.fileTransferButton.setIconSize(QtCore.QSize(50, 50)) pixmap = QtGui.QPixmap(util.curr_directory() + '/images/screenshot.png') icon = QtGui.QIcon(pixmap) self.screenshotButton.setIcon(icon) self.screenshotButton.setIconSize(QtCore.QSize(50, 60)) pixmap = QtGui.QPixmap(util.curr_directory() + '/images/audio_message.png') icon = QtGui.QIcon(pixmap) self.audioMessageButton.setIcon(icon) self.audioMessageButton.setIconSize(QtCore.QSize(50, 50)) pixmap = QtGui.QPixmap(util.curr_directory() + '/images/smiley.png') icon = QtGui.QIcon(pixmap) self.smileyButton.setIcon(icon) self.smileyButton.setIconSize(QtCore.QSize(50, 50)) pixmap = QtGui.QPixmap(util.curr_directory() + '/images/video_message.png') icon = QtGui.QIcon(pixmap) self.videoMessageButton.setIcon(icon) self.videoMessageButton.setIconSize(QtCore.QSize(55, 55)) pixmap = QtGui.QPixmap(util.curr_directory() + '/images/sticker.png') icon = QtGui.QIcon(pixmap) self.stickerButton.setIcon(icon) self.stickerButton.setIconSize(QtCore.QSize(55, 55)) self.screenshotButton.setToolTip( QtGui.QApplication.translate("MenuWindow", "Send screenshot", None, QtGui.QApplication.UnicodeUTF8)) self.fileTransferButton.setToolTip( QtGui.QApplication.translate("MenuWindow", "Send file", None, QtGui.QApplication.UnicodeUTF8)) self.audioMessageButton.setToolTip( QtGui.QApplication.translate("MenuWindow", "Send audio message", None, QtGui.QApplication.UnicodeUTF8)) self.videoMessageButton.setToolTip( QtGui.QApplication.translate("MenuWindow", "Send video message", None, QtGui.QApplication.UnicodeUTF8)) self.smileyButton.setToolTip( QtGui.QApplication.translate("MenuWindow", "Add smiley", None, QtGui.QApplication.UnicodeUTF8)) self.stickerButton.setToolTip( QtGui.QApplication.translate("MenuWindow", "Send sticker", None, QtGui.QApplication.UnicodeUTF8)) self.fileTransferButton.clicked.connect(parent.send_file) self.screenshotButton.clicked.connect(parent.send_screenshot) self.connect(self.screenshotButton, QtCore.SIGNAL("rightClicked()"), lambda: parent.send_screenshot(True)) self.smileyButton.clicked.connect(parent.send_smiley) self.stickerButton.clicked.connect(parent.send_sticker)
def __init__(self, parent): super(DropdownMenu, self).__init__(parent) self.installEventFilter(self) self.setWindowFlags(QtCore.Qt.FramelessWindowHint) self.setMaximumSize(180, 120) self.setMinimumSize(180, 120) self.screenshotButton = QRightClickButton(self) self.screenshotButton.setGeometry(QtCore.QRect(0, 60, 60, 60)) self.screenshotButton.setObjectName("screenshotButton") self.fileTransferButton = QtGui.QPushButton(self) self.fileTransferButton.setGeometry(QtCore.QRect(60, 60, 60, 60)) self.fileTransferButton.setObjectName("fileTransferButton") self.audioMessageButton = QtGui.QPushButton(self) self.audioMessageButton.setGeometry(QtCore.QRect(120, 60, 60, 60)) self.smileyButton = QtGui.QPushButton(self) self.smileyButton.setGeometry(QtCore.QRect(0, 0, 60, 60)) self.videoMessageButton = QtGui.QPushButton(self) self.videoMessageButton.setGeometry(QtCore.QRect(120, 0, 60, 60)) self.stickerButton = QtGui.QPushButton(self) self.stickerButton.setGeometry(QtCore.QRect(60, 0, 60, 60)) pixmap = QtGui.QPixmap(util.curr_directory() + '/images/file.png') icon = QtGui.QIcon(pixmap) self.fileTransferButton.setIcon(icon) self.fileTransferButton.setIconSize(QtCore.QSize(50, 50)) pixmap = QtGui.QPixmap(util.curr_directory() + '/images/screenshot.png') icon = QtGui.QIcon(pixmap) self.screenshotButton.setIcon(icon) self.screenshotButton.setIconSize(QtCore.QSize(50, 60)) pixmap = QtGui.QPixmap(util.curr_directory() + '/images/audio_message.png') icon = QtGui.QIcon(pixmap) self.audioMessageButton.setIcon(icon) self.audioMessageButton.setIconSize(QtCore.QSize(50, 50)) pixmap = QtGui.QPixmap(util.curr_directory() + '/images/smiley.png') icon = QtGui.QIcon(pixmap) self.smileyButton.setIcon(icon) self.smileyButton.setIconSize(QtCore.QSize(50, 50)) pixmap = QtGui.QPixmap(util.curr_directory() + '/images/video_message.png') icon = QtGui.QIcon(pixmap) self.videoMessageButton.setIcon(icon) self.videoMessageButton.setIconSize(QtCore.QSize(55, 55)) pixmap = QtGui.QPixmap(util.curr_directory() + '/images/sticker.png') icon = QtGui.QIcon(pixmap) self.stickerButton.setIcon(icon) self.stickerButton.setIconSize(QtCore.QSize(55, 55)) self.screenshotButton.setToolTip(QtGui.QApplication.translate("MenuWindow", "Send screenshot", None, QtGui.QApplication.UnicodeUTF8)) self.fileTransferButton.setToolTip(QtGui.QApplication.translate("MenuWindow", "Send file", None, QtGui.QApplication.UnicodeUTF8)) self.audioMessageButton.setToolTip(QtGui.QApplication.translate("MenuWindow", "Send audio message", None, QtGui.QApplication.UnicodeUTF8)) self.videoMessageButton.setToolTip(QtGui.QApplication.translate("MenuWindow", "Send video message", None, QtGui.QApplication.UnicodeUTF8)) self.smileyButton.setToolTip(QtGui.QApplication.translate("MenuWindow", "Add smiley", None, QtGui.QApplication.UnicodeUTF8)) self.stickerButton.setToolTip(QtGui.QApplication.translate("MenuWindow", "Send sticker", None, QtGui.QApplication.UnicodeUTF8)) self.fileTransferButton.clicked.connect(parent.send_file) self.screenshotButton.clicked.connect(parent.send_screenshot) self.connect(self.screenshotButton, QtCore.SIGNAL("rightClicked()"), lambda: parent.send_screenshot(True)) self.smileyButton.clicked.connect(parent.send_smiley) self.stickerButton.clicked.connect(parent.send_sticker)