summaryrefslogtreecommitdiff
path: root/raphodo/menubutton.py
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2017-07-06 22:55:18 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2017-07-06 22:55:18 +0200
commit14f84dc139317de4cfc02ff36c2ad799b060dbaf (patch)
tree5163e8e596302e570a2e39c62d7a9df0e1490e28 /raphodo/menubutton.py
parent18afe3e2ebdb10bbc542d79280344d9adf923d2f (diff)
parent083849161f075878e4175cd03cb7afa83d64e7f5 (diff)
Updated version 0.9.0 from 'upstream/0.9.0'
with Debian dir 04f2bb3e026e2a983dcac5cdcc35c9dd8f6b91ab
Diffstat (limited to 'raphodo/menubutton.py')
-rw-r--r--raphodo/menubutton.py46
1 files changed, 46 insertions, 0 deletions
diff --git a/raphodo/menubutton.py b/raphodo/menubutton.py
new file mode 100644
index 0000000..a8ab618
--- /dev/null
+++ b/raphodo/menubutton.py
@@ -0,0 +1,46 @@
+# Copyright (C) 2016 Damon Lynch <damonlynch@gmail.com>
+
+# This file is part of Rapid Photo Downloader.
+#
+# Rapid Photo Downloader is free software: you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Rapid Photo Downloader is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Rapid Photo Downloader. If not,
+# see <http://www.gnu.org/licenses/>.
+
+
+
+from PyQt5.QtGui import QIcon
+from PyQt5.QtWidgets import (QMenu, QToolButton)
+
+class MenuButton(QToolButton):
+ """
+ Button that provides access to a drop-down menu
+ """
+
+ def __init__(self, icon: QIcon, menu: QMenu) -> None:
+ super().__init__()
+
+ self.setPopupMode(QToolButton.InstantPopup)
+ self.setIcon(icon)
+ self.setStyleSheet("""
+ QToolButton {border: none;}
+ QToolButton::menu-indicator { image: none; }
+ QToolButton::hover {
+ border: 1px solid palette(shadow);
+ border-radius: 3px;
+ }
+ QToolButton::pressed {
+ border: 1px solid palette(shadow);
+ border-radius: 3px;
+ }
+ """)
+ self.setMenu(menu) \ No newline at end of file