def __init__(self, *args, **kwargs): tk.Tk.__init__(self, *args, **kwargs) self.field = field.Field(self) self.field.pack(side=tk.BOTTOM) self.controls = controls.Controls(self) self.controls.pack(side=tk.TOP, expand=True, fill=tk.X)
def manual_load_data(): # Loads in the Controls get_ind_var = controls.Controls() found_countries = {} for var in INDEPENDENT_VARS: c, d = get_ind_var.main(COUNTRIES, var, False) for country in d: try: MASTER_DICT[country.lower()] except: MASTER_DICT[country.lower()] = {} for f_var in d[country]: try: int(f_var) MASTER_DICT[country.lower()][var] = d[country] print '.', break except: MASTER_DICT[country.lower()][f_var] = d[country][f_var] print '.', found_countries[var] = c # loads in the dependent variable sheet = dep_var.Dep_Var() d = sheet.get_data() for var in DEPENDENT_VARS: for country in d: if country in COUNTRIES: try: MASTER_DICT[country] except: MASTER_DICT[country] = {} for s_var in d[country]: print var, country, s_var MASTER_DICT[country][s_var] = d[country][s_var] # Loads in the food price data food = foodprice.FoodPrice() food_data = food.get_data() for country in MASTER_DICT: for food in food_data: MASTER_DICT[country.lower()][food] = {} for year in food_data[food]: try: MASTER_DICT[country.lower()][food][year].append( food_data[food][year]) except: MASTER_DICT[ country.lower()][food][year] = food_data[food][year] with open('data.pickle', 'wb') as d: pickle.dump(MASTER_DICT, d, protocol=pickle.HIGHEST_PROTOCOL) print json.dumps(MASTER_DICT, sort_keys=True, indent=4) print '\n\nThe dictionary compiling process took: ' + str( dt.now() - start_time) + ' seconds'
def main(): parser = argparse.ArgumentParser(description='Stagebuzzer') parser.add_argument('-l', '--log-level', action='store', dest='log_level', default='INFO', help='Set log level, default: \'info\'') parser.add_argument('-d', '--log-destination', action='store', dest='log_destination', default='', help='Set log destination (file), default \'\' (stdout)') options = parser.parse_args() utils.log_setup(options.log_level, options.log_destination) general_config = config.GeneralConfig() dmx_config = config.DmxConfig() audio_config = config.AudioConfig() relay_config = config.RelayConfig() button_lights = display.ButtonLights() main_view = display.MainView(button_lights) menu_view = display.MenuView(button_lights) general_menu_view = display.GeneralMenuView(button_lights, general_config) dmx_menu_view = display.DmxMenuView(button_lights, dmx_config) dmx_menu_buzzer_1_view = display.DmxBuzzerMenuView(button_lights, "dmx_menu_buzzer_1_view", "1", dmx_config) dmx_menu_buzzer_2_view = display.DmxBuzzerMenuView(button_lights, "dmx_menu_buzzer_2_view", "2", dmx_config) audio_menu_view = display.AudioMenuView(button_lights, audio_config) # audio_file_menu_view = display.AudioFileMenuView(button_lights, audio_config) relay_menu_view = display.RelayMenuView(button_lights, relay_config) information_menu_view = display.InformationMenuView(button_lights) d = display.Display( [main_view, menu_view, general_menu_view, dmx_menu_view, dmx_menu_buzzer_1_view, dmx_menu_buzzer_2_view, audio_menu_view, relay_menu_view, information_menu_view]) c = controls.Controls(d, button_lights) # callbacks callbacks = [main_view] dmx_output = dmx.DmxOutput() dmx_callback = dmx.DmxBuzzerCallback(dmx_output, dmx_config) callbacks.append(dmx_callback) audio_callback = audio.AudioCallback(audio_config) callbacks.append(audio_callback) buzzer_core = buzzer.BuzzerCore(general_config, callbacks) d.start() while True: time.sleep(1)
def __init__(self): Base.__init__(self) self.equipped = None self.weapons = [] self.inventory = [] self.buffs = [] self.direction = 0 self.controls = controls.Controls() self.dx = 0 self.dy = 0 self.shooting = False self.level = 1 self.attack = 100 self.defense = 100 self.speed = 300 #pixels per second self.wep_index = 0
def start_screen(screen): global _next_screen print("starting") clock = pygame.time.Clock() key_reader = controls.Controls() old_keys = key_reader.read() while True: for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit() sys.exit() break ticks = clock.tick(60) if _next_screen is not None: screen = _next_screen _next_screen = None pygame.display.get_surface().fill((0, 0, 0)) keys = key_reader.read() screen.tick(ticks, keys, old_keys) old_keys = keys screen.draw() pygame.display.flip()
import pygame import controls import debugroom import player pygame.init() # the screen screen = pygame.display.set_mode((800, 640)) pygame.display.set_caption("Cinnamon") # icon = pygame.image.load('filename.png') # pygame.display.set_icon(icon) controls = controls.Controls() room = debugroom.DebugRoom() clock = pygame.time.Clock() running = True while running: controls.reset() # resets key presses where needed for event in pygame.event.get(): if event.type == pygame.QUIT: running = False # get key changes if event.type == pygame.KEYDOWN: controls.key_down(event) if event.type == pygame.KEYUP: controls.key_up(event)
_("Error"), _("There has been an error while taking a screenshot. Please try again later" )) loading_window.destroy() def show_settings_window(self): loading_window = loading.Loading() while Gtk.events_pending(): Gtk.main_iteration() settings_window.show_window() loading_window.destroy() if __name__ == '__main__': notifications_window = notifications.Notifications() summary_window = summary.Summary() send_window = send.Send() controls_window = controls.Controls() settings_window = settings.Settings() tray = TrayIcon() # control notifications every 5 seconds interval_ms = 5 GLib.timeout_add_seconds(interval_ms, tray.get_notifications_interval) Gtk.main()
def controlsButtonClicked(self): director.replace(FadeTransition(controls.Controls(), duration = 1, color = (0, 0, 0)))
# last_input_p2 = Input.NONE STARTING_X = 50 # Setup the players player_one = Player( False, 100, 1, 1, 0, load_images_from_directory( './Assets/Images/Brown Bear/Brown Bear Frames/Running'), load_images_from_directory( './Assets/Images/Brown Bear/Brown Bear Frames/Walking'), load_images_from_directory( './Assets/Images/Brown Bear/Brown Bear Frames/Standing'), load_images_from_directory( './Assets/Images/Brown Bear/Brown Bear Frames/Sliding'), STARTING_X, 350, controls.Controls(pygame.K_LEFT, pygame.K_RIGHT, pygame.K_UP, pygame.K_DOWN, pygame.K_RETURN)) player_two = Player( False, 100, 2, 1, 0, load_images_from_directory('./Assets/Images/Cat/Cat Frames/Running'), load_images_from_directory('./Assets/Images/Cat/Cat Frames/Walking'), load_images_from_directory('./Assets/Images/Cat/Cat Frames/Standing'), load_images_from_directory('./Assets/Images/Cat/Cat Frames/Sliding'), STARTING_X, 450, controls.Controls(pygame.K_a, pygame.K_d, pygame.K_w, pygame.K_s, pygame.K_SPACE)) # set the screen size WINDOW_WIDTH = 1200 WINDOW_HEIGHT = 600 os.environ['SDL_VIDEO_WINDOW_POS'] = "%d,%d" % (50, 50) screen = pygame.display.set_mode((WINDOW_WIDTH, WINDOW_HEIGHT))
if queue.empty(): session.commit() else: sleep(0.1) # can config motor_base_id = int("0x600", 16) driver_base_id = int("0x500", 16) can_interface = sys.argv[1] print(can_interface) bus = native_bus.SocketscanNative_Bus(channel=can_interface) # Set up bus objects motor = motors.Wavesculptor20(mc_base_address=motor_base_id) controls = controls.Controls(controls_base_address=driver_base_id) bms = batteries.orionBMS() mppt_woof = mppts.Drivetek(1809, 'woof') #Different addresses mppt_javed = mppts.Drivetek(1810, 'javed') can_objects = [motor, controls, bms, mppt_woof, mppt_javed] # Set up bus object shared memory files: motor_file = "/dev/shm/motor" controls_file = "/dev/shm/controls" bms_file = "/dev/shm/bms" mppt_woof_file = "/dev/shm/mppt_woof" mppt_javed_file = "dev/shm/mppt_javed" can_files = [ motor_file, controls_file, bms_file, mppt_woof_file, mppt_javed_file ]