Example #1
0
    def redraw(self, msize=32):
        cid = core.data.character_id
        self.canvas.clear()

        for o in core.data.items.values():
            if o["is_dropped"]:
                self.canvas.add(Color(1,1,0,1))
                self.canvas.add(Ellipse(size=(msize, msize), pos=(o["x"]*msize-msize/2, o["y"]*msize-msize/2)))
        for key, o in core.data.characters.items():
            if o["is_dead"]:
                continue
            if key == cid:
                self.canvas.add(Color(1,1,1,1))
            else:
                self.canvas.add(Color(1,0,0,1))
            # キャラクターの線画
            self.canvas.add(Ellipse(size=(msize, msize), pos=(o["x"]*msize-msize/2, o["y"]*msize-msize/2)))
            # キャラクターアングルの線画
            self.canvas.add(Color(0,0,0,1))
            ap = self.angle_pos(o, msize)
            self.canvas.add(Ellipse(size=(msize*0.2, msize*0.2), pos=(ap[0]-msize*0.1, ap[1]-msize*0.1)))
        if cid and cid in core.data.characters:
            self.canvas.add(Color(1,1,1,1))
            # render item names
            for idx,item_id in enumerate(core.data.characters[cid]["items"]):
                label = Label(text=core.data.items[item_id]["name"], font_size=msize*2)
                label.refresh()
                self.canvas.add(Rectangle(size=label.texture.size, pos=(0, idx*msize*2), texture=label.texture))
            # render position
            label = Label(text="{}, {}, {}".format(core.data.characters[cid]["x"], core.data.characters[cid]["y"], core.data.characters[cid]["attack_charge"]), font_size=msize*2)
            label.refresh()
            self.canvas.add(Rectangle(size=label.texture.size, pos=(0, WINDOWSIZE[1]-msize*2), texture=label.texture))
Example #2
0
    def ResultUpdate(self,result):
        self.added=None
        if type(result)==str:
            to_add=Label(text=result,font_size='30sp',valign ='center',halign="center")
            self.added=to_add
            self.add_widget(to_add)
        else:
            layout = GridLayout(cols=1, spacing=10, size_hint_y=None,row_force_default=True, row_default_height=80)
            layout.bind(minimum_height=layout.setter('height'))

            for i in result:
                box=BoxLayout(orientation='vertical')
                title=Label(text=i[3],markup=True)
                url=Label(text="[ref="+i[2]+"]"+i[2]+"[/ref]",font_size="12sp",markup=True)
                url.on_ref_press=(lambda x: webbrowser.get("C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s").open(x))
                content=Label(text="Score: "+str(i[1])+"\n"+"File: "+i[0],font_size="12sp")
                box.add_widget(title)
                box.add_widget(url)
                box.add_widget(content)
                layout.add_widget(box)
            sv = ScrollView(size_hint=(1, None), size=(Window.width, Window.height-50))
            sv.add_widget(layout)
            root=AnchorLayout(anchor_x="left",anchor_y="top")
            root.add_widget(sv)
            self.add_widget(root)
            self.added=root
Example #3
0
    def dowork(self, workIndex):
        root = BoxLayout(orientation='vertical')
        self.popup = Popup(title='Life, the Universe, and Everything. There is an answer.', content=root,
                           auto_dismiss=False)
        if workIndex == 1:
            content = Label(
                text='Take a long break: \n\n Hectoe9000 is cleaning and drying himself. \nThis will take some time.')
            self.popup.bind(on_open=self.clean)
        if workIndex == 2:
            content = Label(text='Take a break: \n\n Hectoe9000 is drying. \nThis will take some time.')
            self.popup.bind(on_open=self.dry)

        root.add_widget(content)
        self.popup.open()
