-
Notifications
You must be signed in to change notification settings - Fork 14
State
The State
class is one of the core components of Python OS. It links together all of the various parts of the UI and system and makes it accessible via the state
global variable. Using this variable, an application can access any of the parts of the system, including the thread controller, notification queue, application list, color palette, and more.
It is initialized automatically by the system. You should never start a new State.
The state
variable is passed to your application's onStart
method along with its app object.
Static Methods
-
exit ()
Exits Python OS. -
rescue ()
Enters the rescue screen. This is a recovery tool that allows the user to close misbehaving apps or exit Python OS. -
error_recovery ( str message="Unknown", data=None )
This method is called by many parts of Python OS if an error is detected. The message will be displayed on the screen, and the data will be saved intemp/last_error.txt
. -
main ()
The main Python OS loop. -
state_shell ()
This is a text-based version of the State Shell app. You can enter commands to debug Python OS.
Object Variables
-
Application activeApplication
The object of the current app. -
ColorPalette colorPalette
The color palette provider object. -
Icons icons
The icon provider object. -
Controller threadController
The thread controller object. -
EventQueue eventQueue
The event queue. -
NotificationQueue notificationQueue
The notification queue. -
FunctionBar functionBar
The UI function bar, located at the bottom of the screen. -
Font font
The default system font. -
Font typingFont
The default monospace font, used for text input. -
ApplicationList appList
The list of all the installed apps on the system. -
Keyboard keyboard
The currently active keyboard. -
GUI gui
The GUI object, containing information about the screen size.
The State class then defines a getter and setter method for each of these variables. They are listed below without description, as their names are self-explanatory.
Getter () | Setter ( arg ) |
---|---|
getActiveApplication | setActiveApplication |
getColorPalette | setColorPalette |
getIcons | setIcons |
getThreadController | setThreadController |
getEventQueue | setEventQueue |
getNotificationQueue | setNotificationQueue |
getFont | setFont |
getTypingFont | setTypingFont |
getGUI | setGUI |
getApplicationList | setApplicationList |
getFunctionBar | setFunctionBar |
getKeyboard | setKeyboard |
Python OS includes an app called "State Shell" which is accessible through the About app. This is something like a terminal interface, and you can use it to debug your system. Any command you enter has the prefix state.
prepended to it.
For example, to get the current GUI refresh rate, you would type:
getGUI().update_interval
Wiki and documentation by Adam Furman. Find an error or have a suggestion? Send it to furmada (at) gmail dot com.
Documentation
-
Application
class -
ApplicationList
class -
Notification
class-
PermanentNotification
class
-
-
NotificationQueue
class -
DataStore
class -
ImmersionUI
class
-
State
class
-
GUI
class
The following classes are all under the GUI class, e.g. Font
is actually accessed as GUI.Font
.
-
Font
class -
Icons
class -
ColorPalette
class -
LongClickEvent
class -
IntermediateUpdateEvent
class -
EventQueue
class -
FunctionBar
class -
Keyboard
class -
Overlay
class -
Dialog
class-
OKDialog
dialog -
ErrorDialog
dialog -
WarningDialog
dialog -
YNDialog
dialog -
OKCancelDialog
dialog -
AskDialog
dialog -
CustomContentDialog
dialog
-
-
NotificationMenu
overlay-
RecentAppSwitcher
overlay -
Selector
overlay
-
-
Component
class
The following classes are all Components
, they inherit from that class.
-
Container
component -
AppContainer
container -
Button
container -
KeyboardButton
container -
TextEntryField
container -
PagedContainer
container-
GriddedPagedContainer
container -
ListedPagedContainer
container
-
-
ButtonRow
container -
ScrollableContainer
container-
ListScrollableContainer
container -
TextScrollableContainer
container -
MultiLineTextEntryField
container
-
-
Text
component -
MultiLineText
component -
ExpandingMultiLineText
component -
Image
component -
Slider
component -
Checkbox
component -
Switch
component -
Canvas
component -
ScrollIndicator
component