Skip to content

Commit 9e478c0

Browse files
committed
More predictable quick menu and close button icon
1 parent b04d6bc commit 9e478c0

4 files changed

Lines changed: 97 additions & 5 deletions

File tree

InitGui.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ def pieMenuStart():
3232
import FreeCADGui as Gui
3333
from PySide import QtCore
3434
from PySide import QtGui
35+
import PieMenuLocator as locator
36+
37+
path = locator.path()
3538

3639
styleButton = ("""
3740
QToolButton {
@@ -60,13 +63,13 @@ def pieMenuStart():
6063

6164
styleMenuClose = ("""
6265
QToolButton {
63-
background-color: rgba(60,60,60,235);
66+
background-color: rgba(60,60,60,255);
67+
color: silver;
6468
border: 1px solid #1e1e1e;
6569
}
6670
6771
QToolButton::menu-indicator {
68-
subcontrol-origin: padding;
69-
subcontrol-position: center center;
72+
image: none;
7073
}
7174
7275
""")
@@ -83,7 +86,8 @@ def pieMenuStart():
8386

8487
styleQuickMenu = ("padding: 5px")
8588

86-
iconClose = QtGui.QApplication.style().standardIcon(QtGui.QStyle.SP_DialogCloseButton)
89+
iconClose = path + "/Resources/icons/PieMenuClose.svg"
90+
iconMenu = path + "/Resources/icons/PieMenuQuickMenu.svg"
8791

8892

8993
def radiusSize(buttonSize):
@@ -110,7 +114,7 @@ def closeButton(buttonSize=32):
110114
button.setProperty("ButtonY", 0)
111115
button.setGeometry(0, 0, buttonSize, buttonSize)
112116
button.setIconSize(QtCore.QSize(icon, icon))
113-
button.setIcon(iconClose)
117+
button.setIcon(QtGui.QIcon(iconClose))
114118
button.setStyleSheet(styleMenuClose + radius)
115119
button.setAttribute(QtCore.Qt.WA_TranslucentBackground)
116120

@@ -125,6 +129,7 @@ def onButton():
125129

126130
def quickMenu(buttonSize=20):
127131

132+
icon = iconSize(buttonSize)
128133
radius = radiusSize(buttonSize)
129134

130135
menu = QtGui.QMenu(mw)
@@ -136,6 +141,8 @@ def quickMenu(buttonSize=20):
136141
button.setProperty("ButtonY", 32)
137142
button.setGeometry(0, 0, buttonSize, buttonSize)
138143
button.setStyleSheet(styleMenuClose + radius)
144+
button.setIconSize(QtCore.QSize(icon, icon))
145+
button.setIcon(QtGui.QIcon(iconMenu))
139146
button.setAttribute(QtCore.Qt.WA_TranslucentBackground)
140147
button.setPopupMode(QtGui.QToolButton
141148
.ToolButtonPopupMode.InstantPopup)

PieMenuLocator.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Pie menu for FreeCAD
2+
# Copyright (C) 2019 triplus @ FreeCAD
3+
#
4+
#
5+
# This library is free software; you can redistribute it and/or
6+
# modify it under the terms of the GNU Lesser General Public
7+
# License as published by the Free Software Foundation; either
8+
# version 2.1 of the License, or (at your option) any later version.
9+
#
10+
# This library is distributed in the hope that it will be useful,
11+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
# Lesser General Public License for more details.
14+
#
15+
# You should have received a copy of the GNU Lesser General Public
16+
# License along with this library; if not, write to the Free Software
17+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18+
19+
"""Pie menu for FreeCAD - Locator."""
20+
21+
22+
import os
23+
24+
25+
def path():
26+
"""Return module path location."""
27+
return os.path.dirname(__file__)

Resources/icons/PieMenuClose.svg

Lines changed: 37 additions & 0 deletions
Loading
Lines changed: 21 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)