How to use set_message method in autotest

Best Python code snippet using autotest_python

BookingWindow.py

Source:BookingWindow.py Github

copy

Full Screen

...19last_name_menu = Menu("", {'X': "Abort"}, exit_value='X')20def show_menu():21 def show_business_select_menu():22 while True:23 last_name_menu.set_message("Your Information", "Information")24 last = last_name_menu.show("Last Name: ", indent=2, sticky_message=True, show_available_seats=True)25 if last == "X":26 booking_menu.set_message("Business Select Booking Aborted", "Error")27 return28 first_name_menu.set_message("Your Information", "Information")29 first = first_name_menu.show("First Name: ", indent=2, sticky_message=True, show_available_seats=True)30 if first == "X":31 booking_menu.set_message("Business Select Booking Aborted", "Error")32 return33 get_my_passenger_list().append(Passenger(last, first, is_business_select=True))34 booking_menu.set_message("Business Select Seat Booked", "Confirmation")35 break36 def show_wga_menu():37 while True:38 last_name_menu.set_message("Your Information", "Information")39 last = last_name_menu.show("Last Name: ", indent=2, sticky_message=True, show_available_seats=True)40 if last == "X":41 booking_menu.set_message("Business Select Booking Aborted", "Error")42 return43 first_name_menu.set_message("Your Information", "Information")44 first = first_name_menu.show("First Name: ", indent=2, sticky_message=True, show_available_seats=True)45 if first == "X":46 booking_menu.set_message("Wanna Get Away Booking Aborted", "Error")47 return48 get_my_passenger_list().append(Passenger(last, first))49 booking_menu.set_message("Wanna Get Away\nSeat Booked", "Confirmation")50 break51 def show_disabled_menu():52 last_name_menu.set_message("Your Information", "Information")53 last = last_name_menu.show(" Last Name: ", indent=2, show_available_seats=True)54 if last == "X":55 booking_menu.set_message("Disabled Booking Aborted", "Error")56 return57 first_name_menu.set_message("Your Information", "Information")58 first = first_name_menu.show(" Last Name: " + last + "\nFirst Name: ", indent=2, show_available_seats=True)59 if first == "X":60 booking_menu.set_message("Disabled Booking Aborted", "Error")61 return62 while True:63 assistive_device_menu.set_message("Your Information", "Information")64 prompt = " Name: " + last + ", " + first + '\n' + \65 "Assistive Device? "66 assistive_device = assistive_device_menu.show(prompt, show_available_seats=True, indent=2, sticky_message=True)67 if assistive_device != assistive_device_menu.invalid_return_value:68 break69 else:70 print(styled("Error Message", "Invalid Input!"))71 time.sleep(2)72 if assistive_device == "X":73 booking_menu.set_message("Disabled Booking Aborted", "Error")74 return75 while True:76 attendant = attendant_menu.show(">>>Response: ", show_available_seats=True, indent=2)77 if attendant != attendant_menu.invalid_return_value:78 if attendant == "Y":79 if wanna_get_away_seats_available() < 2:80 attendant_menu.set_message("Not Enough Seats Available\nFor Attendant", "Caution")81 else:82 break83 else:84 break85 else:86 print(styled("Error Message", "Invalid Input!"))87 time.sleep(2)88 if attendant == "X":89 booking_menu.set_message("Disabled Booking Aborted", "Error")90 return91 elif attendant == "Y":92 last_name_menu.set_message("Attendant Information: Last Name\nLeave Blank To Use '" + last + "'",93 "Information")94 a_last = last_name_menu.show(" Last Name: ", indent=2, show_available_seats=True,95 default_value=last)96 if a_last == "X":97 booking_menu.set_message("Disabled Booking Aborted", "Error")98 return99 first_name_menu.set_message("Attendant Information", "Information")100 a_first = first_name_menu.show(" Last Name: " + a_last + "\nFirst Name: ", indent=2, show_available_seats=True)101 if a_first == "X":102 booking_menu.set_message("Disabled Booking Aborted", "Error")103 return104 d = DisabledPassenger(last, first, assistive_device == "Y")105 get_my_passenger_list().append(d)106 if attendant == 'Y':107 a = AttendantPassenger(a_last, a_first, d)108 a.elder = d109 d.attendant = a110 get_my_passenger_list().append(a)111 booking_menu.set_message("Disabled Passenger and\nAttendant Booked", "Confirmation")112 else:113 booking_menu.set_message("Disabled Passenger Booked", "Confirmation")114 def show_family_menu():115 while True:116 total = 1117 child_count = child_count_menu.show(">>>Children: ", show_available_seats=True, indent=2)118 if isinstance(child_count, str):119 if child_count == child_count_menu.exit_value:120 booking_menu.set_message("Family Booking Aborted", "Error")121 return122 else:123 child_count_menu.set_message("Invalid Number\nOf Children", "Error")124 elif child_count < 1:125 child_count_menu.set_message("Invalid Number\nOf Children", "Error")126 elif child_count + 1 > wanna_get_away_seats_available():127 child_count_menu.set_message("Not Enough Seats Available\nFor " + str(child_count) + " Children",128 "Caution")129 else:130 total += child_count131 break132 if str(child_count).upper() == "X":133 booking_menu.set_message("Family Booking Aborted", "Error")134 return135 while True:136 spouse = spouse_menu.show(">>>Response: ", show_available_seats=True, indent=2)137 if spouse != spouse_menu.invalid_return_value:138 if spouse == "Y":139 if child_count + 2 > wanna_get_away_seats_available():140 spouse_menu.set_message("Not Enough Seats Available\nFor You Spouse", "Caution")141 else:142 total += 1143 break144 else:145 break146 else:147 spouse_menu.set_message("Invalid Response", "Error")148 if spouse == "X":149 booking_menu.set_message("Family Booking Aborted", "Error")150 return151 else:152 name_list = list()153 for i in range(total):154 message_suffix = ""155 if i == 0:156 message = "Your Information"157 elif i == 1 and spouse == "Y":158 message = "Spouse's Information"159 message_suffix = ": Last Name\nLeave Blank to use '" + name_list[0] + "'"160 elif spouse == 'Y':161 message = "Child" + ((' ' + str(i - 1)) if int(child_count) > 1 else '') + " Information"162 message_suffix = ": Last Name\nLeave Blank to use '" + name_list[0] + "'"163 else:164 message = "Child" + ((' ' + str(i)) if int(child_count) > 1 else '') + " Information"165 message_suffix = ": Last Name\nLeave Blank to use '" + name_list[0] + "'"166 last_name_menu.set_message(message + message_suffix, "Information")167 first_name_menu.set_message(message, "Information")168 last = last_name_menu.show(" Last Name: ", indent=2, show_available_seats=True,169 default_value=None if message_suffix == "" else name_list[0])170 prompt = " Last Name: " + last + '\n' + "First Name: "171 if last == "X":172 booking_menu.set_message("Family Booking Aborted", "Error")173 return174 first = first_name_menu.show(prompt, indent=2, show_available_seats=True, sticky_message=True)175 if first == "X":176 booking_menu.set_message("Family Booking Aborted", "Error")177 return178 name_list.append(last)179 name_list.append(first)180 parent = ParentPassenger(name_list.pop(0), name_list.pop(0))181 get_my_passenger_list().append(parent)182 if spouse == 'Y':183 sp = ParentPassenger(name_list.pop(0), name_list.pop(0), spouse=parent)184 parent.spouse = sp185 get_my_passenger_list().append(sp)186 else:187 sp = None188 while len(name_list) > 0:189 child = ChildPassenger(name_list.pop(0), name_list.pop(0), parent)190 parent.children.append(child)191 get_my_passenger_list().append(child)192 if sp is not None:193 sp.children.append(child)194 booking_menu.set_message("Family Tickets Booked", "Confirmation")195 while True:196 reg = wanna_get_away_seats_available()197 bus = business_select_seats_available()198 booking_menu.menu_item(1).set_disabled(bus == 0)199 booking_menu.menu_item(2).set_disabled(reg < 1)200 booking_menu.menu_item(3).set_disabled(reg < 2)201 booking_menu.menu_item(4).set_disabled(reg < 1)202 choice = booking_menu.show(">>>Ticket Type: ", show_available_seats=True)203 if choice == 1:204 show_business_select_menu()205 elif choice == 2:206 show_disabled_menu()207 elif choice == 3:208 show_family_menu()209 elif choice == 4:210 show_wga_menu()211 elif choice == booking_menu.invalid_return_value:212 booking_menu.set_message("Invalid Selection", "Error")213 elif choice == booking_menu.exit_value:...

