Exemplo n.º 1
0
    def __init__(self):
        self.tk = Tk()
        self.tk.configure(background='black')
        self.topFrame = Frame(self.tk, background='black')
        self.bottomFrame = Frame(self.tk, background='black')
        self.topFrame.pack(side=TOP, fill=BOTH, expand=YES)
        self.bottomFrame.pack(side=BOTTOM, fill=BOTH, expand=YES)
        self.centerFrame = Frame(self.tk, background='black')
        self.centerFrame.pack(fill="none", expand=True)
        self.state = False
        self.tk.bind("<Return>", self.toggle_fullscreen)
        self.tk.bind("<Escape>", self.end_fullscreen)
        # clock
        self.clock = Clock(self.topFrame)
        self.clock.pack(side=RIGHT, anchor=N, padx=100, pady=60)
        # weather
        self.weather = Weather(self.topFrame)
        self.weather.pack(side=LEFT, anchor=N, padx=100, pady=60)

        # commands text
        self.commands_sec = Commands(self.bottomFrame)
        self.commands_sec.pack(fill="none", expand=True, anchor="center")
        self.commands_sec.command_actions('weather')
        # news
        # self.news = News(self.bottomFrame)
        # self.news.pack(side=LEFT, anchor=S, padx=100, pady=60)
        # calender - removing for now
        # self.calender = Calendar(self.bottomFrame)
        # self.calender.pack(side = RIGHT, anchor=S, padx=100, pady=60)

        # Greetings

        self.greetings = Greetings(self.centerFrame)
        self.greetings.pack(fill="none", expand=True)
Exemplo n.º 2
0
class FullscreenWindow:
    def __init__(self):
        self.tk = Tk()
        self.tk.configure(background='black')
        self.topFrame = Frame(self.tk, background='black')
        self.bottomFrame = Frame(self.tk, background='black')
        self.topFrame.pack(side=TOP, fill=BOTH, expand=YES)
        self.bottomFrame.pack(side=BOTTOM, fill=BOTH, expand=YES)
        self.centerFrame = Frame(self.tk, background='black')
        self.centerFrame.pack(fill="none", expand=True)
        self.state = False
        self.tk.bind("<Return>", self.toggle_fullscreen)
        self.tk.bind("<Escape>", self.end_fullscreen)
        # clock
        self.clock = Clock(self.topFrame)
        self.clock.pack(side=RIGHT, anchor=N, padx=100, pady=60)
        # weather
        self.weather = Weather(self.topFrame)
        self.weather.pack(side=LEFT, anchor=N, padx=100, pady=60)

        # commands text
        self.commands_sec = Commands(self.bottomFrame)
        self.commands_sec.pack(fill="none", expand=True, anchor="center")
        self.commands_sec.command_actions('weather')
        # news
        # self.news = News(self.bottomFrame)
        # self.news.pack(side=LEFT, anchor=S, padx=100, pady=60)
        # calender - removing for now
        # self.calender = Calendar(self.bottomFrame)
        # self.calender.pack(side = RIGHT, anchor=S, padx=100, pady=60)

        # Greetings

        self.greetings = Greetings(self.centerFrame)
        self.greetings.pack(fill="none", expand=True)
        # self.greetings.place(relx=.5, rely=.5, anchor="center")

    def toggle_fullscreen(self, event=None):
        self.state = not self.state  # Just toggling the boolean
        self.tk.attributes("-fullscreen", self.state)
        return "break"

    def end_fullscreen(self, event=None):
        self.state = False
        self.tk.attributes("-fullscreen", False)
        return "break"
Exemplo n.º 3
0
from plugins.radio import Radio
from plugins.volume import Volume
from plugins.utils import Backlight, Contrast

print("""
This advanced example uses the menu framework.
Providing you have VLC and extra dependencies installed, it should function as an internet radio!

Press CTRL+C to exit.
""")

nav.enable_repeat(True)

# We want to use clock both as an option
# and as the idle plugin
clock = Clock(backlight)
"""
Using a set of nested dictionaries you can describe
the menu you want to display on dot3k.

A nested dictionary describes a submenu.
An instance of a plugin class ( derived from MenuOption ) can be used for things like settings, radio, etc
A function name will call that function.
"""
menu = Menu(
    {
        'Clock': clock,
        'Radio Stream': Radio(),
        'Volume': Volume(backlight),
        'Status': {
            'CPU': GraphCPU(),
"""
Using a set of nested lists you can describe
the menu you want to display on dot3k.

Instances of classes derived from MenuOption can
be used as menu items to show information or change settings.

See GraphTemp, GraphCPU, Contrast and Backlight for examples.
"""

backlight_idle = BacklightIdleTimeout(backlight)

menu = Menu(structure={
    'WiFi': Wlan(),
    'Clock': Clock(backlight),
    'Status': {
        'IP': IPAddress(),
        'CPU': GraphCPU(backlight),
        'Temp': GraphTemp()
    },
    'Settings': {
        'Display': {
            'Contrast': Contrast(lcd),
            'Backlight': Backlight(backlight)
        }
    }
},
            lcd=lcd,
            idle_handler=backlight_idle,
            idle_time=5,
Exemplo n.º 5
0
#!/usr/bin/env python

import dot3k.joystick as joystick
import dot3k.lcd as lcd
import dot3k.backlight as backlight
from dot3k.menu import Menu
from plugins.utils import Backlight, Contrast
from plugins.clock import Clock
from plugins import Radio, Volume, GraphCPU, GraphTemp
import time

# We want to use clock both as an option
# and as the idle plugin
clock = Clock()

"""
Using a set of nested dictionaries you can describe
the menu you want to display on dot3k.

A nested dictionary describes a submenu.
An instance of a plugin class ( derived from MenuOption ) can be used for things like settings, radio, etc
A function name will call that function.
"""
menu = Menu({
    'Clock':clock,
    'Radio Stream':Radio(),
    'Volume':Volume(),
    'Status': {
      'CPU':GraphCPU(),
      'Temp':GraphTemp()
    },
Exemplo n.º 6
0
from plugins.clock import Clock
from plugins.graph import IPAddress, GraphTemp, GraphCPU, GraphNetSpeed
from plugins.wlan import Wlan

print("""
This example uses automation to advance through each menu item.
You should see each menu item appear in turn. However use-input will not be accepted.

Press CTRL+C to exit.
""")

sys.path.append('../../')

menu = Menu(
    {
        'Clock': Clock(),
        'IP': IPAddress(),
        'CPU': GraphCPU(),
        'Temp': GraphTemp()
    }, lcd, None, 30)


def millis():
    return int(round(time.time() * 1000.0))


def advance():
    global last
    if millis() > last + (delay * 1000.0):
        menu.cancel()
        menu.down()
Exemplo n.º 7
0
    my_invader,
    5)

"""
If you want menu items to appear in a defined order, you must
add them one at a time using 'add_item'. This method accepts
a plugin instance, plus the path where you want it to appear.

Instances of classes derived from MenuOption can
be used as menu items to show information or change settings.

See GraphTemp, GraphCPU, Contrast and Backlight for examples.
"""

menu.add_item('Space Invader', my_invader)
menu.add_item('Clock', Clock())
menu.add_item('Status/IP', IPAddress())
menu.add_item('Status/Test', '')
menu.add_item('Status/CPU', GraphCPU())
menu.add_item('Status/Arrr', 'Blah blah')
menu.add_item('Status/Temp', GraphTemp())
menu.add_item('Settings/Display/Contrast', Contrast(lcd)),
menu.add_item('Settings/Display/Backlight', Backlight(backlight))

"""
You can use anything to control dot3k.menu,
but you'll probably want to use dot3k.joystick
"""
REPEAT_DELAY = 0.5

Exemplo n.º 8
0
"""
Using a set of nested lists you can describe
the menu you want to display on dot3k.

Instances of classes derived from MenuOption can
be used as menu items to show information or change settings.

See GraphTemp, GraphCPU, Contrast and Backlight for examples.
"""
my_invader = SpaceInvader()

settings = Camerasettings()

menu = Menu(structure={
    'Take Picture': takeshot(settings),
    'Current Time': Clock(backlight),
    'Camera status': {
        'IP': IPAddress()
    },
    'Camera settings': {
        'ISO': ISO(settings),
        'Orientation': {
            'Horizontal Flip': Hflip(settings),
            'Vertical Flip': Vflip(settings)
        }
    },
    'Settings': {
        'WiFi Setup': Wlan(),
        'Display': {
            'Contrast': Contrast(lcd),
            'Backlight': Backlight(backlight)