def errormsg(self): self.popup.dismiss() self.box1 = BoxLayout(orientation='horizontal', spacing=15, padding=20) self.box = BoxLayout(orientation='vertical', spacing=15, padding=20) self.box.add_widget( MDLabel(halign="center", text="Connection Error....", font_style="H4", theme_text_color="Primary")) self.box.add_widget(self.box1) self.box1.add_widget( MDFillRoundFlatButton(font_size=20, text="Retry", theme_text_color="Custom", text_color=(0, 0, 0, 0), on_release=self.retry)) self.box1.add_widget( MDFillRoundFlatButton(font_size=20, text="Exit", theme_text_color="Custom", text_color=(0, 0, 0, 0), on_release=self.PopDismiss)) self.popup2 = Popup( auto_dismiss=False, separator_height=0, title="", content=self.box, size_hint=(1, .5), ) self.popup2.open()
def loadscreen(self): self.box1 = BoxLayout(orientation='horizontal', spacing=15) self.box = BoxLayout(orientation='vertical', spacing=15, padding=20) self.box.add_widget( MDLabel(halign="center", text="It Will Take Some Time....", font_style="H4", theme_text_color="Primary")) self.box.add_widget(self.box1) self.box1.add_widget( MDFillRoundFlatButton(font_size=20, text="Ok", on_release=self.get_info)) self.box1.add_widget( MDFillRoundFlatButton(font_size=20, text="Exit", on_release=self.PopDismiss)) self.popup = Popup( auto_dismiss=False, separator_height=0, title="", content=self.box, size_hint=(1, .5), ) self.popup.open()
def thirdPopup(): show = P3() # create content for the Popup bl = BoxLayout(orientation='vertical', padding=30) label = Label( text= ' Dimensional measurements \n missing. Please fill all the \n required measurements.', halign='center', valign='middle', color=[1, 1, 1, 1], font_size='18dp') bl.add_widget(label) popupWindow = Popup(title="ERROR", title_color=[1, 0, 0, 1], title_size='25dp', separator_color=[1, 0.4, 0, 1], content=bl, size_hint=(None, None), size=('350dp', '350dp')) btn = MDFillRoundFlatButton(text='OK got it !!!', size_hint=(0.7, 0.3), pos_hint={'center_x': 0.5}, on_release=popupWindow.dismiss) bl.add_widget(btn) popupWindow.open()
def diamPopup(): show = Pdiam() # create content for the Popup bl = BoxLayout(orientation='vertical', padding=30) label = Label( text= ' Diameter has to be positive number. \n Please try again with a positive value', halign='center', valign='middle', color=[1, 1, 1, 1], font_size='18dp') bl.add_widget(label) popupWindow = Popup(title="ERROR", title_color=[1, 0, 0, 1], title_size='25dp', separator_color=[1, 0.4, 0, 1], content=bl, size_hint=(None, None), size=('350dp', '350dp')) btn = MDFillRoundFlatButton(text='OK got it !!!', size_hint=(0.7, 0.3), pos_hint={'center_x': 0.5}, on_release=popupWindow.dismiss) bl.add_widget(btn) popupWindow.open()
def firstPopup(): show = P() #create content for the Popup bl = BoxLayout(orientation='vertical', padding=30) label = Label( text='You should put exactly 3 \n variables at the first segment', halign='center', valign='middle', color=[1, 1, 1, 1], font_size='18dp') bl.add_widget(label) popupWindow = Popup(title="ERROR", title_color=[1, 0, 0, 1], title_size='25dp', separator_color=[1, 0.4, 0, 1], content=bl, size_hint=(None, None), size=('350dp', '350dp')) btn = MDFillRoundFlatButton(text='OK got it !!!', size_hint=(0.7, 0.3), pos_hint={'center_x': 0.5}, on_release=popupWindow.dismiss) bl.add_widget(btn) popupWindow.open()
def error_Popup(): # show = P() #create content for the Popup bl = BoxLayout(orientation='vertical', padding=30) label = Label(text ='This combination of non dimensional \n'\ 'input has infinite solutions. Please \n'\ 'fill in one more coefficient or angle ',halign = 'center', valign = 'middle', color =[1, 1, 1, 1],font_size = '18dp') bl.add_widget(label) popupWindow = Popup(title="ERROR", title_color=[1, 0, 0, 1], title_size='25dp', separator_color=[1, 0.4, 0, 1], content=bl, size_hint=(None, None), size=('350dp', '350dp')) btn = MDFillRoundFlatButton(text='OK got it !!!', size_hint=(0.7, 0.3), pos_hint={'center_x': 0.5}, on_release=popupWindow.dismiss) bl.add_widget(btn) popupWindow.open()
def secondPopup(): show = P2() # create content for the Popup bl = BoxLayout(orientation='vertical', padding=30) label = Label(text=' This combination of variables\n' ' is not valid. \u03B11 has to be \n' ' greater than \u03B21 and \u03B12 has \n' ' to be greater than \u03B22. Please\n' ' try again with new variables', halign='center', valign='middle', color=[1, 1, 1, 1], font_size='18dp') bl.add_widget(label) popupWindow = Popup(title="ERROR", title_color=[1, 0, 0, 1], title_size='25dp', separator_color=[1, 0.4, 0, 1], content=bl, size_hint=(None, None), size=('350dp', '350dp')) btn = MDFillRoundFlatButton(text='OK got it !!!', text_color=[0.5, 1, 1, 1], size_hint=(0.7, 0.3), pos_hint={'center_x': 0.5}, on_release=popupWindow.dismiss) bl.add_widget(btn) popupWindow.open()
def __init__(self, **kwargs): super().__init__() self.app = MDApp.get_running_app() self.buttonPDF = MDFillRoundFlatButton( # BOTON PARA GENERAR PDF pos_hint={ "x": .05, "y": .1 }, size_hint=(.40, .1), text="Crear PDF", on_release=lambda x: self.opcionPDF()) self.buttonEXP = MDFillRoundFlatButton( # BOTON PARA EXPORTAR PDF pos_hint={ "x": .55, "y": .1 }, size_hint=(.40, .1), text="Exportar PDF a Drive", on_release=lambda x: self.exportarPDF()) self.buttontabla = MDFillRoundFlatButton( #Boton para mostrar tabla pos_hint={ "x": .3, "y": .3 }, size_hint=(.40, .1), text="Consultar Productos", on_release=lambda x: self.tablaproductos()) self.buttonconsulta = MDFillRoundFlatButton( # Boton para mostrar tabla pos_hint={ "x": .5, "y": .3 }, size_hint=(.40, .1), text="Consulta de prueba", on_release=lambda x: self.prueba()) #self.add_widget(self.buttonconsulta) #self.add_widget(self.data_tables)##### self.add_widget(self.buttonPDF) self.add_widget(self.buttonEXP) self.add_widget(self.buttontabla)
def sh_delete_item(self): yes_button = MDFillRoundFlatButton(text="Zmazať", on_release=self.close_del_dialog, on_press=self.delete_item) no_button = MDRoundFlatButton(text="Zrušiť", on_release=self.close_del_dialog) self.del_dialog = MDDialog(title="Naozaj zmazať test?", size_hint=[0.8, 0.5], auto_dismiss=False, buttons=[no_button, yes_button]) self.del_dialog.open()
def retry(self, *args): self.promtmsg = False self.againmsg = True self.error.dismiss() self.boxwithbutton = BoxLayout(orientation="horizontal", padding=15, spacing=15) self.boxwithmsg = BoxLayout(orientation="vertical", padding=15, spacing=15) self.boxcontain = BoxLayout(orientation="vertical", padding=15, spacing=15) self.boxwithmsg.add_widget( MDLabel(halign="center", font_style="H4", theme_text_color="Primary", text="This Will Take Some Time!")) self.boxwithbutton.add_widget( MDFillRoundFlatButton(font_size=20, text="Okay", theme_text_color="Custom", text_color=(0, 0, 0, 0), on_release=self.getinfo)) self.boxwithbutton.add_widget( MDFillRoundFlatButton(font_size=20, text="Exit", theme_text_color="Custom", text_color=(0, 0, 0, 0), on_release=self.close)) self.boxcontain.add_widget(self.boxwithmsg) self.boxcontain.add_widget(self.boxwithbutton) self.again = Popup( auto_dismiss=False, separator_height=0, title="", content=self.boxcontain, size_hint=(1, .5), ) self.again.open()
def create_special_row(self): """Creates the last row, which contains the button to get the 'analysis' """ row = MDBoxLayout(spacing=dp(50)) button = MDFillRoundFlatButton( text='Get more info!', on_release=lambda x: self.show_confirmation_dialog()) button.text_color = (1, 1, 1, 1) button.font_name = 'fonts/Montserrat-Regular.ttf' button.md_bg_color = (0.91, 0.46, 0.07, 1) row.add_widget(Widget()) # To center the button row.add_widget(button) row.add_widget(Widget()) return row
def errormsg(self, *args): self.confirm.dismiss() self.boxwithbutton = BoxLayout(orientation="horizontal", padding=15, spacing=15) self.boxwithmsg = BoxLayout(orientation="vertical", padding=15, spacing=15) self.boxcontain = BoxLayout(orientation="vertical", padding=15, spacing=15) self.boxwithmsg.add_widget( MDLabel(halign="center", font_style="H4", theme_text_color="Primary", text="Unable To Contact The Server!")) self.boxwithbutton.add_widget( MDFillRoundFlatButton(font_size=20, text="Try Again", theme_text_color="Custom", text_color=(0, 0, 0, 0), on_release=self.retry)) self.boxwithbutton.add_widget( MDFillRoundFlatButton(font_size=20, text="Exit", theme_text_color="Custom", text_color=(0, 0, 0, 0), on_release=self.close)) self.boxcontain.add_widget(self.boxwithmsg) self.boxcontain.add_widget(self.boxwithbutton) self.error = Popup( auto_dismiss=False, separator_height=0, title="", content=self.boxcontain, size_hint=(1, .5), ) self.error.open()
def load_resources_page(self): self.ids['float_lay'].clear_widgets() ContentNavigationDrawer.populateNavDrawerValues(self) query = f'''SELECT NAME,SUM(UNITS) AS UNITS, SUM(AMOUNT) AS AMOUNT FROM RESOURCES WHERE ACTIVITY_ID = {globalvariables.var_act_id} GROUP BY NAME ORDER BY NAME ''' # run direct SQL stmt = ibm_db.exec_immediate(connection.conn, query) txnlist = ibm_db.fetch_both(stmt) if txnlist is False : warn_label = MDLabel(pos_hint = {'center_x':0.5, 'center_y':0.5},font_size = '10sp', text = "No Resources yet") self.ids['float_lay'].add_widget(warn_label) else: print(txnlist) tlist=[] while(txnlist): tlist.append([txnlist[0],str(txnlist[1]),str(txnlist[2])]) txnlist = ibm_db.fetch_both(stmt) data_tables = MDDataTable( size_hint=(0.8, 0.8), rows_num=100, background_color=[1,0,0,1], pos_hint = {'center_x':0.5, 'center_y':0.5}, column_data=[ ("Resource", dp(50)), ("Units", dp(50)), ("Amount", dp(50)), ], row_data=[(f"{i[0]}",f"{i[1]}",f"{i[2]}") for i in tlist] ) self.ids['float_lay'].add_widget(data_tables) self.ids['float_lay'].add_widget(MDFillRoundFlatButton(text="BACK", pos_hint={'center_x':0.3, 'center_y':0.1}, theme_text_color="Custom", text_color= (0, 0, 1, 1), on_release=lambda x: self.to_previous_page() )) self.ids['float_lay'].add_widget(MDFillRoundFlatButton(text="DETAILS", pos_hint={'center_x':0.7, 'center_y':0.1}, theme_text_color="Custom", text_color= (0, 0, 1, 1), on_release=lambda x: self.to_details_page() ))
def askif(self, *args): self.boxwithbutton = BoxLayout(orientation="horizontal", padding=15, spacing=15) self.boxwithmsg = BoxLayout(orientation="vertical", padding=15, spacing=15) self.boxcontain = BoxLayout(orientation="vertical", padding=15, spacing=15) self.boxwithmsg.add_widget( MDLabel(halign="center", font_style="H4", theme_text_color="Primary", text="Are You Sure?")) self.boxwithbutton.add_widget( MDFillRoundFlatButton(font_size=20, text="Yes", theme_text_color="Custom", text_color=(0, 0, 0, 0), on_release=self.close)) self.boxwithbutton.add_widget( MDFillRoundFlatButton(font_size=20, text="No", theme_text_color="Custom", text_color=(0, 0, 0, 0), on_release=self.dis)) self.boxcontain.add_widget(self.boxwithmsg) self.boxcontain.add_widget(self.boxwithbutton) self.askmsg = Popup( auto_dismiss=False, separator_height=0, title="", content=self.boxcontain, size_hint=(1, .5), ) self.askmsg.open()
def __init__(self, **kwargs): super(Class_Screen1, self).__init__(**kwargs) ### self.Drawing = Draw_Stuff() ### self.Now_Press_Me_Button = MDFillRoundFlatButton() self.Press_Me_Button = MDFillRoundFlatButton() self.Clear_Screen_Button = MDFillRoundFlatButton() self.BStop = MDFillRoundFlatButton() self.TFDisplay = MDTextField() ### self.LH = 0 self.LW = 0 self.Xo = 0 self.Xf = 0 self.Xc = 0 self.Yo = 0 self.Yf = 0 self.Yc = 0 self.StrTime = '' self.To = time.time() self.Tf = time.time() ### return
def _update(self): if not self.button: self.button= MDFillRoundFlatButton(text="Ok") if not self.spinner: self.spinner= AKSpinnerDoubleBounce() self.button.pos_hint= {'center_x': .5, 'center_y': .5} self.button.bind(on_release=self._submit) self.spinner.pos_hint= {'center_x': .5, 'center_y': .5} self.ids.float_box.add_widget(self.button) self.ids.float_box.add_widget(self.spinner) self.ids.float_box.size = self.button.size self.spinner.spinner_size= self.button.height self._success_box_size= [0,self.button.height ] self._failure_box_size= [0,self.button.height ]
def load_hist_page(self): self.ids['float_lay'].clear_widgets() ContentNavigationDrawer.populateNavDrawerValues(self) query = f'''SELECT RES.DATE, CON.FIRST_NAME||' '||CON.LAST_NAME AS NAME, RES.NAME AS ITEM, RES.DESC AS DESC, RES.UNITS, RES.AMOUNT FROM RESOURCES RES, CONTACT CON WHERE RES.ACTIVITY_ID = {globalvariables.var_act_id} AND CON.CONTACT_ID = RES.CONTACT_ID ORDER BY RES.DATE DESC ''' # run direct SQL stmt = ibm_db.exec_immediate(connection.conn, query) txnlist = ibm_db.fetch_both(stmt) if txnlist is False : warn_label = MDLabel(pos_hint = {'center_x':0.5, 'center_y':0.5},font_size = '10sp', text = "No Resources yet") self.ids['float_lay'].add_widget(warn_label) else: print(txnlist) tlist=[] while(txnlist): tlist.append([txnlist[0],txnlist[1],txnlist[2], str(txnlist[3]), str(txnlist[4]), str(txnlist[5]) ]) txnlist = ibm_db.fetch_both(stmt) data_tables = MDDataTable( size_hint=(0.8, 0.8), rows_num=100, background_color=[1,0,0,1], pos_hint = {'center_x':0.5, 'center_y':0.5}, column_data=[ ("Date", dp(30)), ("Name", dp(30)), ("Item", dp(30)), ("Description", dp(30)), ("Units", dp(30)), ("Amount", dp(30)), ], row_data=[(f"{i[0]}",f"{i[1]}",f"{i[2]}",f"{i[3]}",f"{i[4]}",f"{i[5]}") for i in tlist] ) self.ids['float_lay'].add_widget(data_tables) self.ids['float_lay'].add_widget(MDFillRoundFlatButton(text="BACK", pos_hint={'center_x':0.5, 'center_y':0.1}, theme_text_color="Custom", text_color= (0, 0, 1, 1), on_release=lambda x: self.to_previous_page() ))
def create_card(self, session_workout_name, session_date, session_duration, sessions_date_key, num_exc_completed): new_card_layout = MDFloatLayout() # for centering if self.app.reload_for_running_session: excCard = MDCard( spacing=8, radius=[80, 0, 80, 0], orientation="horizontal", size_hint=(0.95, 0.97), padding=[40, 40, 20, 40], # [padding_left, padding_top,padding_right, padding_bottom]. pos_hint={"center_y": 0.5, "center_x": 0.5}, background="resources/card_back_prev.png", elevation=1, on_release=self.view_session, ) else: excCard = LongPressCard( spacing=8, radius=[80, 0, 80, 0], orientation="horizontal", size_hint=(0.95, 0.97), padding=[40, 40, 20, 40], # [padding_left, padding_top,padding_right, padding_bottom]. pos_hint={"center_y": 0.5, "center_x": 0.5}, background="resources/card_back_prev.png", elevation=1, long_press_time=0.5, on_long_press=lambda w: setattr(w, 'text', 'long press!') ) excCard.card_id = excCard # help_layout = self.create_top_card_layout(num_of_exc, num_of_exc_total, exc) # excCard.add_widget(help_layout) session_date = session_date.ctime()[0:10] session_date = " " + session_date[8:] + "\n " + session_date[4:7] print(session_date) date_size_hint_x = 0.2 if self.app.reload_for_running_session: date_size_hint_x = 0.25 date_label = MDLabel( text=session_date, font_style="H6", size_hint=(date_size_hint_x, 1), theme_text_color="Custom", text_color=(1, 1, 1, 1) ) excCard.add_widget(date_label) main_layout = MDGridLayout(rows=2, cols=2, spacing=20) deleteBox = MDCheckbox( size_hint=(0.5, 0.75), on_release=self.update_del_num ) deleteBox.opacity = 0 self.session_card_by_checkBox[deleteBox] = excCard workout_name_label = MDLabel( text=session_workout_name, font_style="H5", theme_text_color="Custom", text_color=self.app.text_color, size_hint=(1.6, 1.6) ) workout_completed_label = MDLabel( text=str(num_exc_completed) + " Exercises Completed", font_style="Caption", size_hint=(0.8, 0.4), theme_text_color="Secondary" ) workout_duration_label = MDLabel( text=" " + session_duration, font_style="Caption", size_hint=(0.6, 0.1), theme_text_color="Secondary" ) main_layout.add_widget(workout_name_label) main_layout.add_widget(deleteBox) # main_layout.add_widget(workout_duration_label) main_layout.add_widget(workout_completed_label) # if self.app.reload_for_running_session: # main_layout.add_widget(MDLabel( # text="", # size_hint=(0.1,0.1))) # # main_layout.add_widget(MDFillRoundFlatButton( # text="LOAD", # text_color=(1, 1, 1, 1), # size_hint=(0.3,1.5), # on_release=self.load_for_running_session)) excCard.add_widget(main_layout) if self.app.reload_for_running_session: excCard.add_widget(MDFillRoundFlatButton( text="LOAD", text_color=(1, 1, 1, 1), on_release=self.load_for_running_session)) new_card_layout.add_widget(excCard) self.session_key_by_card[excCard] = sessions_date_key return new_card_layout
def __init__(self, **kwargs): super().__init__() self.app = MDApp.get_running_app() self.mapview = MapView(lat=19.60389, lon=-99.01260, zoom=10 ) self.marcadoresches = [] self.marcadoressor = [] self.marcadorescomer = [] self.marcadoreshbe = [] self.marcadoresbusqueda = [] self.tipocomercio = '' self.datoshbe = { 'hbe1': {'direccion': 'HDA. CERRO GORDO ', 'colonia': 'Balcones Campestre', 'lat': 21.156959409958873, 'lon': -101.70300001710274, 'tel': '8181531100', 'cp': '37150', 'municipio': 'Leon, Guanajuato' }, 'hbe2': {'direccion': 'BLVD. ADOLFO LÓPEZ MATEOS 2102', 'colonia': 'Jardines del Moral', 'lat': 21.146246179033383, 'lon': -101.68449454293152, 'tel': '4777198103', 'cp': '37160', 'municipio': 'Leon, Guanajuato' }, 'hbe3': {'direccion': 'BLVD. ADOLFO LOPEZ MATEOS 2102', 'colonia': 'Jardines del Moral', 'lat': 21.146236158514455, 'lon': -101.6846125617232, 'tel': '4777198103', 'cp': '37160', 'municipio': 'Leon, Guanajuato' }, 'hbe4': {'direccion': 'AV. Guerrero 2415', 'colonia': 'Terracota', 'lat': 20.695401634729016, 'lon': -101.35843141409075, 'tel': '4621190160', 'cp': '36620', 'municipio': 'Irapuato, Guanajuato' }, } self.datosches = { 'che1': {'direccion': '4TA. AVENIDA NO. 257 LOTE 1', 'colonia': 'Fracc Rey Neza', 'lat': 19.40068, 'lon': -98.98720, 'tel': '54412720', 'cp': '57000', 'municipio': 'Nezahualcoyotl' }, 'che2': {'direccion': 'AV. TEXCOCO NO. 292', 'colonia': 'Pavón', 'lat': 19.396626, 'lon': -99.048428, 'tel': '11038000 ext 37140', 'cp': '57610', 'municipio': 'Nezahualcoyotl' }, 'che3': {'direccion': 'AV. RIO DE LA LOZA NO. 4 ', 'colonia': 'San Miguel Chalma', 'lat': 19.545221, 'lon': -99.152201, 'tel': '11038000 ext 37130', 'cp': '07160', 'municipio': 'Tlalnepantla' }, 'che4': {'direccion': 'AV. INSURGENTES SIN NUMERO', 'colonia': 'Calvario', 'lat': 19.60237, 'lon': -99.05572, 'tel': 'Sin tel', 'cp': '55020', 'municipio': 'Ecatepec de Morelos' }, 'che5': {'direccion': 'AV ALFREDO DEL MAZO NO. 705', 'colonia': 'Tlacopa', 'lat': 19.309995, 'lon': -99.635682, 'tel': '017222379445', 'cp': '50100', 'municipio': 'Toluca de Lerdo' }, 'che6': {'direccion': 'PROL. GUADALUPE VICTORIA NO. 471', 'colonia': 'La Purisima', 'lat': 19.258697, 'lon': -99.628197, 'tel': '017222127113', 'cp': '52140', 'municipio': 'Metepec' }, 'che7': {'direccion': 'BLVRD JUAN HERRERA Y PIÑA 7', 'colonia': 'Barrio Otumba', 'lat': 19.204049, 'lon': -100.125421, 'tel': '7262626942', 'cp': '51200', 'municipio': 'Valle de Bravo' }, 'che8': {'direccion': 'BLVD. MANUEL AVILA CAMACHO 5', 'colonia': 'Lomas de Sotelo', 'lat': 19.454290, 'lon': -99.219101, 'tel': '7262626942', 'cp': '53390', 'municipio': 'Naucalpan de Juárez' }, 'che9': {'direccion': 'AV. DE LOS BOSQUES NO. 128', 'colonia': 'Lomas de Tecamachalco', 'lat': 19.411133, 'lon': -99.250840, 'tel': '5555967887', 'cp': '52780', 'municipio': 'Huixquilucan' }, 'che10': {'direccion': 'AV. CENTRAL ESQ. AV JARDINES DE MORELOS S/N', 'colonia': 'Jardínes de Morelos', 'lat': 19.603457, 'lon': -99.013337, 'tel': '5558371634', 'cp': '55065', 'municipio': 'Ecatepec de Morelos' }, 'che11': {'direccion': 'AV.AQUILES SERDAN 360', 'colonia': 'El Mirador', 'lat': 19.257597, 'lon': -99.022525, 'tel': '5525942726', 'cp': '16740', 'municipio': 'Xochimilco' }, 'che12': {'direccion': 'CTRA. A SANTIAGO TEPELCATLALPAN 400', 'colonia': 'Santiago Tepalcatlalpan', 'lat': 19.257736, 'lon': -99.122394, 'tel': '5555557600', 'cp': '16210', 'municipio': 'Xochimilco' }, 'che13': {'direccion': 'AV. UNIVERSIDAD 740', 'colonia': 'Sta Cruz Atoyac', 'lat': 19.373194, 'lon': -99.162387, 'tel': '8005632222', 'cp': '03310', 'municipio': 'Benito Juárez' }, 'che14': {'direccion': 'VASCO DE QUIROGA 3800', 'colonia': 'Lomas de Santa Fe', 'lat': 19.359963, 'lon': -99.274583, 'tel': '5521678307', 'cp': '05348', 'municipio': 'Cuajimalpa' }, 'che15': {'direccion': 'AV. BENITO JUAREZ NO. 39 MZ 36', 'colonia': 'Presidentes', 'lat': 19.376661, 'lon': -99.223099, 'tel': '5511038000', 'cp': '01290', 'municipio': 'Álvaro Obregón' }, 'che16': {'direccion': 'AV. CANAL DE TEZONTLE 1512', 'colonia': 'Área Federal Central de Abastos', 'lat': 19.384808, 'lon': -99.082368, 'tel': '5511038000', 'cp': '09020', 'municipio': 'Iztapalapa' }, 'che17': {'direccion': 'BUEN TONO NO. 8', 'colonia': 'Centro', 'lat': 19.428273, 'lon': -99.143175, 'tel': '5555124069', 'cp': '06070', 'municipio': 'Cuahtémoc' }, 'che18': {'direccion': 'BLVD. MIGUEL DE CERVANTES SAAVEDRA 397', 'colonia': 'Irrigación', 'lat': 19.441866, 'lon': -99.206946, 'tel': '5555803422', 'cp': '11579', 'municipio': 'Miguel Hidalgo' }, 'che19': {'direccion': 'AV. CUAUTEPEC NO. 117', 'colonia': 'Jorge Negrete', 'lat': 19.526125, 'lon': -99.141422, 'tel': '8009251111', 'cp': '07280', 'municipio': 'Gustavo A. Madero' }, 'che20': {'direccion': 'AV. FORTUNA 334', 'colonia': 'Magdalena de las Salinas', 'lat': 19.482093, 'lon': -99.130347, 'tel': '8009251111', 'cp': '07760', 'municipio': 'Gustavo A. Madero' }, } self.datossor = { 'sor1': {'direccion': 'CTRA. MEXICO-TEPEXPAN ESQ. LOS REYES TEXCOCO NO. 8', 'colonia': 'San Isidro Atlautenco', 'lat': 19.620721, 'lon': -98.997171, 'tel': '8007074262', 'cp': '55064', 'municipio': 'Ecatepec de Morelos' }, 'sor2': {'direccion': 'LA PURISIMA NO. 5', 'colonia': 'San Cristóbal Lejipaya', 'lat': 19.602854, 'lon': -98.946640, 'tel': '5949569566', 'cp': '55800', 'municipio': 'Atenco' }, 'sor3': {'direccion': 'AV. CENTRAL 65', 'colonia': '1ro de Agosto', 'lat': 19.551379, 'lon': -99.018549, 'tel': '8002201234', 'cp': '55100', 'municipio': 'Ecatepec de Morelos' }, 'sor4': {'direccion': 'MEXICO NO. 5', 'colonia': 'Cd. López Mateos', 'lat': 19.568340, 'lon': -99.250645, 'tel': '5558225029', 'cp': '52960', 'municipio': 'Atizapán' }, 'sor5': {'direccion': 'AV. 16 DE SEPTIEMBRE 34', 'colonia': 'Paraiso II', 'lat': 19.631577, 'lon': -99.119169, 'tel': '8007074262', 'cp': '55700', 'municipio': 'Coacalco' }, 'sor6': {'direccion': 'AV. CUITLAHUAC 372', 'colonia': 'Cuitlahuac', 'lat': 19.471089, 'lon': -99.170700, 'tel': '8002201234', 'cp': '02530', 'municipio': 'Azcapotzalco' }, 'sor7': {'direccion': 'AV. TOLTECAS S/N', 'colonia': 'Hab. Los Reyes', 'lat': 19.53765, 'lon': -99.189802, 'tel': '5516659002', 'cp': '54090', 'municipio': 'Tlalnepantla' }, 'sor8': {'direccion': 'AV. GUSTAVO BAZ PRADA 250', 'colonia': 'Bosques de Echegaray', 'lat': 19.491437, 'lon': -99.227430, 'tel': '5553736844', 'cp': '53300', 'municipio': 'Naucalpan' }, 'sor9': {'direccion': 'CALLE MEXIQUENSE 31', 'colonia': 'Los Héroes Tecámac', 'lat': 19.633013, 'lon': -99.033405, 'tel': '5558369960', 'cp': '55765', 'municipio': 'Tecámac' }, 'sor10': {'direccion': 'CTRA. MEX-QRT KM 36.8', 'colonia': 'Reforma Política', 'lat': 19.650797, 'lon': -99.195386, 'tel': '8002201234', 'cp': '54700', 'municipio': 'Cuautitlán Izcalli' }, 'sor11': {'direccion': 'AV. STA. FE 46', 'colonia': 'Lomas de Santa Fe', 'lat': 19.357175, 'lon': -99.273897, 'tel': 'Sin info', 'cp': '01219', 'municipio': 'Cuajimalpa' }, 'sor12': {'direccion': 'AV. IMAN 550', 'colonia': 'Pedregal de Carrasco', 'lat': 19.306898, 'lon': -99.164659, 'tel': '5555288345', 'cp': '04700', 'municipio': 'Coyoacán' }, 'sor13': {'direccion': 'ERMITA IZTAPALAPA 3016', 'colonia': 'Reforma Politica', 'lat': 19.344716, 'lon': -99.027594, 'tel': '8183299252', 'cp': '09730', 'municipio': 'Iztapalapa' }, 'sor14': {'direccion': 'CALZ. DE LA VIGA 1805', 'colonia': 'Mexicaltzingo', 'lat': 19.360090, 'lon': -99.123618, 'tel': '8183299252', 'cp': '09080', 'municipio': 'Iztapalapa' }, 'sor15': {'direccion': 'AV. REVOLUCION 780', 'colonia': 'San Juan', 'lat': 19.379381, 'lon': -99.185600, 'tel': '5555655046', 'cp': '03730', 'municipio': 'Benito Juárez' }, 'sor16': {'direccion': 'OBRERO MUNDIAL 320', 'colonia': 'Piedad Narvarte', 'lat': 19.402383, 'lon': -99.154002, 'tel': '5583299000', 'cp': '03000', 'municipio': 'Benito Juárez' }, 'sor17': {'direccion': 'AV. EL ROSARIO 901', 'colonia': 'El Rosario', 'lat': 19.504132, 'lon': -99.200933, 'tel': '8007074262', 'cp': '02100', 'municipio': 'Azcapotzalco' }, 'sor18': {'direccion': 'CALZ. DE LOS MISTERIOS 62', 'colonia': 'Tepeyac Insurgentes', 'lat': 19.489655, 'lon': -99.119282, 'tel': '8002201234', 'cp': '07020', 'municipio': 'Gustavo A. Madero' }, 'sor19': {'direccion': 'AV. EJERCITO NACIONAL 769', 'colonia': 'Granada', 'lat': 19.439809, 'lon': -99.199979, 'tel': '5591260960', 'cp': '11520', 'municipio': 'Miguel Hidalgo' }, 'sor20': {'direccion': 'AV JARDIN 330', 'colonia': 'Col del Gas', 'lat': 19.468902, 'lon': -99.159565, 'tel': '8002201234', 'cp': '02970', 'municipio': 'Azcapotzalco' }, } self.datoscomer = { 'comer1': {'direccion': 'CALZ DEL HUESO 530', 'colonia': 'Fracc. Los Girasoles', 'lat': 19.305154, 'lon': -99.126231, 'tel': '01 800 3777 333', 'cp': '4929', 'municipio': 'Coyoacan' }, 'comer2': {'direccion': 'ATENAS 6', 'colonia': 'Fracc. Valle Dorado', 'lat': 19.551346, 'lon': -99.209801, 'tel': '01 800 3777 333', 'cp': '54020', 'municipio': 'Tlalnepantla' }, 'comer3': {'direccion': 'BLVD MANUEL AVILA CAMACHO 3228', 'colonia': 'Boulevares', 'lat': 19.498145, 'lon': -99.237891, 'tel': '01 800 3777 333', 'cp': '53100', 'municipio': 'Naucalpan de Juárez' }, 'comer4': {'direccion': 'PLAZUELA DE LA FAMA 1', 'colonia': 'La Fama', 'lat': 19.288794, 'lon': -99.179277, 'tel': '01 800 3777 333', 'cp': '14410', 'municipio': 'Tlalpan' }, 'comer5': {'direccion': 'CIRCUITO MEDICOS 35', 'colonia': 'Ciudad Satélite', 'lat': 19.509474, 'lon': -99.232960, 'tel': '01 800 3777 333', 'cp': '53100', 'municipio': 'Naucalpan de Juárez' }, 'comer6': {'direccion': 'NOGAL 212', 'colonia': 'Santa María La Ribera', 'lat': 19.451636, 'lon': -99.163952, 'tel': '01 800 3777 333', 'cp': '6400', 'municipio': 'Cuauhtémoc' }, 'comer7': {'direccion': 'CTRA A CELAYA 2', 'colonia': 'Fracc. La Lejona 2da Sección', 'lat': 20.897708, 'lon': -100.752716, 'tel': '01 800 3777 333', 'cp': '37765', 'municipio': 'San Miguel Allende' }, 'comer8': {'direccion': 'AV DE LAS TORRES 446', 'colonia': 'San José del Olivar', 'lat': 19.334798, 'lon': -99.227121, 'tel': '01 800 3777 333', 'cp': '1770', 'municipio': 'Álvaro Obregón' }, 'comer9': {'direccion': 'AV MAGNOCENTRO LT 1 MZ 2', 'colonia': 'San Fernando Huixquilucan', 'lat': 19.399401, 'lon': -99.276681, 'tel': '01 800 3777 333', 'cp': '52796', 'municipio': 'Huixquilucan' }, 'comer10': {'direccion': 'XOCHIMILCO 343', 'colonia': 'Anahuac', 'lat': 19.438072, 'lon': -99.179588, 'tel': '01 800 3777 333', 'cp': '11320', 'municipio': 'Miguel Hidalgo' }, 'comer11': {'direccion': 'BOSQUES DE MOCTEZUMA 1B', 'colonia': 'Fracc. La Herradura', 'lat': 19.416958, 'lon': -99.249047, 'tel': '01 800 3777 333', 'cp': '53920', 'municipio': 'Huixquilucan' }, 'comer12': {'direccion': 'CALZ ERMITA IZTAPALAPA 3865', 'colonia': 'Santa María Aztahuacán', 'lat': 19.351905, 'lon': -99.012747, 'tel': '01 800 3777 333', 'cp': '9730', 'municipio': 'Iztapalapa' }, 'comer13': {'direccion': 'PERPETUA 35', 'colonia': 'San José Insurgentes', 'lat': 19.366372, 'lon': -99.182357, 'tel': '01 800 3777 333', 'cp': '3900', 'municipio': 'Benito Juárez' }, 'comer14': {'direccion': 'MIGUEL ANGEL DE QUEVEDO 443', 'colonia': 'Romero de Terreros', 'lat': 19.345040, 'lon': -99.171795, 'tel': '01 800 3777 333', 'cp': '4310', 'municipio': 'Coyoacán' }, 'comer15': {'direccion': 'BOSQUE DE ARRAYAN MZ 5 LT 1', 'colonia': 'Fracc. Conjunto Urbano Bosque Esmeralda', 'lat': 19.548925, 'lon': -99.287349, 'tel': '01 800 3777 333', 'cp': '52973', 'municipio': 'Atizapán de Zaragoza' }, 'comer16': {'direccion': 'AV DE LAS FUENTES 190', 'colonia': 'Lomas de Tecamachalco', 'lat': 19.421845, 'lon': -99.237988, 'tel': '01 800 3777 333', 'cp': '53950', 'municipio': 'Naucalpán de Juárez' }, 'comer17': {'direccion': 'PROLONGACION BOSQUES DE REFORMA 1813', 'colonia': 'Vista Hermosa', 'lat': 19.382919, 'lon': -99.267804, 'tel': '01 800 3777 333', 'cp': '5109', 'municipio': 'Cuajimalpa' }, 'comer18': {'direccion': 'AV. JESUS DEL MONTE 271', 'colonia': 'Jesús del Monte', 'lat': 19.388758, 'lon': -99.293395, 'tel': '01 800 3777 333', 'cp': '52764', 'municipio': 'Huixquilucan' }, 'comer19': {'direccion': 'AV. MIGUEL ANGEL DE QUEVEDO 1144', 'colonia': 'Parque San Andrés', 'lat': 19.342817, 'lon': -99.146703, 'tel': 'Sin Datos', 'cp': '4040', 'municipio': 'Coyoacan' }, 'comer20': {'direccion': 'AV. DEL CARMEN 335', 'colonia': 'Fracc. Avandaro', 'lat': 19.164580, 'lon': -100.125154, 'tel': 'Sin Datos', 'cp': '51200', 'municipio': 'Valle de Bravo' }, } self.entradafield = MDTextFieldRect(pos_hint={"x": .05, "y":.93}, hint_text = "Buscar por Municipio, Colonia, Calle", size_hint = (.6, .060), height = "30dp" ) self.borramarcador = MDIconButton(pos_hint={"x": .80, "y":.9}, icon = "map-marker-off", user_font_size = "32sp", ) self.botonbusqueda = MDIconButton(pos_hint={"x": .65, "y": .9}, icon="magnify", user_font_size="32sp", ) self.botongps = MDIconButton(pos_hint={"x": .75, "y": .03}, icon = "crosshairs-gps", user_font_size = "32sp" ) self.botonayuda = MDIconButton(pos_hint={"x": .75, "y": .13}, #falta agregar funcion para mostrar icon="help-box", user_font_size="32sp" ) self.botonche = MDFillRoundFlatButton(pos_hint={"x": .1, "y": .05}, size_hint=(.25, .07), text = "Chedraui", ) self.mr = Image(source="imagenes/pinrojo.png", pos_hint={"x": -.385, "y": -.41}) self.botonhbe = MDFillRoundFlatButton(pos_hint={"x": .5, "y": .05}, size_hint=(.25, .07), text="HEB" ) self.mg = Image(source="imagenes/pingris.png", pos_hint={"x": .013, "y": -.41}) self.botoncomer = MDFillRoundFlatButton(pos_hint={"x": .1, "y": .15}, size_hint=(.25, .07), text="La Comer" ) self.mv = Image(source="imagenes/pinverde.png", pos_hint={"x": -.385, "y": -.31}) self.botonsor = MDFillRoundFlatButton(pos_hint={"x": .5, "y": .15}, size_hint=(.25, .07), text="Soriana" ) self.ma = Image(source="imagenes/pinazul.png", pos_hint={"x": .013, "y": -.31}) self.botongps.bind(on_press=lambda x: self.ActivaGPS()) self.botonayuda.bind(on_press=lambda x: self.AyudaMapa()) self.botonche.bind(on_press=lambda x: self.Consulta_Che()) self.botonsor.bind(on_press=lambda x: self.Consulta_Sor()) self.botoncomer.bind(on_press=lambda x: self.Consulta_Comer()) self.botonhbe.bind(on_press=lambda x: self.Consulta_HBE()) self.borramarcador.bind(on_press=lambda x: self.BorraMarcador()) self.botonbusqueda.bind(on_press=lambda x: self.Consulta_Busqueda()) self.add_widget(self.mapview) # Se agrega el mapa en la "capa inferior" #self.add_widget(self.botongps) # En una "capa" posterior se agrega el boton para que se vea self.add_widget(self.botonbusqueda) self.add_widget(self.entradafield) self.add_widget(self.botonche) self.add_widget(self.botonhbe) self.add_widget(self.botoncomer) self.add_widget(self.botonsor) self.add_widget(self.botonayuda) self.add_widget(self.borramarcador) self.add_widget(self.mr) self.add_widget(self.mv) self.add_widget(self.mg) self.add_widget(self.ma)
def __init__(self, **kwargs): super().__init__(**kwargs) self.app = MDApp.get_running_app() self.valorbarra = 0 self.buttonactualizar = MDRectangleFlatIconButton( pos_hint={ "center_x": .5, "top": .95 }, #size_hint = (.3,.1), icon="cart-arrow-down", text=" Precios", ) self.msgactualiza = MDLabel(text='Actualizando, espera por favor', pos_hint={ "center_x": .5, "top": .87 }, size_hint=(.8, .1), theme_text_color="Primary", font_style="Subtitle1", halign="center") self.barra = MDProgressBar(id="barrasss", value=0, pos_hint={ "center_x": .5, "center_y": .80 }, size_hint=(.9, .1)) self.etiqueta1 = MDLabel(text='Consultar por Tienda', pos_hint={ "center_x": .5, "top": .80 }, size_hint=(.5, .1), theme_text_color="Primary", font_style="Subtitle1", halign="center") self.buttonche = MDFillRoundFlatButton( pos_hint={ "x": .05, "y": .6 }, size_hint=(.40, .1), text="Chedraui", on_release=lambda x: self.verboton('che')) self.buttonsor = MDFillRoundFlatButton( pos_hint={ "x": .55, "y": .6 }, size_hint=(.40, .1), text="Soriana", on_release=lambda x: self.verboton('sor')) self.buttonhbe = MDFillRoundFlatButton( pos_hint={ "x": .05, "y": .45 }, size_hint=(.40, .1), #theme_text_color = "Primary", text="HBE", on_release=lambda x: self.verboton('hbe')) self.buttoncomer = MDFillRoundFlatButton( pos_hint={ "x": .55, "y": .45 }, size_hint=(.40, .1), text="La Comer", on_release=lambda x: self.verboton('comer')) self.etiqueta2 = MDLabel(text='Consultar por Categoría', pos_hint={ "center_x": .5, "top": .40 }, size_hint=(.5, .1), theme_text_color="Primary", font_style="Subtitle1", halign="center") self.buttonfrutas = MDFillRoundFlatButton( pos_hint={ "x": .05, "y": .20 }, size_hint=(.25, .1), text="Frutas", on_release=lambda x: self.verboton('frutas')) self.buttonverduras = MDFillRoundFlatButton( pos_hint={ "x": .35, "y": .20 }, size_hint=(.25, .1), text="Verduras", on_release=lambda x: self.verboton('verduras')) self.buttoncarnes = MDFillRoundFlatButton( pos_hint={ "x": .65, "y": .20 }, size_hint=(.25, .1), text='Carnes', on_release=lambda x: self.verboton('carnes')) self.buttonlacteos = MDFillRoundFlatButton( pos_hint={ "x": .20, "y": .05 }, size_hint=(.25, .1), text='Lácteos', on_release=lambda x: self.verboton('lacteos')) self.buttonenlatados = MDFillRoundFlatButton( pos_hint={ "x": .50, "y": .05 }, size_hint=(.25, .1), text='Enlatados', on_release=lambda x: self.verboton('enlatados')) self.buttonactualizar.bind(on_press=lambda x: self.ActualizaPrecio()) self.add_widget(self.buttonactualizar) self.add_widget(self.buttonche) self.add_widget(self.buttonsor) self.add_widget(self.buttonhbe) self.add_widget(self.buttoncomer) self.add_widget(self.etiqueta1) self.add_widget(self.etiqueta2) self.add_widget(self.buttonfrutas) self.add_widget(self.buttonverduras) self.add_widget(self.buttoncarnes) self.add_widget(self.buttonlacteos) self.add_widget(self.buttonenlatados)
def __init__(self, **kwargs): super(MDRaisedButton).__init__(**kwargs) super().__init__(**kwargs) self.i = Image() self.incoming = MDFillRoundFlatButton() self.msg = MDFillRoundFlatButton() self.incoming_text = MDLabel() self.text_msg = MDLabel() self.Box = MDBoxLayout() self.count = 0 self.count_the_length = 0 self.screen = MDGridLayout( cols=1, rows=2, md_bg_color=hex8("#00ffff"), size_hint=[1, 1]) self.size = [1, 1] self.Scroll = ScrollView() self.Scroll.scroll_type = ["content", "bars"] self.Scroll.bar_color = hex8("#000000") self.Scroll.bar_width = "5dp" self.text = TextInput( font_name="Default.ttf", size_hint=[1, 1], font_size=23, multiline=False) self.button = MDRaisedButton( size_hint=[0.124, 0.124], font_name="Arial", on_press=lambda message:self.send_it(self.text.text)) self.button.md_bg_color = hex8("#ff00ff") self.button.text = "send" self.button.text_color = hex8("#000000") self.Top = MDGridLayout( cols=2, rows=1, md_bg_color=hex8("#00ffff"), size_hint_x=1, size_hint_y=1, minimum_height=20) self.Container = MDBoxLayout( md_bg_color=hex8("#00ffff"), orientation="vertical", width=self.screen.width, height=self.screen.height) self.Bot = MDBoxLayout( md_bg_color=hex8("##00ffff"), orientation="vertical", width=self.screen.width, height=self.screen.height) self.bottom = MDGridLayout( cols=2, rows=1, md_bg_color=hex8("#00ffff"), width=200, height=200, size_hint=[.07, .07]) self.bottom.add_widget(self.text) self.bottom.add_widget(self.button) self.Top.add_widget(self.Container) self.Top.add_widget(self.Bot) self.Scroll.size = [self.screen.width, self.screen.height] self.Scroll.add_widget(self.Top) self.screen.add_widget(self.Scroll) self.screen.add_widget(self.bottom) self.add_widget(self.screen)
def build(self): screen = MDScreen() # Top toolbar: self.toolbar = MDToolbar(title="Ledstrips", elevation=20) self.toolbar.pos_hint = {"top": 1} self.toolbar.right_action_items = [ # Icon list: https://materialdesignicons.com/ ["exit-to-app", lambda x: self.exit()] ] screen.add_widget(self.toolbar) # Version line: screen.add_widget( MDLabel(text=self._version, font_size=12, pos_hint={ "center_x": 0.5, "center_y": 0.95 }, halign="center")) # Log line: self.text_log = MDLabel(font_size=18, pos_hint={ "center_x": 0.5, "center_y": 0.10 }, halign="center", theme_text_color="Error") screen.add_widget(self.text_log) # # Button Loft: # # Get the status of the ledstrip: try: req = urllib.request.urlopen("http://192.168.1.11:8888/light/Loft") res = req.read() contents = json.loads(res.decode("utf-8")) # self.text_log.text = str(contents) print(contents) self._loftStatus = contents["light"]["state"] self._loftBrightness = contents["light"]["brightness"] self._loftRed = contents["light"]["color"]["red"] self._loftGreen = contents["light"]["color"]["green"] self._loftBlue = contents["light"]["color"]["blue"] except Exception as e: self.text_log.text = str(e) _loft_pos = 0.80 screen.add_widget( MDFillRoundFlatButton(text="Loft", font_size=24, pos_hint={ "center_x": 0.5, "center_y": _loft_pos }, on_press=self.loft)) self.sliderRed_loft = MDSlider(min=0, max=255, value=self._loftRed, color='red', hint=True, hint_radius=4, hint_bg_color='red', hint_text_color='black', pos_hint={ "center_x": 0.5, "center_y": _loft_pos - 0.07 }, size_hint_x=0.9, size_hint_y=0.05) screen.add_widget(self.sliderRed_loft) self.sliderGreen_loft = MDSlider(min=0, max=255, value=self._loftGreen, color='green', hint=True, hint_radius=4, hint_bg_color='green', hint_text_color='black', pos_hint={ "center_x": 0.5, "center_y": _loft_pos - 0.10 }, size_hint_x=0.9, size_hint_y=0.05) screen.add_widget(self.sliderGreen_loft) self.sliderBlue_loft = MDSlider(min=0, max=255, value=self._loftBlue, color='blue', hint=True, hint_radius=4, hint_bg_color='blue', hint_text_color='black', pos_hint={ "center_x": 0.5, "center_y": _loft_pos - 0.13 }, size_hint_x=0.9, size_hint_y=0.05) screen.add_widget(self.sliderBlue_loft) self.sliderBrightness_loft = MDSlider(min=1, max=255, value=self._loftBrightness, color='black', hint=True, hint_radius=4, hint_bg_color='black', hint_text_color='black', pos_hint={ "center_x": 0.5, "center_y": _loft_pos - 0.16 }, size_hint_x=0.9, size_hint_y=0.05) screen.add_widget(self.sliderBrightness_loft) # # Button Bedroom: # # Get the status of the ledstrip: try: req = urllib.request.urlopen( "http://192.168.1.10:8888/light/Bedroom") res = req.read() contents = json.loads(res.decode("utf-8")) # self.text_log.text = str(contents) self._bedroomStatus = contents["light"]["state"] self._bedroomBrightness = contents["light"]["brightness"] self._bedroomRed = contents["light"]["color"]["red"] self._bedroomGreen = contents["light"]["color"]["green"] self._bedroomBlue = contents["light"]["color"]["blue"] except Exception as e: self.text_log.text = str(e) _bedroom_pos = 0.55 screen.add_widget( MDFillRoundFlatButton(text="Bedroom", font_size=24, pos_hint={ "center_x": 0.5, "center_y": _bedroom_pos }, on_press=self.bedroom)) self.sliderRed_bedroom = MDSlider(min=0, max=255, value=self._bedroomRed, color='red', hint=True, hint_radius=4, hint_bg_color='red', hint_text_color='black', pos_hint={ "center_x": 0.5, "center_y": _bedroom_pos - 0.07 }, size_hint_x=0.9, size_hint_y=0.05) screen.add_widget(self.sliderRed_bedroom) self.sliderGreen_bedroom = MDSlider(min=0, max=255, value=self._bedroomGreen, color='green', hint=True, hint_radius=4, hint_bg_color='green', hint_text_color='black', pos_hint={ "center_x": 0.5, "center_y": _bedroom_pos - 0.10 }, size_hint_x=0.9, size_hint_y=0.05) screen.add_widget(self.sliderGreen_bedroom) self.sliderBlue_bedroom = MDSlider(min=0, max=255, value=self._bedroomBlue, color='blue', hint=True, hint_radius=4, hint_bg_color='blue', hint_text_color='black', pos_hint={ "center_x": 0.5, "center_y": _bedroom_pos - 0.13 }, size_hint_x=0.9, size_hint_y=0.05) screen.add_widget(self.sliderBlue_bedroom) self.sliderBrightness_bedroom = MDSlider(min=1, max=255, value=self._bedroomBrightness, color='black', hint=True, hint_radius=4, hint_bg_color='black', hint_text_color='black', pos_hint={ "center_x": 0.5, "center_y": _bedroom_pos - 0.16 }, size_hint_x=0.9, size_hint_y=0.05) screen.add_widget(self.sliderBrightness_bedroom) # # Button Bureau: # # Get the status of the ledstrip: # { # "self": "http://192.168.1.12:8888/light/Bureau", # "light": { # "name": "Bureau", # "uri": "http://192.168.1.12:8888/light/Bureau", # "state": false, # "color": { # "red": 1, # "green": 1, # "blue": 1 # }, # "brightness": 255 # }, # "switches": [ # { # "name": "Desk", # "uri": "http://192.168.1.12:8888/light/Bureau/switch/Desk", # "state": 1 # } # ] # } try: req = urllib.request.urlopen( "http://192.168.1.12:8888/light/Bureau") res = req.read() contents = json.loads(res.decode("utf-8")) # self.text_log.text = str(contents) self._bureauStatus = contents["light"]["state"] self._bureauBrightness = contents["light"]["brightness"] self._bureauRed = contents["light"]["color"]["red"] self._bureauGreen = contents["light"]["color"]["green"] self._bureauBlue = contents["light"]["color"]["blue"] except Exception as e: self.text_log.text = str(e) _bureau_pos = 0.30 screen.add_widget( MDFillRoundFlatButton(text="Bureau", font_size=24, pos_hint={ "center_x": 0.5, "center_y": _bureau_pos }, on_press=self.bureau)) self.sliderRed_bureau = MDSlider(min=0, max=255, value=self._bureauRed, color='red', hint=True, hint_radius=4, hint_bg_color='red', hint_text_color='black', pos_hint={ "center_x": 0.5, "center_y": _bureau_pos - 0.07 }, size_hint_x=0.9, size_hint_y=0.05) screen.add_widget(self.sliderRed_bureau) self.sliderGreen_bureau = MDSlider(min=0, max=255, value=self._bureauGreen, color='green', hint=True, hint_radius=4, hint_bg_color='green', hint_text_color='black', pos_hint={ "center_x": 0.5, "center_y": _bureau_pos - 0.10 }, size_hint_x=0.9, size_hint_y=0.05) screen.add_widget(self.sliderGreen_bureau) self.sliderBlue_bureau = MDSlider(min=0, max=255, value=self._bureauBlue, color='blue', hint=True, hint_radius=4, hint_bg_color='blue', hint_text_color='black', pos_hint={ "center_x": 0.5, "center_y": _bureau_pos - 0.13 }, size_hint_x=0.9, size_hint_y=0.05) screen.add_widget(self.sliderBlue_bureau) self.sliderBrightness_bureau = MDSlider(min=1, max=255, value=self._bureauBrightness, color='black', hint=True, hint_radius=4, hint_bg_color='black', hint_text_color='black', pos_hint={ "center_x": 0.5, "center_y": _bureau_pos - 0.16 }, size_hint_x=0.9, size_hint_y=0.05) screen.add_widget(self.sliderBrightness_bureau) # Setting it in stone: return screen