示例#1
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
示例#2
0
文件: debris.py 项目: Cloudsimc/dot3k
  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)
示例#3
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)
  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)
	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)
示例#6
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)
	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)
示例#8
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
    def __init__(self):
        self.consoleMessages = ConsoleMessages()
	self.ready = False
	self.modules = []
	self.selected_module = 0	
	self.last_update = 0
	
        MenuOption.__init__(self)
示例#10
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, interface):
     self.last_updated = 0
     self.raw_dlold = 0
     self.raw_ulold = 0
     self.tdelta = 0
     self.maxdlspeed = 1000
     self.percent_speed = 0
     self.interface = interface
     MenuOption.__init__(self)
示例#13
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)
示例#14
0
 def __init__(self, aquarium_lights):  #Default settings
     self.modes = ['day', 'night', 'off', 'auto', 'toggle']
     self.modes_toggle = AquariumLights.TOGGLE_MODE_STR
     self.mode = 0
     self.running = False
     self.option_time = 0
     self.is_setup = False
     self.lights_control = aquarium_lights
     MenuOption.__init__(self)
示例#15
0
 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
文件: utils.py 项目: Cloudsimc/dot3k
 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
文件: wlan.py 项目: Corteil/dot3k
    def __init__(self):
        self.items = []

        self.selected_item = 0

        self.scanning = False

        MenuOption.__init__(self)

        self.is_setup = False
示例#20
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)
示例#21
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
示例#22
0
 def __init__(self):
     MenuOption.__init__(self)
     self.vpn_names = {
         "AirVPN_United-Kingdom_UDP-443": "UK",
         "AirVPN_United-States_UDP-443": "US",
         "AirVPN_Europe_UDP-443": "EU",
         "AirVPN_Asia_UDP-80": "AP",
         "None": "None"
     }
     self.vpn_labels = dict((v, k) for (k, v) in self.vpn_names.items())
     self.vpn_choices = ['UK', 'US', 'EU', 'AP', 'None']
示例#23
0
 def __init__(self, backlight):
     self.backlight = backlight
     MenuOption.__init__(self)
     if self.config is None:
         self.config = ConfigParser.ConfigParser()
         self.config.read('dot3k.cfg')
         self.r = int(self.get_option('Backlight', 'r', 255))
         self.g = int(self.get_option('Backlight', 'g', 255))
         self.b = int(self.get_option('Backlight', 'b', 255))
         self.brightness = float(
             self.get_option('Display', 'brightness', 1.0))
示例#24
0
文件: stocks.py 项目: Cloudsimc/dot3k
  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
示例#25
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
示例#26
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)
示例#27
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)
示例#28
0
文件: wlan.py 项目: GeorgN/dot3k
  def __init__(self, backlight=None):
    self.items = []

    self.selected_item = 0

    self.scanning = False

    self.backlight = backlight

    MenuOption.__init__(self)
    
    self.is_setup = False
 def __init__(self):
     """
     We need somewhere to track which option is selected
     """
     self.selected_option = 0
     """
     We should also keep track of what the options are
     """
     self.options = ['Pirate', 'Monkey', 'Robot', 'Ninja', 'Dolphin']
     """
     You *must* call the __init__ method on the parent class
     """
     MenuOption.__init__(self)
示例#30
0
文件: utils.py 项目: gcWorld/dot3k
 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)
示例#31
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)
示例#32
0
文件: clock.py 项目: Cloudsimc/dot3k
  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)
示例#33
0
    def __init__(self, backlight=None):
        self.modes = ['date', 'week', 'binary', 'day', 'night']
        self.mode = 0
        self.binary = True
        self.running = False

        self.option_time = 0

        self.day_hour = 20
        self.night_hour = 8

        self.is_setup = False

        MenuOption.__init__(self)
示例#34
0
        def __init__(self, app, cards, name, cont=False):
            self.cards = cards
            self.name = name
            self.cont = cont
            self.app = app

            self.currentIndex = 0
            self.indices = [i for i in cards]

            self.back = False
            self.lastUpdate = 0
            self.running = False

            MenuOption.__init__(self)
示例#35
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
示例#36
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)
示例#37
0
文件: volume.py 项目: GeorgN/dot3k
 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
示例#38
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
示例#39
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)
示例#40
0
文件: radio.py 项目: Corteil/dot3k
 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]
     }
示例#41
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]
   }
示例#42
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
示例#43
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
示例#44
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)
示例#45
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)
示例#46
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)
示例#47
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)
示例#48
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)
示例#49
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)
示例#50
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
示例#51
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)
示例#52
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)
示例#53
0
 def __init__(self, backlight):
     self.backlight = backlight
     self.brightness = 1.0
     self._icons_setup = False
     MenuOption.__init__(self)
示例#54
0
 def __init__(self, lcd):
     self.lcd = lcd
     self.contrast = 30
     self._icons_setup = False
     MenuOption.__init__(self)