Example #4
0
    def exit(self):
        print("exit")
        root = BoxLayout(orientation='vertical')
        root2 = BoxLayout()
        root2.add_widget(
            Label(
                text=
                'Do you realy want to close satoshi 24 ? \nThere will be no more drinks ....',
                font_size='35sp'))
        root.add_widget(root2)

        root3 = BoxLayout(size_hint_y=0.15)
        buttOK = Button(text='OK', font_size=60)
        root3.add_widget(buttOK)

        buttCancel = Button(text='Cancel', font_size=60)
        root3.add_widget(buttCancel)
        root.add_widget(root3)

        popup = Popup(title='WAIT !!!', content=root, auto_dismiss=False)

        buttOK.bind(on_press=self.shutdown)
        buttCancel.bind(on_press=popup.dismiss)
        #popup.bind(on_dismiss=self.shutdown)
        popup.open()
Example #5
0
    def choiceDrink(self, *args):
        self.readPumpConfiguration()
        if len(self.drinkOnScreen) - 1 < args[0]:
            print("no drinks found.")
            return

        root = BoxLayout(orientation='vertical')
        root2 = BoxLayout()
        root2.add_widget(Image(source='img/empty-glass.png'))
        root2.add_widget(
            Label(
                text=
                'Please be shoure ,\n that a Glas \nwith min 400ml \nstands under the extruder.'
            ))
        root.add_widget(root2)

        content = Button(text='OK', font_size=60, size_hint_y=0.15)
        root.add_widget(content)

        popup = Popup(title='LOOK HERE !!!', content=root, auto_dismiss=False)

        def closeme(button):
            popup.dismiss()
            Clock.schedule_once(partial(self.doGiveDrink, args[0]), .5)

        content.bind(on_press=closeme)
        popup.open()
Example #6
0
    def doGiveDrink(self, drink, intervaltime):
        root = BoxLayout(orientation='vertical')
        content = Label(text='Take a break\nYour \n' +
                        self.drinkOnScreen[drink]["name"] + '\nwill be mixed.',
                        font_size='40sp')
        root.add_widget(content)
        popup = Popup(
            title='Life, the Universe, and Everything. There is an answer.',
            content=root,
            auto_dismiss=False)

        def makeDrink(parentwindow):
            drinks = self.drinkOnScreen[drink]
            hector = HectorHardware(config)

            for ingridient in drinks["recipe"]:
                hector.valve_dose(pumpList[ingridient[0]], ingridient[1])
                time.sleep(.1)
                print("IndexPumpe: ", pumpList[ingridient[0]])
                print("Ingredient: ", ingridient[0])
                print("Output in ml: ", ingridient[1])
                self.db.countUpIngredient(ingridient[0], ingridient[1])

            time.sleep(1)
            self.db.countUpDrink(drinks["name"])
            hector.finger(1)
            hector.ping(3)
            hector.finger(0)
            print(drinks["name"])
            parentwindow.dismiss()

        popup.bind(on_open=makeDrink)

        popup.open()
Example #7
0
    def _draw_label(self, *t):
        self._labelIG.clear()
        if not self.label and not self.label_icon:
            return

        theta = self.start_angle + (self.label_angle_ratio *
                                    (self.end_angle - self.start_angle))
        c = cos(radians(theta))
        s = sin(radians(theta))
        r = self.r
        r1 = r * self.label_radius_ratio
        if self.label_icon:
            label = CoreImage(self.label_icon)
            t = label.texture
            iconSize = max(t.size)
            scale = r * self.label_icon_scale / float(iconSize)
            tw, th = t.size
            tw *= scale
            th *= scale
        else:
            label = Label(text=self.label,
                          markup=True,
                          bold=True,
                          font_size=self.label_font_size)
            label.refresh()
            t = label.texture
            tw, th = t.size
        self._labelIG.add(
            Rectangle(pos=(self.centerx + r1 * s - tw / 2,
                           self.centery + r1 * c - th / 2),
                      size=(tw, th),
                      texture=t))
 def drawText(self, text, size, x, y, r, g, b, a):
     label = Label(text=text, font_size=size, color=(r, g, b, a))
     label.refresh()
     texture = label.texture
     texture_size = list(texture.size)
     with self.canvas:
         Rectangle(texture=texture, pos=(x, y), size=texture_size)
 def __init__(self, **kwargs):
     self.label = Label(text='v',
                        font_size=sp(14),
                        padding=sp(3),
                        valign='middle',
                        halign='center')
     self.label.refresh()
     super(VectorWidget, self).__init__(**kwargs)
