#18 setting actions

open
nobody
None
5
2009-03-06
2009-03-06
Anonymous
No

Here are some ideas regarding setting actions in qgit, these would mostly make working with actions very powerful - so they are not meant to be very specific, but only meant to be "enablers" for more high level implementations on top of them:

-> allow users to specify a "context" for their actions, i.e. to indicate when the action should become available - valid contexts could be specified as attributes for currently selected items, for example: "is_master", "is_branch", "is_tag" etc. - some actions might also be applicable in certain circumstances, this would help enable the UI to associate actions with such attributes, to interactively enable/disable certain actions depending on whether they have the corresponding attribute set or not - attributes would then be dynamically communicated from qgit to its actions for each active selection.

-> expose item-specific data via variables to the action dialog, so that UI details for an item may be accessed using a variable to reference it in an action, for example to get the SHA1 id/hash of the active selection and access it from an action, there could be a $SHA1 variable exposed in the actions dialog, likewise other commonly available info for each commit could be exposed via such fields - for example the commit date, author name, author email: $COMMIT.DATE, $COMMIT.AUTHOR_NAME, $COMMIT.AUTHOR_EMAIL - by exposing such meta information to actions, these would become highly configurable and could neatly integrate into the UI, without actions just being "dumb scripts".

-> allow users to specify if the action should be made available via a context menu or just a toolbar button (or possibly also both?)

-> allow users to associate a custom icon/symbol with their actions (mostly useful for the toolbar)

-> allow users to provide tooltips/descriptions for their actions

Thanks for considering these ideas

All the best from Germany

- Boris

Discussion

  • I just had a look into the source code, and maybe these "action contexts" could be very easily implemented: at the moment, qgit seems to set some environment variables for action scripts.
    So it could also set a couple more environment variables like the following:

    QGIT_SELECTION_IS_BRANCH
    QGIT_SELECTION_IS_TAG
    QGIT_SELECTION_IS_MASTER
    QGIT_SELECTION_IS_HEAD

    These could then be used by scripts to check what in what context they are called, i.e. what the current UI selection is and if the script can run on it.
    In the action dialog, one could simply allow users via checkboxes to enable their scripts for all valid "contexts" - so that the qgit can automatically determine if a script is valid to run or not, qgit could then dynamically enable/disable certain actions based on the active selection.

    By using checkboxes for this purpose instead of a dropdown box, users could easily define multiple valid execution contexts

    - Boris

     
  • I agree, having support for this would be very: I was just about to file a feature request about improving the support for working with remote repositories and branches. This could be trivially implemented as a custom action if a script could refer back to the UI items that are selected or marked by the user, so that it could dynamically do something like "git ls-remote" for any given repository and add new branches to the local repository.

     
  • FWIW, I find this a very interesting idea!