-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFunctionButtonsList.py
More file actions
executable file
·80 lines (66 loc) · 2.57 KB
/
FunctionButtonsList.py
File metadata and controls
executable file
·80 lines (66 loc) · 2.57 KB
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
#!/usr/bin/python
import cairo
import math
from math import pi
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import GObject, Gtk
class FunctionButtonList(object):
def __init__(self):
self.ButtonList = []
self.source_id = 0
self.verticalLength = 0
def append(self, item):
self.ButtonList.append(item)
self.verticalLength += 145
def get_by_index(self, index):
return self.ButtonList[index]
def get_len(self):
return len(self.ButtonList)
def in_animation(self):
for i in range(0, len(self.ButtonList)):
if self.ButtonList[i].InAnimation:
return True
return False
def appear_all(self):
def appear_all_callback(Blist):
exbt = Blist.ButtonList[0]
flag = exbt.Real_dimension < exbt.Request_dimension
if flag:
for i in range(0, len(Blist.ButtonList)):
Blist.ButtonList[i].Gap -= 1
Blist.ButtonList[i].Real_dimension += 2
Blist.ButtonList[i].Alfa += 1 / 57
exbt.Parent.queue_draw()
else:
for i in range(0, len(Blist.ButtonList)):
Blist.ButtonList[i].InAnimation = False
GObject.source_remove(Blist.source_id)
return True
if not self.in_animation():
for i in range(0, len(self.ButtonList)):
self.ButtonList[i].Enabled = True
self.ButtonList[i].InAnimation = True
self.source_id = GObject.timeout_add(
2, appear_all_callback, self)
def desappear_all(self):
def desappear_all_callback(Blist):
exbt = Blist.ButtonList[0]
flag = exbt.Real_dimension > 1
if flag:
for i in range(0, len(Blist.ButtonList)):
Blist.ButtonList[i].Gap += 1
Blist.ButtonList[i].Real_dimension -= 2
Blist.ButtonList[i].Alfa -= 1 / 57
exbt.Parent.queue_draw()
else:
for i in range(0, len(Blist.ButtonList)):
Blist.ButtonList[i].InAnimation = False
Blist.ButtonList[i].Enabled = False
GObject.source_remove(Blist.source_id)
return True
if not self.in_animation():
for i in range(0, len(self.ButtonList)):
self.ButtonList[i].InAnimation = True
self.source_id = GObject.timeout_add(
2, desappear_all_callback, self)