mirror of
https://github.com/freedomofpress/dangerzone.git
synced 2025-04-28 18:02:38 +02:00
updater: Move "Ok" button to the right
Move the "Ok" button in the prompt that asks users if they want to enable update checks to the right, to further reinforce that this is the default action.
This commit is contained in:
parent
bc4bba4fa1
commit
d5ca6bb422
2 changed files with 27 additions and 9 deletions
|
@ -152,19 +152,17 @@ class Dialog(QtWidgets.QDialog):
|
|||
self.ok_button = QtWidgets.QPushButton(ok_text)
|
||||
self.ok_button.clicked.connect(self.clicked_ok)
|
||||
|
||||
self.extra_button: Optional[QtWidgets.QPushButton] = None
|
||||
if extra_button_text:
|
||||
self.extra_button = QtWidgets.QPushButton(extra_button_text)
|
||||
self.extra_button.clicked.connect(self.clicked_extra)
|
||||
|
||||
buttons_layout = QtWidgets.QHBoxLayout()
|
||||
buttons_layout.addStretch()
|
||||
buttons_layout.addWidget(self.ok_button)
|
||||
if extra_button_text:
|
||||
buttons_layout.addWidget(self.extra_button)
|
||||
self.cancel_button: Optional[QtWidgets.QPushButton] = None
|
||||
if has_cancel:
|
||||
self.cancel_button = QtWidgets.QPushButton(cancel_text)
|
||||
self.cancel_button.clicked.connect(self.clicked_cancel)
|
||||
buttons_layout.addWidget(self.cancel_button)
|
||||
|
||||
buttons_layout = self.create_buttons_layout()
|
||||
|
||||
layout = QtWidgets.QVBoxLayout()
|
||||
layout.addLayout(message_layout)
|
||||
|
@ -172,6 +170,18 @@ class Dialog(QtWidgets.QDialog):
|
|||
layout.addLayout(buttons_layout)
|
||||
self.setLayout(layout)
|
||||
|
||||
def create_buttons_layout(self) -> QtWidgets.QHBoxLayout:
|
||||
buttons_layout = QtWidgets.QHBoxLayout()
|
||||
buttons_layout.addStretch()
|
||||
|
||||
buttons_layout.addWidget(self.ok_button)
|
||||
if self.extra_button:
|
||||
buttons_layout.addWidget(self.extra_button)
|
||||
if self.cancel_button:
|
||||
buttons_layout.addWidget(self.cancel_button)
|
||||
|
||||
return buttons_layout
|
||||
|
||||
def create_layout(self) -> QtWidgets.QBoxLayout:
|
||||
raise NotImplementedError("Dangerzone dialogs must implement this method")
|
||||
|
||||
|
|
|
@ -11,12 +11,12 @@ from typing import Any, Optional
|
|||
from packaging import version
|
||||
|
||||
if typing.TYPE_CHECKING:
|
||||
from PySide2 import QtCore
|
||||
from PySide2 import QtCore, QtWidgets
|
||||
else:
|
||||
try:
|
||||
from PySide6 import QtCore
|
||||
from PySide6 import QtCore, QtWidgets
|
||||
except ImportError:
|
||||
from PySide2 import QtCore
|
||||
from PySide2 import QtCore, QtWidgets
|
||||
|
||||
import markdown
|
||||
import requests
|
||||
|
@ -61,6 +61,14 @@ class UpdateCheckPrompt(Alert):
|
|||
self.x_pressed = True
|
||||
event.accept()
|
||||
|
||||
def create_buttons_layout(self) -> QtWidgets.QHBoxLayout:
|
||||
buttons_layout = QtWidgets.QHBoxLayout()
|
||||
buttons_layout.addStretch()
|
||||
assert self.cancel_button is not None
|
||||
buttons_layout.addWidget(self.cancel_button)
|
||||
buttons_layout.addWidget(self.ok_button)
|
||||
return buttons_layout
|
||||
|
||||
|
||||
class UpdateReport:
|
||||
"""A report for an update check."""
|
||||
|
|
Loading…
Reference in a new issue