Add Help dialog

This commit is contained in:
Rebecca Breu 2021-04-17 19:49:23 +02:00
parent 9a1abe755a
commit 976c671180
6 changed files with 64 additions and 2 deletions

View file

@ -175,4 +175,10 @@ actions = [
'shortcuts': ['Ctrl+Shift+A'],
'callback': 'on_action_deselect_all',
},
{
'id': 'help',
'text': '&Help',
'shortcuts': ['Ctrl+H'],
'callback': 'on_action_help',
},
]

View file

@ -69,4 +69,10 @@ menu_structure = [
'normalize_size',
],
},
{
'menu': '&Help',
'items': [
'help',
],
},
]

View file

@ -0,0 +1,26 @@
<h4>Pan Canvas</h4>
<p>
Middle Click + Drag<br/>
Left Click + Alt + Drag
</p>
<h4>Zoom Canvas</h4>
<p>
Mouse wheel up/down
</p>
<h4>Select Items</h4>
Single Item: Left Click<br/>
Multiple Items: Ctrl + Left Click<br/>
Rubberband Selection: Left Click + Drag
<h4>Move Selection</h4>
Left Click + Drag
<h4>Snap Rotation</h4>
Shift or Ctrl while rotating

View file

@ -14,6 +14,7 @@
# along with BeeRef. If not, see <https://www.gnu.org/licenses/>.
import logging
import os.path
from PyQt6 import QtWidgets
from PyQt6.QtCore import Qt
@ -61,3 +62,23 @@ class BeeProgressDialog(QtWidgets.QProgressDialog):
def on_finished(self, filename, errors):
self.close()
class HelpDialog(QtWidgets.QDialog):
def __init__(self, parent):
super().__init__(parent)
self.setWindowTitle('BeeRef Help')
docdir = os.path.join(os.path.dirname(__file__),
'documentation')
tabs = QtWidgets.QTabWidget()
# Controls
with open(os.path.join(docdir, 'controls.html')) as f:
controls_txt = f.read()
controls = QtWidgets.QLabel(controls_txt)
tabs.addTab(controls, '&Controls')
layout = QtWidgets.QVBoxLayout()
self.setLayout(layout)
layout.addWidget(tabs)
self.show()

View file

@ -112,7 +112,7 @@ class SelectableMixin(BaseItemMixin):
SELECT_LINE_WIDTH = 4 # line width for the selection box
SELECT_HANDLE_SIZE = 15 # size of selection handles for scaling
SELECT_RESIZE_SIZE = 20 # size of hover area for scaling
SELECT_ROTATE_SIZE = 15 # size of hover area for rotating
SELECT_ROTATE_SIZE = 10 # size of hover area for rotating
def init_selectable(self):
self.setAcceptHoverEvents(True)

View file

@ -22,7 +22,7 @@ from beeref.actions import ActionsMixin
from beeref import commands
from beeref.config import CommandlineArgs
from beeref import fileio
from beeref.gui import BeeProgressDialog, WelcomeOverlay
from beeref.gui import BeeProgressDialog, WelcomeOverlay, HelpDialog
from beeref.items import BeePixmapItem
from beeref.scene import BeeGraphicsScene
@ -270,6 +270,9 @@ class BeeGraphicsView(QtWidgets.QGraphicsView, ActionsMixin):
logger.info('User quit. Exiting...')
self.app.quit()
def on_action_help(self):
HelpDialog(self)
def on_insert_images_finished(self, filename, errors):
if errors:
errornames = [