Skip to content

DataStore

Adam Furman edited this page Jul 8, 2016 · 1 revision

DataStore class

The DataStore class implements simple persistent memory for applications. If used in an app, it creates a file in the res/ directory called app_name.ds, which contains JSON text. The class acts like a dict, with values being automatically saved as they are modified. Each app object has a dataStore attribute which lets it access its own DataStore. However, the actual file will not be created until data is written.

DataStore ( Application app )

Accessible via app.dataStore.

Object Variables

  • Application application The application object that the DataStore is for.
  • str dsPath The path to the file.
  • dict data The data in the store. Note that this is only created if a value is read from the store, so always do a "get" operation before writing data.

Methods

  • getStore () An internal method that initializes the file.
  • saveStore () An internal method that saves the data to the file.
  • get ( str key, default=None ) Read a value from the store, returning default if it does not exist.
  • set ( str key, value ) Sets a value.

Note that the DataStore class also supports reading and writing via __getitem__ and __setitem__.

Home

Getting Started

Documentation

Threads and Tasks

Applications and Notifications

The State Class and Variable

The GUI, Events, Resources, and Dialogs

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

GUI Components and Containers

  • 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
Clone this wiki locally