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.

viewer.kv 5.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. #:kivy 1.9.0
  2. #:import SlideViewer hadaly.viewer.SlideViewer
  3. #:import PainterToolBar hadaly.viewer.PainterToolBar
  4. #:import Painter hadaly.painter.Painter
  5. #:import win kivy.core.window
  6. <ViewerScreen>:
  7. app: app
  8. box: _box
  9. carousel: _carousel
  10. BoxLayout:
  11. id: _box
  12. spacing: dp(10)
  13. Carousel:
  14. id: _carousel
  15. direction: 'right'
  16. loop: False
  17. TouchActionArea:
  18. app: app
  19. Widget:
  20. name: 'ltop'
  21. size_hint: 0.4,0.3
  22. pos_hint: {'top': 1}
  23. Widget:
  24. name: 'lbottom'
  25. size_hint: 0.4,0.3
  26. pos_hint: {'bottom': 1}
  27. Widget:
  28. name: 'rtop'
  29. size_hint: 0.4,0.3
  30. pos_hint: {'top': 1, 'right': 1}
  31. Widget:
  32. name: 'rbottom'
  33. size_hint: 0.4,0.3
  34. pos_hint: {'bottom': 1, 'right': 1}
  35. Widget:
  36. name: 'center'
  37. size_hint: 0.5,0.4
  38. pos_hint: {'center_x': 0.5, 'center_y': 0.5}
  39. <ImgFullZoom>:
  40. pos_hint: 0, 0
  41. size: 200, 200
  42. size_hint: None, None
  43. keep_ratio: True
  44. allow_stretch: False
  45. id: _img_zoom
  46. <SlidesDialog>:
  47. grid: _grid
  48. size_hint: 0.6, 0.6
  49. GridLayout:
  50. id: _grid
  51. cols: 6
  52. padding: [5,5,5,5]
  53. spacing: dp(5)
  54. dialog: root
  55. <SlideButton>:
  56. app:app
  57. on_press: self.parent.dialog.dismiss()
  58. <SlideBox>:
  59. viewer: _viewer
  60. float_layout: _float_layout
  61. toolbar: _toolbar
  62. painter: _painter
  63. FloatLayout:
  64. id: _float_layout
  65. viewer: _viewer
  66. SlideViewer:
  67. id: _viewer
  68. slidebox: root
  69. app: app
  70. image: _image
  71. painter: _painter
  72. do_rotation: False
  73. size: self.size
  74. on_size: self.center = self.center
  75. pos: self.parent.pos
  76. auto_bring_to_front: False
  77. AsyncImage:
  78. source: root.slide['img_src']
  79. keep_ratio: True
  80. mipmap: True
  81. id: _image
  82. pos_hint: {'center_x': 0.5, 'center_y': 0.5}
  83. Painter:
  84. id: _painter
  85. locked: True
  86. pos_hint: {'center_x': 0.5, 'center_y': 0.5}
  87. AnchorLayout:
  88. id: _gui_layout
  89. anchor_x:'right'
  90. anchor_y: app.config.get('viewer', 'caption_pos')
  91. pos: self.parent.pos
  92. BoxLayout:
  93. canvas.before:
  94. Color:
  95. rgba: (0, 0, 0, 1)
  96. Rectangle:
  97. pos: self.pos
  98. size: self.size
  99. orientation:'vertical'
  100. size_hint: 0.35, 0.1
  101. padding: [5, 5, 5, 5]
  102. ViewSlideLabel:
  103. id: _caption_artist
  104. text: root.slide.artist
  105. ViewSlideLabel:
  106. id: _caption_title
  107. text: root.slide.title
  108. italic: True
  109. ViewSlideLabel:
  110. id: _caption_year
  111. text: root.slide.year
  112. BoxLayout:
  113. id: _toolbar
  114. lock_btn: _lock_btn
  115. orientation: 'horizontal'
  116. spacing: dp(3)
  117. Button:
  118. id: _lock_btn
  119. background_color: [1, 1, 1, 0]
  120. border_color: [1,1,1,1]
  121. text: u'\uf13e'
  122. font_name: 'data/fonts/fontawesome-webfont.ttf'
  123. font_size: '30sp'
  124. size_hint: (None, None)
  125. size: (30, 30)
  126. on_press: root.viewer.lock()
  127. <ViewSlideLabel@Label>:
  128. font_size: app.config.getint('viewer', 'font_size')
  129. text_size: self.width, self.height
  130. size: self.parent.width, self.texture_size[1]
  131. shorten: True
  132. shorten_from: 'right'
  133. halign: 'center'
  134. <SlideImage@Image>:
  135. keep_ratio: True
  136. allow_stretch: False
  137. id: _image
  138. size: 400, 400
  139. <PainterToolBar>:
  140. id: _toolbar
  141. orientation: 'horizontal'
  142. color_picker: _color_picker
  143. size_hint: None, None
  144. size: (200, 40)
  145. spacing: dp(3)
  146. Button:
  147. background_color: [1, 1, 1, 0]
  148. border_color: [1,1,1,1]
  149. text: u'\uf12d'
  150. font_name: 'data/fonts/fontawesome-webfont.ttf'
  151. font_size: '30sp'
  152. size_hint: (None, None)
  153. size: (dp(30), dp(30))
  154. on_press: root.painter.canvas.clear()
  155. Button:
  156. id: _color_picker
  157. background_color: [1, 1, 1, 0]
  158. border_color: [1,1,1,1]
  159. text: u'\uf111'
  160. color: root.paint_color
  161. on_color: root.paint_color = self.color
  162. font_name: 'data/fonts/fontawesome-webfont.ttf'
  163. font_size: '30sp'
  164. size_hint: (None, None)
  165. size: (dp(30), dp(30))
  166. on_press: root.show_color_picker(self.color)
  167. Slider:
  168. id: _slider
  169. orientation: 'horizontal'
  170. min: 0.5
  171. max: 10
  172. step: 0.5
  173. value: root.thickness
  174. on_value: root.thickness = self.value