pi-top / pi-top-4-miniscreen Goto Github PK
View Code? Open in Web Editor NEWpi-top [4] Miniscreen Widget/Menu Application
pi-top [4] Miniscreen Widget/Menu Application
Can come later, but nice to have.
Receive signal of event, emit signal to OS, capture signal and display on screen.
Consider delaying actual shutdown command in device manager by 1 second to give the user time to see the message?
For example if a project name is too long or a SSID is too long it should be a scrolling animation.
Create a repo and source project this project definitely need the python common library and test project to create unit tests.
Common library's get_battery_capacity
is not currently speaking directly with ZMQ.
More generally, there is a wider issue that some of common lib is used by device manager, some depends on device manager. We have no way of discerning from the outside which of these functions can be used by the device manager - this could lead to issues later on.
feature/videoShootDemo
Consider separating startup from pt-sys-menu
, as they are not intrinsically linked.
Audio file:
https://drive.google.com/open?id=1IoZKmEQm9hwpOlCjnUq_kA4Sy4KfVW_K
The vnc and wifi page gif aren't shown correctly as they don't use the gif's worked out fps they use the hotspot's from which they are called fps which causes the animation to play incorrectly. (first frame isn't held long enough)
the speed of the animation is pretty slow.
A solution is to use ptoled libraries's playing gif metho which it shows the gif correctly.
Hint/tips look at pt-device-manager
For each project on the desktop:
These derived classes will be easy to use pages for users to make pages to show text or an animation or run a program. Each class will a derived of the base class Page.
The unit tests for these classes may vary depending on the the type of class it is.
The different pages we have in mind right now is.
TestPage
ImagePage
AnimationPage
ProgramPage
For these we will need to make template hotspots or components depending on how we decide on things.
E.g. a project page which is currently running cannot be exited without stopping the code. This would involve locking the viewport position from updating from button presses while in a locked state, for example.
The responsibility of this class is to take a page and show it on screen and pass methods to the ButtonController class to be invoked when a button is pressed using the callback design pattern.
class OLEDController:
data members:
current_page : page # this data member will be updated every time show_page() is called this is how we keep track of what is on screen
button_controller : ButtonController
register_for_buttons : bool
debug : bool
methods:
register(register_for_button_events : bool, debug : bool) # set the device if debug is True than a pygames frame to emulate the screen,
if the bool is set to True the internal methods will be passed to the ButtonController
show_page(Page) # this method will show the given page on the oled screen and set the current_page = the Page
_on_up_button_pressed() # calls show_page(current_page.up_button_page) if up_button_page is set and calls current_page.on_up_button()
_on_cancel_button_pressed() # calls show_page(current_page.cancel_button_page) if cancel_button_page is set and calls current_page.on_close_button()
_on_select_button_pressed() # calls show_page(current_page.select_button_page) if select_button_page is set and calls current_page.on_select_button()
_on_down_button_pressed() # calls show_page(current_page.down_button_page) if down_button_page is set and calls current_page.on_down_button()
unregister() # this will need to be called at the end so the ButtonController stops listening for button presses (I think this could be done through signal handing on exit of the program call it)
Unit tests for this class
# with every test create the matching if incorrectly done the issues is resolved tests
test if a page is passed to it correctly that the correct thigns are set like current_page
test if register sets the correct device
test if register sets initializes ButtonController properly
test if unregister stops the ButtonController listening for buttons
example
class OLEDController():
self._button_controller
self._current_page
self._register_for_buttons
def register(startup_page, register_for_button_events):
self._current_page = startup_page
self._register_for_buttons = register_for_button_events
if self._register_for_buttons:
self._button_controller = ButtonController()
self._button_controller.register()
self._button_controller.on_up_button_pressed(self._on_up_button_pressed)
self._button_controller.on_down_button_pressed(self._on_down_button_pressed)
self._button_controller.on_select_button_pressed(self._on_select_button_pressed)
self._button_controller.on_cancel_button_pressed(self._on_cancel_button_pressed)
def _on_up_button_pressed():
if self._current_page.up_button_page is not None:
self._current_page = self._current_page.up_button_page
else self._current_page.on_up_button_pressed is not None:
self._current_page.on_up_button_pressed()
def _on_down_button_pressed():
if self._current_page.down_button_page is not None:
self._current_page = self._current_page.down_button_page
else self._current_page.on_down_button_pressed is not None:
self._current_page.on_down_button_pressed()
def _on_select_button_pressed():
if self._current_page.select_button_page is not None:
self._current_page = self._current_page.select_button_page
else self._current_page.on_select_button_pressed is not None:
self._current_page.on_select_button_pressed()
def _on_cancel_button_pressed():
if self._current_page.cancel_button_page is not None:
self._current_page = self._current_page.cancel_button_page
else self._current_page.on_cancel_button_pressed is not None:
self._current_page.on_cancel_button_pressed()
def unregister():
if self._register_for_buttons:
self._button_controller.unregister()
The responsibility of this class is to build the page to be be shown on screen.
class Page:
data members:
page_name # page name can be used to identify the page
contents # what the page will look like (either hot spot or a collection of components)
up_button_page # pointer to another page
down_button_page # pointer to another page
select_button_page # pointer to another page
cancel_button_page # pointer to another page
methods:
# these methods will be called in the OLEDController e.g. the OLEDController will show the page of
up_button_page if set then call the on_up_button()
on_up_button()
on_down_button()
on_select_button()
on_cancel_button()
on_up_button()
Unit tests for this class
# with every test create the matching if incorrectly done the issues is resolved tests
test if the page object gets created properly
test if the methods correctly choose between method or page
test if the components/hotspot set to contents is correct
The issue is on the oled you won't see the full name.
To be added independently of menu system (e.g an animation on a page separate from the rest of the menu system)
"As a user turning on my device for the first time, without a display, I would like to be given instructions on my OLED display on how to connect via VNC so I can go through the pi-top first time setup procedure"
Test if viewport is refreshed correctly - i.e. triggered by redraw of hotspot
Screen disappears when position is updated when at end of viewport. Removing transitional page movement should avoid this issue. We can always look to add this later.
When pressing up or down the screen is updated properly. But when select or cancel is pressed sometimes the screen isn't updated until up or down is pressed.
Steps to duplicate:
press select and cancel a few times and you'll notice the screen not update.
But if you press up or down it will be on the correct menu.
In particular, the image that intends you to either connect via network or HDMI is not clear enough, and doesn't respond to a network cable being connected (e.g. no positive feedback)
e.g. Project title page can use an animated image and some text
Make widgets modular - e.g. let project title page have animation and title by using animated_gif widget and title_text
Design pattern thoughts: pass in the canvas, define area to work in, return altered canvas
Should this have an animation?
Need to get some design work done for this.
Minimum information for VNC connection:
When the pt4 is powered on the user has to wait a pretty long time before the sys menu start-up animation or sound kicks in.
This is a weird UX of the device being blank while everything is loading.
As per discussed we will make a oled library to build the menu system. This will be the library which we will release to users to work with the oled.
The initial design choice made is to forgo the viewpoint scrolling system for a "pages" event-based system where a page is like a node in a linked list and events are based on button presses.
Class page:
on_up_button_pressed = a page which is shown on screen when up in pressed.
on_down_button_pressed = a page which is shown on screen when down in pressed.
on_select_button_pressed = A method, a program starting or a new menu.
on_cancel_button_pressed = This button is to be used as a way to go back up a menu or stop a program running/ or break out of a method.
The library should be designed in a way to have a simple way to create pages, but not block users from creating custom pages allowing the user to choose how much they want to customise a page. Below is a idea we pseudo coded about the how the library should be used.
def play_sound():
// play the sound
screen_control_client = ScreenControl.register_client()
page_sub = PageFactory.create_text_page("Sub Menu")
page_main = PageFactory.create_text_page("Main Menu", play_sound, )
page.next_page = page_sub
page.on_next_button = () => screen_control_client.display_page(page_sub)
page.on_select_button = () => play_sound()
screen_control_client.show_page(page)
from pt-hardware-control import TextPage
class CustomTextPage(TextPage):
on_next_button()
{
next_page = PageFactory.create_text_page("TGhe next page")
ScreenControl.display_page(next_page)
}
the pages default method of creation will use a factory method design pattern. So all standard pages/page template can be constructed from the same class. The factory may also have a constructor to call a builder class for a specific more complicated page.
The standard pages list as it stands
PageModel(base)
Image page
Animation page
Text page
Program page
For showing the page on screen we haven't decided, but you can see from the example code above we have the idea of a seperate class called "ScreenControl" to be the controller/driver for the pages to the screen.
Waiting on designs from John
Transient error/dialog messages which could be subsequently dismissed, reverting back to the previous display
The placeholder animation is too long.
The responsibility of this class is to listen for button presses over zmq and invoke the methods passed to in. (callback pattern)
class ButtonController:
data members:
methods:
register() # register to listen for button presses and pass in the methods
on_up_button_pressed(fn) # this method will be invoked on up button press
on_down_button_pressed(fn) # this method will be invoked on down button press
on_select_button_pressed(fn) # this method will be invoked on select button press
on_cancel_button_pressed(fn) # this method will be invoked on cancel button press
unregister() # unregister to stop listening for button presses
Unit tests for this class
Test if the methods are invoked when a mocked button press happens
OLED battery icon not using 'cable connected' state for charging icon
If 'fully charged', will still show as charging, when it isn't
Should show if the power supply is detected
This could be a hardware issue, and could be fixed in up-to-date hardware.
When pressing the up and down buttons, sometimes they just don't do anything. In particular this is noticeable when pressing several times is fairly quick succession.
Do something with got_pi_control if it is false.
This global variable is how we check if the pi has control over the oled.
Due to the assets not being in an ideal while dealing with getting that sorted I need put placeholders in place.
Currently, all menus are generated on application start. This is a problem if a new project is added, or a project is removed. Therefore, everything should be dynamically handled.
Happens with two consecutive identical animated image widgets will cause a crash (not just the same image - the same hotspot! This includes if a menu only has one widget of this kind, due to infini-scrolling)
We should use a standard library for handling configuration (e.g. which system widgets to show)
https://docs.python.org/3.4/library/configparser.html
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.