aboutsummaryrefslogtreecommitdiffstats
path: root/tagit/widgets/browser.kv
blob: 63495be44f59bf845ece28b857bab553f2bf17c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#-- #:import OpenGroup tagit.actions.grouping

<Browser>:
    root: None
    spacing: 10
    size_hint: 1.0, 1.0
    page_size: self.cols * self.rows
    # must not define rows and cols

<BrowserItem>:
    is_cursor: False
    is_selected: False


<BrowserImage>: # This be an image
    preview: image

    AsyncBufferImage:
        id: image
        size_hint: None, None
        # actual size is set in code
        pos: 0, 0
        # coordinates of the (actual) image's top-right corner
        tr_x: self.center_x + self.texture.width / 2.0 if self.texture is not None else None
        tr_y: self.center_y + self.texture.height / 2.0 if self.texture is not None else None

    # FIXME: mb/port
    #OpenGroup:
    #    root: root.browser.root
    #    # positioning:
    #    # (1) top right corner of the root (inside root)
    #    #x: root.width - self.width
    #    #y: root.height - self.height
    #    # (2) top right corner of the root (inside root)
    #    #pos_hint: {'top': 1.0, 'right': 1.0}
    #    # (3) top right corner of the image (outside the image)
    #    #x: image.tx is not None and image.tx or float('inf')
    #    #y: image.ty is not None and image.ty or float('inf')
    #    # (4) top right corner of the image (inside root, outside the image if possible)
    #    tr_x: root.width - self.width
    #    tr_y: root.height - self.height
    #    x: min(self.tr_x, image.tr_x is not None and image.tr_x or float('inf'))
    #    y: min(self.tr_y, image.tr_y is not None and image.tr_y or float('inf'))
    #
    #    opacity: root.is_group and 1.0 or 0.0
    #    show: 'image', 

<BrowserDescriptionLabel@Label>:
    halign: 'left'
    valign: 'center'
    text_size: self.size

<BrowserDescription>: # This be a list item
    spacer: 20
    preview: image

    AsyncBufferImage:
        id: image
        size_hint: None, 1
        # actual size is set in code
        pos: 0, 0

    BrowserDescriptionLabel:
        text: root.text
        markup: True
        size_hint: None, 1
        width: root.width - image.width - root.spacer - 35
        pos: root.height + root.spacer, 0

<AsyncBufferImage>:
    mirror: False
    angle: 0
    opacity: 0

    canvas.before:
        PushMatrix
        Rotate:
            angle: self.mirror and 180 or 0
            origin: self.center
            axis: (0, 1, 0)

        Rotate:
            angle: self.angle
            origin: self.center
            axis: (0, 0, 1)

    canvas.after:
        PopMatrix

## EOF ##