def test_icons_have_size():
    from kivymd.icon_definitions import md_icons
    from kivy.core.text import Label

    lbl = Label(font_name="Icons")
    for icon_name, icon_value in md_icons.items():
        assert len(icon_value) == 1
        lbl.refresh()
        assert lbl.get_extents(icon_value) is not None
Example #11
0
 def perform_layout(self, constraints):
     if not self.label:
         self.label = Label(
             text=self.widget.text,
             font_size=self.widget.size
         )
         self.label.refresh()
     self.bounds.size = constraints.constrain(
         Point(self.label.width, self.label.height)
     )
Example #12
0
def banner_and_background(Screen):
    with Screen.canvas:
        Color(0.4, 0.4, 0.4, 0.3)
        Rectangle(pos=root.pos, size=(screenx, screeny))
        Color(0.2, 0.2, 0.2, 0.7)
        Rectangle(pos=(150, 500), size=(500, 100))
    label = Label()
    label.font_size = '36sp'
    label.pos = (350, 500)
    label.text = "AttenBuddy-Desktop"
    Screen.add_widget(label)
Example #13
0
 def _create_line_label(self, text):
     # Create a label from a text, using line options
     ntext = text.replace('\n', '').replace('\t', ' ' * self.tab_width)
     kw = self._get_line_options()
     cid = '%s\0%s' % (ntext, str(kw))
     texture = Cache.get('textinput.label', cid)
     if not texture:
         label = Label(text=ntext, **kw)
         label.refresh()
         texture = label.texture
         Cache.append('textinput.label', cid, texture)
     return texture
Example #14
0
 def bar_name(self, value: str):
     if not isinstance(value, str):
         raise TypeError("Label must a string, not {}!".format(type(value)))
     else:
         value = Label(text=value,
                       halign='middle',
                       valign='middle',
                       font_size=20)
         self._name = value
         self._name_text = value.text
         self._name.refresh()
         self._name_size = value.texture.size
Example #15
0
    def setUpCanvas(self):
        self.instructionGroup = InstructionGroup(group=self.get_unique_id())
        self.state_circle_color = Color(.5, .5, .5, 1)
        self.state_circle = Ellipse(group=self.get_unique_id(),
                                    pos=self.offset_pos,
                                    size=(self.radius * 2, self.radius * 2))
        self.state_highlight_color = Color(.8, .8, .8, 1)
        self.state_highlight = Line(width=1.5,
                                    ellipse=(self.offset_pos[0],
                                             self.offset_pos[1],
                                             self.radius * 2, self.radius * 2))

        self.state_label = Label(text_size=(self.radius * 2 - 6,
                                            self.radius * 2),
                                 halign='center',
                                 valign='middle')
        self.state_label.text = self.name
        self.state_label.refresh()
        self.state_label_color = Color(1, 1, 1, 1)
        self.state_label_rect = Rectangle(
            pos=Vector(self.offset_pos) + Vector(3, 0),
            size=(self.radius * 2 - 6, self.radius * 2),
            texture=self.state_label.texture)

        # These can be added to the group later, no need to add unused
        # instructions.
        self.line_color = Color(1, 1, 1, 1)
        self.final_state_circle = Line(
            width=1.2,
            ellipse=(self.offset_pos[0] + 5, self.offset_pos[1] + 5,
                     (self.radius - 5) * 2, (self.radius - 5) * 2))

        self.initial_state_arrow = Line(width=1.8, cap='round', joint='round')
        self.initial_state_arrow.points = (self.pos[0] - 7, self.pos[1] +
                                           self.radius + 10, self.pos[0],
                                           self.pos[1] + self.radius + 2,
                                           self.pos[0] + 7,
                                           self.pos[1] + self.radius + 10)

        self.initial_state_tail = Line(width=1.8, cap='round')
        self.initial_state_tail.points = (self.pos[0],
                                          self.pos[1] + self.radius + 25,
                                          self.pos[0],
                                          self.pos[1] + self.radius + 2)

        self.instructionGroup.add(self.state_circle_color)
        self.instructionGroup.add(self.state_circle)
        self.instructionGroup.add(self.state_highlight_color)
        self.instructionGroup.add(self.state_highlight)
        self.instructionGroup.add(self.state_label_color)
        self.instructionGroup.add(self.state_label_rect)
        self.instructionGroup.add(self.line_color)
