def alerts(self, sender): # Retrieve alerts alerts = wa.get_alerts(json_w, json_f) ''' Kill sceneview to cut memory overhead, textview then loads much faster. Note too that when textview is loaded via .present() without killing the sceneview, the sceneview will lock up after closing the textview window. ''' self.remove_subview(self.scene_view) tv = ui.TextView() #w, h = ui.get_screen_size() #tv.frame = (0, 20, w, h / 1.2) tv.frame = self.bounds tv.border_color = 'grey' tv.border_width = 3 tv.background_color = ('white') tv.text = alerts tv.editable = False tv.selectable = False tv.font = ('<system>', 9) self.closebutton(tv) self.add_subview(tv)
def __init__(self, in_scene): # Set up title bar with web view button b1 = ui.ButtonItem('Web View', action = self.web_weather, tint_color = 'black') self.right_button_items = [b1] # If any severe weather then set up a button to view the alerts if len(wa.get_alerts(json_w, json_f)) != 0: b2 = ui.ButtonItem('Severe Weather Alert', action = self.alerts, tint_color = 'red') self.left_button_items = [b2] self.present('full_screen') self.scene_view = scene.SceneView(frame = self.bounds) self.scene_view.scene = in_scene self.add_subview(self.scene_view)