예제 #1
0
 def addRouter(self, instance):
     nodeButton = Button(pos=(self.pendingNodePosY, self.pendingNodePosX),
                         size_hint=(None, None),
                         size=(40, 40))
     nodeImg = Image(source="Images/router.png")
     nodeLabel = Label()
     nodeButton.add_widget(nodeImg)
     nodeButton.add_widget(nodeLabel)
     nodeImg.center_x = nodeImg.parent.center_x
     nodeImg.center_y = nodeImg.parent.center_y + 10
     nodeLabel.center_x = nodeLabel.parent.center_x
     nodeLabel.center_y = nodeLabel.parent.center_y - 10
     nodeButton.bind(on_press=self.showNodeBubble)
     self.add_widget(nodeButton)
     self.netManager.addRouter(nodeButton)
     nodeLabel.text = self.netManager.getNodeName(nodeButton)
예제 #2
0
    def draw_background(self):
        self.canvas.clear()
        Window.clearcolor = (0, 0.5, 0.5, 1)
        self.draw_notes()
        self.assign_labels()
        with self.canvas:
            distBetween = self.barOneSizeY / 5

            for i in range(1,6):  
                Rectangle(pos=(self.barOneStartX, self.barOneStartY - (i * distBetween)), size=(self.barOneSizeX, 2))
                Rectangle(pos=(self.barTwoStartX, (self.barTwoStartY - (i * distBetween) - self.barTwoPosOffset)), size=(self.barTwoSizeX, 2))
   
            Rectangle(pos=(self.performanceStartX, self.performanceStartY), size = (self.performanceSizeX, self.performanceSizeY))
            
            title = Label(text='Sight Reading Prototype', font_size=50)
            title.center_x = Window.width / 2
            title.center_y = Window.height - 50
예제 #3
0
 def drawTouchPoints(self):
     for touch in self.active_points.values():
         
         # We need to convert kivy y coordinate to GestureWorks y coordinate
         touch_y = int(self.root.height - touch.position.y)
         touch_x = int(touch.position.x)
         
         with self.root.canvas:
             
             # Draw the circles
             Color(*get_color_from_hex('ffe354'))
             Ellipse(pos=(touch_x - 20, touch_y + 20), size=(40,40))
             Line(circle=(touch_x, touch_y + 40, 30, 0, 360), width=2)
     
             # Draw the touchpoint info
             label = Label(text='ID: {}\nX: {} | Y: {}'.format(touch.point_id, touch_x, touch_y))
             label.center_x = touch_x + 80
             label.center_y = touch_y + 80
             label.color = (1,1,1)       
예제 #4
0
    def openPampaMT(self, project):

        self.clear_widgets()

        self.add_widget(self.image_back_ground)
        self.project = project

        lb_creating_the_project = Label()
        lb_creating_the_project.text = lang['Creating_the_Project']
        lb_creating_the_project.bold = True
        lb_creating_the_project.font_size = 17

        lb_creating_the_project.size_hint = None, None
        lb_creating_the_project.height = 30
        lb_creating_the_project.width = 150

        lb_creating_the_project.center_y = 250
        lb_creating_the_project.center_x = 400

        self.add_widget(lb_creating_the_project)

        self.progress_bar_finish = ProgressBar()
        self.progress_bar_finish.size_hint = None, None
        self.progress_bar_finish.width = 350
        self.progress_bar_finish.height = 10
        self.progress_bar_finish.value = 1
        self.progress_bar_finish.center_x = 400
        self.progress_bar_finish.center_y = 150
        self.add_widget(self.progress_bar_finish)

        self.lb_finish = Label(text=lang['Creating...'])
        self.lb_finish.size_hint = None, None
        self.lb_finish.width = 350
        self.lb_finish.height = 30
        self.lb_finish.center_x = 400
        self.lb_finish.center_y = 120
        self.add_widget(self.lb_finish)

        parallel_progress_bar = threading.Thread(target=self.finish_project)
        parallel_progress_bar.start()
