Django Library PyGal
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

help.py 4.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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_vendor (TEXT):
  62. * camera_model (TEXT):
  63. * orientation (NUMERIC):
  64. * width (NUMERIC):
  65. === Audio
  66. * album (TEXT):
  67. * artist (TEXT):
  68. * bitrate (NUMERIC):
  69. * duration (NUMERIC):
  70. * genre (TEXT):
  71. * title (TEXT):
  72. * track (NUMERIC):
  73. * year (NUMERIC):
  74. === Video
  75. * ratio (NUMERIC):
  76. == Search syntax (Whoosh)
  77. === Logic operators
  78. * AND
  79. ** **Example:** "foo AND bar" - Search will find all items with foo and bar.
  80. * OR
  81. ** **Example:** "foo OR bar" - Search will find all items with foo, bar or with foo and bar.
  82. * NOT
  83. ** **Example:** "foo NOT bar" - Search will find all items with foo and no bar.
  84. === Search in specific fields
  85. A search pattern like //foo:bar// does look for //bar// in the field named //foo//.
  86. This search pattern can also be combined with other search text via logical operators.
  87. === Search for specific content
  88. * **Wildcards:**
  89. * **Range:**
  90. ** From To:
  91. ** Above:
  92. ** Below:
  93. * **Named constants:**
  94. ** //now//: Current date
  95. ** //-[num]y//: Current date minus [num] years
  96. ** ...
  97. == Examples
  98. * [[/pygal/userview/search?q=type:video AND datetime:2018|type:video AND datetime:2018]] gives results with all videos in year 2018.
  99. * [[/pygal/userview/search?q=datetime:[-2y to now]|datetime:[-2y to now]]] gives results with all item of the last two years.
  100. * [[/pygal/userview/search?q=rel_path:2018*|rel_path:2018*]] gives results with all item having 2018 in their path.
  101. * [[/pygal/userview/search?q=tag:Test|tag:Test]] gives results with all item having Test in their tags.
  102. * [[/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.
  103. """))
  104. help_pages = {
  105. 'main': MAIN,
  106. 'faq': FAQ,
  107. 'access': ACCESS,
  108. 'search': SEARCH,
  109. }
  110. def actionbar(context, request, current_help_page=None, **kwargs):
  111. actionbar_entries = (
  112. ('1', 'Main'),
  113. ('2', 'Faq'),
  114. ('3', 'Access'),
  115. ('4', 'Search'),
  116. )
  117. for num, name in actionbar_entries:
  118. context[context.ACTIONBAR].append_entry(
  119. HELP_UID + '-%s' % name.lower(), # uid
  120. _(name), # name
  121. color_icon_url(request, num + '.png'), # icon
  122. pygal.url_helpview(request, name.lower()), # url
  123. True, # left
  124. name.lower() == current_help_page, # active
  125. )