def __init__(self, **kwargs): super().__init__( **kwargs, title="Wi-Fi Hotspot", Rows=[ partial( APPageRow, attribute="ssid", default_text="Not active", icon_path=get_image_file_path( "sys_info/networking/wifi-small.png"), ), partial( APPageRow, attribute="passphrase", icon_path=get_image_file_path( "sys_info/networking/padlock-small.png"), ), partial( APPageRow, attribute="ip_address", icon_path=get_image_file_path( "sys_info/networking/home-small.png"), ), ], )
def __init__(self, **kwargs): super().__init__( **kwargs, title="Wi-Fi", Rows=[ partial( Row, column_widths=[15, "auto"], Columns=[ partial( Image, vertical_align="center", image_path=get_image_file_path( "sys_info/networking/antenna-small.png" ), ), WifiStrength, ], ), partial( IconTextRow, text=get_ssid(), get_text=get_ssid, icon_path=get_image_file_path("sys_info/networking/wifi-small.png"), ), partial( IconTextRow, text=get_ip_address(), get_text=get_ip_address, icon_path=get_image_file_path("sys_info/networking/home-small.png"), ), ] )
def __init__( self, text: str, action: Callable, get_enabled_state: Optional[Callable] = None, font_size=14, **kwargs, ) -> None: self._action = action self._get_enabled_state = get_enabled_state action_state = ActionState.PROCESSING super().__init__(**kwargs, initial_state={"action_state": action_state}) self.text_component = self.create_child( Text, text=text, font_size=font_size, align="right", vertical_align="center", ) self.status_icon_component = self.create_child( Image, image_path=get_image_file_path(image_paths[action_state])) # get initial state in background threading.Thread(target=self._update_action_state, daemon=True).start()
def get_bootsplash_image_path(): try: config = ConfigParser() config.read("/etc/pt-miniscreen/settings.ini") return config.get("Bootsplash", "Path") except Exception: pass return get_image_file_path("startup/pi-top_startup.gif")
def __init__(self, **kwargs): super().__init__(**kwargs, title="Login Details", Rows=[ partial( IconTextRow, text=get_user(), get_text=get_user, icon_path=get_image_file_path( "sys_info/networking/person-small.png"), ), partial( IconTextRow, text=get_password(), get_text=get_password, text_vertical_align="bottom", icon_path=get_image_file_path( "sys_info/networking/padlock-small.png"), ), Row, ])
def __init__(self, **kwargs): super().__init__( **kwargs, text="Settings", image_path=get_image_file_path("menu/settings.gif"), virtual_page_list=False, # pages should keep state when not visible Pages=[ SSHTogglePage, VNCTogglePage, FurtherLinkTogglePage, APTogglePage, DisplayResetPage, ], )
def __init__(self, **kwargs): super().__init__( **kwargs, title="Ethernet", Rows=[ Row, # empty row partial( IconTextRow, icon_path=get_image_file_path( "sys_info/networking/home-small.png"), text=get_internal_ip(iface="eth0"), get_text=lambda: get_internal_ip(iface="eth0"), ), Row, # empty row ])
def __init__(self, **kwargs): super().__init__( **kwargs, title="USB", Rows=[ Row, # empty row partial( IconTextRow, icon_path=get_image_file_path( "sys_info/networking/home-small.png"), text=get_ip_address(), get_text=get_ip_address, ), Row, # empty row ])
def __init__(self, **kwargs): super().__init__( **kwargs, text="System", image_path=get_image_file_path("menu/system.gif"), image_size=(29, 29), Pages=[ LoginDetailsPage, BatteryPage, CPUPage, MemoryPage, SoftwarePage, PitopHardwarePage, RPiHardwarePage, ] )
def __init__(self, **kwargs): super().__init__(**kwargs, text="Network", image_path=get_image_file_path("menu/network.gif"), Pages=[WifiPage, EthernetPage, APPage, USBPage])
def get_battery_image_path(): return get_image_file_path( "sys_info/battery_shell_charging.png" if cable_connected( ) else "sys_info/battery_shell_empty.png")
from pt_miniscreen.core.utils import apply_layers, layer, offset_to_center from pt_miniscreen.utils import get_image_file_path logger = logging.getLogger(__name__) class ActionState(Enum): UNKNOWN = auto() PROCESSING = auto() ENABLED = auto() DISABLED = auto() IDLE = auto() image_paths = { ActionState.UNKNOWN: get_image_file_path("status/unknown.png"), ActionState.ENABLED: get_image_file_path("status/enabled.png"), ActionState.DISABLED: get_image_file_path("status/disabled.png"), ActionState.PROCESSING: get_image_file_path("status/processing.gif"), ActionState.IDLE: get_image_file_path("status/idle.png"), } class ActionPage(Component): def __init__( self, text: str, action: Callable, get_enabled_state: Optional[Callable] = None, font_size=14, **kwargs,
def _get_lower_icon_path(self): if self.can_perform_action: return get_image_file_path("gutter/tick.png") if self.can_enter_menu: return get_image_file_path("gutter/right_arrow.png")
def _get_upper_icon_path(self): if self.can_exit_menu: return get_image_file_path("gutter/left_arrow.png") if self.stack.active_component.can_scroll_up(): return get_image_file_path("gutter/top_arrow.png")
def get_path(relative_path): real_image = get_image_file_path(relative_path) test_image = real_image.replace("pt_miniscreen", "tests") return test_image if path.exists(test_image) else real_image
def __init__(self, **kwargs): super().__init__(**kwargs) self.icon_component = self.create_child( Image, image_path=get_image_file_path("sys_info/cpu.png")) self.cpu_bars_component = self.create_child(CPUBars)