예제 #5
0
    def openPampaMT(self, project):
        
        self.clear_widgets()

        self.add_widget(self.image_back_ground)
        self.project = project

        lb_creating_the_project = Label()
        lb_creating_the_project.text = lang['Creating_the_Project']
        lb_creating_the_project.bold = True
        lb_creating_the_project.font_size = 17

        lb_creating_the_project.size_hint = None, None
        lb_creating_the_project.height = 30
        lb_creating_the_project.width = 150

        lb_creating_the_project.center_y = 250
        lb_creating_the_project.center_x = 400

        self.add_widget(lb_creating_the_project)

        self.progress_bar_finish = ProgressBar()
        self.progress_bar_finish.size_hint = None, None
        self.progress_bar_finish.width = 350
        self.progress_bar_finish.height = 10
        self.progress_bar_finish.value = 1
        self.progress_bar_finish.center_x = 400
        self.progress_bar_finish.center_y = 150
        self.add_widget(self.progress_bar_finish)

        self.lb_finish = Label(text=lang['Creating...'])
        self.lb_finish.size_hint = None, None
        self.lb_finish.width = 350
        self.lb_finish.height = 30
        self.lb_finish.center_x = 400
        self.lb_finish.center_y = 120
        self.add_widget(self.lb_finish)

        parallel_progress_bar = threading.Thread(target=self.finish_project)
        parallel_progress_bar.start()
예제 #6
0
    def initialize(self,*args):

        #1. Draw tick marks and numbers
        for i in range(1,13):
            radians = 30*i*pi/180
            radius = .5*self.width

            # Draw ticket mark first
            tick_length = .1*radius

            start_x = radius + radius*sin(radians)
            start_y = radius + radius*cos(radians)

            end_x = radius + (radius - tick_length)*sin(radians)
            end_y = radius + (radius - tick_length)*cos(radians)

            with self.clock_layout.canvas:
                Line(points=[start_x,start_y,end_x,end_y],width=.0085*self.width)

            # Write number
            number = Label(text=str(i),
                           font_size=.1*self.width,
                           size_hint=(None,None),
                           bold=True)
            number.size = number.texture_size
            number.center_x =  radius + (radius - 2.5*tick_length)*sin(radians)
            number.center_y = radius + (radius - 2.5*tick_length)*cos(radians)

            # Add to layout
            self.clock_layout.add_widget(number)

        # 2.Initialize second, minute, and hour hands
        if self.enable_seconds:
            self.clock_layout.canvas.add(self.second_hand)
        self.clock_layout.canvas.add(self.minute_hand)
        self.clock_layout.canvas.add(self.hour_hand)

        # 2. Force update
        self.update()
