-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
102 lines (69 loc) · 2.32 KB
/
main.py
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
91
92
93
94
95
96
97
98
99
100
101
102
__version__ = '0.3.5'
from kivy.app import App
from kivy.core.window import Window
from kivy.lang.builder import Builder
from kivy.uix.boxlayout import BoxLayout
from kivy.properties import NumericProperty, ListProperty
from kivy.uix.screenmanager import ScreenManager, Screen
from kivymd.theming import ThemeManager
from custom.button import CustomFlatIconButton
from update import Update
try:
import android
except ImportError:
android = None
if not android:
W = 335
Window.size = (W, W * 15.471074 / 9) #15.471074 / 9 соотношение сторон не фулскрин приложения на андроид
class Tab(CustomFlatIconButton):
index = NumericProperty(0)
bottom_line_color = ListProperty((1, 1, 1, 0))
class TabsBar(BoxLayout):
__events__ = ('on_switch_tab',)
current_tab = NumericProperty(0)
def on_create(self):
for i, tab in enumerate(self.children[::-1]):
tab.index = i
self.color_control()
def switch_tab(self, index):
self.current_tab = index
self.color_control()
self.dispatch('on_switch_tab')
def on_switch_tab(self):
pass
def color_control(self):
for tab in self.children:
if tab.index == self.current_tab:
tab.bottom_line_color[3] = .8
else:
tab.bottom_line_color[3] = 0
class MySettings(Screen):
pass
class Calculator(Screen):
def switch_screen(self, index):
screen = self.scr_mang.screen_names[index]
self.scr_mang.current = screen
class MainFrame(ScreenManager):
def switch_screen(self, index):
screen = self.scr_mang.screen_names[index]
self.scr_mang.current = screen
class CalculatorApp(App):
title = 'Calculator'
theme_cls = ThemeManager()
theme_cls.theme_style = 'Dark'
color_scheme = {
'button': (.6, .56, 1, .25),
'keyboard-button': (.9, .85, 1, .05),
'toolbar': (.6, .56, 1, .25),
}
version = __version__
git_version = ''
update_available = False
def build(self):
update = Update(self, Window)
update.start()
return Builder.load_string(open("kv/main.kv", encoding='utf-8').read())
def on_pause(self):
return True
if __name__ == '__main__':
CalculatorApp().run()