def __init__(self, character, controller): Widget.__init__(self) self.character = character self.controller = controller summary = CharacterSummary(self.character, self.controller) self.summary.add_widget(summary)
def __init__(self, **kwargs): self.dbCom = DatabaseCommunication() try: self.dbCom.initDb(DB_HOST, DB_LOGIN, DB_PASSWORD) except: pass Widget.__init__(self) self.loginButton.on_press = self.logRequest self.getPatientData.on_press = self.showPatientDataById self.setPatientData.on_press = self.updatePatientDataById self.delPatientData.on_press = self.deletePatientDataById self.modVisitButton.on_press = self.getVisitDataByWrittenId self.addProcedure.on_press = self.addProcedureById self.delProcedure.on_press = self.delProcedureById self.addDiag.on_press = self.addDiagById self.delDiag.on_press = self.delDiagById self.addMed.on_press = self.addMedById self.delMed.on_press = self.delMedById self.addVisit.on_press = self.addVisitById self.removeVisit.on_press = self.delVisitById self.exportAsCCDA.on_press = self.exportAsCCDAById self.loginPassword.text = "jan123" self.loginLogin.text = "janvak" self.exportAsCCDAPath.text = str( pathlib.Path().absolute()) + "/output.xml" self.loadProcConcepts() self.loadDiagConcepts() self.loadMedConcepts()
def __init__(self, *kargs, **kwargs): Widget.__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) # 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): Widget.__init__(self, **kwargs) self.canvas = RenderContext(use_parent_projection=True) self.canvas.shader.source = 'tex_atlas.glsl' fmt = ( (b'vCenter', 2, 'float'), (b'vPosition', 2, 'float'), (b'vTexCoords0', 2, 'float'), ) texture, uvmap = load_atlas('icons.atlas') a = uvmap['icon_clock'] vertices = ( 128, 128, -a.su, -a.sv, a.u0, a.v1, 128, 128, a.su, -a.sv, a.u1, a.v1, 128, 128, a.su, a.sv, a.u1, a.v0, 128, 128, -a.su, a.sv, a.u0, a.v0, ) indices = (0, 1, 2, 2, 3, 0) b = uvmap['icon_paint'] vertices += ( 256, 256, -b.su, -b.sv, b.u0, b.v1, 256, 256, b.su, -b.sv, b.u1, b.v1, 256, 256, b.su, b.sv, b.u1, b.v0, 256, 256, -b.su, b.sv, b.u0, b.v0, ) indices += (4, 5, 6, 6, 7, 4) with self.canvas: Mesh(fmt=fmt, mode='triangles', vertices=vertices, indices=indices, texture=texture)
def __init__(self): Widget.__init__(self) mainwidget = CBL_Edit_Level_Screen(pos=(10, 10), size=(Window.width - 20, Window.height - 20)) self.add_widget(mainwidget) Clock.schedule_once(mainwidget.level.update, .5)
def __init__(self, direction, hp, **kwargs): """Initialize a Critter `direction`: direction in radians that the critter is facing initially `hp`: Health of the Critter """ Widget.__init__(self, **kwargs) # Max health self.hp = hp # Direction we're facing currently self.direction = direction # Speed in tiles per second self.speed = CRITTER_SPEED # Damage done (accessed through .damage) self._damage = 0 # Are we dead yet? self.dead = False # x-component of velocity self.xdir = int(numpy.sign(round(numpy.cos(direction)))) # y-component of velocity self.ydir = int(numpy.sign(round(numpy.sin(direction)))) # Initial velocity self.initial_dir = self.xdir, self.ydir self.draw() Clock.schedule_once(self.go) Clock.schedule_once(self.tick)
def __init__(self,*args, **kwargs): Widget.__init__(self,*args,**kwargs) KVector.__init__(self,*args,**kwargs) with self.canvas: self.icolor = Color(rgba=self.main_color) self.head = Mesh(mode='triangle_fan',indices=[0,1,2]) self.shaft = Line(width=self.shaft_width) self.fletching = Ellipse() self.ocolor = Color(rgba=self.outline_color) self.head_outline = Line(width=self.outline_width) self.shaft_outline_left = Line(width=self.outline_width) self.shaft_outline_right = Line(width=self.outline_width) self.fletching_outline = Line() self.bind( o_x=self.update_dims, o_y=self.update_dims, to_x=self.update_dims, to_y=self.update_dims, head_size=self.update_dims, head_angle=self.update_dims, shaft_width=self.update_shaft_width, outline_color=self.update_outline_color, main_color=self.update_color, outline_width=self.update_outline_width, distortions=self.update_dims, ) self.update_dims() self.update_shaft_width() self.update_color()
def __init__(self, app): Widget.__init__(self) with self.canvas: PushMatrix() self.cam_pos = Translate() self.scale = Scale(5) with self.canvas.after: PopMatrix() self.app = app self.selection = None self.spawn_object = EditorObject('spawn_pos', color=(1, 0, 0, 1), size=(1, 1)) self.goal_object = EditorObject('goal_pos', color=(1, 0, 0, 1), size=(1, 1)) self.add_widget(self.spawn_object) self.add_widget(self.goal_object) self.objects = set() self.selection_label = self.app.root.ids['selection_label'] self.first_attr = self.app.root.ids['first_attr'] self.y_pos = self.app.root.ids['y_pos'] self.angle = self.app.root.ids['angle']
def __init__(self, **kw): """**Constructor**: Create a new letter box :param keywords: dictionary of keyword arguments **Precondition**: See below. To use the constructor for this class, you should provide it with a list of keyword arguments that initialize various attributes. For example, to initialize the text and the foreground color, use the constructor call GObject(text='A',foreground=[1,0,0,1]) You do not need to provide the keywords as a dictionary. The ** in the parameter `keywords` does that automatically. Any attribute of this class may be used as a keyword. The argument must satisfy the invariants of that attribute. See the list of attributes of this class for more information.""" Widget.__init__(self, **kw) self._label = Label(**kw) self._state = False self._set_properties(kw) self._configure() self.bind(pos=self._reposition, size=self._resize)
def __init__(self, dur, pulsing): Widget.__init__(self) self.dur = dur self.mode = 'Moving Block' self.pulsing = pulsing self.pulse_schedule = None self.text_feedback_label = Label(text='Welcome to Intuitive Metronome (IM)!', font_size=26, bold=True, pos=(350, 300), color=TEXT_COLOR) self.text_feedback = 'Welcome to Intuitive Metronome (IM)!' self.add_widget(self.text_feedback_label) with self.canvas: Color(BLOCK_COLOR[0], BLOCK_COLOR[1], BLOCK_COLOR[2], BLOCK_COLOR[3]) self.block = Rectangle(size_hint=(None, None)) self.accomp_file = None self.accomp_playing = False # Leap Variables self.controller = Leap.Controller() self.data, self.fs = sf.read('click.wav', dtype='float32') self.animation = None self.click_schedule = None self.controller = Leap.Controller() self.state = 'stop' self.is_running = False self.stop_time = None self.my_recording = [] self.gave_recording_feedback = False Clock.schedule_interval(self.update_label, 0.5) Clock.schedule_interval(self.on_update, 1)
def __init__(self): Widget.__init__(self) self.fbo = None self.fbo_pos = None self.fbo_size = None self.fbo_real_size = None self.fbo_scale = None
def __init__(self, color=Color(1., 1., 0.), size=(50, 50), pos=(100, 100), **kwargs): Widget.__init__(self, **kwargs) self.size = size self.pos = pos self.ball = Ellipse(pos = self.pos, size = self.size) self.canvas.add(color) self.canvas.add(self.ball)
def __init__(self, **kw): """**Constructor**: Create a new letter box :param keywords: dictionary of keyword arguments **Precondition**: See below. To use the constructor for this class, you should provide it with a list of keyword arguments that initialize various attributes. For example, to initialize the text and the foreground color, use the constructor call GObject(text='A',foreground=[1,0,0,1]) You do not need to provide the keywords as a dictionary. The ** in the parameter `keywords` does that automatically. Any attribute of this class may be used as a keyword. The argument must satisfy the invariants of that attribute. See the list of attributes of this class for more information.""" Widget.__init__(self,**kw) self._label = Label(**kw) self._state = False self._set_properties(kw) self._configure() self.bind(pos=self._reposition,size=self._resize)
def __init__(self): Widget.__init__(self) self.username = ObjectProperty(None) self.password = ObjectProperty(None) self.host = ObjectProperty(None) self.app = None self.login_prog = None
def __init__(self, **kwargs): """Function called when the game3 is created """ Widget.__init__(self, **kwargs) # Opening file reading mode loaded_file = open("./game3.txt", "r") #read the first line line = loaded_file.readline() #Loading all the file in 2 different lists while (line!="endfile"): if (line[0]!='#'): tab_res = line.split('&') tab_save = tab_res[1].split('/') tab_name = tab_save[4].split('.') nameImg = tab_name[0] if (tab_res[0]=="Object"): #Create Object with src and category obj = Object2(tab_res[1],nameImg,tab_res[2],tab_res[3],size=(self.windowSave[0]*1/4,self.windowSave[1]*1/3),text=tab_res[4]) #Updating object's list self.ObjectList.append(obj) if (tab_res[0]=="ObjectForm"): cat =tab_res[2] form = ObjectForm(tab_res[1],nameImg,cat,tab_res[3], size=(self.windowSave[0]*1/4,self.windowSave[1]*1/3)) #updating form's list self.ObjectFormList.append(form) #read the next line line = loaded_file.readline() self.new_round()
def __init__(self, **kwargs): """ Function called when soundGame is created :param kwargs: :return: """ Widget.__init__(self, **kwargs) self.new_round()
def __init__(self, **kwargs): Widget.__init__(self, **kwargs) self.canvas = RenderContext(use_parent_projection=True) self.canvas.shader.source = 'starfield.glsl' self.vfmt = ( ('vCenter', 2, 'float'), ('vScale', 1, 'float'), ('vPosition', 2, 'float'), ('vTexCoords0', 2, 'float'), ) self.vsize = sum(attr[1] for attr in self.vfmt) self.indices = [] for i in xrange(0, 4 * NSTARS, 4): self.indices.extend(( i, i + 1, i + 2, i + 2, i + 3, i)) self.vertices = [] for i in xrange(NSTARS): self.vertices.extend(( 0, 0, 1, -24, -24, 0, 1, 0, 0, 1, 24, -24, 1, 1, 0, 0, 1, 24, 24, 1, 0, 0, 0, 1, -24, 24, 0, 0, )) self.texture = Image('star.png').texture self.stars = [Star(self, i) for i in xrange(NSTARS)]
def __init__(self): Widget.__init__(self) # setup config from command line args parser = argparse.ArgumentParser(description='Test Game Client') parser.add_argument('server_host', metavar='host', type=str, help='server host', default='127.0.0.1') parser.add_argument('server_port', metavar='port', type=int, help='server port', default='50051') args = parser.parse_args() if not args.server_host or not args.server_port: args.print_help() sys.exit(1) self.host = args.server_host self.port = args.server_port self.init()
def __init__(self, **kwargs): self.builded = False self.divW = 5 self.divH = 5 self.vertLines = [] self.horiLines = [] self.charaWidget = None wh = int(min(self.width // self.divW, (self.height - self.yBias) // self.divH)) self.blockSize = wh self.xMergin = (self.width - wh * self.divW) // 2 self.yMergin = ((self.height - self.yBias) - wh * self.divH) // 2 Widget.__init__(self, **kwargs) Map.__init__(self) with self.canvas: for x in range(self.divW): for y in range(self.divH): self.SetBlock([x, y], NullBlockWidget(pos=self.GetRectPos([x, y]), size=[wh, wh])) for i in range(self.divH+1): Color(0.3, 0.3, 0.3) self.vertLines += [Line(points=self.GetRectPos([0, i]) + self.GetRectPos([self.divW, i]), width=2)] for i in range(self.divW+1): Color(0.3, 0.3, 0.3) self.horiLines += [Line(points=self.GetRectPos([i, 0]) + self.GetRectPos([i, self.divH]), width=2)] self.builded = True
def __init__(self, card_id, card_holder, number_in_hand): Widget.__init__(self) Button.__init__(self) self.card_id = card_id self.card_holder = card_holder self.number_in_hand = number_in_hand self.background_normal = 'assets/cards/' + str(card_holder) + '/1' + str(card_id)
def __init__(self): Widget.__init__(self) self.ids['tInput'].bind(focus=self.on_input_focus) self.ids['tInput'].bind(text=self.on_input_text) self.buttons = [] for name in self.hero_names: for hero_name in name: # height=self.height*0.10157, bt = Button(text='', background_normal='images/%s.png'%hero_name, width=Window.width/3.25, size_hint_x=None, size_hint_y=None, opacity=0.8) bt.height=bt.width*0.5620 bt.bind(on_press=lambda x, n=hero_name: self.button_press(n)) bt.bind(width=self.on_button_width) self.buttons.append(bt) self.buttons.sort(key=lambda x: x.background_normal) for bt in self.buttons: self.ids.glayout.add_widget(bt) if platform == 'android': self.MediaPlayer=autoclass('android.media.MediaPlayer') self.player = self.MediaPlayer() self.ids.glayout.bind(minimum_height=self.ids.glayout.setter('height')) if platform == 'android': #Ad Network showAd # print("READY TO SHOW? ", AdBuddiz.isReadyToShowAd())#showAd(PythonActivity.mActivity)) pass self.presses = 0
def __init__(self, direction, hp, **kwargs): """Initialize a Critter `direction`: direction in radians that the critter is facing initially `hp`: Health of the Critter """ Widget.__init__(self, **kwargs) # Max health self.hp = hp # Direction we're facing currently self.direction = direction # Speed in tiles per second self.speed = CRITTER_SPEED # Damage done (accessed through .damage) self._damage = 0 # Are we dead yet? self.dead = False # x-component of velocity self.xdir = int(sign(round(cos(direction)))) # y-component of velocity self.ydir = int(sign(round(sin(direction)))) # Initial velocity self.initial_dir = self.xdir, self.ydir self.draw() Clock.schedule_once(self.go) Clock.schedule_once(self.tick)
def __init__(self, name, width, height, **kwargs): Widget.__init__(self, **kwargs) self.name = str(name) self.width = width self.height = height #get the layer for ease of iteration below #using XPath to find all 'data' nodes that are children of nodes #that have the name of the instance of the class self.layer = root.find(".//*[@name='" + self.name + "']/data") x = 0 y = self.height * dp(32) - dp( 32 ) #assuming all the tiles will be 32px. To render the tileset from top left to bottom right. firsttime = True for gid in self.layer: gid = int(gid.attrib['gid']) ts = get_tileset(gid) if x % (self.width * dp(32)) == 0 and not firsttime: y -= dp(32) x -= self.width * dp(32) if gid != 0: self.canvas.add( Rectangle(size=(dp(ts.tilesetTileWidth), dp(ts.tilesetTileHeight)), pos=(x, y), texture=tile_atlas[gid])) x += dp(32) if firsttime: firsttime = False
def __init__(self, _min=0, _max=100, value=50): self.__min = _min self.__max = _max self.__value = value # used here only to save current pos and size self.widget_area = Rectangle() self.circle = AndroidSliderCenter(radius=5) self.bg_line = Rectangle() self.bg_line_color = Color(0.109,0.109,0.109,1.0) self.progress_line = Rectangle() self.bg_height = 3 Widget.__init__(self) self.canvas.add(self.bg_line_color) self.canvas.add(self.bg_line) self.canvas.add(Color(0.18,0.7,0.89,1.0)) self.canvas.add(self.progress_line) self.canvas.add(Color(0.18,0.7,0.89,1.0)) self.canvas.add(self.circle) self.canvas.add(Color(0.18,0.7,0.89,0.5)) self.canvas.add(self.circle.outer_circle) self.min = self.__min self.max = self.__max self.value = self.__value ButtonBehavior.__init__(self)
def __init__(self, queue): print("YEAH!") Widget.__init__(self) self.actionQueue = queue self.movesQueue = np.array([(0, 0) for x in range(NUM_OF_TRAIL)]) self.oldBalls = [ Ellipse(pos=(0, 0), size=(20, 20)) for x in range(NUM_OF_TRAIL) ]
def __init__(self, client, ship_size, lights, **kwargs): Widget.__init__(self, **kwargs) self._client = client self._ship_size = ship_size self._lights = lights self.bind(pos=self.draw_ship) self.bind(size=self.draw_ship) self.draw_ship()
def __init__( self, **kargs ) : Widget.__init__( self, **kargs ) if not "label" in kargs : kargs["label"] = str( self.point ) if not "font_size" in kargs : kargs["font_size"] = FONT_SIZE-2 self.lbl.text = kargs["label"] self.lbl.font_name = FONT_NAME self.lbl.font_size = kargs["font_size"] self.scale( 0, 0, 1, 1 )
def __init__(self, **kwargs): Widget.__init__(self, **kwargs) self.balls = [] for i in xrange(5): self.balls.append( CircleWidget(color=Color(1-i, 0., i), pos=(i*100, i*100)) ) for ball in self.balls: self.add_widget(ball)
def __init__(self, angle_calculator, value=0, **kwargs): Widget.__init__(self, **kwargs) self._angle_calculator = angle_calculator self.value = value self.bind(pos=self.draw) self.bind(size=self.draw) self.bind(value=self.draw) self.draw()
def __init__(self, card_id, card_holder, number_in_hand): Widget.__init__(self) Button.__init__(self) self.card_id = card_id self.card_holder = card_holder self.number_in_hand = number_in_hand self.background_normal = 'assets/cards/' + str( card_holder) + '/1' + str(card_id)
def __init__(self, watch_dir=".", session_dir=".", **kwargs): Widget.__init__(self, **kwargs) self.watch_dir = watch_dir self.session_dir = session_dir self._keyboard = Window.request_keyboard( self._keyboard_closed, self, 'text') self._keymap = defaultdict(list) self._keyboard.bind(on_key_down=self._handle_keypress) self.bind(pos=self.redraw, size=self.redraw)
def __init__(self): Widget.__init__(self) self.pos = (0, 0) self.size = (1, 1) with self.canvas: Color(*RGBAColor.GREY) Ellipse(pos=self.pos, size=self.size)
def __init__(self): self.pos = Vector(*Window.size) - Vector(*_CHECK_POINT_OFFSET) self.size = (20, 20) Widget.__init__(self) with self.canvas: Color(*RGBAColor.GREY) Rectangle(pos=self.pos, size=self.size)
def __init__(self): self.size = Window.size self.pos = (0, 0) self._cars = [] self._airport = Airport() self._downtown = Downtown() self._painter = Painter() self._is_paused = True rcParams['toolbar'] = 'None' self._figure = pyplot.figure(figsize=(6, 3)) self._figure.canvas.set_window_title("Mean Reward") self._plot = self._figure.add_subplot(1, 1, 1, facecolor=RGBAColor.GREY) self._empty_plot = self._figure.canvas.copy_from_bbox(self._plot.bbox) self._plot.grid() self._plot.set_xlabel("step") self._plot.set_ylabel("reward") self._plot.set_xlim(0.0, _PLOTTING_INTERVAL + 200) self._plot.set_ylim(-1.1, 1.2) self._plot_lines = [] self._save_button = Button( text="save", pos=(Window.width - 270, 50), size=(100, 50), ) self._load_button = Button( text="load", pos=(Window.width - 150, 50), size=(100, 50), ) self._clear_button = Button( text="clear", pos=(Window.width - 150, 120), size=(100, 50), ) self._pause_button = Button( text="run", pos=(Window.width - 270, 120), size=(100, 50), ) Widget.__init__(self) self.sand = numpy.zeros(( self.width, self.height, ))
def __init__(self, **kwargs): Widget.__init__(self, **kwargs) # TODO: in Kivy, a subclass of any given widget subclass would # require setting text to "root.sv" in KV, where sv was a # StringProperty in the subclass. if 'text' in kwargs: self.sv.set(kwargs['text']) # print("The parent of a Label is {}".format(self.parent)) if self.parent is not None: self.finalize()
def __init__(self, pos, color): self.color = color self.pos = pos self.size = (20, 10) Widget.__init__(self) with self.canvas: Color(*self.color) Rectangle(pos=self.pos, size=self.size)
def __init__(self, info_dict, employees, wastage=None): Widget.__init__(self) self.info_dict = info_dict # TODO get default unit if wastage is None: wastage = {'waste1': (0, 'kg'), 'waste2': (0, 'kg')} self.wastage = wastage self.employees = employees self.qc = [] self.adjustments = {'E01': 0, 'E02': 0, 'E03': 0}
def __init__(self, **kwargs): Widget.__init__(self, **kwargs) self.balls = [] for i in xrange(5): self.balls.append( CircleWidget(color=Color(1 - i, 0., i), pos=(i * 100, i * 100))) for ball in self.balls: self.add_widget(ball)
def __init__(self, src, nme, cat, vid, **kwargs): """Function executed when the Object2 is created. """ Widget.__init__(self, **kwargs) self.name = nme self.category = cat self.rect = Rectangle(pos=self.pos, size=self.size, source=src) self.canvas.add(self.rect) self.src = src self.video = vid
def __init__(self, **kwargs): Widget.__init__(self, **kwargs) with self.canvas.after: Color(1, 1, 1, 1, mode='rgba') for y in range(self.floor_number + 1): Line(points=[ 0, y * self.floor_height, self.room_width, y * self.floor_height ], dash_length=5, dash_offset=5)
def __init__(self, pos, size, black, row, col): Widget.__init__(self) ButtonBehavior.__init__(self) self.black = black # The square's color self.unit = None # The unit that is on the board (None/'b'/'r') self.pos = pos # Position on screen (x, y) self.size = size # Size (height, width) self.queen = False # Whether the unit on the square is a queen self.selected = False # If the square is selected self.row = row # Row of square on board self.col = col # Column of square on board
def __init__(self, X, Y, largeur, elements=None, **kwargs): Widget.__init__(self, **kwargs) self.X = X self.Y = Y self.largeur = largeur self.width = largeur self.height = largeur self.elements = [] if elements is not None: self.elements.append(elements) self.reDessiner()
def __init__(self, job_info, wastage=None): Widget.__init__(self) start = datetime.now() self.job_info = job_info self.job_info['date'] = start.strftime('%Y-%m-%d') self.job_info['time_fr'] = start.strftime('%H:%M') if wastage is None: wastage = {'waste1': (0, 'kg'), 'waste2': (0, 'kg')} self.wastage = wastage self.adjustments = {'B1': 0, 'B2': 0, 'B3': 0, 'B4': 0, 'B5': 0} self.qc = None
def __init__(self, *args, **kwargs): Widget.__init__(self, *args, **kwargs) self.bind(pos=self.draw) self.bind(size=self.draw) self.gridLayer = BoxLayout(opacity=1) self.neuronLayer = Widget(opacity=1) self.add_widget(self.gridLayer) self.add_widget(self.neuronLayer) self._gridSize = 5 self._neuronSize = 60 self.initNeurons()
def __init__(self, color=Color(1., 1., 0.), size=(50, 50), pos=(100, 100), **kwargs): Widget.__init__(self, **kwargs) self.size = size self.pos = pos self.ball = Ellipse(pos=self.pos, size=self.size) self.canvas.add(color) self.canvas.add(self.ball)