Most applications today contain actions (application wide or not) like Quit, Help, About, etc.
I propose to create in taurus a catalog of such actions so they appear coherent in all taurus applications.
Here is a proposal for an initial list:
Name | Label | Icon | Shortcut | Checkable | Tooltip |
---|---|---|---|---|---|
Help | &Help | "help-contents" | Ctrl-? | False | Help on {app_name} |
About | &About | "help-about" | False | About {app-name} | |
Quit | &Quit | "application-exit" | Ctrl-Q | False | Quit {app_name} |
Fullscreen | &Fullscreen | "view-restore"/"view-fullscreen" | Ctrl-F | True | Toggle fullscreen on/off |
Restart | &Restart | "view-refresh" (maybe specific?) | Ctrl-R | False | Restart {app-name} |
New | &New | "document-new" | Ctrl-N (*) | False | New... |
Open | &Open | "document-open" | Ctrl-O (*) | False | Open... |
Close | &Close | "document-close" | Ctrl-W (*) | False | Close |
Save | &Save | "document-save" | Ctrl-S (*) | False | Save |
Save As | Save &As | "document-save-as" | False | Save As... | |
Save All | Save A&ll | "document-save" | Ctrl+Shift+S | False | Save All |
Cut | Cu&t | "edit-cut" | Ctrl-X (*) | False | Cut |
Copy | &Copy | "edit-copy" | Ctrl-C (*) | False | Copy |
Paste | &Paste | "edit-paste" | Ctrl-V (*) | False | Paste |
Delete | &Delete | "edit-delete" | False | Delete | |
Undo | Undo | "edit-undo" | Ctrl+Z (*) | False | Undo |
Redo | Redo | "edit-redo" | Ctrl+Shift-Z (*) | False | Redo |
(*) is operating system and local specific
This feature request proposes to add a new package called
taurus.qt.qtgui.action
to implement the functionality.
A simple enum and function:
class Actions(Enum): Help = 0 About = 1 Quit = 2 Fullscreen = 3 def getAction(action_id, scope="application"): """ Returns the action given by the action_id. If scope is application (default), the same action reference is returned every time it is asked for. If scope is None a new action is created every time. """ pass
should do the trick.
Helpers may be added as needed. Example:
def onAssist(collection_file): """ Helper for the Help action. Usage:: from functools import partial from taurus.qt.qtgtui.action import Actions, getAction, onAssist onMyAssist = partial(onAssist, "my_collection.qhc") help_action = getAction(Actions.Help) help_action.triggered.connect(onMyAsssist) """ from taurus.qt.qtgui.help import Assist assist = Assist(collection_file) assist.start()
Tiago sent patches that implement this feature but their integration is "on hold" until a decision about PyQt4.4 compatibility requirements is taken (the patches are not PyQt4.4 compatible)
The "hold" can be lifted (and the patches integrated) when we integrate taurus4 into develop, since PyQt4.4 will no longer be supported
Ticket moved from /p/sardana/tickets/291/
Can't be converted: