def __init__(self,bkground,sprites,*args,**kwargs): FloatLayout.__init__(self,*args,**kwargs) self.touch = 0,0 self.bkground = bkground if isinstance(bkground,BackgroundWidget )else BackgroundWidget(bkground) self.isprites = sprites # ListProperty(background, cat, mouse) self.build_stage()
def __init__(self, **kwargs): BetterLogger.__init__(self) FloatLayout.__init__(self, **kwargs) self.size_hint = None, None self.register_event_type("on_items")
def __init__(self): """ Sobre escribe el constructor de la clase FloatLayout """ try: FloatLayout.__init__(self) self.ldatos.conectar() self.getappsettings() self.datos_api = SQLData(self.__django_api) #self.__api_success = datos_api.testapi() self.horario_grid.addcolumna("Codigo", "txt", "left", .15, False, 'codigo') self.horario_grid.addcolumna("Materia", "key", "center", .52, False, 'nombre') self.horario_grid.addcolumna("Dia", "txt", "left", .08, False, 'dia') self.horario_grid.addcolumna("Hora", "txt", "left", .15, False, 'hora') self.horario_grid.addcolumna("Aula", "txt", "left", .1, False, 'aula') self.horario_grid.addheaders() # self.gridTest.datasource = self.datos # self.gridTest.addgridrow([True, "1", "Articulo 1", "10", False]) if not self.__is_sync or self.__carnet_sync == '': self.showloginform() else: self.showhorario() except AppMiscError as exp: showmessagebox(exp.title, exp.message)
def __init__(self, **kwargs): FloatLayout.__init__(self, **kwargs) self.all_boxes = [ self.ids.posts, self.ids.friends, self.ids.photos, self.ids.albums, self.ids.checkins, self.ids.likes, self.ids.about, self.ids.groups ] self.load_settings()
def __init__(self, **kwargs): """Set up the CardDisplays.""" FloatLayout.__init__(self, **kwargs) self.main = BoxLayout(orientation="vertical", pos_hint={'x':0, 'y':0}) self.slots = [] for i in range(len(self.board)): # for card in board iterates all sides layout = BoxLayout() side_slots = [] for card in self.board[i]: display = CardDisplay(card=card) side_slots.append(display) layout.add_widget(display) self.slots.append(side_slots) self.main.add_widget(layout) self.add_widget(self.main) # Prep the next round prompt widget for later self._next_round_prompt = BoxLayout(size_hint=(1, .125)) self._next_round_prompt.add_widget(Button(text="Replay", on_release=self.rescore_prompted)) self._next_round_prompt.add_widget(Widget()) # spacer self._next_round_prompt.add_widget(Button(text="Continue", on_release=self.next_round_prompted)) # Prep for powerup overlays self.powerup_anchor = AnchorLayout(anchor_x='right', anchor_y='top', size_hint=(1, 1), pos_hint={'x':0, 'y':0}) self.add_widget(self.powerup_anchor)
def __init__(self, **kwargs): BetterLogger.__init__(self) FloatLayout.__init__(self, **kwargs) GlobalEvents.bind(mine_batch_finished=self.batch_finished) GlobalEvents.bind(remove_mine_finished_icon=self.remove_finished_icon) GlobalEvents.bind(on_scatter_transformed=self.update_positions)
def __init__(self): FloatLayout.__init__(self) self.background = Rectangle(pos=self.pos, size=self.size, source='field.jpg') self.canvas.add(self.background) #Clock.schedule_once(partial(self.take_two, self.width, self.height)) #Clock.schedule_once(partial(self.aspect_ratio, self, 0)) self.ratio = 0.5 self.head = None #Node(0.2, 0.5) self.tail = self.head self.command_menu = None self.click_type = False #What mode it's in -- select or create self.dont_check = False #I think normal buttons pass on on_touch_up even when they took the event, so this prevents that from being processed self.buttons = SideButtons() self.add_widget(self.buttons) self.bind(size=self.take_two, pos=self.take_two) def omg(_a=0, _b=0, _c=0, _d=0): self.parent.bind(size=self.aspect_ratio) self.bind(parent=omg)
def __init__(self, engine, **kwargs): FloatLayout.__init__(self, **kwargs) self.engine = engine for cell in engine.cells: self.grid.add_widget(cell) self.line_length = engine.line_length self.engine.grid_ref = self
def __init__(self, *kargs, **kwargs): FloatLayout.__init__(self, *kargs, **kwargs) # Bind the keyboard self._keyboard = Window.request_keyboard(self._keyboard_closed, self) self._keyboard.bind(on_key_down = self._on_keyboard_down) self._keyboard.bind(on_key_up = self._on_keyboard_up) # Set up the controls self.controls = { 'thrust': 0, 'turning': 0, 'attack': 0, } self.old_controls = dict(self.controls) self.hud = FloatLayout(size_hint=(1, 1)) self.add_widget(self.hud) health_label = Label( text='Health', pos_hint={ 'top': 1.4, 'center_x': 0.5, } ) self.hud.add_widget(health_label) self.health = ProgressBar( pos_hint={ 'top': 1, 'center_x': 0.5, }, size_hint=(0.5, 0.1) ) self.hud.add_widget(self.health) # Screen objects self.space = FloatLayout() self.add_widget(self.space) # Objects to display self.objects = {} self.player_id = None # Debug Object if DEBUG: data = { 'object_id': 0, 'type': 'player', 'pos_x': 100, 'pos_y': 100, 'angle': 50, 'vel_x': 10, 'vel_y': 10, 'vel_angle': 120, } self.add_object(data)
def __init__(self, **kwargs): FloatLayout.__init__(self, **kwargs) self.slide_num = -1 self.lock = threading.Lock() self._keyboard = Window.request_keyboard(self._keyboard_closed, self) self._keyboard.bind(on_key_down=self._on_keyboard_up) self.__input_file = None self.__input_diog_open = False
def __init__(self, gridradius, **kw): FloatLayout.__init__(self, **kw) self.gridradius = gridradius self.grid = hexgrid.HexagonGrid(gridradius) self.images = hexgrid.HexagonGrid(gridradius) self.randomise() self.filling = False self.filled = False
def __init__(self, **kwargs): FloatLayout.__init__(self, **kwargs) self.graph = GraphCanvas() bubble = EditBubble() self.graph.bubble = bubble self.add_widget(self.graph) self.add_widget(bubble)
def __init__(self, *args, **kwargs): FloatLayout.__init__(self, *args, **kwargs) self.bind(pos=self.draw) self.bind(size=self.draw) self.gridLayer = BoxLayout(opacity=1) self.neuronLayer = BoxLayout() self.add_widget(self.gridLayer) self.add_widget(self.neuronLayer) self._gridSize = 4
def __init__(self): """ Sobre escribe el constructor de la clase __init_ """ FloatLayout.__init__(self) try: self.__sql = SqlData('data/db.sqlite3') self.__sql.conectar() self.__destinos = self.__sql.get_sectores_zonas() self.dropdesde.datasource = self.__destinos self.drophasta.datasource = self.__destinos except Exception as ex: showmessagebox('TAXIMETRO', ex.message, 2)
def __init__(self): FloatLayout.__init__(self) self.head = None#Node(0.2, 0.5) self.tail = self.head self.command_menu = None self.click_type = False #What mode it's in -- select or create self.dont_check = False #I think normal buttons pass on on_touch_up even when they took the event, so this prevents that from being processed self.buttons = SideButtons() self.add_widget(self.buttons)
def __init__(self, user, show_stats): """Constructor method Args: user (str): Name of user in video. show_stats (bool): Whether to display statistics on display. """ self.user = user self.show_stats = show_stats FloatLayout.__init__(self) self.stat_lbl = StatisticsLabel(latency=0) if self.show_stats: self.add_widget(self.stat_lbl)
def __init__(self): """ Creates a new view for display This constructor does very little. It does not hook up the view to the game window. That functionality happens behind the scenes with hidden methods. You should only use use the object provided in the `view` attribute of :class:`GameApp`. See the documentation of that class for more information. """ FloatLayout.__init__(self) self._frame = InstructionGroup() self.bind(pos=self._reset) self.bind(size=self._reset) self._reset()
def __init__(self, **kwargs): self.bg_image = Image(allow_stretch=True, keep_ratio=True) self.fg_image = Image(allow_stretch=True, keep_ratio=True) BetterLogger.__init__(self) ButtonBehavior.__init__(self) FloatLayout.__init__(self, **kwargs) self.add_widget(self.bg_image) self.add_widget(self.fg_image) self.bg_image.texture = Textures.get("Buttons", "bg_" + str(self.bg_type)) self.size_hint_x = None self.size_hint_y = graphicsConfig.getfloat("Buttons", "size_hint_y_" + str(self.size_type))
def __init__(self, **kwargs): self.bg_image = Image(allow_stretch=True, keep_ratio=True) self.fg_image = Image(allow_stretch=True, keep_ratio=True) BetterLogger.__init__(self) FloatLayout.__init__(self, **kwargs) self.bg_image.texture = Textures.get("ResourceMiner", "finished_icon_bg") self.size_hint_x = None self.size_hint_y = 0.1 self.add_widget(self.bg_image) self.add_widget(self.fg_image)
def __init__(self, title): """Initializes MyPopup. This function initializes the classs MyPopup. It does so by setting the title attribute and calling the initialization function. Args: self: Variable refering to the class this function is a part of (MyPopup). title: String containing the title of the pop up. """ FloatLayout.__init__(self) self.title = title
def __init__(self, **kwargs): """ Sobreescribe constructor de la clase para agregar funcionalidad en caso de configurar algunas propiedades """ if 'texto' in kwargs: self.texto = kwargs['texto'] if 'textocolor' in kwargs: self.textocolor = kwargs['textocolor'] if 'backcolor' in kwargs: self.backcolor = kwargs['backcolor'] FloatLayout.__init__(self, **kwargs) self.mensaje.texto = self.texto self.mensaje.textocolor = self.textocolor self.mensaje.bordercolor = self.mensaje.textocolorrgb(self.textocolor) self.mensaje.backcolor = self.backcolor
def __init__(self, **kwargs): FloatLayout.__init__(self, **kwargs) self.android = kwargs['android'] if 'levels' in kwargs and kwargs['levels'] is not None: self.levels = kwargs['levels'] print self.levels else: self.levels = [] #self.levels = [Level1, Level2, LevelAI] self.current_level = -1 self.level = None if not self.android: self.keyboard = Window.request_keyboard(self.keyboard_closed, self) self.keyboard.bind(on_key_down=self.on_key_down) self.keyboard.bind(on_key_up=self.on_key_up)
def __init__(self, user_lst): """Constructor method. Args: user_lst (list): List of users in call. """ FloatLayout.__init__(self) self.video_display_dct = {} self.show_stats = False username = App.get_running_app().root_sm.current_screen.username for user in user_lst: if user != username: self.video_display_dct[user] = PeerVideoDisplay( user, self.show_stats) self.ids.video_display_layout.add_widget( self.video_display_dct[user])
def __init__(self, *args, **kwargs): FloatLayout.__init__(self, *args, **kwargs) self._keyboard = None from kivy.clock import Clock def shortcut(*largs): if self.use_keyboard_shortcut: def keyboard_shortcut(win, scancode, *largs): modifiers = largs[-1] ##print win, scancode, largs #alt cmd start the magical tour ##print 'scancode', scancode, scancode == self.scancode ##print 'modifiers', self.modifiers,'in', modifiers, (set(self.modifiers) in set(modifiers) or ( modifiers == self.modifiers)) if scancode == self.scancode and (set(self.modifiers) in set(modifiers) or ( modifiers == self.modifiers)): self.activated = not self.activated from kivy.core.window import Window Window.bind(on_keyboard=keyboard_shortcut) Clock.schedule_once(shortcut, 1)
def __init__(self, **kw): """ Initializer: Creates a new Panel for drawing shapes Parameter **kw: The panel dimensions and color Precondition: **kw are Kivy keyword arguments """ # Pass Kivy arguments to super class. FloatLayout.__init__(self, **kw) # Make the background solid white color = Color(1.0, 1.0, 1.0, 1.0) self.canvas.add(color) rect = Rectangle(pos=map(dp, self.pos), size=map(dp, self.size)) self.canvas.add(rect) # Call helper function in lab10.py lab10.draw_shapes(self)
def __init__(self): FloatLayout.__init__(self) self.is_waiting = True self.vector = [(0, 0), (0, 0)] self.gravity_vector = [(0, 0), (0, -1)] self.shot_multiplier = 0.5 self.player_twos_turn = False Clock.schedule_interval(self.main_game_loop, 0.5) # game objects self.image_processor = ImageProcessor("assets/Michael.jpg") self.image_processor.find_contours() self.tanks = [] self.spawn_tanks(2) # set size image_x = len(self.image_processor.terrain) image_y = len(self.image_processor.terrain[1])
def __init__(self): try: FloatLayout.__init__(self) self.ldatos.conectar() self.getappsettings() # if not self.__is_sync: # self.showloginform() datos_api = SQLData(self.__django_api) # self.gridTest.addcolumna("Carnet", "txt", "left", 50, False, 'carnet') # self.gridTest.addcolumna("Usuario", "key", "center", 90, False, 'username') # self.gridTest.addcolumna("Nombre", "txt", "left", 150, False, 'first_name') # self.gridTest.addcolumna("Apellido", "txt", "left", 150, False, 'last_name') # self.gridTest.addcolumna("Email", "txt", "left", 355, False, 'email') # self.datos.view = "rest-auth/user" # self.gridTest.addheaders() # self.gridTest.datasource = self.datos # self.gridTest.addgridrow([True, "1", "Articulo 1", "10", False]) except AppMiscError as exp: showmessagebox(exp.title, exp.message)
def __init__(self, **kwargs): BetterLogger.__init__(self) FloatLayout.__init__(self, **kwargs) self.create_renderer() if userSettings.get("debug", "building_hit_boxes"): self.bind(buildings=lambda _instance, _value: self.redraw_hit_boxes()) GlobalEvents.bind(building_moved=lambda _instance, _x, _y: self.redraw_hit_boxes(), building_rotated=lambda _instance, _rotation: self.redraw_hit_boxes()) self.log_info("Created renderer, starting to create building objects") for building_id in gameData.get("placed_buildings"): building_info = gameData.get("placed_buildings", building_id) building_class = str_to_building[building_info.pop("type")] building = building_class(**building_info) building.id = building_id self.log_debug("Created building object for building", building_id, "with info", building_info) self.add_building(building) self.log_info("Created objects -", self.buildings)
def __init__(self,listaArticulos,listaInventario,listaDiferencias): """Inicia el constructor de la clase ejecutando el constructor de la clase base""" self.ListaArticulos = PArchivos(listaArticulos) self.ListaInventario = PArchivos(listaInventario) self.ListaDiff = PArchivos(listaDiferencias) FloatLayout.__init__(self) self.clearFields() self.clearFieldsI() self.scrollGridView.do_scroll_y = True self.scrollGridView.do_scroll_x = False self.scrollGridViewI.do_scroll_y = True self.scrollGridViewI.do_scroll_x = False self.scrollGridViewD.do_scroll_y = True self.scrollGridViewD.do_scroll_x = False self.gridListaArticulos.addColumna("Activo","chk","na",70,True) self.gridListaArticulos.addColumna("Articulo","key","center",200,False) self.gridListaArticulos.addColumna("Descripcion","txt","left",356,False) self.gridListaArticulos.addColumna("Cantidad","txt","right",100,False) self.gridListaArticulos.addColumna("Borrar","borrar","na",70,False) self.addHeaders(self.gridListaArticulos) self.cargarListaArticulos() self.gridListaInventario.addColumna("Articulo","key","center",200,False) self.gridListaInventario.addColumna("Descripcion","txt","left",426,False) self.gridListaInventario.addColumna("Cantidad","txt","right",100,False) self.gridListaInventario.addColumna("Borrar","borrar","na",70,False) self.addHeaders(self.gridListaInventario) self.gridListaDiff.addColumna("Articulo","key","center",200,False) self.gridListaDiff.addColumna("Descripcion","txt","left",496,False) self.gridListaDiff.addColumna("Cantidad","txt","right",100,False) self.addHeaders(self.gridListaDiff) self.articulo2IDTxt.bind(on_text_validate=self.searchArticulo)
def __init__(self, *args, **kwargs): FloatLayout.__init__(self, *args, **kwargs) self.new_book()
def __init__(self, **kwargs): FloatLayout.__init__(self, **kwargs) self.arrows = [] self.setup()
def __init__(self, *args, **kwargs): FloatLayout.__init__(self, *args, **kwargs) self.action_event_widgets = [] self.mapping_name = ""
def __init__(self): FloatLayout.__init__(self) self.boxy.submitbutton.bind(on_press = self.submit_data)
def __init__(self, app): self.last_media = None self.app = app FloatLayout.__init__(self)
def __init__(self, mappings, profile, auth_key, server_url, colors={}, **kwargs): global api_version FloatLayout.__init__(self) # load the kivy button mappings for the macros with open(mappings) as f: self.mappings = json.load(f) # load the macro profile for this application with open(profile) as f: p = json.load(f) k = p.keys()[0] # apply button labels, colors, and macros for i, b in self.mappings.iteritems(): if i in self.ids: if 'label' in b: self.ids[i].text = b['label'] if 'color' in b and b['color'] in colors: self.ids[i].color = colors[b['color']] if 'macro' in b and b['macro'] in p[k]: self.ids[i].bind(on_press=self.make_request) if 'background_down' in dir(self.ids[i]): if 'background_down' in b: self.ids[i].background_down = b['background_down'] else: self.ids[i].background_down = 'atlas://data/images/defaulttheme/button_disabled' # pass hostname as username username = platform.node() # set password to auth key password = auth_key # session will send auth for requests, retry up to 3x self.s = Session() self.s.mount("http://", adapters.HTTPAdapter(max_retries=3)) self.s.auth=(username, password) self.server_url = server_url # authenticate and register client r = self.s.get(self.server_url + '/auth', timeout=5) if r.status_code != 200: Logger.error('init: Unable to Authenticate: Expected Response Code 200, Got {0}'.format(r.status_code)) exit(1) # confirm server api version r = self.s.get(self.server_url, timeout=5) if LooseVersion(r.json()['application']['api']) < LooseVersion(api_version): Logger.error('init: Incompatible Server: API version >= {0} Required'.format(api_version)) exit(1) # get resource URLs r = self.s.get(self.server_url, timeout=5) profiles_url = r.json()['profiles']['url'] # validate profile r = self.s.post(profiles_url, files={k:open(profile, 'rb')}, params={'validate_only':'true'}, timeout=5) if r.status_code != 200: Logger.error(r.json()['message']) sys.exit(1) r = self.s.get(profiles_url, timeout=5) # find and update profile if it exists profiles = r.json() profile_url = '' if k in profiles: profile_url = profiles[k]['url'] r = self.s.get(profile_url, timeout=5) if r.json() != p: r = self.s.put(profile_url, files={k:open(profile, 'rb')}, timeout=5) if r.status_code != 204: Logger.error('init: Unable to Update Profile: Expected Response Code 204, Got {0}'.format(r.status_code)) exit(1) else: r = self.s.post(profiles_url, files={k:open(profile, 'rb')}, timeout=5) if r.status_code != 201: Logger.error('init: Unable to Create Profile: Expected Response Code 201, Got {0}'.format(r.status_code)) exit(1) profile_url = r.headers['location'] self.profile_url = profile_url return
def __init__(self, **kwargs): BetterLogger.__init__(self) FloatLayout.__init__(self, **kwargs) self.add_widget(self.move_buttons_holder) self.add_widget(self.custom_buttons_holder)
def __init__(self, **kwargs): FloatLayout.__init__(self, **kwargs) self.level_select()
def __init__(self, **kwargs): FloatLayout.__init__(self, **kwargs) self._search_worker()
def __init__(self,*args,**kwargs): FloatLayout.__init__(self,**kwargs) app.camera = NewCamera(os.path.join(app.path_project, 'photos')) app.path_db = os.path.join(app.path_project,'db.json') tiny_orm.Model.define_db(app.path_db) self.load_map(self.get_markers())
def __init__(self): FloatLayout.__init__(self) self.add_bar() self.add_ti()
def __init__(self, **kwargs): FloatLayout.__init__(self, **kwargs) self.Manage_file = ManageFile() print('object created')
def __init__(self, parent): FloatLayout.__init__(self) self.myparent = parent
def __init__(self): FloatLayout.__init__(self) self.connected = False self.socket = None self.send_stream = None self.recv_stream = None
def __init__(self, map_path,*args,**kwargs): FloatLayout.__init__(self,*args,**kwargs) self.image_path = map_path