예제 #7
0
 def setup_contents(self):
     x = self.x
     center_y = self.center_y
     top = self.top
     
     # data_width = 600
     # data_x = 10
     # data_text_height = 15
     
     #create objects
     title_label = Label(text="Waiting", size_hint=(None, None))
     artist_label = Label(text="Waiting", size_hint=(None, None))
     album_label = Label(text="Waiting", size_hint=(None, None))
     playtime_label = Label(text="00:00", size_hint=(None, None))
     length_label = Label(text="00:00", size_hint=(None, None))
     playback_slider = Slider(min=0, max=0, value=0, size_hint=(None, None))
     next_btn = Button(text="Waiting", size_hint=(None, None))
     prev_btn = Button(text="Waiting", size_hint=(None, None))
     play_btn = Button(text="Waiting", size_hint=(None, None))
     # vol_up_btn = Button(text="Waiting", size_hint=(None, None))
     # vol_down_btn = Button(text="Waiting", size_hint=(None, None))
     
     
     #layout the objects
     padding_x = 5
     padding_y = 1
     
     btn_dim = 75
     btn_size = (btn_dim, btn_dim)
     
     play_btn.size = btn_size
     next_btn.size = btn_size
     prev_btn.size = btn_size
     
     play_btn.x = x + padding_x
     play_btn.center_y = center_y
     prev_btn.x = x + padding_x * 2 + btn_dim
     prev_btn.center_y = center_y
     next_btn.x = x + padding_x * 3 + btn_dim * 2
     next_btn.center_y = center_y
     
     # vol_up_btn.size = btn_size
     # vol_down_btn.size = btn_size
     # vol_up_btn.x = x + padding_x * 4 + btn_dim * 3
     # vol_up_btn.center_y = center_y
     # vol_down_btn.x = x + padding_x * 5 + btn_dim * 4
     # vol_down_btn.center_y = center_y
     
     
     data_x = x + padding_x * 4 + btn_dim * 3
     # data_x = x + padding_x * 6 + btn_dim * 5
     data_width = self.width - data_x
     text_height = 15
     time_width = 40
     slider_height = 30
     slider_center_y = top - padding_y * 4 - text_height * 3 - slider_height / 2.0
     
     title_label.pos = (data_x + padding_x, top - (padding_y + text_height) * 1)
     title_label.size = (data_width - 2 * padding_x, text_height)
     artist_label.pos = (data_x + padding_x, top - (padding_y + text_height) * 2)
     artist_label.size = (data_width - 2 * padding_x, text_height)
     album_label.pos = (data_x + padding_x, top - (padding_y + text_height) * 3)
     album_label.size = (data_width - 2 * padding_x, text_height)
     playtime_label.size = (time_width, text_height)
     playtime_label.x = data_x + padding_x
     playtime_label.center_y = slider_center_y
     length_label.size = (time_width, text_height)
     length_label.right = data_x + data_width - padding_x
     length_label.center_y = slider_center_y
     playback_slider.width = length_label.x - padding_x * 2 - playtime_label.right
     playback_slider.height = slider_height
     playback_slider.x = playtime_label.right + padding_x
     playback_slider.center_y = slider_center_y
     
     #add the objects
     self._add_widget(play_btn)
     self._add_widget(prev_btn)
     self._add_widget(next_btn)
     self._add_widget(title_label)
     self._add_widget(artist_label)
     self._add_widget(album_label)
     self._add_widget(playtime_label)
     self._add_widget(length_label)
     self._add_widget(playback_slider)
     
     
     playback_slider.bind(on_touch_up=self.slider_touch_up, on_touch_down=self.slider_touch_down)
     playback_slider.bind(value=self._update_playtime_label)
     play_btn.bind(on_press=self.play_pause_track)
     next_btn.bind(on_press=self.next_track)
     prev_btn.bind(on_press=self.prev_track)
     
     vol_up_btn.bind(on_press=self.vol_up)
     vol_down_btn.bind(on_press=self.vol_down)
     
     
     #store objects to self
     self.play_btn = play_btn
     self.prev_btn = prev_btn
     self.next_btn = next_btn
     self.title_label = title_label
     self.artist_label = artist_label
     self.album_label = album_label
     self.playtime_label = playtime_label
     self.length_label = length_label
     self.playback_slider = playback_slider
