Django Library PyGal
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

help.py 4.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. from django.utils.translation import gettext as _
  2. import mycreole
  3. import pygal
  4. from themes import color_icon_url
  5. # TODO: Add field descriptions including the filed list choices, if field has a list of limited values (e.g. flash: "fired", ...)
  6. # TODO: Describe logic operator order and brackets if possible
  7. # TODO: Expend Examples for pictures without flash and high f_number to get potentially good quality images.
  8. HELP_UID = 'help'
  9. MAIN = mycreole.render_simple(_("""
  10. = PyGal
  11. **PyGal** is a File **Gal**ery visulisation tool implementes in **Py**thon.
  12. It is designed to visualise images and videos. Nevertheless it is also possible to \
  13. visualise audio files and all other files.
  14. == Help
  15. * [[faq|Frequently asked questions]]
  16. * [[access|Access Conrtrol]]
  17. * [[search|Help on Search]]
  18. """))
  19. FAQ = mycreole.render_simple(_("""
  20. = Frequently asked questions
  21. ==Repeat-Mode
  22. On Problems with the Repeat-Mode, please check your Browser \
  23. [[https://www.google.com/search?q=autoplay+enable+browser|properties]] \
  24. for autoplay restrictions!
  25. """))
  26. ACCESS = mycreole.render_simple(_("""
  27. = Access control
  28. Access Control is defined on folder level. The rights given for a folder \
  29. are the rights for all items in that folder. The folder itself has no access \
  30. restrictions. The content of a folder is defined by the accessable items \
  31. recursive below that folder.
  32. **Example:** If a user has only read access to the folder "bar" below the folder "foo", \
  33. but not to "foo", he will see the folder "bar" inside the folder "foo" and all items in \
  34. "foo/bar", but not the items in the folder "foo".
  35. """))
  36. SEARCH = mycreole.render_simple(_("""
  37. = Search
  38. The search looks up full words in //Itemnames (name)// and //Tags (tag)// without giving \
  39. special search commands in the search string.
  40. == Search-Fields
  41. The useful search fields depend on the item type. Therefore some fields are given twice or \
  42. more in the different type depending lists.
  43. === General search fields
  44. * rel_path (TEXT):
  45. * name (TEXT):
  46. * type (TEXT):
  47. * favourite_of (KEYWORD):
  48. * datetime (DATETIME):
  49. * size (NUMERIC):
  50. * tag (KEYWORD):
  51. === Image
  52. * exposure_program (TEXT):
  53. * exposure_time (NUMERIC):
  54. * flash (TEXT):
  55. * f_number (NUMERIC):
  56. * focal_length (NUMERIC):
  57. * lon (NUMERIC):
  58. * lat (NUMERIC):
  59. * height (NUMERIC):
  60. * iso (NUMERIC):
  61. * camera (TEXT):
  62. * orientation (NUMERIC):
  63. * width (NUMERIC):
  64. === Audio
  65. * album (TEXT):
  66. * artist (TEXT):
  67. * bitrate (NUMERIC):
  68. * duration (NUMERIC):
  69. * genre (TEXT):
  70. * title (TEXT):
  71. * track (NUMERIC):
  72. * year (NUMERIC):
  73. === Video
  74. * ratio (NUMERIC):
  75. == Search syntax (Whoosh)
  76. === Logic operators
  77. * AND
  78. ** **Example:** "foo AND bar" - Search will find all items with foo and bar.
  79. * OR
  80. ** **Example:** "foo OR bar" - Search will find all items with foo, bar or with foo and bar.
  81. * NOT
  82. ** **Example:** "foo NOT bar" - Search will find all items with foo and no bar.
  83. === Search in specific fields
  84. A search pattern like //foo:bar// does look for //bar// in the field named //foo//.
  85. This search pattern can also be combined with other search text via logical operators.
  86. === Search for specific content
  87. * **Wildcards:**
  88. * **Range:**
  89. ** From To:
  90. ** Above:
  91. ** Below:
  92. * **Named constants:**
  93. ** //now//: Current date
  94. ** //-[num]y//: Current date minus [num] years
  95. ** ...
  96. == Examples
  97. * [[/pygal/userview/search?q=type:video AND datetime:2018|type:video AND datetime:2018]] gives results with all videos in year 2018.
  98. * [[/pygal/userview/search?q=datetime:[-2y to now]|datetime:[-2y to now]]] gives results with all item of the last two years.
  99. * [[/pygal/userview/search?q=rel_path:2018*|rel_path:2018*]] gives results with all item having 2018 in their path.
  100. * [[/pygal/userview/search?q=tag:Test|tag:Test]] gives results with all item having Test in their tags.
  101. * [[/pygal/userview/search?q=datetime:2016 AND favourite_of:*|datetime:2016 AND favourite_of:*]] gives results with all item having 2018 in their tags or path and are favourite of someone.
  102. """))
  103. help_pages = {
  104. 'main': MAIN,
  105. 'faq': FAQ,
  106. 'access': ACCESS,
  107. 'search': SEARCH,
  108. }
  109. def actionbar(context, request, current_help_page=None, **kwargs):
  110. actionbar_entries = (
  111. ('1', 'Main'),
  112. ('2', 'Faq'),
  113. ('3', 'Access'),
  114. ('4', 'Search'),
  115. )
  116. for num, name in actionbar_entries:
  117. context[context.ACTIONBAR].append_entry(
  118. HELP_UID + '-%s' % name.lower(), # uid
  119. _(name), # name
  120. color_icon_url(request, num + '.png'), # icon
  121. pygal.url_helpview(request, name.lower()), # url
  122. True, # left
  123. name.lower() == current_help_page, # active
  124. )