Full Screen

Full Screen

default.py

Source:default.py Github

copy

Full Screen

...78 self.setFocus( self.getControl( 30 ) )79 else:80 self.setFocus( self.getControl( 50 ) )8182 def set_message( self, msg_id=750, status=0 ):83 xbmcgui.lock()84 self.clear_message_timer()85 self.hide_status_bar()86 key = ( 500, 510, 520, )[ status ]87 self.getControl( key ).reset()88 self.getControl( key ).addLabel( _( msg_id ) )89 self.getControl( key ).setVisible( True )90 if ( status == 2 ):91 self.timer_msg = threading.Timer( 10, self.set_message, () )92 self.timer_msg.start()93 xbmcgui.unlock()9495 def hide_status_bar( self ):96 self.getControl( 500 ).setVisible( False )97 self.getControl( 510 ).setVisible( False )98 self.getControl( 520 ).setVisible( False )99 self.getControl( 900 ).setVisible( False )100101 def clear_message_timer( self ):102 if ( self.timer_msg is not None ): self.timer_msg.cancel()103104 def change_settings( self ):105 import settings106 settings = settings.GUI( "script-KCP-settings.xml", os.getcwd(), "Default", language=_ )107 settings.doModal()108 if ( settings.changed ):109 self.wrt54g._get_settings()110 if ( settings.restart ):111 self.check_status()112 del settings113 114 def check_status( self ):115 self.command_running = True116 self._status_xbox( False )117 self._status_router( False )118 self._status_kaid_running( False )119 self._set_status()120 self.command_running = False121 122 def _set_status( self ):123 self.set_status_labels()124 self.set_status_buttons()125126 def _status_xbox( self, update=True ):127 self.set_message( 500, 1 )128 ok = self.wrt54g._status_xbox()129 if ( ok == 2 ): self.set_message( 530, 2 )130 else: self.set_message()131 if ( update ): self._set_status()132 133 def _status_router( self, update=True ):134 self.set_message( 501, 1 )135 ok, version = self.wrt54g._status_router_kaid()136 if ( ok and version ): tmp_version = "Kaid (v.%s)" % ( version[ 0 ], )137 else: tmp_version = _( 112 )138 self.KAID_VERSION = [ _( 111 ), tmp_version, _( 113 ) ][ self.wrt54g.STATUS_ROUTER ]139 if ( ok == 2 ): self.set_message( 531, 2 )140 elif ( self.wrt54g.STATUS_ROUTER ):141 self.set_message( 502, 1 )142 ok = self.wrt54g._status_router_kaid_conf()143 if ( ok == 2 ): self.set_message( 531, 2)144 else: self.set_message()145 if ( update ): self._set_status()146147 def _status_kaid_running( self, update=True ):148 if ( self.wrt54g.STATUS_ROUTER != 2 ):149 self.set_message( 503, 1 )150 ok = self.wrt54g._status_kaid_running()151 if ( ok == 2 ): self.set_message( 531, 2 )152 else: self.set_message()153 if ( update ): self._set_status()154 155 def _kaid_restart( self ):156 self.set_message( 600 + ( not self.wrt54g.STATUS_KAID_RUNNING ), 1 )157 ok = self.wrt54g._kaid_restart()158 if ( not ok ): self.set_message( 630, 2 )159 else: 160 self.show_progressbar( 5 )161 self._status_kaid_running()162 163 def _kaid_kill( self ):164 self.set_message( 602, 1 )165 ok = self.wrt54g._kaid_kill()166 if ( not ok ): self.set_message( 630, 2 )167 else: 168 self.set_message()169 self._status_kaid_running()170 171 def _kaid_upload( self ):172 self.set_message( 603, 1 )173 ok = self.wrt54g._kaid_upload()174 if ( not ok ): self.set_message( 633, 2 )175 else: 176 self.set_message( 606, 1 )177 ok = self.wrt54g._finalize_upload()178 if ( not ok ): self.set_message( 636, 2 )179 else: 180 self._status_router( False )181 #self.set_message( 607, 1 )182 #ok = self.wrt54g._config_file_patch()183 #if ( not ok ): self.set_message( 637, 2 )184 #else:185 self._kaid_restart()186187 def _router_reboot( self ):188 self.set_message( 604, 1 )189 ok = self.wrt54g._router_reboot()190 if ( not ok ): self.set_message( 630, 2 )191 else: 192 self.show_progressbar( 20 )193 self.set_message()194 self._set_status()195196 def show_progressbar( self, seconds ):197 sleep_time = int( float( seconds * 1000 ) / 100 )198 self.hide_status_bar()199 self.getControl( 900 ).setPercent( 0 )200 self.getControl( 900 ).setVisible( True )201 for percent in range( 101 ):202 self.getControl( 900 ).setPercent( percent )203 xbmc.sleep( sleep_time )204 self.getControl( 900 ).setVisible( False )205 206 def exit_script( self, restart=False ):207 self.clear_message_timer() ...