예제 #8
0
def draws_lines_Z(x0, y0, dx, dy, fzoom,fzoomy, border, xmin, xmax, ymin, ymax, limx, limy, label_y, scale_y, component):
    xf = x0 + dx
    yf = y0 + dy

    deca_x = range(xmin, xmax + 1)
    deca_y = range(ymin, ymax, 5)

    # if limy == 90:
    #     lb_y = [0, 45, 90]
    # elif limy == 180:
    #     lb_y = [0, 90, 180]

    lb_y = [-15, -10, -5, 0, 5, 10, 15]

    #lb_y = [-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

    scale = [1, 2, 3, 4, 5, 6, 7, 8, 9,
             10, 20, 30, 40, 50, 60, 70, 80, 90,
             100, 200, 300, 400, 500, 600, 700, 800, 900,
             1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000,
             10000, 20000, 30000, 40000, 50000, 60000, 70000, 80000, 90000,
             100000, 200000, 300000, 400000, 500000, 600000, 700000, 800000, 900000,
             1000000, 2000000, 3000000, 4000000, 5000000, 6000000, 7000000, 8000000, 9000000,
             10000000, 20000000, 30000000, 40000000, 50000000, 60000000, 70000000, 80000000, 90000000,
             100000000]

    scale_log = []
    for i in scale:
        scale_log.append(log10(i))

    scale_log_zoom = []
    for i in scale_log:
        scale_log_zoom.append(i * fzoom)

    lay = FloatLayout()
    with lay.canvas:
        Color(rgba=[0, 0, 0, 1])
        Line(points=[x0, y0, xf, y0], width=border)
        Color(rgba=[0, 0, 0, 1])
        Line(points=[x0, y0, x0, yf], width=border)
        Color(rgba=[0, 0, 0, 1])
        Line(points=[xf, y0, xf, yf], width=border)
        Color(rgba=[0, 0, 0, 1])
        Line(points=[x0, yf, xf, yf], width=border)
        Color(rgba=[0, 0, 0, 1])
        Color(rgba=[.2, .2, .2, 1.])
        Ellipse(size=[6, 6], pos=[int(((dx / 3) * 2) + x0 + 5), yf + 10])

        c = 0
        for i in scale_log_zoom:
            if scale[c] > limx:
                continue
            else:
                Color(rgba=[0., 0., 0., 1.])
                Line(points=[i + x0, y0, i + x0, y0 - 5])
                c += 1

        for i in deca_y:
            i = int(i * fzoomy)
            Color(rgba=[0., 0., 0., 1.])
            Line(points=[x0 - 5, i + y0, x0, i + y0])

        for i in deca_y:
            i = int(i * fzoomy)
            Color(rgba=[0., 0., 0., 1.])
            Line(points=[xf + 5, i + y0, xf, i + y0])

        if scale_y == True:
            for i in lb_y:

                lb_phi = Label()
                lb_phi.color = [0, 0, 0, 1]
                lb_phi.markup = True
                lb_phi.text = str(i)
                lb_phi.size_hint = None, None
                lb_phi.height = 30
                lb_phi.width = 30

                if limy == 180:
                    y = (i/2 * fzoomy) + y0

                elif limy == 90:
                    y = ((i+15) * fzoomy) + y0

                lb_phi.center_x = xf + 25
                lb_phi.center_y = y

                lay.add_widget(lb_phi)

        for i in deca_x:

            if deca_x[0] < 0:
                pos = -deca_x[0]

            lb = Label()
            lb.color = [0,0,0,1]
            lb.markup = True
            lb.text = '10' + '[sup][size=10]' + str(i) + '[/size][/sup]'
            lb.size_hint = None, None
            lb.height = 30
            lb.width = 30

            x = int((x0 - 15) + ((i + pos) * fzoom))
            lb.pos = x, y0 - 30
            lay.add_widget(lb)

    lb_title = Label()
    lb_title.color = [0, 0, 0, 1.]
    lb_title.font_size = 17
    lb_title.text = 'Z' + component
    lb_title.size_hint = None, None
    lb_title.height = 30
    lb_title.width = 370
    lb_title.center_x = int((lb_title.width/2) + x0) - 25
    lb_title.center_y = yf + 15

    #lay.add_widget(lb_title)

    if label_y == True:

        lb_rho_ohm_meter = LabelRot()
        lb_rho_ohm_meter.size_hint = None, None
        lb_rho_ohm_meter.height = 100
        lb_rho_ohm_meter.width = 25
        lb_rho_ohm_meter.markup =True
        lb_rho_ohm_meter.italic = True
        lb_rho_ohm_meter.text = 'φ (graus)'
        lb_rho_ohm_meter.color = [0., 0., 0., 1.]
        lb_rho_ohm_meter.center_x = x0 - 40
        lb_rho_ohm_meter.center_y = int(y0 + dy/2)

        lay.add_widget(lb_rho_ohm_meter)

    bt_rho_xy = PointPlotEX()
    bt_rho_xy.center_x = int(((dx / 3) + x0) - 50)
    bt_rho_xy.center_y = yf + 14
    lb_rho_xy = Label()
    lb_rho_xy.size_hint = None, None
    lb_rho_xy.height = 30
    lb_rho_xy.width = 30
    lb_rho_xy.center_x = int((dx / 3) + x0 - 20)
    lb_rho_xy.center_y = yf + 15
    lb_rho_xy.markup = True
    lb_rho_xy.text = 'Re Z[sub][size=15]'+ component +'[/size][/sub]'
    lb_rho_xy.color = [.2, .2, .2, 1.]
    lb_rho_xy.font_size = 17

    lay.add_widget(bt_rho_xy)
    lay.add_widget(lb_rho_xy)


    lb_rho_yx = Label()
    lb_rho_yx.size_hint = None, None
    lb_rho_yx.height = 30
    lb_rho_yx.width = 30
    lb_rho_yx.center_x = int(((dx / 3) * 2) + x0 + 40)
    lb_rho_yx.center_y = yf + 15
    lb_rho_yx.markup = True
    lb_rho_yx.text = 'Im Z[sub][size=15]'+ component +'[/size][/sub]'
    lb_rho_yx.color = [.2, .2, .2, 1.]
    lb_rho_yx.font_size = 17


    lay.add_widget(lb_rho_yx)


    return lay
예제 #9
0
def draws_lines_rho( x0, y0, dx, dy, fzoom, border, xmin, xmax, ymin, ymax, limx, limy, label_y):
    xf = x0 + dx
    yf = y0 + dy

    deca_x = range(xmin, xmax + 1)
    deca_y = range(ymin, ymax + 1)

    scale = [1, 2, 3, 4, 5, 6, 7, 8, 9,
             10, 20, 30, 40, 50, 60, 70, 80, 90,
             100, 200, 300, 400, 500, 600, 700, 800, 900,
             1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000,
             10000, 20000, 30000, 40000, 50000, 60000, 70000, 80000, 90000,
             100000, 200000, 300000, 400000, 500000, 600000, 700000, 800000, 900000,
             1000000, 2000000, 3000000, 4000000, 5000000, 6000000, 7000000, 8000000, 9000000,
             10000000, 20000000, 30000000, 40000000, 50000000, 60000000, 70000000, 80000000, 90000000,
             100000000]

    scale_log = []
    for i in scale:
        scale_log.append(log10(i))

    scale_log_zoom = []
    for i in scale_log:
        scale_log_zoom.append(i * fzoom)

    lay = FloatLayout()
    with lay.canvas:
        Color(rgba=[0, 0, 0, 1])
        Line(points=[x0, y0, xf, y0], width=border)
        Color(rgba=[0, 0, 0, 1])
        Line(points=[x0, y0, x0, yf], width=border)
        Color(rgba=[0, 0, 0, 1])
        Line(points=[xf, y0, xf, yf], width=border)
        Color(rgba=[0, 0, 0, 1])
        Line(points=[x0, yf, xf, yf], width=border)
        Color(rgba=[0, 0, 0, 1])
        Color(rgba=[.2, .2, .2, 1.])
        Ellipse(size=[6, 6], pos=[int(((dx / 3) * 2) + x0 - 23), yf + 7])

        c = 0
        for i in scale_log_zoom:
            if scale[c] > limx:
                continue
            else:
                Color(rgba=[0., 0., 0., 1.])
                Line(points=[i + x0, y0, i + x0, y0 - 5])
                c += 1
        c = 0
        for i in scale_log_zoom:
            if scale[c] > limy:
                continue
            else:
                Color(rgba=[0, 0, 0, 1])
                Line(points=[x0, i + y0, x0 - 5, i + y0])
            c += 1

        c = 0
        for i in scale_log_zoom:
            if scale[c] > limy:
                continue
            else:
                Color(rgba=[0, 0, 0, 1])
                Line(points=[xf, i + y0, xf + 5, i + y0])
            c += 1

        for i in deca_y:

            if deca_y[0] < 0:
                pos = -deca_y[0]

            lb = Label()
            lb.color = [0, 0, 0, 1]
            lb.markup = True
            lb.text = '10' + '[sup][size=10]' + str(i) + '[/size][/sup]'
            lb.size_hint = None, None
            lb.height = 30
            lb.width = 30

            y = int((y0 - 20) + ((i + pos) * fzoom))
            lb.pos = x0 - 35, y
            lay.add_widget(lb)

        for i in deca_x:

            if deca_x[0] < 0:
                pos = -deca_x[0]

            lb = Label()
            lb.color = [0, 0, 0, 1]
            lb.markup = True
            lb.text = '10' + '[sup][size=10]' + str(i) + '[/size][/sup]'
            lb.size_hint = None, None
            lb.height = 30
            lb.width = 30

            x = int((x0 - 20) + ((i + pos) * fzoom))
            lb.pos = x + 5, y0 - 35
            lay.add_widget(lb)

    if label_y == True:
        lb_rho_ohm_meter = LabelRot()
        lb_rho_ohm_meter.size_hint = None, None
        lb_rho_ohm_meter.height = 100
        lb_rho_ohm_meter.width = 25
        lb_rho_ohm_meter.markup = True
        lb_rho_ohm_meter.italic = True
        lb_rho_ohm_meter.text = 'ρ (Ω.m)'
        lb_rho_ohm_meter.color = [0., 0., 0., 1.]
        lb_rho_ohm_meter.center_x = x0 - 40
        lb_rho_ohm_meter.center_y = int(y0 + dy / 2)

        lay.add_widget(lb_rho_ohm_meter)

    bt_rho_xy = PointPlotEX()
    bt_rho_xy.center_x = int(((dx/3) + x0)-20)
    bt_rho_xy.center_y = yf + 10
    lb_rho_xy = Label()
    lb_rho_xy.size_hint = None, None
    lb_rho_xy.height = 30
    lb_rho_xy.width = 30
    lb_rho_xy.center_x = int((dx/3) + x0)
    lb_rho_xy.center_y = yf + 15
    lb_rho_xy.markup = True
    lb_rho_xy.text = 'ρ[sub]xy[/sub]'
    lb_rho_xy.color = [.2, .2, .2, 1.]
    lb_rho_xy.font_size = 23

    lay.add_widget(bt_rho_xy)
    lay.add_widget(lb_rho_xy)


    lb_rho_yx = Label()
    lb_rho_yx.size_hint = None, None
    lb_rho_yx.height = 30
    lb_rho_yx.width = 30
    lb_rho_yx.center_x = int(((dx / 3) * 2) + x0)
    lb_rho_yx.center_y = yf + 15
    lb_rho_yx.markup = True
    lb_rho_yx.text = 'ρ[sub]yx[/sub]'
    lb_rho_yx.color = [.2, .2, .2, 1.]
    lb_rho_yx.font_size = 23


    lay.add_widget(lb_rho_yx)

    return lay
