def create_list(self, current_list): bike_list = [] for x in range(0, len(current_list)): num = str(x) bike_list.append( GZFrameContainer(element_name=("bike_item_group_" + num), children=[ GZFrameText(element_name=("bike_group_" + num), props={"text":current_list[x]['text'], "size":20, "font":"Times New Roman", "color":"black", "grid": [0,0]}), GZFrameText(element_name=("bike_item_status_" + num), props={"text":current_list[x]['availability'], "size":20, "font":"Times New Roman", "color":"black", "grid": [1,0]}) ], props={'layout': 'grid'}) ) return bike_list
def render(self, state): return [ GZFrameContainer(element_name='welcome_group', children=[ GZFrameText(element_name="header_text", props={"text":"Welcome to BikeCheck", "size":40, "font":"Times New Roman", "color":"lightblue"}), GZFrameButton(element_name="enter_button", props={"text":"Enter", "command": self.recognize_face}), ]) ]
def render(self, state): return [ GZFrameContainer(element_name='app_controls_group', children=[ GZFrameButton(element_name='back_button', props={ 'command': self.on_back, 'text': 'Back' }), ]), GZFrameText(element_name="header_text", props={ "text": "Maintenance", "size": 40, "font": "Times New Roman", "color": "lightblue" }), ]
def on_user_detected(self): if self.user_detected is not None: self.element.cancel(self.on_user_detected) if self.user: cropped_user_img = self.state.face.find_user(self.user) im = Image.fromarray(cropped_user_img) self.state.update_state({'auth': {'face_id': self.user.get('faceId')}}) pic = GZFramePicture(element_name="user_picture", props={'image': im}, height=200, width=200) text = GZFrameText(element_name="picture_text", props={"text":"Welcome {}!".format(self.user.get('name', 'Associate')), "size":50, "font":"Times New Roman", "color":"black"}) self.gzframe.view.destroy('welcome_group') self.gzframe.view.render(text) self.gzframe.view.render(pic) # pic.element.show() self.gzframe.app.after(2000, self.go_to_verify) else: self.user_detected = None self.retries += 1 self.recognize_face()
def render(self, state): def get_bike_list(): return { 'bike_list': [{ 'text': 'Mountain Bike', 'availability': 'Available' }] } bike_list = get_bike_list() return [ GZFrameButton(element_name="logout_button", props={ "text": "Log Out", "command": self.logout }), GZFrameText(element_name="header_text", props={ "text": "Available Bikes", "size": 30, "font": "Times New Roman", "color": "lightblue" }), BikeListComponent(element_name="bike_list", props=bike_list, state=state), GZFrameButton(element_name="checkout_button", props={ "text": "Check Out", "command": self.checkout_bike }), GZFrameButton(element_name="maintenance_button", props={ "text": "Maintenance", "command": self.to_maintenance }) ]
def render(self, state): welcome_message = "Welcome {name}".format(name=state.name) font = 'Times New Roman' numeric_keys = [] for x in range(0, 10): numeric_key_label = str((x + 1) if x < 9 else 0) element_name = 'numeric_button_' + numeric_key_label grid = [x % 3, int(x / 3)] if x < 9 else [1, 3] numeric_keys.append( GZFrameButton(element_name=element_name, on_click=self.on_pin_entry, props={ 'text': numeric_key_label, 'grid': grid })) return [ GZFrameButton(element_name='update_name', props={ 'command': self.update_name, 'text': 'Update Name' }), GZFrameContainer(element_name='app_controls_group', children=[ GZFrameButton(element_name='back_button', props={ 'command': self.on_back, 'text': 'Back' }), ]), GZFrameText(element_name='header_text', props={ 'text': welcome_message, 'size': 40, 'font': font, 'color': 'lightblue' }), GZFrameText(element_name='pin_text', props={ 'text': 'Enter your PIN to validate', 'size': 30, 'font': font, 'color': 'lightblue' }), GZFrameText(element_name='pin_input', props={ 'text': '', 'size': 60, 'font': font, 'color': 'black' }), GZFrameContainer(element_name='error_box', children=[ GZFrameText(element_name='pin_error', props={ 'text': 'The pin is invalid', 'visible': False, 'color': 'red' }), ]), GZFrameContainer(element_name='control_buttons_group', children=[ GZFrameButton(element_name="validate_button", props={ "text": "Validate", "command": self.validate_pin, 'enabled': False, 'grid': [0, 0] }), GZFrameButton(element_name="clear_button", props={ "text": "Clear", "command": self.clear_pin, 'enabled': False, 'grid': [1, 0] }) ], props={'layout': 'grid'}), GZFrameContainer(element_name='numeric_key_group', children=numeric_keys, props={'layout': 'grid'}) ]