Example #16
0
 def _get_line_options(self):
     # Get or create line options, to be used for Label creation
     if self._line_options is None:
         self._line_options = kw = {
             'font_size': self.font_size,
             'font_name': self.font_name,
             'anchor_x': 'left',
             'anchor_y': 'top',
             'padding_x': 0,
             'padding_y': 0,
             'padding': (0, 0)}
         self._label_cached = Label(**kw)
     return self._line_options
Example #17
0
    def start_game(self):
        creps = []
        conveers = []
        crep_numbers = []
        self.create_creps(creps)
        self.create_conveers(conveers, creps)
        combine = Combine()
        combine.pos = 0, conveers[0].top
        combine.size = self.s.combine_width, self.s.combine_height
        self.root.add_widget(combine)

        for i in range(len(creps)):
            """Рисование крепей и конвееров"""
            self.root.add_widget(conveers[i])
            self.root.add_widget(creps[i])
            l = Label()
            self.root.add_widget(l)
Example #18
0
    def __init__(self, message, writer=False, **kwargs):
        super(Message, self).__init__(**kwargs)
        MAX_WIDTH = Win.width // 2

        if writer:
            position = {"right": .95, "center_y": .5}
        else:
            position = {"x": .05, "center_y": .5}

        # self.add_widget(Button(size_hint_x = MAX_WIDTH, pos_hint = {"right": 1,"y":0}))

        messageText = Label(text=message,
                            padding=[3.0, 4.0],
                            color=COLOR["LIGHT"]["MAIN_COLOR"],
                            font="20px")
        messageText.refresh()
        if messageText.texture.size[0] <= MAX_WIDTH:
            messageText.text_size = [messageText.texture.size[0], None]
        else:
            messageText.text_size = [MAX_WIDTH, None]
        messageText.refresh()
        print(MAX_WIDTH, messageText.texture.size, messageText.text_size)
        self.size_hint_y = None
        self.height = messageText.texture.size[1]

        self.add_widget(
            Button(pos_hint=position,
                   size_hint=[None, None],
                   width=messageText.texture.size[0] + 4,
                   height=self.height + 2,
                   background_normal="images/backLayout.png",
                   background_down="images/backLayout.png",
                   background_color=[.75, .75, .75, 1]))
        self.add_widget(
            Button(pos_hint=position,
                   size_hint_x=None,
                   width=messageText.texture.size[0],
                   background_normal="images/backLayout.png",
                   background_down="images/backLayout.png"))
        messageImage = Image(texture=messageText.texture,
                             size_hint_x=None,
                             width=messageText.texture.size[0],
                             pos_hint=position)

        self.add_widget(messageImage)
Example #19
0
 def __init__(self, **kwargs):
     super(Month, self).__init__(**kwargs)
     self.month_i = datetime.today().month
     self.year = datetime.today().year
     self.text = self.month_name(self.month_i)
     self.prev = prev = Button(text='<',
                               on_release=self.prev_month,
                               size_hint_x=.1)
     self.title = title = Label(text=self.txt(),
                                markup=True,
                                valign='middle',
                                size_hint_x=.2)
     self.next = next = Button(text='>',
                               on_release=self.next_month,
                               size_hint_x=.1)
     self.add_widget(prev)
     self.add_widget(title)
     self.add_widget(next)
    def setUpCanvas(self):
        self.tb_size = (50, 20)

        self.instruction_group = InstructionGroup(group=self.get_unique_id())

        self.trans_line_color = Color(.9, .9, .9)
        self.trans_bezier = Line(cap='round',
                                 joint='round',
                                 width=2,
                                 bezier_precision=75)
        self.trans_arrow_color = Color(.5, .5, .5)
        self.trans_arrow = Triangle()

        self.trans_label_bg_color = Color(.6, .6, .6, 1)
        self.trans_label_bg = Rectangle(size=self.tb_size)
        self.trans_label_highlight_color = Color(.9, .9, .9)
        self.trans_label_highlight = Line(cap='round',
                                          joint='round',
                                          width=1.5)
        self.trans_label = Label(text_size=self.tb_size,
                                 halign='center',
                                 valign='middle')
        self.trans_label.text = str(self.direction) + ': ' + str(
            self.read_sym) + ', ' + str(self.write_sym)
        self.trans_label.refresh()
        self.trans_label_color = Color(1, 1, 1, 1)
        self.trans_label_rect = Rectangle(size=self.tb_size,
                                          texture=self.trans_label.texture)

        self.instruction_group.add(self.trans_line_color)
        self.instruction_group.add(self.trans_bezier)
        self.instruction_group.add(self.trans_arrow_color)
        self.instruction_group.add(self.trans_arrow)

        self.instruction_group.add(self.trans_label_bg_color)
        self.instruction_group.add(self.trans_label_bg)
        self.instruction_group.add(self.trans_label_highlight_color)
        self.instruction_group.add(self.trans_label_highlight)
        self.instruction_group.add(self.trans_label_color)
        self.instruction_group.add(self.trans_label_rect)

        self.update_positions()
Example #21
0
    def fill_marks(self):
        s.send(('--get_marks--' + login_of_user).encode())
        time.sleep(1)
        self.ids.students_marks.clear_widgets()
        global student_marks
        a = 0
        mark_str = ''
        if student_marks:
            for text in student_marks:
                a = a + 1
                mark_str = mark_str + text + ' '
                if a == 2:
                    self.lab = Label(text=mark_str)
                    self.ids.students_marks.add_widget(self.lab)
                    mark_str = ''
                    a = 0
        print("callback")
        print(student_marks)

        pass
Example #22
0
    def lightningSwitch(self):
        root = BoxLayout(orientation='vertical')

        root2 = BoxLayout()
        root2.add_widget(
            Label(
                text=
                'Do you want to get connected to a lightning node?\n\n Choose wisely,\n because this panel\n can be used once only!',
                font_size='30sp'))
        root.add_widget(root2)

        lightningBIT = Button(text='Bitcoin im Turm-Node (inactive)',
                              font_size=30,
                              size_hint_y=0.15)
        root.add_widget(lightningBIT)
        lightningLAN = Button(text='esotronic.net-LAN-Node',
                              font_size=30,
                              size_hint_y=0.15)
        root.add_widget(lightningLAN)
        lightningOFF = Button(text='OFF', font_size=30, size_hint_y=0.15)
        root.add_widget(lightningOFF)

        popup = Popup(title="Lightning configuration",
                      content=root,
                      auto_dismiss=False)

        def lnd_off(button):
            self.lightning = False
            popup.dismiss()

        lightningOFF.bind(on_press=lnd_off)

        def lnd_on(button):
            self.lightning = True
            popup.dismiss()

        lightningLAN.bind(on_press=lnd_on)
        lightningBIT.bind(on_press=lnd_on)

        popup.open()
Example #23
0
    def choiceDrink(self, *args):
        self.readPumpConfiguration()
        if len(self.drinkOnScreen) - 1 < args[0]:
            print("no drinks found.")
            return

        root = BoxLayout(orientation='vertical')
        root2 = BoxLayout()
        root2.add_widget(Image(source='img/empty-glass.png'))
        root2.add_widget(
            Label(
                text=
                'Please be sure\n that a glass \nwith min 200 ml \nis placed onto \nthe black fixture.',
                font_size='30sp'))
        root.add_widget(root2)

        contentOK = Button(text='OK', font_size=60, size_hint_y=0.5)
        root.add_widget(contentOK)

        contentCancel = Button(text='Cancel', font_size=60, size_hint_y=0.5)
        root.add_widget(contentCancel)

        popup = Popup(title='', content=root, auto_dismiss=False)

        def closeme(button):
            popup.dismiss()
            Clock.schedule_once(partial(self.doGiveDrink, args[0]), .01)

        contentOK.bind(on_press=closeme)

        def cancelme(button):
            popup.dismiss()

        contentCancel.bind(on_press=cancelme)

        popup.open()
Example #24
0
 def __init__(self, color):
     self.time = 0
     self.color = color
     lb = Label(text='00000', color=self.color)
     lb.refresh()
     self.image = Rectangle(pos=(0, 0), size=(100, 30), texture=lb.texture)
Example #25
0
 def count_time(self, dt):
     self.time += dt
     lb = Label(text=self.get_text_time(), color=self.color)
     lb.refresh()
     self.image.texture = lb.texture
Example #26
0
 def test_unicode_name(self):
     from kivy.core.text import Label
     lbl = Label(font_name=self.font_name)
     lbl.refresh()
     self.assertNotEqual(lbl.get_extents(''), None)
Example #27
0
	def __init__(self, **kwargs):
		
		print("make l3d")
		
		self.boatCoor = boatPos()
		self.kShift = False
		
		self.oBoxFile = "./3dModels/3d_box.obj"
		self.objs = [
			['boat',"./3dModels/boat2_3dex_boat.obj","./3dModels/oiysh_profile2.jpeg"],
			#['genoa',"./3dModels/boat2_3dex_sailGenoa_onPower.obj","./3dModels/3d_texture_genoa.jpg"],
			['main',"./3dModels/boat2_3dex_sailMain_sailup_onPower.obj","./3dModels/IMG_5410.jpg"]
			#['boom',"./3dModels/boat2_3dex_boom.obj",""],
			#['ruder',"./3dModels/boat2_3dex_ruder.obj",""],
			#['tiler',"./3dModels/boat2_3dex_tiler.obj",""],
			#['roseta','./3dModels/3d_roseta.obj','']
			
			]

		tp = '''#:kivy 1.0
#: import Layout3D kivy3dgui.layout3d
#: import Animation kivy.animation.Animation
Layout3D:
    id: par
    size_hint: (1.0, 1.0)
    post_processing: True
    
		
    	'''		
		
		for i,oo in enumerate(self.objs):
			tp+= self.kvStr4Obj(oo[0],oo[1],oo[2])
		"""
		boardSize = [3,9]
		tileSize = 4
		xOff = boardSize[0]*tileSize*0.5
		for x in range(0,boardSize[0],1):
			for y in range(0,boardSize[1],1):
				print("tile ",x,"x",y)
				tp+= self.kvStr4Obj(
					"b_%s_%s"%(x,y), 
					self.oBoxFile, 
					"",
					pos=[-xOff+x*tileSize,-8,-y*tileSize]
					)
		"""	
			
		#print("-------------------------")
		#print(tp+"\n--------------------------")
		self.l = Builder.load_string(tp)
		#print("DONE")
		#sys.exit(11)
		
		self.root = self.l
		
		bl = BoxLayout(orientation="vertical")
		b = Button(
			size_hint = (0.1,0.1),
			text="r90",
			size = (10,10
				))
		b.bind(on_release=self.btClick)
			
		bl.add_widget(b)
		
		
		if True:
			axis = ["x","y","z"]
			
			## pos
			blS = BoxLayout(orientation="vertical")
			blS.add_widget(Label(text="Position:"))
			for i,a in enumerate(axis):
				objTid = "sb3dp%s"%a
				objT = Slider(
					id = objTid,
					min = -100.0,
					value = self.boatCoor.pos[i],
					max = 100.0
					)
				objT.bind(on_touch_move=self.onsBTouch)
				blS.add_widget(objT)
			
			## rot
			blS.add_widget(Label(text="Rotation:"))
			for a in axis:
				objTid = "sb3dr%s"%a
				objT = Slider(
					id = objTid,
					min = -180.0,
					value = self.boatCoor.rot[i],
					max = 180.0
					)
				objT.bind(on_touch_move=self.onsBTouch)
				blS.add_widget(objT)
				
				
			## sails
			blS.add_widget(Label(text="Genoa:"))
			objT = Slider(
				id = "sb4dg",
				min = -90.0,
				value = self.boatCoor.rot[i],
				max = 90.0
				)
			objT.bind(on_touch_move=self.onsBTouch)
			blS.add_widget(objT)
			
			blS.add_widget(Label(text="Main:"))
			objT = Slider(
				id = "sb4dm",
				min = -90.0,
				value = self.boatCoor.rot[i],
				max = 90.0
				)
			objT.bind(on_touch_move=self.onsBTouch)
			blS.add_widget(objT)
			
			blS.add_widget(Label(text="Tiller:"))
			objT = Slider(
				id = "sb4dt",
				min = -45.0,
				value = self.boatCoor.rot[i],
				max = 45.0
				)
			objT.bind(on_touch_move=self.onsBTouch)
			blS.add_widget(objT)
			
			
			
			self.l.add_widget(blS)
		
		self.l.add_widget(bl)
		
		self.l.bind(on_touch_down = self.on_touch_down)
		self.l.bind(on_touch_move = self.on_touch_move)
		self.l.bind(on_touch_up = self.on_touch_up)
		
		self.boatCoor.setObjAsArray(self)
		
		print("------------------------------")
		#print(self.l.ids.Nboat)
		#print(self.l.ids.Nboat.rotate)
		#print(self.l.ids.Nboat.yaw)
		#print(self.l.ids.Nboat.roll)
		#print(help(self.l.ids.Nboat))
		
		print("make l3d DONE")
from collections.abc import Iterable
from math import ceil

# This constant enforces the cap argument to be one of the caps accepted by the kivy.graphics.Line class
_ACCEPTED_BAR_CAPS = {"round", "none", "square"}

# Declare the defaults for the modifiable values
_DEFAULT_THICKNESS = 10
_DEFAULT_CAP_STYLE = 'round'
_DEFAULT_PRECISION = 10
_DEFAULT_PROGRESS_COLOUR = (1, 0, 0, 1)
_DEFAULT_BACKGROUND_COLOUR = (0.26, 0.26, 0.26, 1)
_DEFAULT_MAX_PROGRESS = 100
_DEFAULT_MIN_PROGRESS = 0
_DEFAULT_WIDGET_SIZE = 200
_DEFAULT_TEXT_LABEL = Label(text="{}%", font_size=40)

# Declare the defaults for the normalisation function, these are used in the textual representation (multiplied by 100)
_NORMALISED_MAX = 1
_NORMALISED_MIN = 0


class CircularProgressBar(Widget):
    """
    Widget used to create a circular progress bar.

    You can either modify the values within the code directly, or use the .kv language to pass them to the class.

    The following keyword values are currently used:

        1. thickness - thickness of the progress bar line (positive integer)
Example #29
0
    def choiceDrink(self, *args):
        self.readPumpConfiguration()
        if len(self.drinkOnScreen) - 1 < args[0]:
            print("no drinks found.")
            return

        ## Start Script to create Invoice
        print("start lnd-invoicetoqr.sh")
        subprocess.call("lnd/lnd-invoicetoqr.sh")
        print("end lnd-invoicetoqr.sh")

        root = BoxLayout(orientation='vertical')
        root2 = BoxLayout()
        root2.add_widget(Image(source='lnd/temp/tempQRCode.png'))
        root2.add_widget(
            Label(
                text=
                'Please be sure\n that a glass \nwith min 200 ml \nis placed onto the black fixture.',
                font_size='30sp'))
        root.add_widget(root2)

        ## This was commented out to be sure the user only gets a drink after paying the bill.
        #contentOK = Button(text='OK', font_size=60, size_hint_y=0.15)
        #root.add_widget(contentOK)

        contentCancel = Button(text='Cancel', font_size=60, size_hint_y=0.15)
        root.add_widget(contentCancel)

        popup = Popup(title='Not your coins, not your cocktail :-)',
                      content=root,
                      auto_dismiss=False)

        ## This was commented out to be sure the user only gets a drink after paying the bill.
        #def closeme(button):
        #    popup.dismiss()
        #    Clock.schedule_once(partial(self.doGiveDrink, args[0]), .01)

        ## This was commented out to be sure the user only gets a drink after paying the bill.
        #contentOK.bind(on_press=closeme)

        def cancelme(button):
            popup.dismiss()

        #Button cancel payment, is not working right now
        contentCancel.bind(on_press=cancelme)

        ## Beginn Function to periodically check the payment using lnd-checkinvoice1.sh
        def checkPayment(parent):

            print("start check script")

            ## while loop to check if lnd-checkinvoice1.sh returns SETTLED, if not wait for a second and start over
            paymentSettled = False
            while paymentSettled == False:
                ## run lnd-checkinvoice1.sh and write output to variable s
                s = subprocess.check_output(["sh", "lnd/lnd-checkinvoice1.sh"])
                print(s)

                ## check if s is 'SETTLED', if so, close popup and start doGiveDrink
                if b'SETTLED' in s:
                    paymentSettled = True
                    popup.dismiss()
                    Clock.schedule_once(partial(self.doGiveDrink, args[0]),
                                        .01)
                else:
                    ## if not 'SETTLED' wait a second and start over
                    paymentSettled = False
                    time.sleep(1)
                pass
            pass

            print("end check script")
            ## End Function to periodically check the payment using lnd-checkinvoice1.sh

        ## start 'checkPayment-loop' when loading popup
        popup.bind(on_open=checkPayment)

        popup.open()
Example #30
0
    def drawIt(self):

        with self.canvas:
            self.setColor('w')

            PushMatrix()
            self.centPos = Translate(0, 0, 0)
            self.comScale = Scale(1, 1, 1)
            self.comRot = Rotate(0, 0, 0, 1)

            # HDG
            PushMatrix()
            self.rHdg = Rotate(0, 0, 0, -1)
            self.setColor("hdg")
            l = Label(text="HDG", font_size=12)
            l.refresh()
            Rectangle(size=l.size,
                      pos=((0 - l.size[0] / 2.0), 130),
                      texture=l.texture)
            self.drawArrow(l.size[0])
            self.setColor("w")
            PopMatrix()
            #HDG

            self.r = Rotate(0, 0, 0, 1)

            # COG
            PushMatrix()
            self.rCog = Rotate(0, 0, 0, -1)
            self.setColor("cog")
            l = Label(text="COG", font_size=12)
            l.refresh()
            Rectangle(size=l.size,
                      pos=((0 - l.size[0] / 2.0), 130),
                      texture=l.texture)
            self.drawArrow(l.size[0])
            self.setColor('w')
            PopMatrix()

            # COG

            # NESW
            PushMatrix()
            comDir = "NESW"
            for d in comDir:
                l = Label(text=d, font_size=20)
                l.refresh()
                Rectangle(size=l.size,
                          pos=((0 - l.size[0] / 2.0), 70),
                          texture=l.texture)
                Rotate(-90, 0, 0, 1)
            PopMatrix()
            # NESW

            for d in range(0, 360, 30):
                l = Label(text=str(d), font_size=12)
                l.refresh()
                Rectangle(size=l.size,
                          pos=((0 - l.size[0] / 2.0), 90),
                          texture=l.texture)
                Rotate(-30, 0, 0, 1)

            for l5 in range(0, 360, 5):
                Rotate(5, 0, 0, 1)
                Rectangle(pos=(0, 120), size=(1, 2))

            for l10 in range(0, 360, 10):
                Rotate(10, 0, 0, 1)
                Rectangle(pos=(-1, 106), size=(2, 10))

            for l45 in range(0, 360, 45):
                Rotate(45, 0, 0, 1)
                Rectangle(pos=(-3, 120), size=(6, 10))

            self.bind(pos=self.updateIt)
            #self.bind( size = self.updateOfSize )
            #self.bind( scale = self.scale )
            #self.bind( rotation = self.rotation )

            PopMatrix()