def on_long_press(self): files = os.listdir( os.path.join(os.getcwd(), load_config()["device_path"])) if any([x.endswith('tmp') for x in files]): print('COFAM') day = self.parent.parent.ids.date.dp.text.split(',')[1][1:] data = Data(filename=datename(day)) with open(data.tmp_path, 'r') as f: lines = json.load(f) if len(lines) > 1: with open(data.tmp_path, 'w') as f: json.dump(lines[:-1], f) else: os.remove(data.tmp_path) pop = Popup() pop.title = 'Komunikat' pop.separator_height = 0 pop.size_hint = (.5, .4) pop.content = Button(text='Operacja cofnięta') pop.content.bind(on_press=pop.dismiss) pop.open() else: pop = Popup() pop.title = 'Komunikat' pop.separator_height = 0 pop.size_hint = (.6, .2) pop.content = Button(text='Brak nowych wpisów') pop.content.bind(on_press=pop.dismiss) pop.open()
def mostrar(on_seleccionar): pantalla = PantallaSeleccionarComposicion() pop = Popup(title="Seleccione el tipo de composición", content=pantalla, size_hint=(None,None),size=(500,800)) pop.separator_height = 0 pantalla.popup = pop pantalla.on_seleccionar = on_seleccionar pop.open()
def __init__(self, screen_manager, localization): self.sm = screen_manager self.l = localization description = ( self.l.get_str('The console will close any critical processes and shut down safely after 60 seconds, ready for power off.') + \ "\n\n" + \ self.l.get_str('This extends the lifetime of the console.') + '\n\n' + \ self.l.get_str('You will still need to power down your machine separately after the console has finished shutting down.') ) title_string = self.l.get_str('Shutting down') + '...' shutdown_string = self.l.get_bold('Shutdown now') cancel_string = self.l.get_bold('Cancel') def cancel_shutdown(*args): os.system('sudo shutdown -c') def shutdown_now(*args): os.system('sudo shutdown -h now') img = Image(source="./asmcnc/apps/shapeCutter_app/img/info_icon.png", allow_stretch=False) label = Label(size_hint_y=1.5, text_size=(480, None), halign='center', valign='middle', text=description, color=[0,0,0,1], padding=[0,0], markup = True) ok_button = Button(text=shutdown_string, markup = True) ok_button.background_normal = '' ok_button.background_color = [76 / 255., 175 / 255., 80 / 255., 1.] cancel_button = Button(text=cancel_string, markup = True) cancel_button.background_normal = '' cancel_button.background_color = [230 / 255., 74 / 255., 25 / 255., 1.] btn_layout = BoxLayout(orientation='horizontal', spacing=10, padding=[0,10,0,0]) btn_layout.add_widget(cancel_button) btn_layout.add_widget(ok_button) layout_plan = BoxLayout(orientation='vertical', spacing=10, padding=[20,10,20,10]) layout_plan.add_widget(img) layout_plan.add_widget(label) layout_plan.add_widget(btn_layout) popup = Popup(title=title_string, title_color=[0, 0, 0, 1], title_font= 'Roboto-Bold', title_size = '20sp', content=layout_plan, size_hint=(None, None), # size=(300, 300), size=(540, 400), auto_dismiss= False ) popup.background = './asmcnc/apps/shapeCutter_app/img/popup_background.png' popup.separator_color = [249 / 255., 206 / 255., 29 / 255., 1.] popup.separator_height = '4dp' ok_button.bind(on_press=shutdown_now) cancel_button.bind(on_press=cancel_shutdown) cancel_button.bind(on_press=popup.dismiss) popup.open()
def __init__(self, machine, screen_manager, localization): self.m = machine self.m.soft_stop() self.sm = screen_manager self.l = localization def machine_reset(*args): self.m.stop_from_soft_stop_cancel() def machine_resume(*args): self.m.resume_from_a_soft_door() stop_description = self.l.get_str("Is everything OK? You can resume the job, or cancel it completely.") resume_string = self.l.get_bold("Resume") cancel_string = self.l.get_bold("Cancel") title_string = self.l.get_str("Warning!") img = Image(source="./asmcnc/apps/shapeCutter_app/img/error_icon.png", allow_stretch=False) label = Label(size_hint_y=2, text_size=(360, None), halign='center', valign='middle', text=stop_description, color=[0,0,0,1], padding=[0,0], markup = True) resume_button = Button(text=resume_string, markup = True) resume_button.background_normal = '' resume_button.background_color = [76 / 255., 175 / 255., 80 / 255., 1.] cancel_button = Button(text=cancel_string, markup = True) cancel_button.background_normal = '' cancel_button.background_color = [230 / 255., 74 / 255., 25 / 255., 1.] btn_layout = BoxLayout(orientation='horizontal', spacing=15, padding=[0,5,0,0], size_hint_y=2) btn_layout.add_widget(cancel_button) btn_layout.add_widget(resume_button) layout_plan = BoxLayout(orientation='vertical', spacing=5, padding=[30,20,30,0]) layout_plan.add_widget(img) layout_plan.add_widget(label) layout_plan.add_widget(btn_layout) popup = Popup(title=title_string, title_color=[0, 0, 0, 1], title_font= 'Roboto-Bold', title_size = '20sp', content=layout_plan, size_hint=(None, None), size=(400, 300), auto_dismiss= False ) popup.separator_color = [230 / 255., 74 / 255., 25 / 255., 1.] popup.separator_height = '4dp' popup.background = './asmcnc/apps/shapeCutter_app/img/popup_background.png' cancel_button.bind(on_press=machine_reset) cancel_button.bind(on_press=popup.dismiss) resume_button.bind(on_press=machine_resume) resume_button.bind(on_press=popup.dismiss) popup.open()
def __init__(self, screen_manager, machine, localization, description): self.sm = screen_manager self.m = machine self.l = localization title_string = self.l.get_str('Welcome to SmartBench') ok_string = self.l.get_bold('Ok') remind_string = self.l.get_bold('Remind me later') def set_trigger_to_false(*args): self.m.write_set_up_options(False) self.sm.get_screen('lobby').carousel.load_next(mode='next') def set_trigger_to_true(*args): self.m.write_set_up_options(True) img = Image(source="./asmcnc/apps/shapeCutter_app/img/info_icon.png", allow_stretch=False) label = Label(size_hint_y=2, text_size=(420, None), markup=True, halign='center', valign='middle', text=description, color=[0,0,0,1], padding=[0,0]) ok_button = Button(text=ok_string, markup = True) ok_button.background_normal = '' ok_button.background_color = [76 / 255., 175 / 255., 80 / 255., 1.] remind_me_button = Button(text=remind_string, markup = True) remind_me_button.background_normal = '' remind_me_button.background_color = [230 / 255., 74 / 255., 25 / 255., 1.] btn_layout = BoxLayout(orientation='horizontal', spacing=15, padding=[20,10,20,0]) btn_layout.add_widget(remind_me_button) btn_layout.add_widget(ok_button) layout_plan = BoxLayout(orientation='vertical', spacing=10, padding=[10,10,10,10]) layout_plan.add_widget(img) layout_plan.add_widget(label) layout_plan.add_widget(btn_layout) popup = Popup(title=title_string, # title_color=[0.141, 0.596, 0.957, 1], title_color=[0, 0, 0, 1], title_font= 'Roboto-Bold', title_size = '20sp', content=layout_plan, size_hint=(None, None), size=(500, 440), auto_dismiss= False ) popup.background = './asmcnc/apps/shapeCutter_app/img/popup_background.png' popup.separator_color = [249 / 255., 206 / 255., 29 / 255., 1.] popup.separator_height = '4dp' ok_button.bind(on_press=popup.dismiss) ok_button.bind(on_press=set_trigger_to_false) remind_me_button.bind(on_press=popup.dismiss) remind_me_button.bind(on_press=set_trigger_to_true) popup.open()
def __init__(self, screen_manager, machine, localization, warning_message): self.sm = screen_manager self.m = machine self.l = localization description = warning_message title_string = self.l.get_str('Warning!') yes_string = self.l.get_bold('Yes') no_string = self.l.get_bold('No') def set_park(*args): self.m.set_standby_to_pos() self.m.get_grbl_status() img = Image(source="./asmcnc/apps/shapeCutter_app/img/error_icon.png", allow_stretch=False) label = Label(size_hint_y=1, text_size=(360, None), halign='center', valign='middle', text=description, color=[0,0,0,1], padding=[40,20], markup = True) ok_button = Button(text=yes_string, markup = True) ok_button.background_normal = '' ok_button.background_color = [76 / 255., 175 / 255., 80 / 255., 1.] back_button = Button(text=no_string, markup = True) back_button.background_normal = '' back_button.background_color = [230 / 255., 74 / 255., 25 / 255., 1.] btn_layout = BoxLayout(orientation='horizontal', spacing=10, padding=[0,0,0,0]) btn_layout.add_widget(back_button) btn_layout.add_widget(ok_button) layout_plan = BoxLayout(orientation='vertical', spacing=10, padding=[40,20,40,20]) layout_plan.add_widget(img) layout_plan.add_widget(label) layout_plan.add_widget(btn_layout) popup = Popup(title=title_string, title_color=[0, 0, 0, 1], title_font= 'Roboto-Bold', title_size = '20sp', content=layout_plan, size_hint=(None, None), size=(300, 350), auto_dismiss= False ) popup.separator_color = [230 / 255., 74 / 255., 25 / 255., 1.] popup.separator_height = '4dp' popup.background = './asmcnc/apps/shapeCutter_app/img/popup_background.png' ok_button.bind(on_press=popup.dismiss) ok_button.bind(on_press=set_park) back_button.bind(on_press=popup.dismiss) popup.open()
def __init__(self, screen_manager, localization, description): self.sm = screen_manager self.l = localization popup_width = 600 title_string = self.l.get_str('Information') ok_string = self.l.get_bold('Ok') img = Image(source="./asmcnc/apps/shapeCutter_app/img/info_icon.png", allow_stretch=False) info_label = RstDocument(text=description, background_color=[1, 1, 1, 1], base_font_size=26, underline_color='000000') ok_button = Button(text=ok_string, markup=True) ok_button.background_normal = '' ok_button.background_color = [76 / 255., 175 / 255., 80 / 255., 1.] btn_layout = BoxLayout(orientation='horizontal', spacing=15, padding=[10, 20, 10, 0], size_hint_y=0.6) btn_layout.add_widget(ok_button) scroll_layout = ScrollView(do_scroll_x=True, do_scroll_y=True, scroll_type=['content'], always_overscroll=True, size_hint_y=1.2) scroll_layout.add_widget(info_label) layout_plan = BoxLayout(orientation='vertical', spacing=0, padding=[10, 10, 10, 10]) layout_plan.add_widget(img) layout_plan.add_widget(scroll_layout) layout_plan.add_widget(btn_layout) popup = Popup(title=title_string, title_color=[0, 0, 0, 1], title_font='Roboto-Bold', title_size='20sp', content=layout_plan, size_hint=(None, None), size=(popup_width, 440), auto_dismiss=False) popup.background = './asmcnc/apps/shapeCutter_app/img/popup_background.png' popup.separator_color = [249 / 255., 206 / 255., 29 / 255., 1.] popup.separator_height = '4dp' ok_button.bind(on_press=popup.dismiss) popup.open()
def __init__(self, screen_manager, localization, settings_manager, warning_message): self.sm = screen_manager self.set = settings_manager self.l = localization title_string = self.l.get_str('There was a problem updating the software') + '...' repair_string = self.l.get_bold('Repair') back_string = self.l.get_bold('Go Back') description = warning_message def repair(*args): self.sm.get_screen('update').repair_sw_over_wifi() img = Image(source="./asmcnc/apps/shapeCutter_app/img/error_icon.png", allow_stretch=False) label = Label(size_hint_y=1.4, text_size=(560, None), halign='center', valign='middle', text=description, color=[0,0,0,1], padding=[20,20], markup = True) ok_button = Button(text=repair_string, markup = True) ok_button.background_normal = '' ok_button.background_color = [76 / 255., 175 / 255., 80 / 255., 1.] back_button = Button(text=back_string, markup = True) back_button.background_normal = '' back_button.background_color = [230 / 255., 74 / 255., 25 / 255., 1.] btn_layout = BoxLayout(orientation='horizontal', spacing=10, padding=[0,0,0,0]) btn_layout.add_widget(back_button) btn_layout.add_widget(ok_button) layout_plan = BoxLayout(orientation='vertical', spacing=10, padding=[10,20,10,20]) layout_plan.add_widget(img) layout_plan.add_widget(label) layout_plan.add_widget(btn_layout) popup = Popup(title=title_string, title_color=[0, 0, 0, 1], title_font= 'Roboto-Bold', title_size = '20sp', content=layout_plan, size_hint=(None, None), size=(600, 420), auto_dismiss= False ) popup.separator_color = [230 / 255., 74 / 255., 25 / 255., 1.] popup.separator_height = '4dp' popup.background = './asmcnc/apps/shapeCutter_app/img/popup_background.png' ok_button.bind(on_press=popup.dismiss) ok_button.bind(on_press=repair) back_button.bind(on_press=popup.dismiss) popup.open()
def mostrar(on_aceptar): pantalla = PantallaConfirmacion() pop = Popup(title="Confirmacion", content=pantalla, size_hint=(None, None), size=(400, 400)) pop.separator_height = 0 pantalla.popup = pop pantalla.on_aceptar = on_aceptar pop.open()
def mostrar(palabra, on_seleccionar): pantalla = PantallaSeleccionarPalabraRima(palabra=palabra) pop = Popup(title="Seleccione la palabra", content=pantalla, size_hint=(None, None), size=(500, 800)) pop.separator_height = 0 pantalla.popup = pop pantalla.on_seleccionar = on_seleccionar pop.open()
def __init__(self, screen_manager): self.shapecutter_sm = screen_manager description = "If this is your first time using the app, please go to the tutorial.\n\n" \ "If you need help or support, please visit customer support at www.yetitool.com/support" img = Image(source="./asmcnc/apps/shapeCutter_app/img/info_bigger.png", allow_stretch=False) label = Label(size_hint_y=1, text_size=(360, None), halign='left', valign='middle', text=description, color=[0, 0, 0, 1], padding=[20, 20]) tutorial_button = Button(text='[b]Tutorial[/b]', markup=True) tutorial_button.background_normal = '' tutorial_button.background_color = [0.141, 0.596, 0.957, 1] ok_button = Button(text='[b]Ok[/b]', markup=True) ok_button.background_normal = '' ok_button.background_color = [76 / 255., 175 / 255., 80 / 255., 1.] btn_layout = BoxLayout(orientation='horizontal', spacing=15, padding=[50, 20, 50, 0]) btn_layout.add_widget(tutorial_button) btn_layout.add_widget(ok_button) layout_plan = BoxLayout(orientation='vertical', spacing=10, padding=[50, 20, 50, 20]) layout_plan.add_widget(img) layout_plan.add_widget(label) layout_plan.add_widget(btn_layout) popup = Popup(title='Information', title_color=[0, 0, 0, 1], title_font='Roboto-Bold', title_size='20sp', content=layout_plan, size_hint=(None, None), size=(400, 380), auto_dismiss=False) popup.separator_color = [249 / 255., 206 / 255., 29 / 255., 1.] popup.separator_height = '4dp' popup.background = './asmcnc/apps/shapeCutter_app/img/popup_background.png' ok_button.bind(on_press=popup.dismiss) tutorial_button.bind(on_press=self.go_tutorial) tutorial_button.bind(on_press=popup.dismiss) popup.open()
def __init__(self, screen_manager, machine, localization, return_to_screen, cancel_to_screen): self.sm = screen_manager self.m = machine self.l = localization def home_now(*args): self.m.request_homing_procedure(return_to_screen, cancel_to_screen) stop_description = self.l.get_str("You need to home SmartBench first!") title_string = self.l.get_str("Warning!") home_string = self.l.get_bold("Home") cancel_string = self.l.get_bold("Cancel") img = Image(source="./asmcnc/apps/shapeCutter_app/img/error_icon.png", allow_stretch=False) label = Label(size_hint_y=2, text_size=(360, None), halign='center', valign='middle', text=stop_description, color=[0,0,0,1], padding=[0,0], markup = True) home_button = Button(text=home_string, markup = True) home_button.background_normal = '' home_button.background_color = [33 / 255., 150 / 255., 243 / 255., 98 / 100.] cancel_button = Button(text=cancel_string, markup = True) cancel_button.background_normal = '' cancel_button.background_color = [230 / 255., 74 / 255., 25 / 255., 1.] btn_layout = BoxLayout(orientation='horizontal', spacing=15, padding=[0,5,0,0], size_hint_y=2) btn_layout.add_widget(cancel_button) btn_layout.add_widget(home_button) layout_plan = BoxLayout(orientation='vertical', spacing=5, padding=[30,20,30,0]) layout_plan.add_widget(img) layout_plan.add_widget(label) layout_plan.add_widget(btn_layout) popup = Popup(title=title_string, title_color=[0, 0, 0, 1], title_font= 'Roboto-Bold', title_size = '20sp', content=layout_plan, size_hint=(None, None), size=(400, 300), auto_dismiss= False ) popup.separator_color = [230 / 255., 74 / 255., 25 / 255., 1.] popup.separator_height = '4dp' popup.background = './asmcnc/apps/shapeCutter_app/img/popup_background.png' home_button.bind(on_press=home_now) home_button.bind(on_press=popup.dismiss) cancel_button.bind(on_press=popup.dismiss) popup.open()
def __init__(self, screen_manager, localization, message): self.sm = screen_manager self.l = localization description = self.l.get_str("Software update was successful.") + \ "\n\n" + \ self.l.get_str("Update message") + ": " + \ message + \ "\n" + \ self.l.get_str("Please do not restart your machine until you are prompted to do so.") title_string = self.l.get_str('Update Successful!') ok_string = self.l.get_bold('Ok') def reboot(*args): self.sm.current = 'rebooting' img = Image(source="./asmcnc/apps/shapeCutter_app/img/info_icon.png", allow_stretch=False) label = Label(size_hint_y=1.2, text_size=(660, None), halign='center', valign='middle', text=description, color=[0,0,0,1], padding=[40,10], markup = True) ok_button = Button(text=ok_string, markup = True) ok_button.background_normal = '' ok_button.background_color = [76 / 255., 175 / 255., 80 / 255., 1.] btn_layout = BoxLayout(orientation='horizontal', spacing=10, padding=[0,0,0,0]) btn_layout.add_widget(ok_button) layout_plan = BoxLayout(orientation='vertical', spacing=10, padding=[40,20,40,20]) layout_plan.add_widget(img) layout_plan.add_widget(label) layout_plan.add_widget(btn_layout) popup = Popup(title=title_string, title_color=[0, 0, 0, 1], title_font= 'Roboto-Bold', title_size = '20sp', content=layout_plan, size_hint=(None, None), size=(700, 400), auto_dismiss= False ) popup.separator_color = [249 / 255., 206 / 255., 29 / 255., 1.] popup.separator_height = '4dp' popup.background = './asmcnc/apps/shapeCutter_app/img/popup_background.png' ok_button.bind(on_press=popup.dismiss) # ok_button.bind(on_press=reboot) popup.open() Clock.schedule_once(reboot, 6)
def __init__(self, screen_manager): self.sm = screen_manager description = self.sm.l.get_str("Machine is not Idle.") + "\n\n" \ + self.sm.l.get_str("Please check that SmartBench is clear, and then use the Pro app to RESET SmartBench before using Shape Cutter.") title_string = self.sm.l.get_str('Warning!') ok_string = self.sm.l.get_bold('Ok') img = Image(source="./asmcnc/apps/shapeCutter_app/img/error_icon.png", allow_stretch=False) label = Label(size_hint_y=1, text_size=(360, None), halign='left', valign='middle', text=description, color=[0, 0, 0, 1], padding=[20, 20]) ok_button = Button(text=ok_string, markup=True) ok_button.background_normal = '' ok_button.background_color = [230 / 255., 74 / 255., 25 / 255., 1.] btn_layout = BoxLayout(orientation='horizontal', spacing=15, padding=[50, 25, 50, 0]) btn_layout.add_widget(ok_button) layout_plan = BoxLayout(orientation='vertical', spacing=10, padding=[50, 20, 50, 20]) layout_plan.add_widget(img) layout_plan.add_widget(label) layout_plan.add_widget(btn_layout) popup = Popup(title=title_string, title_color=[0, 0, 0, 1], title_font='Roboto-Bold', title_size='20sp', content=layout_plan, size_hint=(None, None), size=(400, 380), auto_dismiss=False) popup.separator_color = [230 / 255., 74 / 255., 25 / 255., 1.] popup.separator_height = '4dp' popup.background = './asmcnc/apps/shapeCutter_app/img/popup_background.png' ok_button.bind(on_press=popup.dismiss) popup.open()
def __init__(self, screen_manager, localization): self.sm = screen_manager self.l = localization def confirm_cancel(*args): self.sm.get_screen('stop_or_resume_job_decision').confirm_job_cancel() stop_description = self.l.get_str("Are you sure you want to cancel the job?") title_string = self.l.get_str("Warning!") yes_string = self.l.get_bold("Yes") no_string = self.l.get_bold("No") img = Image(source="./asmcnc/apps/shapeCutter_app/img/error_icon.png", allow_stretch=False) label = Label(size_hint_y=2, text_size=(360, None), halign='center', valign='middle', text=stop_description, color=[0,0,0,1], padding=[0,0], markup = True) resume_button = Button(text=no_string, markup = True) resume_button.background_normal = '' resume_button.background_color = [76 / 255., 175 / 255., 80 / 255., 1.] cancel_button = Button(text=yes_string, markup = True) cancel_button.background_normal = '' cancel_button.background_color = [230 / 255., 74 / 255., 25 / 255., 1.] btn_layout = BoxLayout(orientation='horizontal', spacing=15, padding=[0,5,0,0], size_hint_y=2) btn_layout.add_widget(cancel_button) btn_layout.add_widget(resume_button) layout_plan = BoxLayout(orientation='vertical', spacing=5, padding=[30,20,30,0]) layout_plan.add_widget(img) layout_plan.add_widget(label) layout_plan.add_widget(btn_layout) popup = Popup(title=title_string, title_color=[0, 0, 0, 1], title_font= 'Roboto-Bold', title_size = '20sp', content=layout_plan, size_hint=(None, None), size=(400, 300), auto_dismiss= False ) popup.separator_color = [230 / 255., 74 / 255., 25 / 255., 1.] popup.separator_height = '4dp' popup.background = './asmcnc/apps/shapeCutter_app/img/popup_background.png' cancel_button.bind(on_press=confirm_cancel) cancel_button.bind(on_press=popup.dismiss) resume_button.bind(on_press=popup.dismiss) popup.open()
def __init__(self, screen_manager, localization, usb): self.sm = screen_manager self.l = localization title_string = self.l.get_str('Error!') ok_string = self.l.get_bold('Ok') description = ( self.l.get_str("Problem mounting USB stick. Please remove your USB stick, and check that it is working properly.") + \ "\n\n" + \ self.l.get_str("If this error persists, you may need to reformat your USB stick.") ) def restart_polling(*args): usb.start_polling_for_usb() img = Image(source="./asmcnc/apps/shapeCutter_app/img/error_icon.png", allow_stretch=False) label = Label(size_hint_y=1, text_size=(360, None), halign='center', valign='middle', text=description, color=[0,0,0,1], padding=[0,10], markup = True) ok_button = Button(text=ok_string, markup = True) ok_button.background_normal = '' ok_button.background_color = [230 / 255., 74 / 255., 25 / 255., 1.] btn_layout = BoxLayout(orientation='horizontal', spacing=10, padding=[0,0,0,0]) btn_layout.add_widget(ok_button) layout_plan = BoxLayout(orientation='vertical', spacing=10, padding=[40,20,40,20]) layout_plan.add_widget(img) layout_plan.add_widget(label) layout_plan.add_widget(btn_layout) popup = Popup(title=title_string, title_color=[0, 0, 0, 1], title_font= 'Roboto-Bold', title_size = '20sp', content=layout_plan, size_hint=(None, None), size=(500, 400), auto_dismiss= False ) popup.separator_color = [230 / 255., 74 / 255., 25 / 255., 1.] popup.separator_height = '4dp' popup.background = './asmcnc/apps/shapeCutter_app/img/popup_background.png' ok_button.bind(on_press=popup.dismiss) ok_button.bind(on_press=restart_polling) popup.open()
def __init__(self, screen_manager): self.systemtools_sm = screen_manager description = "You should only quit to the console if you have been instructed to do so by YetiTool support.\n\n" + \ "This will take you to the YetiTool splash screen, and exit the software.\n\n" + \ "Would you like to quit to console now?" def quit_console(*args): sys.exit() img = Image(source="./asmcnc/apps/shapeCutter_app/img/error_icon.png", allow_stretch=False) label = Label(size_hint_y=2, text_size=(360, None), halign='center', valign='middle', text=description, color=[0,0,0,1], padding=[20,0], markup = True) ok_button = Button(text='[b]Yes[/b]', markup = True) ok_button.background_normal = '' ok_button.background_color = [76 / 255., 175 / 255., 80 / 255., 1.] back_button = Button(text='[b]No[/b]', markup = True) back_button.background_normal = '' back_button.background_color = [230 / 255., 74 / 255., 25 / 255., 1.] btn_layout = BoxLayout(orientation='horizontal', spacing=15, padding=[0,5,0,0]) btn_layout.add_widget(back_button) btn_layout.add_widget(ok_button) layout_plan = BoxLayout(orientation='vertical', spacing=10, padding=[30,20,30,0]) layout_plan.add_widget(img) layout_plan.add_widget(label) layout_plan.add_widget(btn_layout) popup = Popup(title='Warning!', title_color=[0, 0, 0, 1], title_font= 'Roboto-Bold', title_size = '20sp', content=layout_plan, size_hint=(None, None), size=(360, 360), auto_dismiss= False ) popup.separator_color = [230 / 255., 74 / 255., 25 / 255., 1.] popup.separator_height = '4dp' popup.background = './asmcnc/apps/shapeCutter_app/img/popup_background.png' ok_button.bind(on_press=popup.dismiss) ok_button.bind(on_press=quit_console) back_button.bind(on_press=popup.dismiss) popup.open()
def __init__(self, screen_manager, report_string): self.sm = screen_manager # img = Image(source="./asmcnc/apps/shapeCutter_app/img/info_icon.png", allow_stretch=False) label1 = Label(size_hint_y=1, text_size=(None, None), markup=True, halign='left', valign='middle', text=report_string, color=[0, 0, 0, 1], padding=[10, 10]) ok_button = Button(text='[b]Ok[/b]', markup=True) ok_button.background_normal = '' ok_button.background_color = [76 / 255., 175 / 255., 80 / 255., 1.] text_layout = BoxLayout(orientation='horizontal', spacing=0, padding=0) text_layout.add_widget(label1) btn_layout = BoxLayout(orientation='horizontal', spacing=15, padding=[150, 10, 150, 0], size_hint_y=0.3) btn_layout.add_widget(ok_button) layout_plan = BoxLayout(orientation='vertical', spacing=10, padding=[10, 10, 10, 10]) # layout_plan.add_widget(img) layout_plan.add_widget(text_layout) layout_plan.add_widget(btn_layout) popup = Popup(title='Output', title_color=[0, 0, 0, 1], title_font='Roboto-Bold', title_size='20sp', content=layout_plan, size_hint=(None, None), size=(700, 400), auto_dismiss=False) popup.background = './asmcnc/apps/shapeCutter_app/img/popup_background.png' popup.separator_color = [249 / 255., 206 / 255., 29 / 255., 1.] popup.separator_height = '4dp' ok_button.bind(on_press=popup.dismiss) popup.open()
def __init__(self, screen_manager, message): self.sm = screen_manager description = "Please wait" + message img = Image(source="./asmcnc/apps/shapeCutter_app/img/info_icon.png", allow_stretch=False) label = Label(size_hint_y=1, text_size=(360, None), halign='center', valign='middle', text=description, color=[0, 0, 0, 1], padding=[40, 20], markup=True) ok_button = Button(text='[b]Ok[/b]', markup=True) ok_button.background_normal = '' ok_button.background_color = [76 / 255., 175 / 255., 80 / 255., 1.] btn_layout = BoxLayout(orientation='horizontal', spacing=10, padding=[0, 0, 0, 0]) btn_layout.add_widget(ok_button) layout_plan = BoxLayout(orientation='vertical', spacing=10, padding=[40, 20, 40, 20]) layout_plan.add_widget(img) layout_plan.add_widget(label) layout_plan.add_widget(btn_layout) popup = Popup(title='Please Wait...', title_color=[0, 0, 0, 1], title_font='Roboto-Bold', title_size='20sp', content=layout_plan, size_hint=(None, None), size=(500, 400), auto_dismiss=False) popup.separator_color = [249 / 255., 206 / 255., 29 / 255., 1.] popup.separator_height = '4dp' popup.background = './asmcnc/apps/shapeCutter_app/img/popup_background.png' ok_button.bind(on_press=popup.dismiss) Clock.schedule_once(lambda dt: popup.dismiss(), 2.5) popup.open()
def __init__(self, screen_manager): self.shapecutter_sm = screen_manager ok_button = Button(text='[b]Ok[/b]', markup=True) ok_button.background_normal = '' ok_button.background_color = [76 / 255., 175 / 255., 80 / 255., 1.] btn_layout = BoxLayout(orientation='horizontal', spacing=15, padding=[150, 0, 150, 0], size_hint_y=0.2) btn_layout.add_widget(ok_button) rst_doc = RstDocument( source='./asmcnc/apps/shapeCutter_app/feeds_and_speeds_table.rst', background_color=[1, 1, 1, 1], base_font_size=26, underline_color='000000') rst_layout = ScrollView(do_scroll_x=True, do_scroll_y=True, scroll_type=['content'], size_hint_y=0.8) rst_layout.add_widget(rst_doc) layout_plan = BoxLayout(orientation='vertical', spacing=10, padding=[10, 10, 10, 10]) layout_plan.add_widget(rst_layout) layout_plan.add_widget(btn_layout) popup = Popup( title='Information', # title_color=[0.141, 0.596, 0.957, 1], title_color=[0, 0, 0, 1], title_font='Roboto-Bold', title_size='20sp', content=layout_plan, size_hint=(None, None), size=(700, 400), auto_dismiss=False) popup.background = './asmcnc/apps/shapeCutter_app/img/popup_background.png' popup.separator_color = [249 / 255., 206 / 255., 29 / 255., 1.] popup.separator_height = '4dp' ok_button.bind(on_press=popup.dismiss) popup.open()
def __init__(self, app_manager): self.am = app_manager description = "You should only access the factory settings if you have been instructed to do so by YetiTool support.\n\n" + \ "Please enter the password to proceed." def check_password(*args): if textinput.text == "Work Smart": self.am.systemtools_sm.open_system_tools() self.am.systemtools_sm.open_factory_settings_screen() img = Image(source="./asmcnc/apps/shapeCutter_app/img/error_icon.png", allow_stretch=False) label = Label(size_hint_y=1.2, text_size=(450, None), halign='center', valign='middle', text=description, color=[0,0,0,1], padding=[0,0], markup = True) textinput = TextInput(size_hint_y=1, text = '') ok_button = Button(text='[b]Ok[/b]', markup = True) ok_button.background_normal = '' ok_button.background_color = [230 / 255., 74 / 255., 25 / 255., 1.] btn_layout = BoxLayout(orientation='horizontal', spacing=10, padding=[10,0,10,0]) btn_layout.add_widget(ok_button) layout_plan = BoxLayout(orientation='vertical', spacing=5, padding=[40,10,40,10]) layout_plan.add_widget(img) layout_plan.add_widget(label) layout_plan.add_widget(textinput) layout_plan.add_widget(btn_layout) popup = Popup(title='Warning!', title_color=[0, 0, 0, 1], title_font= 'Roboto-Bold', title_size = '20sp', content=layout_plan, size_hint=(None, None), size=(500, 320), auto_dismiss= False, pos_hint={'x': 150.0 / 800.0, 'y':160.0 / 480.0}, ) popup.separator_color = [230 / 255., 74 / 255., 25 / 255., 1.] popup.separator_height = '4dp' popup.background = './asmcnc/apps/shapeCutter_app/img/popup_background.png' ok_button.bind(on_press=check_password) ok_button.bind(on_press=popup.dismiss) popup.open()
def __init__(self, screen_manager, error_message): self.shapecutter_sm = screen_manager description = error_message img = Image(source="./asmcnc/apps/shapeCutter_app/img/error_icon.png", allow_stretch=False) label = Label(size_hint_y=1, text_size=(360, None), halign='left', valign='middle', text=description, color=[0, 0, 0, 1], padding=[20, 20]) ok_button = Button(text='[b]Ok[/b]', markup=True) ok_button.background_normal = '' ok_button.background_color = [230 / 255., 74 / 255., 25 / 255., 1.] btn_layout = BoxLayout(orientation='horizontal', spacing=15, padding=[50, 25, 50, 0]) btn_layout.add_widget(ok_button) layout_plan = BoxLayout(orientation='vertical', spacing=10, padding=[50, 20, 50, 20]) layout_plan.add_widget(img) layout_plan.add_widget(label) layout_plan.add_widget(btn_layout) popup = Popup(title='Warning!', title_color=[0, 0, 0, 1], title_font='Roboto-Bold', title_size='20sp', content=layout_plan, size_hint=(None, None), size=(400, 380), auto_dismiss=False) popup.separator_color = [230 / 255., 74 / 255., 25 / 255., 1.] popup.separator_height = '4dp' popup.background = './asmcnc/apps/shapeCutter_app/img/popup_background.png' ok_button.bind(on_press=popup.dismiss) popup.open()
def __init__(self, screen_manager, outcome, message): self.sm = screen_manager label1 = Label(size_hint_y=0.92, text_size=(None, None), markup=True, halign='left', valign='top', text=message, font_size='11sp', color=[0, 0, 0, 1]) back_button = Button(text='[b]Ok[/b]', markup=True) back_button.background_normal = '' back_button.background_color = [230 / 255., 74 / 255., 25 / 255., 1.] text_layout = BoxLayout(orientation='horizontal', spacing=0, padding=0) text_layout.add_widget(label1) btn_layout = BoxLayout(orientation='horizontal', spacing=20, padding=[100, 0, 100, 0], size_hint_y=0.2) btn_layout.add_widget(back_button) layout_plan = BoxLayout(orientation='vertical', spacing=0, padding=[10, 0, 10, 0]) # layout_plan.add_widget(img) layout_plan.add_widget(text_layout) layout_plan.add_widget(btn_layout) popup = Popup(title=outcome, title_color=[0, 0, 0, 1], title_font='Roboto-Bold', title_size='20sp', content=layout_plan, size_hint=(None, None), size=(780, 480), auto_dismiss=False) popup.background = './asmcnc/apps/shapeCutter_app/img/popup_background.png' popup.separator_color = [249 / 255., 206 / 255., 29 / 255., 1.] popup.separator_height = '4dp' back_button.bind(on_press=popup.dismiss) popup.open()
def __init__(self, screen_manager, localization, description): self.sm = screen_manager self.l = localization img = Image(source="./asmcnc/apps/shapeCutter_app/img/info_icon.png", allow_stretch=False) label = Label(size_hint_y=1, text_size=(360, None), halign='center', valign='middle', text=description, color=[0,0,0,1], padding=[40,20], markup = True) title_string = self.l.get_str('Information') ok_string = self.l.get_bold('Ok') ok_button = Button(text=ok_string, markup = True) ok_button.background_normal = '' ok_button.background_color = [76 / 255., 175 / 255., 80 / 255., 1.] btn_layout = BoxLayout(orientation='horizontal', spacing=10, padding=[0,0,0,0]) btn_layout.add_widget(ok_button) layout_plan = BoxLayout(orientation='vertical', spacing=10, padding=[40,20,40,20]) layout_plan.add_widget(img) layout_plan.add_widget(label) layout_plan.add_widget(btn_layout) popup = Popup(title=title_string, title_color=[0, 0, 0, 1], title_font= 'Roboto-Bold', title_size = '20sp', content=layout_plan, size_hint=(None, None), size=(300, 300), auto_dismiss= False ) popup.background = './asmcnc/apps/shapeCutter_app/img/popup_background.png' popup.separator_color = [249 / 255., 206 / 255., 29 / 255., 1.] popup.separator_height = '4dp' ok_button.bind(on_press=popup.dismiss) popup.open()
def _return_popup( self, title: AnyStr, content: Widget, size: Tuple = (500, 100), size_hint=(None, None) ) -> Popup: """ This method is for creating a unified Popup which will have a similar design throughout the application :param title: Title of the popup :type title: str :param content: content to be put in the popup :type content: Widget :param size: size of the Popup :type size: tuple :param size_hint: size hint of the Popup wrt to the parent :type size_hint: tuple; default=(500, 100) :return: the generated Popup :rtype: Popup """ popup = Popup(title=f"{self.constants.name} - {title}", content=content, size=size, size_hint=size_hint, title_align='center') # popup_background = ModalView() # popup_background.add_widget(Image(source=self.constants.rocket_image)) # popup.background = self.constants.rocket_image popup.background_color = [0, 255, 220, 0.9] popup.title_size = 18 # size in sp 255 0 120 popup.title_color = [1, 255, 0, 1] # rgba (pink) popup.separator_color = [1, 0, 255, 255] # rgba (cyan) popup.separator_height = 5 return popup
def __init__(self, screen_manager, localization): self.systemtools_sm = screen_manager self.l = localization description = self.l.get_str( "Would you like to reboot the console now?") title_string = self.l.get_str('Warning!') ok_string = self.l.get_bold('Yes') back_string = self.l.get_bold('No') def reboot_console(*args): self.systemtools_sm.sm.current = 'rebooting' img = Image(source="./asmcnc/apps/shapeCutter_app/img/error_icon.png", allow_stretch=False) label = Label(size_hint_y=2, text_size=(360, None), halign='center', valign='middle', text=description, color=[0, 0, 0, 1], padding=[0, 0], markup=True) ok_button = Button(text=ok_string, markup=True) ok_button.background_normal = '' ok_button.background_color = [76 / 255., 175 / 255., 80 / 255., 1.] back_button = Button(text=back_string, markup=True) back_button.background_normal = '' back_button.background_color = [230 / 255., 74 / 255., 25 / 255., 1.] btn_layout = BoxLayout(orientation='horizontal', spacing=15, padding=[0, 5, 0, 0]) btn_layout.add_widget(back_button) btn_layout.add_widget(ok_button) layout_plan = BoxLayout(orientation='vertical', spacing=10, padding=[30, 20, 30, 0]) layout_plan.add_widget(img) layout_plan.add_widget(label) layout_plan.add_widget(btn_layout) popup = Popup(title=title_string, title_color=[0, 0, 0, 1], title_font='Roboto-Bold', title_size='20sp', content=layout_plan, size_hint=(None, None), size=(360, 360), auto_dismiss=False) popup.separator_color = [230 / 255., 74 / 255., 25 / 255., 1.] popup.separator_height = '4dp' popup.background = './asmcnc/apps/shapeCutter_app/img/popup_background.png' ok_button.bind(on_press=popup.dismiss) ok_button.bind(on_press=reboot_console) back_button.bind(on_press=popup.dismiss) popup.open()
def __init__(self, screen_manager, localization, description, more_info): self.sm = screen_manager self.l = localization popup_width = 500 label_width = popup_width - 40 def open_more_info(*args): PopupFSCKInfo(self.sm, self.l, more_info) title_string = self.l.get_str('Error!') ok_string = self.l.get_bold('Ok') more_info_string = self.l.get_bold('More info') img = Image(source="./asmcnc/apps/shapeCutter_app/img/error_icon.png", allow_stretch=False) label = Label(size_hint_y=2, text_size=(label_width, None), markup=True, halign='center', valign='middle', text=description, color=[0, 0, 0, 1], padding=[10, 10]) ok_button = Button(text=ok_string, markup=True) ok_button.background_normal = '' ok_button.background_color = [230 / 255., 74 / 255., 25 / 255., 1.] more_info_button = Button(text=more_info_string, markup=True) more_info_button.background_normal = '' more_info_button.background_color = [ 33 / 255., 150 / 255., 243 / 255., 98 / 100. ] btn_layout = BoxLayout(orientation='horizontal', spacing=15, padding=[10, 20, 10, 0]) btn_layout.add_widget(more_info_button) btn_layout.add_widget(ok_button) layout_plan = BoxLayout(orientation='vertical', spacing=10, padding=[10, 10, 10, 10]) layout_plan.add_widget(img) layout_plan.add_widget(label) layout_plan.add_widget(btn_layout) popup = Popup(title=title_string, title_color=[0, 0, 0, 1], title_font='Roboto-Bold', title_size='20sp', content=layout_plan, size_hint=(None, None), size=(popup_width, 440), auto_dismiss=False) popup.background = './asmcnc/apps/shapeCutter_app/img/popup_background.png' popup.separator_color = [230 / 255., 74 / 255., 25 / 255., 1.] popup.separator_height = '4dp' ok_button.bind(on_press=popup.dismiss) more_info_button.bind(on_press=open_more_info) more_info_button.bind(on_press=popup.dismiss) popup.open()
def __init__(self, screen_manager, localization): self.systemtools_sm = screen_manager self.l = localization description = ( self.l.get_str("The developer app is to help our engineers access extra settings and " + \ "functions that might not be stable, or change how SmartBench behaves.") + \ " " + \ self.l.get_str("By using the developer app, you may risk causing damage to SmartBench.") + \ "\n" + \ self.l.get_str("Please enter the password if you want to continue.") ) title_string = self.l.get_str('Warning!') ok_string = self.l.get_bold('Ok') def check_password(*args): if textinput.text == "dev": self.systemtools_sm.open_developer_screen() img = Image(source="./asmcnc/apps/shapeCutter_app/img/error_icon.png", allow_stretch=False) label = Label(size_hint_y=1, text_size=(550, None), halign='center', valign='middle', text=description, color=[0, 0, 0, 1], padding=[0, 0], markup=True) textinput = TextInput(size_hint_y=0.7, text='') ok_button = Button(text=ok_string, markup=True) ok_button.background_normal = '' ok_button.background_color = [230 / 255., 74 / 255., 25 / 255., 1.] btn_layout = BoxLayout(orientation='horizontal', spacing=10, padding=[20, 0, 20, 0]) btn_layout.add_widget(ok_button) layout_plan = BoxLayout(orientation='vertical', spacing=10, padding=[40, 10, 40, 10]) layout_plan.add_widget(img) layout_plan.add_widget(label) layout_plan.add_widget(textinput) layout_plan.add_widget(btn_layout) popup = Popup(title=title_string, title_color=[0, 0, 0, 1], title_font='Roboto-Bold', title_size='20sp', content=layout_plan, size_hint=(None, None), size=(600, 400), auto_dismiss=False) popup.separator_color = [230 / 255., 74 / 255., 25 / 255., 1.] popup.separator_height = '4dp' popup.background = './asmcnc/apps/shapeCutter_app/img/popup_background.png' ok_button.bind(on_press=check_password) ok_button.bind(on_press=popup.dismiss) popup.open()
def __init__(self, screen_manager, localization): self.systemtools_sm = screen_manager self.l = localization description = self.l.get_str( "Please enter the password to use the factory settings.") title_string = self.l.get_str('Warning!') ok_string = self.l.get_bold('Ok') def check_password(*args): if textinput.text == "fac": self.systemtools_sm.open_factory_settings_screen() img = Image(source="./asmcnc/apps/shapeCutter_app/img/error_icon.png", allow_stretch=False) label = Label(size_hint_y=0.7, text_size=(450, None), halign='center', valign='middle', text=description, color=[0, 0, 0, 1], padding=[0, 0], markup=True) textinput = TextInput(size_hint_y=1, text='') ok_button = Button(text=ok_string, markup=True) ok_button.background_normal = '' ok_button.background_color = [230 / 255., 74 / 255., 25 / 255., 1.] btn_layout = BoxLayout(orientation='horizontal', spacing=10, padding=[10, 0, 10, 0]) btn_layout.add_widget(ok_button) layout_plan = BoxLayout(orientation='vertical', spacing=5, padding=[40, 10, 40, 10]) layout_plan.add_widget(img) layout_plan.add_widget(label) layout_plan.add_widget(textinput) layout_plan.add_widget(btn_layout) popup = Popup( title=title_string, title_color=[0, 0, 0, 1], title_font='Roboto-Bold', title_size='20sp', content=layout_plan, size_hint=(None, None), size=(500, 260), auto_dismiss=False, pos_hint={ 'x': 150.0 / 800.0, 'y': 200.0 / 480.0 }, ) popup.separator_color = [230 / 255., 74 / 255., 25 / 255., 1.] popup.separator_height = '4dp' popup.background = './asmcnc/apps/shapeCutter_app/img/popup_background.png' ok_button.bind(on_press=check_password) ok_button.bind(on_press=popup.dismiss) popup.open()
def __init__(self, screen_manager, localization): self.systemtools_sm = screen_manager self.l = localization description = ( self.l.get_str( "Beta testing allows our engineers and beta testers to try out software updates " + \ "that might not be stable, or change how SmartBench behaves." ) + \ "\n\n" + \ self.l.get_str("By updating to a beta version or developer branch you may risk causing damage to SmartBench.") + \ "\n\n" + \ self.l.get_str("Do you want to continue?") ) title_string = self.l.get_str('Warning!') ok_string = self.l.get_bold('Yes') back_string = self.l.get_bold('No') def dev_app(*args): self.systemtools_sm.open_beta_testing_screen() img = Image(source="./asmcnc/apps/shapeCutter_app/img/error_icon.png", allow_stretch=False) label = Label(size_hint_y=2, text_size=(410, None), halign='center', valign='middle', text=description, color=[0, 0, 0, 1], padding=[0, 0], markup=True) ok_button = Button(text=ok_string, markup=True) ok_button.background_normal = '' ok_button.background_color = [76 / 255., 175 / 255., 80 / 255., 1.] back_button = Button(text=back_string, markup=True) back_button.background_normal = '' back_button.background_color = [230 / 255., 74 / 255., 25 / 255., 1.] btn_layout = BoxLayout(orientation='horizontal', spacing=15, padding=[0, 10, 0, 0]) btn_layout.add_widget(back_button) btn_layout.add_widget(ok_button) layout_plan = BoxLayout(orientation='vertical', spacing=10, padding=[30, 20, 30, 0]) layout_plan.add_widget(img) layout_plan.add_widget(label) layout_plan.add_widget(btn_layout) popup = Popup(title=title_string, title_color=[0, 0, 0, 1], title_font='Roboto-Bold', title_size='20sp', content=layout_plan, size_hint=(None, None), size=(550, 400), auto_dismiss=False) popup.separator_color = [230 / 255., 74 / 255., 25 / 255., 1.] popup.separator_height = '4dp' popup.background = './asmcnc/apps/shapeCutter_app/img/popup_background.png' ok_button.bind(on_press=popup.dismiss) ok_button.bind(on_press=dev_app) back_button.bind(on_press=popup.dismiss) popup.open()