Full Screen

Full Screen

display_manager.py

Source:display_manager.py Github

copy

Full Screen

...20 self.display_thread = Thread(target=self.run, daemon=True)21 self.display_thread.start()22 def stop(self):23 self.locker.acquire()24 self.display.set_message("P:" + str(self.points))25 self.display_stop.set()26 def addPoints(self, points):27 self.locker.acquire()28 self.points += points29 self.locker.release()30 def removePoints(self, points):31 self.locker.acquire()32 self.points -= points33 self.locker.release()34 def normal(self, **kwargs):35 if not self.eyes_locker.acquire(blocking=False):36 return37 self.left_eye.set_message("^^^^^%^", 1, speed=200)38 self.right_eye.set_message('_____&_', 1, speed=200)39 self.eyes_locker.release()40 def _reset_normal(self, duration):41 def target():42 time.sleep(duration)43 self.normal()44 Thread(target=target, daemon=True).start()45 def happy(self, duration=2):46 self.left_eye.set_message("|", 1)47 self.right_eye.set_message("{", 1)48 self._reset_normal(duration)49 def sleep(self, duration=2):50 self.left_eye.set_message("%", 1)51 self.right_eye.set_message("&", 1)52 self._reset_normal(duration)53 def love(self, duration=2):54 self.left_eye.set_message("[\\]\\", 1, 400)55 self.right_eye.set_message("[\\]\\", 1, 400)56 self._reset_normal(duration)57 def angry(self, duration=2):58 self.left_eye.set_message("}", 1)59 self.right_eye.set_message("~", 1)60 self._reset_normal(duration)61 def surprised(self, duration=2):62 self.left_eye.set_message("`", 1)63 self.right_eye.set_message("`", 1)64 self._reset_normal(duration)65 def sick(self, duration=2):66 self.left_eye.set_message("@", 2, 200)67 self.right_eye.set_message("@", 3, 200)68 self._reset_normal(duration)69 def get_time_remaining(self):70 return MATCH_DURATION-round(time.time() - self.start_time)71 def updateDisplay(self):72 remaining_time = MATCH_DURATION-round(time.time() - self.start_time)73 if remaining_time > 0:74 try:75 self.display.set_message(76 "T:"+str(remaining_time) + " P:" + str(self.points))77 except ValueError:78 self.display.set_message("P:" + str(self.points))79 else:80 self.display.set_message("P:" + str(self.points))81 def run(self):82 while not self.display_stop.is_set():83 self.locker.acquire()84 self.updateDisplay()85 self.locker.release()...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run autotest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful