-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
162 lines (160 loc) · 7.22 KB
/
main.py
File metadata and controls
162 lines (160 loc) · 7.22 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
from logging import root
import kivymd
from kivymd import *
from kivymd.uix.label import MDLabel
from kivymd.uix.list import OneLineIconListItem
from kivymd.uix.list import MDList
from kivy.properties import StringProperty
from kivymd.app import MDApp
from kivy.utils import platform
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.floatlayout import FloatLayout
from kivymd.theming import ThemableBehavior
from kivy.uix.screenmanager import ScreenManager, Screen
from kivy_garden.mapview import MapView, MapSource
from kivymd.uix.behaviors import RoundedRectangularElevationBehavior, RectangularElevationBehavior, RectangularRippleBehavior
from kivymd.uix.card import MDCard
from os.path import join, dirname
class MD3Card(MDCard, RoundedRectangularElevationBehavior):
'''Implements a material design v3 card.'''
text = StringProperty()
class ContentScreen(Screen):
pass
class InicioScreen(Screen):
pass
class ConfiguracionScreen(Screen):
pass
class ContactoScreen(Screen):
pass
class AcercaDeScreen(Screen):
pass
class AppScreen(Screen):
pass
class MenuScreen(Screen):
pass
class InformacionScreen(Screen):
pass
class Dis_AuditivaScreen(Screen):
pass
class Dis_ComunicativaScreen(Screen):
pass
class Dis_FisicaScreen(Screen):
pass
class Dis_VisualScreen(Screen):
pass
class AyudaScreen(Screen):
pass
class Pais_CostaRicaScreen(Screen):
pass
class Pais_GuatemalaScreen(Screen):
pass
class Pais_PanamaScreen(Screen):
pass
class Pais_RepublicaDominicanaScreen(Screen):
pass
class ComunidadScreen(Screen):
pass
class LugaresScreen(Screen):
pass
class Pais_Lugares_CostaRicaScreen(Screen):
pass
class Pais_Lugares_GuatemalaScreen(Screen):
pass
class Pais_Lugares_PanamaScreen(Screen):
pass
class Pais_Lugares_RepublicaDominicanaScreen(Screen):
pass
class ForoScreen(Screen):
pass
class ItemDrawer(OneLineIconListItem):
icon = StringProperty()
class ContentNavigationDrawer(BoxLayout):
pass
class MyCard(RectangularElevationBehavior, RectangularRippleBehavior, FloatLayout):
ripple_scale = 1.4
text = StringProperty()
text_label = StringProperty()
class DrawerList(ThemableBehavior, MDList):
def set_color_item(self, instance_item):
# Set the color of the icon and text for the menu item.
for item in self.children:
if item.text_color == self.theme_cls.primary_color:
item.text_color = self.theme_cls.text_color
break
instance_item.text_color = self.theme_cls.primary_color
class generisapp(MDApp):
title = "Generis"
estado_asistente = 1
#Esta funcion solicita un nombre de archivo y nos retornara una ruta completa para acceder al archivo, dependiendo de la plataforma en la que se este ejecutando la app nos retornara la ruta para el archivo adecuado
def on_start(self):
icons_item = {
"home": "Inicio",
"phone-message": "Contacto",
"cog": "Configuración",
"information-variant": "Acerca de",
"power": "Salir",
}
for icon_name in icons_item.keys():
self.root.ids.appscreen.ids.md_list.add_widget(ItemDrawer(icon=icon_name, text=icons_item[icon_name]))
def showtext(self, txtfile):
with open(self.ruta(txtfile),"r") as f:
filetext = f.read()
return filetext
def back_to_appscreen(self):
self.root.current = "AppScreen"
self.root.ids.appscreen.ids.nav_drawer.set_state("toggle")
def call_drawerlist_menuderecho(self, button):
if button.icon == "book-information-variant":
self.root.ids.appscreen.ids.inicio_screen.ids.screen_manager_informacion.current = "InformacionScreen"
elif button.icon == "phone-message":
self.root.current = "ContactoScreen"
elif button.icon == "cog":
self.root.current = "ConfiguracionScreen"
elif button.icon == "information-variant":
self.root.current = "AcercaDeScreen"
elif button.icon == "power":
self.stop()
def call_btnspeeddial_informacion(self, button):
if button.icon == "book-information-variant":
self.root.ids.appscreen.ids.inicio_screen.ids.screen_manager_informacion.current = "InformacionScreen"
elif button.icon == "ear-hearing":
self.root.ids.appscreen.ids.inicio_screen.ids.screen_manager_informacion.current = "Dis_AuditivaScreen"
elif button.icon == "account-question":
self.root.ids.appscreen.ids.inicio_screen.ids.screen_manager_informacion.current = "Dis_ComunicativaScreen"
elif button.icon == "wheelchair-accessibility":
self.root.ids.appscreen.ids.inicio_screen.ids.screen_manager_informacion.current = "Dis_FisicaScreen"
elif button.icon == "eye":
self.root.ids.appscreen.ids.inicio_screen.ids.screen_manager_informacion.current = "Dis_VisualScreen"
def call_btnspeeddial_ayuda(self, button):
if button.icon == "account-question":
self.root.ids.appscreen.ids.inicio_screen.ids.screen_manager_ayuda.current = "AyudaScreen"
elif button.icon == str(self.ruta("images/CR.png")):
self.root.ids.appscreen.ids.inicio_screen.ids.screen_manager_ayuda.current = "Pais_CostaRicaScreen"
elif button.icon == str(self.ruta("images/GT.png")):
self.root.ids.appscreen.ids.inicio_screen.ids.screen_manager_ayuda.current = "Pais_GuatemalaScreen"
elif button.icon == str(self.ruta("images/PA.png")):
self.root.ids.appscreen.ids.inicio_screen.ids.screen_manager_ayuda.current = "Pais_PanamaScreen"
elif button.icon == str(self.ruta("images/DO.png")):
self.root.ids.appscreen.ids.inicio_screen.ids.screen_manager_ayuda.current = "Pais_RepublicaDominicanaScreen"
def call_btnspeeddial_lugares(self, button):
if button.icon == "map-marker-radius":
self.root.ids.appscreen.ids.inicio_screen.ids.screen_manager_lugares.current = "LugaresScreen"
elif button.icon == str(self.ruta("images/CR.png")):
self.root.ids.appscreen.ids.inicio_screen.ids.screen_manager_lugares.current = "Pais_Lugares_CostaRicaScreen"
elif button.icon == str(self.ruta("images/GT.png")):
self.root.ids.appscreen.ids.inicio_screen.ids.screen_manager_lugares.current = "Pais_Lugares_GuatemalaScreen"
elif button.icon == str(self.ruta("images/PA.png")):
self.root.ids.appscreen.ids.inicio_screen.ids.screen_manager_lugares.current = "Pais_Lugares_PanamaScreen"
elif button.icon == str(self.ruta("images/DO.png")):
self.root.ids.appscreen.ids.inicio_screen.ids.screen_manager_lugares.current = "Pais_Lugares_RepublicaDominicanaScreen"
def ruta(self, nombre_archivo):
curdir = dirname(__file__)
ruta_completa = join(curdir, 'resources/', nombre_archivo)
return ruta_completa
############################################
#Esta funcion permite mantener la app abierta aunque salgamos de ella, en android
def on_pause(self):
return True
#Ejecuta la app
if __name__ == '__main__':
generisapp().run()