mirror of
https://github.com/freedomofpress/dangerzone.git
synced 2025-04-28 18:02:38 +02:00
Add update error red dot to hamburger menu
This commit is contained in:
parent
c9eac42855
commit
53ec1cad63
4 changed files with 63 additions and 2 deletions
|
@ -263,6 +263,9 @@ class MainWindow(QtWidgets.QMainWindow):
|
||||||
sep = hamburger_menu.insertSeparator(hamburger_menu.actions()[0])
|
sep = hamburger_menu.insertSeparator(hamburger_menu.actions()[0])
|
||||||
# FIXME: Add red bubble next to the text.
|
# FIXME: Add red bubble next to the text.
|
||||||
error_action = QtGui.QAction("Update error", hamburger_menu) # type: ignore [attr-defined]
|
error_action = QtGui.QAction("Update error", hamburger_menu) # type: ignore [attr-defined]
|
||||||
|
error_action.setIcon(
|
||||||
|
QtGui.QIcon(self.load_svg_image("hamburger_menu_update_dot_error.svg"))
|
||||||
|
)
|
||||||
error_action.triggered.connect(self.show_update_error)
|
error_action.triggered.connect(self.show_update_error)
|
||||||
hamburger_menu.insertAction(sep, error_action)
|
hamburger_menu.insertAction(sep, error_action)
|
||||||
else:
|
else:
|
||||||
|
@ -282,7 +285,9 @@ class MainWindow(QtWidgets.QMainWindow):
|
||||||
sep = hamburger_menu.insertSeparator(hamburger_menu.actions()[0])
|
sep = hamburger_menu.insertSeparator(hamburger_menu.actions()[0])
|
||||||
success_action = QtGui.QAction("New version available", hamburger_menu) # type: ignore [attr-defined]
|
success_action = QtGui.QAction("New version available", hamburger_menu) # type: ignore [attr-defined]
|
||||||
success_action.setIcon(
|
success_action.setIcon(
|
||||||
QtGui.QIcon(self.load_svg_image("hamburger_menu_update_available.svg"))
|
QtGui.QIcon(
|
||||||
|
self.load_svg_image("hamburger_menu_update_dot_available.svg")
|
||||||
|
)
|
||||||
)
|
)
|
||||||
success_action.triggered.connect(self.show_update_success)
|
success_action.triggered.connect(self.show_update_success)
|
||||||
hamburger_menu.insertAction(sep, success_action)
|
hamburger_menu.insertAction(sep, success_action)
|
||||||
|
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
48
share/hamburger_menu_update_dot_error.svg
Normal file
48
share/hamburger_menu_update_dot_error.svg
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg
|
||||||
|
height="45.115959"
|
||||||
|
id="Layer_1"
|
||||||
|
version="1.1"
|
||||||
|
viewBox="0 0 45.115959 45.115959"
|
||||||
|
width="45.115959"
|
||||||
|
xml:space="preserve"
|
||||||
|
sodipodi:docname="hamburger_menu_update_error_dot.svg"
|
||||||
|
inkscape:version="1.2.2 (b0a8486541, 2022-12-01)"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"><defs
|
||||||
|
id="defs7"><inkscape:perspective
|
||||||
|
sodipodi:type="inkscape:persp3d"
|
||||||
|
inkscape:vp_x="0 : 29.115959 : 1"
|
||||||
|
inkscape:vp_y="0 : 1000 : 0"
|
||||||
|
inkscape:vp_z="32 : 29.115959 : 1"
|
||||||
|
inkscape:persp3d-origin="16 : 23.782626 : 1"
|
||||||
|
id="perspective236" /></defs><sodipodi:namedview
|
||||||
|
id="namedview5"
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#000000"
|
||||||
|
borderopacity="0.25"
|
||||||
|
inkscape:showpageshadow="2"
|
||||||
|
inkscape:pageopacity="0.0"
|
||||||
|
inkscape:pagecheckerboard="0"
|
||||||
|
inkscape:deskcolor="#d1d1d1"
|
||||||
|
showgrid="true"
|
||||||
|
inkscape:zoom="13.609375"
|
||||||
|
inkscape:cx="25.49713"
|
||||||
|
inkscape:cy="25.49713"
|
||||||
|
inkscape:window-width="1499"
|
||||||
|
inkscape:window-height="1017"
|
||||||
|
inkscape:window-x="416"
|
||||||
|
inkscape:window-y="58"
|
||||||
|
inkscape:window-maximized="1"
|
||||||
|
inkscape:current-layer="Layer_1"><inkscape:grid
|
||||||
|
type="xygrid"
|
||||||
|
id="grid371"
|
||||||
|
originx="4.9965558"
|
||||||
|
originy="5.0700345" /></sodipodi:namedview><circle
|
||||||
|
style="fill:#ff0000;stroke-width:2.64607;fill-opacity:1"
|
||||||
|
id="path193"
|
||||||
|
cx="22.447765"
|
||||||
|
cy="22.521242"
|
||||||
|
r="17.304247" /></svg>
|
After Width: | Height: | Size: 1.6 KiB |
|
@ -151,7 +151,8 @@ def test_update_detected(
|
||||||
assert load_svg_spy.call_count == 2
|
assert load_svg_spy.call_count == 2
|
||||||
assert load_svg_spy.call_args_list[0].args[0] == "hamburger_menu_update_success.svg"
|
assert load_svg_spy.call_args_list[0].args[0] == "hamburger_menu_update_success.svg"
|
||||||
assert (
|
assert (
|
||||||
load_svg_spy.call_args_list[1].args[0] == "hamburger_menu_update_available.svg"
|
load_svg_spy.call_args_list[1].args[0]
|
||||||
|
== "hamburger_menu_update_dot_available.svg"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Check that new menu entries have been added.
|
# Check that new menu entries have been added.
|
||||||
|
@ -284,6 +285,13 @@ def test_update_error(
|
||||||
assert len(menu_actions_after) == 5
|
assert len(menu_actions_after) == 5
|
||||||
assert menu_actions_after[2:] == menu_actions_before
|
assert menu_actions_after[2:] == menu_actions_before
|
||||||
|
|
||||||
|
# Check that the hamburger icon has changed with the expected SVG image.
|
||||||
|
assert load_svg_spy.call_count == 2
|
||||||
|
assert load_svg_spy.call_args_list[0].args[0] == "hamburger_menu_update_error.svg"
|
||||||
|
assert (
|
||||||
|
load_svg_spy.call_args_list[1].args[0] == "hamburger_menu_update_dot_error.svg"
|
||||||
|
)
|
||||||
|
|
||||||
error_action = menu_actions_after[0]
|
error_action = menu_actions_after[0]
|
||||||
assert error_action.text() == "Update error"
|
assert error_action.text() == "Update error"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue