Пример #1
0
 def setup(self, config):
   self.ready = False
   MenuOption.setup(self, config)
   if 'Radio Stations' in self.config.sections():
     self.stations = self.config.options('Radio Stations')
     self.ready = True
     self.start()
Пример #2
0
    def __init__(self, settings):
        MenuOption.__init__(self)
	self.settings=settings
	self.mode = 0
	self.current_iso = 0
	self.current_hflip = False
	self.current_vflip = False
    def setup(self, config):
        MenuOption.setup(self, config)
        
        self.whitelist = self.getWhitelist(config)
        self.blacklist = self.getBlacklist(config)
        self.whitelist_status = self.getWhitelistStatus(config)
        self.blacklist_status = self.getBlacklistStatus(config)

        lcd.create_char(0, [0, 4, 14, 0, 0, 14, 4, 0])  # Up down arrow

        # init webclient
        self.webclient = Webclient(config)
        
        # get the modules as JSON
	complete_modules = self.getModules()
	
        for line in complete_modules:
            if self.whitelist:
                if line in self.whitelist:
                    self.modules.append(line)
            else:
                self.modules.append(line)
          
            if self.blacklist_status:
                if line in self.blacklist and line in self.modules:
                    self.modules.remove(line)

	self.ready = True
Пример #4
0
	def __init__(self):
		self.mode = 0 # 0:Player View, 1:Menu
		self.selindex = 0
		self.options = [
			"Pause",
			"Back"
		]
		self.actions = [
			self.do_play,
			self.do_back
		]
		self.mpd = MPDClient()
		self.mpd.timeout = 10
		self.mpd.idletimeout = None
		self.is_setup = False

		# Icons
		self.anim_play = [[0,0,8,12,14,12,8,0],[0,0,4,6,7,6,4,0],[0,0,2,3,19,3,2,0],[0,0,1,17,25,17,1,0],[0,0,16,24,28,24,16,0]]
		self.anim_pause = [[0,0,0,0,0,0,0,0],[0,27,27,27,27,27,27,0]]
		self.icon_stop = [0,0,31,31,31,31,31,0]
		
		try:
			self.mpd.connect("localhost", 6600)
		except socket.error:
			print("Could not connect to MPD")
		
		MenuOption.__init__(self)
Пример #5
0
Файл: menu.py Проект: akx/dot3k
 def __init__(self):
     self.start = self.millis()
     self.invader = [
         [14, 31, 21, 31, 9, 18, 9, 18],
         [14, 31, 21, 31, 18, 9, 18, 9]
     ]
     MenuOption.__init__(self)
Пример #6
0
	def __init__(self):
		hostapd_config = self.read_config_file('/etc/hostapd/hostapd.conf')

		self.ssid = str(util_get_safe_from_map(hostapd_config,'ssid'))
		self.psk = str(util_get_safe_from_map(hostapd_config,'wpa_passphrase'))

		MenuOption.__init__(self)
  def __init__(self):
    self.selected_option = 0

    self.options = [
      'Pirate',
      'Monkey',
      'Robot',
      'Ninja',
      'Dolphin'
    ]

    '''
    Python has no "switch" so we'll store an array of functions
    to call when an option is selected
    '''
    self.actions = [
      self.handle_pirate,
      self.handle_monkey,
      self.handle_robot,
      self.handle_ninja,
      self.handle_dolphin,
    ]

    '''
    We want to give each menu option a status icon too, and
    here's a place to store them.
    '''
    self.icons = [None] * 5

    MenuOption.__init__(self)
Пример #8
0
 def __init__(self):
     self.icon_eth = [0,0,4,4,21,21,17,31]
     self.icon_wifi = [0,0,14,17,4,10,0,4,0,0]
     self.icon_br = [0,4,12,31,0,31,6,4,0]
     self.refresh_ips()
     self.is_setup = False
     MenuOption.__init__(self)
Пример #9
0
 def setup(self, config):
   MenuOption.setup(self, config)
   self.edit_mode = EDIT_VOLUME
   self.volume = int(self.get_option('Sound','volume',80))
   self.set_volume()
   self.actual_volume = self.get_volume()
   self.output_mode = self.get_mode()
Пример #10
0
  def __init__(self):
    self.debug = False
    self.debris = []
    self.stars = []
    self.running = False
    self.max_debris = 10
    self.max_stars  = 10
    self.last_update = 0
    self.time_start = 0
    self.sprites = [
      [14,31,31,14,0 ,0 ,0 ,0 ], # 0: Debris top of char
      [0 ,0 ,0 ,0 ,14,31,31,14], # 1: Debris bottom of char
      [30,5 ,7 ,30,0 ,0 ,0 ,0 ], # 2: Ship top of char
      [0 ,0 ,0 ,0 ,30,5 ,7, 30], # 3: Ship bottom of char

      [30,5 ,7 ,30,14,31,31,14], # 4: Ship above debris
      [14,31,31,14,30,5 ,7, 30], # 5: Ship below debris
    ]
    self.width  = 16
    self.height = 5 # Two rows per char
  
    self.player_x = 1 # Player horizontal position
    self.player_y = 3 # Player vertical position

    self.current_player_x   = None
    self.current_player_y   = None
    self.current_player_pos = None

    self.fill_debris()

    MenuOption.__init__(self)
Пример #11
0
	def __init__(self):

		self.cols = 16
		self.initialized = False
		
		self.scroll_up_icon = chr(0)
		self.scroll_down_icon = chr(1)
		self.abbreviation_icon = chr(2)
		self.placeholder_icon = chr(3)
		self.caps_on = True
		self.symbols_mode = False
		self.cancel_aborts = False # by default, Cancel button acts as Delete
		self.selection = {'row': 0, 'option': 0}
		self.first_displayed_row = 0
		
		self.uppercase_letters = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
		self.lowercase_letters = list('abcdefghijklmnopqrstuvwxyz')
		self.space_symbol = 'Spc'
		self.line_break = '\n' # for layout only; can't be entered
		self.numbers = list('0123456789')
		self.quick_punctuation = list('./:@')
		self.symbols = list('./:@\'"~+-=_!?,;()[]<>{}\\^|&*$%#`')
		self.caps_command = "Caps"
		self.symbols_command = "More"
		self.delete_command = "Del"
		self.cancel_command = "Cancel"
		self.commit_command = "Accept"
		self.commands = [self.caps_command, self.symbols_command, self.delete_command, self.cancel_command, self.commit_command]
		
		self.uppercase_set = self.uppercase_letters
		self.uppercase_set.append(self.space_symbol)
		self.uppercase_set.extend(self.numbers)
		self.uppercase_set.extend(self.quick_punctuation)
		self.uppercase_set.extend(self.commands)
		
		self.lowercase_set = self.lowercase_letters
		self.lowercase_set.append(self.space_symbol)
		self.lowercase_set.extend(self.numbers)
		self.lowercase_set.extend(self.quick_punctuation)
		self.lowercase_set.extend(self.commands)
		
		self.symbols_set = self.symbols
		self.symbols_set.append(self.line_break)
		self.symbols_set.extend(self.commands)
		
		self.confirm_accept = "Yes"
		self.confirm_cancel = "No"
		self.confirm_quit = "Quit"
		self.confirm_set = [self.confirm_accept, self.confirm_cancel, self.confirm_quit]
		
		self.display_map = [] # 2D array of options
		self.display_ranges = [] # 2D array of range-arrays with option extents

		self.entered_text = ''
		self.confirming = False

		MenuOption.__init__(self)

		self.is_setup = False
Пример #12
0
    def __init__(self):
        self.selected_option = 0
        self.options = [
                {'title': 'Play', 'action': self.handle_play, 'icon': ' '},
                {'title': 'Stop', 'action': self.handle_stop, 'icon': ' '}
                ]

        MenuOption.__init__(self)
    def __init__(self):
	self.ready = False
	self.config = ConfigObj("init.conf")
	self.cmds = None
	self.selected_cmd = 0
	self.last_update = 0
	
	MenuOption.__init__(self)	
    def __init__(self):
        self.consoleMessages = ConsoleMessages()
	self.ready = False
	self.modules = []
	self.selected_module = 0	
	self.last_update = 0
	
        MenuOption.__init__(self)
Пример #15
0
Файл: graph.py Проект: akx/dot3k
 def __init__(self):
     self.last = self.millis()
     self.last_update = 0
     self.raw_dlold = 0
     self.raw_ulold = 0
     self.dlspeed = 0
     self.ulspeed = 0
     self.iface = 'eth0'
     MenuOption.__init__(self)
Пример #16
0
 def __init__(self, backlight):
   self.backlight = backlight
   self.hue = 0
   self.sat = 100
   self.val = 100
   self.mode = 0
   self.modes = ['h','s','v','r','g','b']
   self.from_hue()
   MenuOption.__init__(self)
Пример #17
0
  def __init__(self):
    self.items = []

    self.selected_item = 0

    self.scanning = False

    MenuOption.__init__(self)
    
    self.is_setup = False
Пример #18
0
 def __init__(self, backlight):
   self.backlight = backlight
   self.hue = 0
   self.sat = 100
   self.val = 100
   self.mode = 0
   self.modes = ['h','s','v','r','g','b','e']
   self.from_hue()
   self._icons_setup = False
   MenuOption.__init__(self)
Пример #19
0
  def __init__(self):
    self.companies = ['GOOG','AAPL','TWTR','FB']
    self.data = {}
    self.company = 0

    self.last_update = 0
    self.last_event = 0

    MenuOption.__init__(self)
    
    self.is_setup = False
Пример #20
0
  def __init__(self, backlight=None):
    self.items = []

    self.selected_item = 0

    self.scanning = False

    self.backlight = backlight

    MenuOption.__init__(self)
    
    self.is_setup = False
Пример #21
0
  def __init__(self):
    self.last = self.millis()
    self.last_update = 0
    
    self.apikey = 'MissingAPI'
    self.stations = 'MissingStat'

    self.weatherconditionsresult = ''

    self.is_setup = False
        
    MenuOption.__init__(self)
Пример #22
0
 def __init__(self):
   self.last = self.millis()
   self.last_update = 0
   
   self.apikey = 'MissingAPI'
   self.stations = 'MissingStat'
   
   self.WU_Alerts_Result = ''
   
   self.is_setup = False
   
   MenuOption.__init__(self)
Пример #23
0
 def __init__(self, backlight):
     self.backlight = backlight
     self.hue = 0
     self.sat = 100
     self.val = 100
     self.mode = 0
     self.r = 0
     self.g = 0
     self.b = 0
     self.modes = ["h", "s", "v", "r", "g", "b", "e"]
     self.from_hue()
     self._icons_setup = False
     MenuOption.__init__(self)
Пример #24
0
 def __init__(self):
   self.last = self.millis()
   self.last_update = 0
   self.modes = ['P1','P2','P3','P4','P5','P6','P7','P8']
   self.mode = 0
   
   self.apikey = 'MissingAPI'
   self.stations = 'MissingStat'
   
   self.WU_Fcst_Result = ''
   
   self.is_setup = False
   
   MenuOption.__init__(self)
Пример #25
0
 def __init__(self, backlight = None):
   MenuOption.__init__(self)
   self.output_options = {
                          MODE_AUTO: 'Auto',
                          MODE_HEADPHONES: 'Headphones',
                          MODE_HDMI: 'HDMI'
                         }
   self.output_mode = -1
   self.volume = None
   self.backlight = backlight
   self.actual_volume = 0
   self.last_update = 0
   self.edit_mode = EDIT_VOLUME
   self._icons_setup = False
Пример #26
0
 def __init__(self, backlight=None):
     MenuOption.__init__(self)
     self.output_options = {
         MODE_AUTO: 'Auto',
         MODE_HEADPHONES: 'Headphones',
         MODE_HDMI: 'HDMI'
     }
     self.output_mode = -1
     self.volume = None
     self.backlight = backlight
     self.actual_volume = 0
     self.last_update = 0
     self.edit_mode = EDIT_VOLUME
     self._icons_setup = False
Пример #27
0
  def __init__(self):
    self.modes = ['date','week','binary','dim','bright']
    self.mode = 0
    self.binary = True
    self.running = False

    self.option_time = 0

    self.dim_hour = 20
    self.bright_hour = 8

    self.is_setup = False

    MenuOption.__init__(self)
Пример #28
0
  def __init__(self, backlight = None):
    self.modes = ['date','week','binary','dim','bright']
    self.mode = 0
    self.binary = True
    self.running = False
    self.backlight = backlight

    self.option_time = 0

    self.dim_hour = 20
    self.bright_hour = 8

    self.is_setup = False

    MenuOption.__init__(self)
Пример #29
0
    def __init__(self):
        self.selected_option = 0

        self.options = ['Pirate', 'Monkey', 'Robot', 'Ninja', 'Dolphin']
        """
        Python has no "switch" so we'll store an array of functions
        to call when an option is selected
        """
        self.actions = [
            self.handle_pirate,
            self.handle_monkey,
            self.handle_robot,
            self.handle_ninja,
            self.handle_dolphin,
        ]

        MenuOption.__init__(self)
Пример #30
0
    def __init__(self):

        self.items = []

        self.selected_item = 0

        self.last_update = 0
        self.updating = False

        self.last_event = 0

        MenuOption.__init__(self)

        self.is_setup = False

        self.auto_cycle_timeout = 10000  # Start auto advancing after n/1000 sec of no user interaction
        self.auto_cycle_speed = 10000  # Time between advances
Пример #31
0
 def __init__(self):
     MenuOption.__init__(self)
     self.selected_station = 0
     self.selected_option = 0
     self.pid = None
     self.socket = None
     self.current_stream = None
     self.current_state = None
     # Keep track of whether we've started a VLC instance
     self.started_vlc_instance = False
     self.last_update = 0
     self.mode = 'main'
     atexit.register(self.kill)
     self.icons = {
         'play': [0, 24, 30, 31, 30, 24, 0, 0],
         'pause': [0, 27, 27, 27, 27, 27, 0, 0],
         'stop': [0, 31, 31, 31, 31, 31, 0, 0]
     }
Пример #32
0
    def __init__(self, backlight=None, interface='wlan0'):
        self.items = []
        self.interface = interface

        self.wifi_pass = ""

        self.selected_item = 0

        self.connecting = False
        self.scanning = False
        self.has_error = False
        self.error_text = ""

        self.backlight = backlight

        MenuOption.__init__(self)

        self.is_setup = False
Пример #33
0
 def __init__(self):
   MenuOption.__init__(self)
   self.selected_station = 0
   self.selected_option = 0
   self.pid = None
   self.socket = None
   self.current_stream = None
   self.current_state = None
   # Keep track of whether we've started a VLC instance
   self.started_vlc_instance = False
   self.last_update = 0
   self.mode = 'main'
   atexit.register(self.kill)
   self.icons = {
     'play': [0,24,30,31,30,24,0,0],
     'pause':[0,27,27,27,27,27,0,0],
     'stop': [0,31,31,31,31,31,0,0]
   }
Пример #34
0
Файл: wlan.py Проект: akx/dot3k
    def __init__(self, backlight=None, interface='wlan0'):
        self.items = []
        self.interface = interface

        self.wifi_pass = ""

        self.selected_item = 0

        self.connecting = False
        self.scanning = False
        self.has_error = False
        self.error_text = ""

        self.backlight = backlight

        MenuOption.__init__(self)

        self.is_setup = False
Пример #35
0
    def __init__(self, backlight=None):
        self.modes = ['date', 'dim', 'bright']
        self.mode = 0
        self.running = False

        if backlight is None:
            import dot3k.backlight
            self.backlight = dot3k.backlight
        else:
            self.backlight = backlight

        self.option_time = 0

        self.dim_hour = 20
        self.bright_hour = 8

        self.is_setup = False

        MenuOption.__init__(self)
Пример #36
0
    def __init__(self, backlight=None):
        self.modes = ['date', 'week', 'binary', 'dim', 'bright']
        self.mode = 0
        self.binary = True
        self.running = False

        if backlight is None:
            import dot3k.backlight
            self.backlight = dot3k.backlight
        else:
            self.backlight = backlight

        self.option_time = 0

        self.dim_hour = 20
        self.bright_hour = 8

        self.is_setup = False

        MenuOption.__init__(self)
Пример #37
0
  def __init__(self):
    self.selected_option = 0

    """
    Python has no "switch" so we'll store an array of functions
    to call when an option is selected.

    We've added icons to this example, so instead of two arrays
    we've collected all the related stuff into an array of
    dictionaries.
    """
    self.options = [
      {'title': 'Pirate', 'action': self.handle_pirate,   'icon': ' '}
      {'title': 'Pirate', 'action': self.handle_monkey,   'icon': ' '}
      {'title': 'Pirate', 'action': self.handle_robot,    'icon': ' '}
      {'title': 'Pirate', 'action': self.handle_ninja,    'icon': ' '}
      {'title': 'Pirate', 'action': self.handle_dolphin,  'icon': ' '}
    ]

    MenuOption.__init__(self)
Пример #38
0
    def __init__(self):
        self.modes = ['date', 'week', 'binary', 'dim', 'bright']
        self.mode = 0
        self.binary = True
        self.running = False

        #        if backlight is None:
        #            import dot3k.backlight
        #            self.backlight = dot3k.backlight
        #        else:
        #            self.backlight = backlight

        self.option_time = 0

        #        self.dim_hour = 20
        #        self.bright_hour = 8

        self.is_setup = False

        MenuOption.__init__(self)
Пример #39
0
    def __init__(self, backlight=None):
        if backlight is None:
            import dot3k.backlight
            self.backlight = dot3k.backlight
        else:
            self.backlight = backlight

        self.debug = False
        self.star_seed = 'thestarsmydestination'
        self.debris_seed = 'piratemonkeyrobotninja'
        self.debris = []
        self.stars = []
        self.running = False
        self.max_debris = 10
        self.max_stars = 10
        self.last_update = 0
        self.time_start = 0
        self.sprites = [
            [14, 31, 31, 14, 0, 0, 0, 0],  # 0: Debris top of char
            [0, 0, 0, 0, 14, 31, 31, 14],  # 1: Debris bottom of char
            [30, 5, 7, 30, 0, 0, 0, 0],  # 2: Ship top of char
            [0, 0, 0, 0, 30, 5, 7, 30],  # 3: Ship bottom of char

            [30, 5, 7, 30, 14, 31, 31, 14],  # 4: Ship above debris
            [14, 31, 31, 14, 30, 5, 7, 30],  # 5: Ship below debris

            [0, 14, 31, 31, 31, 31, 14, 0]  # 6: Giant debris
        ]
        self.width = 16
        self.height = 5  # Two rows per char

        self.player_x = 1  # Player horizontal position
        self.player_y = 3  # Player vertical position

        self.current_player_x = None
        self.current_player_y = None
        self.current_player_pos = None

        self.fill_debris()

        MenuOption.__init__(self)
Пример #40
0
    def __init__(self):
        # IP
        self.wlan0 = self.get_addr('wlan0')
        self.mode = 0

        # TIMEDATE
        self.running = False

        # if backlight is None:
        # import dot3k.backlight
        # self.backlight = dot3k.backlight
        # else:
        # self.backlight = backlight

        self.option_time = 0

        # self.dim_hour = 23
        # self.bright_hour = 10

        self.is_setup = False

        MenuOption.__init__(self)
Пример #41
0
  def __init__(self):

    self.mode        = _MODE_ENTRY
    self.input_prompt= ''

    self.initialized = False
    self.back_icon   = chr(0)
    self.entry_char  = 0
    self.entry_mode  = 0
    self.entry_chars = [list('\'|~+-_!?.0123456789'+self.back_icon+' abcdefghijklmnopqrstuvwxyz' + self.back_icon),
					   list('"<>{}()[]:;/\^&*$%#'+self.back_icon+'@ABCDEFGHIJKLMNOPQRSTUVWXYZ'  + self.back_icon)]

    self.entry_text  = [' ']*16

    self.confirm = 0
    self.final_text = ''

    self.entry_position = 0

    MenuOption.__init__(self)
    
    self.is_setup = False
Пример #42
0
 def __init__(self, repline):
     self.repline = repline
     self._icons_setup = False
     MenuOption.__init__(self)
Пример #43
0
 def __init__(self, backlight):
     self.backlight = backlight
     self.brightness = 1.0
     self._icons_setup = False
     MenuOption.__init__(self)
Пример #44
0
 def __init__(self, lcd):
     self.lcd = lcd
     self.contrast = 30
     self._icons_setup = False
     MenuOption.__init__(self)
Пример #45
0
 def __init__(self):
     self.start = self.millis()
     self.invader = [[14, 31, 21, 31, 9, 18, 9, 18],
                     [14, 31, 21, 31, 18, 9, 18, 9]]
     MenuOption.__init__(self)
Пример #46
0
 def setup(self, config):
     MenuOption.setup(self, config)
Пример #47
0
 def __init__(self):
     self.mode = 0
     self.wlan0 = self.get_addr('wlan0')
     self.eth0 = self.get_addr('eth0')
     self.is_setup = False
     MenuOption.__init__(self)
    def setup(self, config):
        MenuOption.setup(self, config)

        if 'commands' in self.config.sections():
            self.cmds = self.config.options('commands')
            self.ready = True
Пример #49
0
 def __init__(self, lcd):
   self.lcd = lcd
   self.contrast = 30
   MenuOption.__init__(self)
Пример #50
0
 def __init__(self):
     MenuOption.__init__(self)
     self.uptime_pat = re.compile(
         'up( (?P<days>\d+) days?,)?\s+((?P<hours>\d+):)?(?P<mins>\d+)( min)?,'
     )
Пример #51
0
        def __init__(self):
            MenuOption.__init__(self)
            self._setup = False
            self._icons = {
                'ICON_PLAY': {
                    'index':
                    1,
                    'bmp': [
                        0b10000, 0b11000, 0b11100, 0b11110, 0b11100, 0b11000,
                        0b10000, 0b00000
                    ]
                },
                'ICON_PAUSE': {
                    'index':
                    2,
                    'bmp': [
                        0b00000, 0b11011, 0b11011, 0b11011, 0b11011, 0b11011,
                        0b11011, 0b00000
                    ]
                },
                'ICON_STOP': {
                    'index':
                    3,
                    'bmp': [
                        0b00000, 0b11111, 0b11111, 0b11111, 0b11111, 0b11111,
                        0b11111, 0b00000
                    ]
                },
                'ICON_REPEAT': {
                    'index':
                    4,
                    'bmp': [
                        0b00010, 0b01111, 0b10010, 0b10000, 0b00001, 0b01001,
                        0b11110, 0b01000
                    ]
                },
                'ICON_SHUFFLE': {
                    'index':
                    5,
                    'bmp': [
                        0b00000, 0b00000, 0b11011, 0b00100, 0b00100, 0b11011,
                        0b00000, 0b00000
                    ]
                }
            }
            self._animations = {
                'ANIM_PAUSE': {
                    'index':
                    7,
                    'frames': [
                        self._icons['ICON_PAUSE']['bmp'],
                        [0, 0, 0, 0, 0, 0, 0, 0]
                    ],
                    'fps':
                    2
                }
            }
            """ :var MPDClient """
            self.mpd_status_reader = None
            """ :var MPDClient """
            self.mpd_controller = None

            # self.mpd = None
            self.mpd_status = None

            self.volume = 100
            self.volume_pressed = time() - 5

            self._reconnect()
 def __init__(self, backlight):
     self.backlight = backlight
     self.r = 255
     self.g = 255
     self.b = 255
     MenuOption.__init__(self)
Пример #53
0
 def setup(self, config):
     MenuOption.setup(self, config)
     self.curr_idx = 0
     self.curr_val = self.lights_control._schedule[self.curr_idx]
Пример #54
0
 def __init__(self, backlight=None):
     self.backlight = backlight
     self.cpu_samples = [0, 0, 0, 0, 0]
     self.cpu_avg = 0
     self.last = self.millis()
     MenuOption.__init__(self)
 def __init__(self):
     MenuOption.__init__(self)
    def __init__(self, backlight):
        self.backlight = backlight

        MenuOption.__init__(self)
Пример #57
0
 def __init__(self):
     self.cpu_samples = [0, 0, 0, 0, 0]
     self.last = self.millis()
     MenuOption.__init__(self)
Пример #58
0
 def setup(self, config):
     MenuOption.setup(self, config)
     self.load_options()
Пример #59
0
 def __init__(self):
     self.last = self.millis()
     MenuOption.__init__(self)