예제 #10
0
    def draw_final_screen(self):
        self.canvas.clear()
        Window.clearcolor = (0, 0.5, 0.5, 1)
        results = False
        previousResults = []

        with self.canvas:
                title = Label(text="Results", font_size = 60)
                notes = Label(text= ("Total Notes Hit: " + str(self.player1.notesHitTotal) + "/" + str(self.gameManager.totalNotes - 1)), font_size=40)
                scoreFInal = Label(text= ("Score: " + str(self.player1.curScore)), font_size=40)
                maxNotes = Label(text= ("Max Streak: " + str(self.player1.maxConcurrentNotes)), font_size=40)
            
                if(self.passedSong):
                    title.text = "Result: Pass"
                else:
                    title.text = "Result: Failed"
            
                title.center_x = Window.width / 2
                title.center_y = Window.height / 2 + 60
            
                notes.center_x = Window.width / 2
                notes.center_y = Window.height / 2 - 40
                
                scoreFInal.center_x = Window.width / 2
                scoreFInal.center_y = Window.height / 2

                maxNotes.center_x = Window.width / 2
                maxNotes.center_y = Window.height / 2 - 80

                #Read in and display results
                file = open("Timings.txt", "r")
                if file.mode == 'r':
                    contents = file.read().splitlines()
                    for i in contents:
                        if(results == True):
                            try:
                                previousResults.append(int(i))
                            except:
                                print("not int")

                        if(i == "Results"):
                            results = True

                    file.close()

                previousResults.sort()
                previousResults.reverse()

                numOfPreviousResults = len(previousResults)
                
                #Print previous results
                if(numOfPreviousResults >= 3):
                    for i in range(0,3):
                        note = Label(text= ("Leaderboard: " + str(i+1) + " " + str(previousResults[i])), font_size=20)
                        note.center_x = Window.width / 2
                        note.center_y = Window.height / 2 - 140 - (i * 20)
                else:
                    for i in range(numOfPreviousResults):
                        note = Label(text= ("Leaderboard: " + str(i+1) + " " + str(previousResults[i])), font_size=20)
                        note.center_x = Window.width / 2
                        note.center_y = Window.height / 2 - 140 - (i * 20)