Пример #1
0
    def __init__(self, player_file=None, **kwargs):
        Screen.__init__(self, **kwargs)        
        self.purchased = []
        if player_file is None:
            self._purchased_file = os.path.join("player", "backgrounds.txt")
        else: self._purchased_file = player_file
        self._read_purchased()
        self.purchased_cat = BackgroundCategory('Purchased')
        
        self.categories = []
        self._available_file = os.path.join("data", "Backgrounds.txt")
        self._read_available()

        layout = BoxLayout(orientation="vertical")
        layout.add_widget(ActionBar(size_hint=(1, .125)))
        scroller = ScrollView(do_scroll_x=False)
        self.grid = GridLayout(cols=1, size_hint_y=None)
        self.grid.add_widget(CategoryIcon(screen=self,
                                          category=self.purchased_cat))
        self.bind(size=self._resize_grid)
        for cat in self.categories:
            self.grid.add_widget(CategoryIcon(screen=self,
                                              category=cat))
        scroller.add_widget(self.grid)
        layout.add_widget(scroller)
        self.add_widget(layout)
Пример #2
0
    def __init__(self, parent, titleheader="Title", message="Message", options={"OK": ""}, size=(400, 400)):

        def popup_callback(instance):
            "callback for button press"
            self.retvalue = instance.text
            self.popup.dismiss()

        self.parent = parent
        self.retvalue = None
        self.titleheader = titleheader
        self.message = message
        self.options = options
        self.size = size
        box = GridLayout(orientation='vertical', cols=1)
        box.add_widget(Label(text=self.message, font_size=16))
        b_list = []
        buttonbox = BoxLayout(orientation='horizontal')
        for b in self.options:
            b_list.append(Button(text=b, size_hint=(1,.35), font_size=20))
            b_list[-1].bind(on_press=popup_callback)
            buttonbox.add_widget(b_list[-1])
        box.add_widget(buttonbox)
        self.popup = Popup(title=titleheader, content=box, size_hint=(None, None), size=self.size)
        self.popup.open()
        self.popup.bind(on_dismiss=self.OnClose)
Пример #3
0
 def popup(self, title, message, lambdaYes, lambdaNo):
   if self.bPopup:
     return
   self.bPopup = True
   content = BoxLayout(orientation="vertical", size_hint=(1,1))
   self.popupLayout = Popup(title = title, content=content, auto_dismiss=False, size_hint = (0.9, 0.3))
   content.add_widget(Label(text=message))
   btnLayout = BoxLayout(orientation="horizontal", size_hint=(1,1), spacing=kivy.metrics.dp(20))
   btn_Yes = Button(text='Yes')
   btn_No = Button(text='No')
   btnLayout.add_widget(btn_No)
   btnLayout.add_widget(btn_Yes)
   
   content.add_widget(btnLayout)
   bResult = True
   def closePopup(instance, bYes):
     if bYes and lambdaYes:
       lambdaYes()
     elif lambdaNo:
       lambdaNo()
     self.popupLayout.dismiss()
     self.bPopup=False
   btn_Yes.bind(on_press=lambda inst:closePopup(inst, True))
   btn_No.bind(on_press=lambda inst:closePopup(inst, False))
   self.popupLayout.open()
   return
Пример #4
0
    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)
Пример #5
0
 def add_column(self, widget, lista):
     bl = BoxLayout(orientation="vertical")
     for element in lista[0]:
         lab = ListaNumeros(text=str(element))
         lista[1].append(lab)
         bl.add_widget(lab)
     widget.add_widget(bl)
Пример #6
0
	def __init__(self,**kwargs):
		super(DragTab,self).__init__(**kwargs)
		#Base Layer
		self.base=BoxLayout()
		#right-hand column is X, lefthand is a vertical box layout
		self.Scrollhome=StackLayout(orientation='tb-lr', size_hint=(.3,1))
		self.Scrollhome.add_widget(Button(text='hi'))
		self.lefthand=BoxLayout(orientation='vertical', size_hint=(.7,1))
		#within lefthand, stats and a series of semesters
		self.Planner=GridLayout(size_hint=(1,.9),rows=2, cols=4)

		self.Planner.add_widget(Semester(size_hint=(1,1)))

		self.Planner.add_widget(Button(text='A Semester'))
		self.Planner.add_widget(Button(text='A Semester'))
		self.Planner.add_widget(Button(text='A Semester'))
		self.Planner.add_widget(Button(text='A Semester'))

		self.lefthand.add_widget(self.Planner)
		self.lefthand.add_widget(Button(size_hint=(1,.1),text= 'We can display statistics here'))
		

		self.base.add_widget(self.lefthand)
		self.base.add_widget(self.Scrollhome)
		


		self.add_widget(self.base)
Пример #7
0
    def do_email(self, popup, address, filename, widget):
        thread = SenderThread(address, filename)
        thread.daemon = True
        thread.start()
        popup.dismiss()

        layout = BoxLayout(orientation='vertical')
        label = Label(
            text='Just sent this image to:\n\n{}'.format(address),
            font_size=30)
        button = Button(
            text='Awesome!',
            font_size=30,
            background_color=(0, 1, 0, 1))
        layout.add_widget(label)
        layout.add_widget(button)

        popup = Popup(
            title='Just thought you should know...',
            content=layout,
            size_hint=(.5, .5))

        button.bind(on_release=popup.dismiss)
        from kivy.core.window import Window

        Window.release_all_keyboards()
        self.reset_email_textinput()
        popup.open()
Пример #8
0
    def show_view_list_path(self, *args, **kwargs):
        
        self.clear_widgets()
        color = ColorLayout()
        boxl = BoxLayout(orientation= 'vertical',anchor_y= "top")
        grid = GridLayout(cols=1, size_hint_y=None)
        grid.bind(minimum_height=grid.setter('height')) 
        scroll = ScrollView(size_hint=(None, None))
        scroll.size = (Window.width, Window.height)
        scroll.center = Window.center
        #2 Space added but button go back ocuppies space and first value hidden.
        l_space = MultiLineLabel(text='',font_size="16dp", background_color=(255,255,255,255), markup=True)
        grid.add_widget(l_space)
        l_space = MultiLineLabel(text='',font_size="16dp", background_color=(255,255,255,255), markup=True)
        grid.add_widget(l_space)
        
        for i in args[0]:
            text = '[color=333333]'+'  '+i['text'] + '[/color]'+'  '
            #~ l = MultiLineLabel(text=text,font_size="16dp",markup=True)
            l = MultiLineLabel(text=text,font_size="16dp", background_color=(255,255,255,255), markup=True)
            i['stations'] and l.bind(on_press = partial(self.show_list_stations, i['stations'],args[0]))
            grid.add_widget(l)
            
        button_back = Button(text="Go Back", auto_dismiss=False, size_hint=(None, None), pos_hint= {'center_x':.5, 'center_y':.7})
        button_back.height="50dp"
        button_back.width="100dp"
        button_back.bind(on_press = lambda widget: self.show_option_view())

        scroll.add_widget(grid)
        boxl.add_widget(scroll)
        boxl.add_widget(button_back)
        color.add_widget(boxl)
        self.add_widget(color)
Пример #9
0
    def show_wifi_scans(self):
        stack = self.ids['scan_layout']
        stack.clear_widgets()
        wifi_scans = wifi.names.keys()
        for name in wifi_scans:
            content = ""
            items = wifi._get_network_info(name)
            for key, value in items.iteritems():
                content += "{}:    {} \n".format(key, value)

            popup = self._create_popup(name, content)
            boxl = BoxLayout(orientation='horizontal')
            button = Button(
                text=name,
                size_hint=(1, 1),
                height='40dp',
                on_release=popup.open,
            )
            button_connect = Button(
                text="Connect",
                size_hint_x=.2,
                on_release=partial(self.connect, name))

            boxl.add_widget(button)
            boxl.add_widget(button_connect)
            stack.add_widget(boxl)
Пример #10
0
	def build(self): # 1
		root = BoxLayout(orientation='horizontal') # 1
		verticalBtns = BoxLayout(orientation='vertical', size_hint_x = 0.25) # 1
		PID = PIDcontroller()	# 12
		plotter = PlotterWidget()	# 7
		Clock.schedule_interval(plotter.update, SAMPLE_RATE)	# 8
		
		# 1 adding our buttons to the interface
		coffeeButton = Button(text='coffee') 	# 2
		steamButton = Button(text='steam') 		# Not defined in tut
		waterButton = Button(text='water') 		# Not defined in tut
				
		# 3
		coffeeButton.bind(on_press=self.coffeePress_callback)		# 3
		coffeeButton.bind(on_release=self.coffeeRelease_callback)	# 3
		steamButton.bind(on_press=self.steamPress_callback)			# Not defined in tut
		steamButton.bind(on_release=self.steamRelease_callback)		# Not defined in tut
		waterButton.bind(on_press=self.waterPress_callback)			# Not defined in tut
		waterButton.bind(on_release=self.waterRelease_callback)		# Not defined in tut
		
		# 9; Link up SP from steam button to the currentSignal on plotter object.
		self.bind(SP=plotter.setter('currentSignal'))
		# 12; Link up the temperature read the PID thread and set currentTemp from this.
		# Uncomment to activate Controller. 
		# Will need daemon thread to stop lag once activated. Won't cover this, in this tut.
		#Clock.schedule_interval(PID.updatePID, SAMPLE_RATE)
		#PID.bind(PV = plotter.setter('currentTemp'))
		
		# 1 Add to the RootWidget child widgets:
		root.add_widget(plotter)				# 7
		verticalBtns.add_widget(coffeeButton) 	# 2
		verticalBtns.add_widget(steamButton) 	# Not defined in tut
		verticalBtns.add_widget(waterButton) 	# Not defined in tut
		root.add_widget(verticalBtns)			# 2
		return root # 1
Пример #11
0
  def show_install_form(self):
    self.orientation = 'vertical'
    self.spacing='10sp'

    headerLayout = BoxLayout(orientation='horizontal')
    headerLabelsLayout = BoxLayout(orientation='vertical')

    headerLabelsLayout.add_widget(Label(text='Proyecto TiX', font_size=24))

    headerLabelsLayout.add_widget(Label(text='Iniciar sesion', font_size=18))

    headerLayout.add_widget(headerLabelsLayout)
    headerLayout.add_widget(Image(source='./images/LogoTiX.png'))
    self.add_widget(headerLayout)

    form = GridLayout(cols=2)
    form.add_widget(Label(text='Usuario'))
    self.username = TabTextInput(multiline=False)
    form.add_widget(self.username) #Username field
    form.add_widget(Label(text='Password'))
    self.password = TabTextInput(password=True, multiline=False) #Password field
    self.username.set_next(self.password)
    form.add_widget(self.password)
    self.add_widget(form)
    loginButton = Button(text="Conectar", size_hint_y=None, height='50sp',font_size=20)
    self.password.set_next(loginButton)
    self.add_widget(loginButton)
    loginButton.bind(on_press=partial(loginButtonOnClick,self.username,self.password)) #Accion que realizara el loginButton
Пример #12
0
    def build(self):
        self.title = "MOONBOARD"
        parent = BoxLayout(size=(Window.width, Window.height))
        self.gridsDisplay = MoonboardAppLayout()
        parent.add_widget(self.gridsDisplay)

        return parent
Пример #13
0
class TwistedClientApp(App):
    connection = None

    def build(self):
        root = self.setup_gui()
        self.connect_to_server()
        return root

    def setup_gui(self):
        self.textbox = TextInput(size_hint_y=.1, multiline=False)
        self.textbox.bind(on_text_validate=self.send_message)
        self.label = Label(text='connecting...\n')
        self.layout = BoxLayout(orientation='vertical')
        self.layout.add_widget(self.label)
        self.layout.add_widget(self.textbox)
        return self.layout

    def connect_to_server(self):
        reactor.connectTCP('localhost', 8000, EchoFactory(self))

    def on_connection(self, connection):
        self.print_message("connected succesfully!")
        self.connection = connection

    def send_message(self, *args):
        msg = self.textbox.text
        if msg and self.connection:
            self.connection.write(str(self.textbox.text))
            self.textbox.text = ""

    def print_message(self, msg):
        self.label.text += msg + "\n"
Пример #14
0
        def build(self):
            root = FloatLayout()
            bx = BoxLayout()
            bx.add_widget(Button())
            bx.add_widget(Button())
            bx2 = BoxLayout()
            bx2.add_widget(Button())
            bx2.add_widget(Button())
            bx2.add_widget(Button())
            spl = Splitter(
                size_hint=(1, .25),
                pos_hint = {'top': 1},
                sizable_from = 'bottom')
            spl1 = Splitter(
                sizable_from='left',
                size_hint=(None, 1), width=90)
            spl1.add_widget(Button())
            bx.add_widget(spl1)
            spl.add_widget(bx)

            spl2 = Splitter(size_hint=(.25, 1))
            spl2.add_widget(bx2)
            spl2.sizable_from = 'right'
            root.add_widget(spl)
            root.add_widget(spl2)
            return root
Пример #15
0
    def _create_popup(self, instance):
        ''' create popup layout '''
        content = BoxLayout(orientation='vertical', spacing=5)
        self.popup = popup = Popup(title=self.title, content=content, size_hint=(0.95, 0.95))

        # create the filechooser
        uRoot, uName = split(self.value)  # pylint: disable=unused-variable
        uRoot = ReplaceVars( uRoot)
        self.textinput = textinput = FileBrowser( select_string     = ReplaceVars('$lvar(563)'),\
                                                  cancel_string     = ReplaceVars('$lvar(5009)'),\
                                                  libraries_string  = ReplaceVars('$lvar(5018)'),\
                                                  favorites_string  = ReplaceVars('$lvar(5019)'),\
                                                  computer_string   = ReplaceVars('$lvar(5020)'),\
                                                  location_string   = ReplaceVars('$lvar(5021)'),\
                                                  listview_string   = ReplaceVars('$lvar(5022)'),\
                                                  iconview_string   = ReplaceVars('$lvar(5023)'),\
                                                  path              = uRoot,dirselect=False,\
                                                  transition        = FadeTransition(),\
                                                  size_hint         = (1, 1),\
                                                  favorites         = [(oORCA.uAppPath, 'ORCA')],\
                                                  show_fileinput    = False,\
                                                  show_filterinput  = False\
                                                  )

        # construct the content
        content.add_widget(textinput)
        textinput.bind(on_success=self._validate,on_canceled=self._dismiss)

        # all done, open the popup !
        popup.open()
Пример #16
0
    def __init__(self,**kwargs):
        super(Catalog, self).__init__(**kwargs)       

        #self.orientation = 'vertical'

        self.search_bar = BoxLayout(size_hint=(1.0,0.05))        
        self.search_bar.add_widget(Label(text='Search',size_hint=(0.25,1.0)))
        self.search_text = (TextInput(multiline=False))
        self.search_bar.add_widget(self.search_text)

        self.filter_bar = BoxLayout(size_hint=(1.0,0.05))        
        self.AHSE = ToggleButton(text='AHSE',size_hint=(0.25,1.0))
        self.ENGR = ToggleButton(text='ENGR',size_hint=(0.25,1.0))
        self.MTH = ToggleButton(text='MTH',size_hint=(0.25,1.0))
        self.SCI = ToggleButton(text='SCI',size_hint=(0.25,1.0))        
        self.filter_bar.add_widget(self.AHSE)
        self.filter_bar.add_widget(self.ENGR)
        self.filter_bar.add_widget(self.MTH)
        self.filter_bar.add_widget(self.SCI)

        self.scrollview = ScrollView(size_hint=(1.0,0.9),size=(400,400))
        self.courses = StackLayout(spacing=5,size_hint_y=None)
        self.courses.bind(minimum_height=self.courses.setter('height'))
        for course_object in catalog:
            course_item = Course_Item(course=course_object,size_hint=(0.245,None),height=200)                             
            self.courses.add_widget(course_item)
        self.scrollview.add_widget(self.courses)
                        
        self.add_widget(self.search_bar)
        self.add_widget(self.filter_bar)
        self.add_widget(self.scrollview)

        Clock.schedule_interval(self.update_favorites,0.1)
        Clock.schedule_interval(self.search_function,0.1)
Пример #17
0
    def __init__(self, **kwargs):
        super(GameRecorder, self).__init__(**kwargs)
        self.orientation = 'vertical' if self.height > self.width else 'horizontal'
        self.bind(size=self.on_size, orientation=self.on_orientation)

        self.game = Game()
        side_box = BoxLayout(orientation='vertical')
        b = BoxLayout(size_hint_y=None, height=dp(50))
        back_button = CustomButton(text='<< Games')
        undo_button = CustomButton(text='Reset')
        undo_button.bind(on_release=self.reset)
        back_button.bind(on_release=self.go_back)
        b.add_widget(back_button)
        b.add_widget(undo_button)

        save_button = CustomButton(text='Save game', size_hint_y=None, height=dp(50))
        save_button.bind(on_release=self.save_popup)
        side_box.add_widget(b)
        side_box.add_widget(save_button)


        moves_scroll = ScrollView()
        self.moves_table=MovesGrid(padding=dp(10), spacing=dp(10))
        for move in self.game.move_history:
            self.moves_table.add_widget(MoveButton(text=move))

        side = self.height if self.orientation == 'horizontal' else self.width
        self.board = ChessboardUI(game=self.game, size_hint=(None,None), height=side, width=side)
        self.board.bind(move_made=self.change_moves)

        self.add_widget(self.board)
        moves_scroll.add_widget(self.moves_table)
        side_box.add_widget(moves_scroll)
        self.add_widget(side_box)
Пример #18
0
    def build(self):
        # create root widget
        root_widget = FloatLayout()
        box = BoxLayout(orientation='vertical',
                        size_hint=(None, None),
                        size=(400, 200),
                        spacing=dp(20),
                        padding=dp(20),
                        pos_hint={'center_x': .5, 'center_y':.5})

        # create the labels and the textinputs
        lbl_user =  Label(text='User Name:')
        lbl_password = Label(text='Password')
        ti_user = TextInput()
        ti_password = TextInput(password=True)
        
        # create the containers for the labels and textinputs
        grid_user_pass = GridLayout(rows=2, cols=2, spacing=dp(20))
        # create the ok button
        my_but_is_ok = Button(text='OK')
        my_but_is_ok.bind(on_release=lambda *args: self.check_user(ti_user.text, ti_password.text))

        # add the labels and input fields to the container 
        grid_user_pass.add_widget(lbl_user)
        grid_user_pass.add_widget(ti_user)
        grid_user_pass.add_widget(lbl_password)
        grid_user_pass.add_widget(ti_password)

        # add the grid_container into it's container
        box.add_widget(grid_user_pass)
        root_widget.add_widget(box)
        # add the ok button at the bottom of the grid
        box.add_widget(my_but_is_ok)

        return root_widget
Пример #19
0
class MyApp(App):
    def build(self):
        self.modes = (
            '%I:%m:%S',
            '%H:%m:%S %P',
            '%S:',
        )
        self.mode = 0
        self.main_box = BoxLayout(orientation='vertical')

        self.button = Button(text='label', font_size=100)
        self.main_box.add_widget(self.button)

        self.button.bind(on_press=self.tap)
        Clock.schedule_interval(self.timer, 0.01)

        return self.main_box

    def tap(self, button):
        if self.mode +1 == len(self.modes):
            self.mode = 0
        else:
            self.mode +=1

    def timer(self, dt):
        now = datetime.datetime.now()
        self.button.text = now.strftime(self.modes[self.mode])
        if self.mode == 2:
            self.button.text += str(now.microsecond)[:3]
Пример #20
0
	def throw_button(self, in_message):
		self.ids.result_grid.clear_widgets()
		
		native_lang  = 'en'
		to_lang = 'en'
		from_lang = 'en'
		translation = in_message
		out_message = ''

		self.ids.steps_progbar.value = 0

		for index in range(20):
			self.ids.steps_progbar.value += 1 

			rand_int = r.randint(0,len(self.lang_array)-1)
			to_lang = self.lang_array[rand_int][1]
			translation = self.translate(translation, to_lang, from_lang)[0]
			from_lang = to_lang

			line_box = BoxLayout()
			line_box.add_widget(Image(source = 'Art/Flags/' + self.lang_array[rand_int][1] + '.png', size_hint_x = 0.1))
			step_text = TextInput(text = translation, readonly = True)
			line_box.add_widget(step_text)
			self.ids.result_grid.add_widget(line_box)
		out_message = self.translate(translation, native_lang, from_lang)[0]
		self.ids.popup.dismiss()
		self.ids.out_message.text = out_message
Пример #21
0
 def selection_buttons(self, d_btn_state, r_btn_state):
     direct_btn = MyButton(text="Dus", on_press=self.direct_selected, state=d_btn_state)
     reverse_btn = MyButton(text="Intors", on_press=self.reverse_selected, state=r_btn_state)
     selection_btns = BoxLayout(size_hint_y=None, height="50dp")
     selection_btns.add_widget(direct_btn)
     selection_btns.add_widget(reverse_btn)
     return selection_btns
Пример #22
0
	def timesheet_pop(self):
		"""Popup to display the Timesheet"""

		popup = Popup(title='Timesheet')
		b=BoxLayout(orientation='vertical')
		s = ScrollView()
		global tslabel
		tslabel=Label(size_hint_y=None,line_height=1.5,valign="top",
					  text="|_ID_|______DATE______|___TIME_SPENT____|_____TASK_________|")
		tslabel.bind(texture_size=tslabel.setter('size'))
		btn1=Button(text='CLOSE',size_hint=(1,.06))
		s.add_widget(tslabel)
		b.add_widget(s)
		b.add_widget(btn1)
		popup.content=b
		popup.open()
		btn1.bind(on_press=popup.dismiss)

		con=lite.connect('TimeTracker.db')
		with con:
				cur=con.cursor()
				cur.execute("SELECT ID, TASK_DATE, TIME, TASK FROM Timesheet")
				rows = cur.fetchall()
				for row in rows:
				  tslabel.text=tslabel.text+"\n   "
				  tslabel.text+=str(row[0]).center(4)+"      "+str(row[1])
				  tslabel.text+="  "+str(row[2]).center(34)+"  "+str(row[3])
		if con:
				con.close()
Пример #23
0
def PopupAudit(audit_obj, key):
    def on_close(*args):
        def _on_close(*args):
            Window.rotation = 0
        Clock.schedule_once(_on_close, .25)

    assert isinstance(audit_obj, AuditResult) or audit_obj is None
    if audit_obj is None:
        text = "No audit attribute found for %s" % key
    else:
        text = str(audit_obj)
    btnclose = Button(text='Continue', size_hint_y=None, height='50sp')
    content = BoxLayout(orientation='vertical')
##    lbl = TextInput(text=text, font_size='12sp', auto_indent=True,
##            readonly=True, disabled=True,
##            font_name='fonts'+os.sep+'DroidSansMono.ttf')
    lbl = ScrollableText(text=text)
    content.add_widget(lbl)
    content.add_widget(btnclose)
    p = Popup(title='Audit of "%s"' % key, content=content,
                #size=('300dp', '300dp'),
                size_hint=(.95, .75))
    btnclose.bind(on_release=p.dismiss)
    p.bind(on_open=lbl.go_top)
    # See if this is a pretty long audit, so we will display long ways
    if max([len(a) for a in text.split('\n')]) > 30:
        p.bind(on_dismiss=on_close) and None
        p.size_hint = (.95, .95)
        Window.rotation = 90
    p.open()
Пример #24
0
class GUI:
    root = None
    _properties = None
    _window = None
    
    def __init__(self, kvFile):
        self.root = BoxLayout()
        Builder.load_file(kvFile)
        self._properties = {}
        
    def setWindow(self, window):
        self.root.clear_widgets()
        self._window = window()
        self._window.setProperty(self._properties)
        self.root.add_widget(self._window)
    
    def getWindow(self):
        return self._window.__class__
    
    def setProperty(self, key, value):
        self._properties[key] = value
        if self._window <> None: self._window.setProperty({key:value})
    
    def getProperty(self, key):
        return self._properties[key]
Пример #25
0
 def __init__(self, **kwargs):
     Screen.__init__(self, **kwargs)
     main = BoxLayout(orientation="vertical")
     main.add_widget(ActionBar(size_hint=(1, .125)))
     carousel = Carousel(direction='right')
     layout = GridLayout(rows=2)
     i, c = 0, 0
     for card in self.definition.cards(App.get_running_app().achievements,
                                       use_blocks=False):
         color = (1, 1, 1, 1)
         if str(card) in self.definition.blocked_cards:
             color = (.5, 0, 0, 1)
         layout.add_widget(CardSelect(card=card,
                                      color=color,
                                      callback=self._card_detail,
                                      args=(card,)))
         i += 1
         c += 1
         if i == 10:
             carousel.add_widget(layout)
             layout = GridLayout(rows=2)
             i = 0
     if c < 50 + len(self.definition.specials):
         layout.add_widget(CardSelect(card=self.LOCKED_CARD))
     carousel.add_widget(layout)
     main.add_widget(carousel)
     self.add_widget(main)
Пример #26
0
 def input_menu(self):
     ''' create containers for menu gui '''
     main_layout = BoxLayout(orientation='vertical', size_hint=(None, None), size=(400,200))     
     button_layout = BoxLayout(orientation='horizontal')
     
     # add transparent background
     with main_layout.canvas.before:
         Color(.5, .5, .5, .2) 
         self.rect = Rectangle(size=main_layout.size, pos=main_layout.pos)
         
     # create components
     label = Label(font_size=25, text='Enter Username')
     done_button = Button(font_size=25, text='Done')
     exit_button = Button(font_size=25, text='Exit')
     
     # button events
     done_button.bind(on_release=self.get_flickr_images)
     exit_button.bind(on_release=self.exit_application)
     
     # add components to containers
     main_layout.add_widget(label)
     main_layout.add_widget(textbox)
     button_layout.add_widget(done_button)
     button_layout.add_widget(exit_button)
     main_layout.add_widget(button_layout)
     
     s = Scatter(size_hint=(None, None), size=(450,250), pos=(300, 300), do_rotation=False, do_scale=False)
     s.add_widget(main_layout)
     self.root.add_widget(s)
Пример #27
0
    def build(self):
        root = BoxLayout(orientation='horizontal', padding=20, spacing=20)
        tree = TreeView(
            size_hint=(None, 1), width=200, hide_root=True, indent_level=0)

        def create_tree(text):
            return tree.add_node(TreeViewLabel(
                text=text, is_open=True, no_selection=True))

        def attach_node(text, n):
            tree.add_node(TreeViewLabel(text=text), n)

        tree.bind(selected_node=self.on_select_node)
        n = create_tree('Widgets')
        attach_node('Standard widgets', n)
        attach_node('Complex widgets', n)
        attach_node('Scatters', n)
        attach_node('Treeviews', n)
        attach_node('Popup', n)
        n = create_tree('Layouts')
        attach_node('Anchor Layout', n)
        attach_node('Box Layout', n)
        attach_node('Float Layout', n)
        attach_node('Grid Layout', n)
        attach_node('Stack Layout', n)
        root.add_widget(tree)
        self.content = content = BoxLayout()
        root.add_widget(content)
        sc = Showcase()
        sc.content.add_widget(root)
        self.content.add_widget(StandardWidgets())
        return sc
Пример #28
0
    def __init__(self, text_):
        super(RoachWarningBox, self).__init__(orientation='vertical', size_hint=(1,1))

        top_padding = BoxLayout(size_hint=(1,1))
        self.square_label = Label(text = text_)
        bottom_padding = BoxLayout(size_hint=(1,1))
        buttons = BoxLayout(orientation='horizontal', size_hint=(1, 1))

        ok_button = Button(text='Yes',  size_hint=(1,0.2))
        ok_button.bind(on_press=self.selection_yes)
        cancel_button = Button(text='No', size_hint=(1, 0.2))
        cancel_button.bind(on_press=self.selection_no)

        buttons.add_widget(ok_button)
        buttons.add_widget(cancel_button)

        self.add_widget(top_padding)
        self.add_widget(self.square_label)
        self.add_widget(bottom_padding)
        self.add_widget(buttons)

        self.choosen_name = ''
        self.popup = None

        self.continues = True
        self.choise = True
Пример #29
0
    def Load(self):
        """
        Load from the Disk
        Button > Load()
        """
        from functools import partial
        from kivy.uix import filechooser
        from kivy.uix.filechooser import FileChooserListView, FileChooserIconView
        main = ModalView(size_hint=(.8,.8)) # everything on this Modal is 80%
        BL = BoxLayout(portrait="vertical")
        
        FLV = FileChooserListView(path="coreEngine/Saved",)
        
        

        def cTexloader(instance):
            Selected = FLV.selection
            Selected_Attr = Selected
            LStoString = str(Selected_Attr[0])
            self.Loader_NoErr(ctexSaved=LStoString,fixedPath=LStoString)
            
            
            


        

        Load_Btn = Button(text="Load this File")
        Load_Btn.bind(on_press=cTexloader)
        main.add_widget(BL)
        BL.add_widget(FLV) 
        BL.add_widget(Load_Btn)       

        main.open()
Пример #30
0
	def readme_pop(self):
		""" Readme """

		popup = Popup(title='README')
		b=BoxLayout(orientation='vertical')
		s = ScrollView()
		global tslabel
		tslabel=Label(size_hint_y=None,line_height=1.5,valign="top",
					  text= "Copyright (C) 2015 Revathy Narayanan\n" +
					  "The TimeTracker is a Python application \n that will keep"+
					  " track of time spent\n in day-to-day activities.\n\n"+
"The Application will have features \n"+
"* Start/Stop watch \n * Log Task\n * Add Comments\n"+
"* Generate & View Timesheet\n * Mail Timesheet\n\n "+
"The code is licensed under MIT License(MIT).\n "+
"Please see the file license in this distribution\n for license terms in the link below :\n"+
"https://github.com/rev20/Time-Tracker/blob/master/LICENSE \n\n"+
"Following is the link for the repository: \n"+
"https://github.com/rev20/Time-Tracker/")

		tslabel.bind(texture_size=tslabel.setter('size'))
		btn1=Button(text='CLOSE',size_hint=(1,.06))
		s.add_widget(tslabel)
		b.add_widget(s)
		b.add_widget(btn1)
		popup.content=b
		popup.open()
		btn1.bind(on_press=popup.dismiss)
Пример #31
0
 def __init__(self, **kwargs):
     super(Result, self).__init__(**kwargs)
     self.settings = kwargs['settings']
     self.listOfWitgetsOnRightCol = []
     fonLayout = FloatLayout()
     fonResult = Image(source='fonResult.png', allow_stretch=True)
     resultLayout = BoxLayout(orientation='horizontal')
     colsOneLayout = BoxLayout(orientation='vertical', size_hint=(.69, 1))
     rowsOneInColsOneLayout = BoxLayout(orientation='horizontal',
                                        size_hint=(1, .5))
     self.blazonImg = Image(source='riba_kit.png',
                            allow_stretch=True,
                            size_hint=(.4, 1))
     self.questionLbl = Label(text='ВОПРОС',
                              size_hint=(.6, 1),
                              markup=True,
                              font_size=28,
                              halign='left',
                              valign='center')
     self.questionLbl.bind(size=self.questionLbl.setter('text_size'))
     rowsOneInColsOneLayout.add_widget(Widget(size_hint=(0.05, 1)))
     rowsOneInColsOneLayout.add_widget(self.blazonImg)
     rowsOneInColsOneLayout.add_widget(Widget(size_hint=(0.05, 1)))
     rowsOneInColsOneLayout.add_widget(self.questionLbl)
     colsOneLayout.add_widget(rowsOneInColsOneLayout)
     rowsTwoInColsOneLayout = BoxLayout(orientation='horizontal',
                                        size_hint=(1, .3))
     self.ansYes = Label(text='[color=01CC8B][b]ЗА[/b][/color]',
                         markup=True,
                         font_size=24,
                         size_hint=(.7, .5))
     self.ansNo = Label(text='[color=FD0302][b]ПРОТИВ[/b][/color]',
                        markup=True,
                        font_size=24,
                        size_hint=(.7, .5))
     rowsTwoInColsOneLayout.add_widget(Widget(size_hint=(.2, 1)))
     rowsTwoInColsOneLayout.add_widget(self.ansYes)
     rowsTwoInColsOneLayout.add_widget(Widget(size_hint=(.1, 1)))
     rowsTwoInColsOneLayout.add_widget(self.ansNo)
     rowsTwoInColsOneLayout.add_widget(Widget(size_hint=(.2, 1)))
     colsOneLayout.add_widget(rowsTwoInColsOneLayout)
     colsOneLayout.add_widget(Widget(size_hint=(1, .2)))
     resultLayout.add_widget(colsOneLayout)
     resultLayout.add_widget(Widget(size_hint=(.05, 1)))
     self.colsTwoLayout = GridLayout(rows=7,
                                     size_hint=(.31, 1),
                                     row_force_default=True,
                                     row_default_height=150)
     resultLayout.add_widget(self.colsTwoLayout)
     fonLayout.add_widget(fonResult)
     fonLayout.add_widget(resultLayout)
     self.bind(on_pre_enter=self.updateBlazonImg)
     self.bind(on_pre_enter=self.updateQuestionLbl)
     self.bind(on_pre_enter=self.updateColsTwo)
     self.add_widget(fonLayout)
Пример #32
0
class Viewer(Widget):
    '''A button that results in a popup window when pressed. Changing the test within
    the popup menu changes the text on the button'''
    def __init__(self, title, but, Set_Label):

        super(Viewer, self).__init__()

        self.Set_Label = Set_Label
        self.but = but
        self.title = title
        self.Pops = Popup(title=self.title,
                          size_hint=(None, None),
                          size=(300, 150),
                          auto_dismiss=False,
                          pos_hint={
                              'x': .425,
                              'y': .6
                          },
                          separator_color=[0.3, 0.2, 0, 1],
                          title_color=[0.3, 0.2, 0, 1],
                          title_size='20sp')
        #self.Pops.background = 'images/Pop_Background.png'

        self.Pops.bind(on_open=lambda widget: self.FocTxt())
        self.Tex = TextInput(font_size=35, multiline=False)

        self.B = Button(text='Press To Confirm')
        self.B.bind(on_press=lambda widget: self.SubChangeDismiss(
            self.Tex, self.Set_Label, self.Pops))
        self.FL = BoxLayout(orientation='vertical',
                            size_hint_x=1,
                            size_hint_y=1,
                            rows=1)
        self.box1 = BoxLayout(orientation='vertical',
                              size_hint_x=1,
                              size_hint_y=.6,
                              rows=1)
        self.box2 = BoxLayout(orientation='vertical',
                              size_hint_x=1,
                              size_hint_y=.4,
                              rows=1)

        self.Pops.add_widget(self.FL)
        self.FL.add_widget(self.box1)
        self.FL.add_widget(self.box2)
        self.box1.add_widget(self.Tex)
        self.box2.add_widget(self.B)

        self.add_widget(self.Pops)

        self.wasUpdated = 'Hello Peter'

    def SubChangeDismiss(self, Tx, Bt, PP):
        '''When activated, this function changes the text
        of a button to the text of the text input, defocuses
        on the text input box and closes the popup'''
        if Tx.text.strip() == '':
            Bt.text = '0'
        else:
            Bt.text = Tx.text
        Tx.focus = False
        self.wasUpdated = 'hello Chad'
        PP.dismiss()

    def FocTxt(self):
        '''When the popup is opened up, it immediately focuses on the text box.
        This will automatically call keyboards in apple/android devices, plus is
        just convienient'''
        self.Tex.focus = True
        return self.Pops

    '''def build(self):
Пример #33
0
    def build(self):
        box = BoxLayout(orientation="vertical")
        box.add_widget(
            Label(text_size=(width, None),
                  text="Enter IP Address and Select Display Type"))

        spaceBox = BoxLayout(orientation="horizontal")
        spaceBox.add_widget(Widget(size_hint=(None, None), size=(5, 5)))
        self.text = TextInput(multiline=False,
                              font_size="20sp",
                              size_hint_y=None,
                              size=(10, 40))
        spaceBox.add_widget(self.text)
        spaceBox.add_widget(Widget(size_hint=(None, None), size=(5, 5)))
        box.add_widget(spaceBox)

        box.add_widget(Widget(size_hint=(None, None), size=(10, 10)))
        buttonBox = BoxLayout(orientation="horizontal", spacing=5)

        btn1 = Button(text="Vertical", on_press=self.btn1)
        btn2 = Button(text="Horizontal", on_press=self.btn2)
        buttonBox.add_widget(btn1)
        buttonBox.add_widget(btn2)
        box.add_widget(buttonBox)

        return box
Пример #34
0
class The_Clicker_Program_App(App):
    def do_the_update(
        self, args
    ):  # Активує виконання функції self.to_add_every_second раз в одну секундку
        Clock.schedule_interval(self.to_add_every_second, 1)

    def to_add_every_second(self,
                            args):  # Активує додавання очок кожної секунди
        self.button1.text = str(
            "%.2f" %
            (float(self.button1.text) + float(self.every_second_income)))

    def to_click(
        self, args
    ):  # Добавляє очки до головного показника при кліку на першу кнопку
        self.x = str(float(self.button1.text) + self.adder)
        self.button1.text = str("%.2f" % float(self.x))
        self.button1.background_color = [random(), random(), random(), 1]

    def upgrade_second(
            self, args):  # Збільшує прирість очок на 0.05 за кожну секунду.
        if float(self.button1.text) >= self.every_second_income * 100:
            self.button1.text = str("%.2f" %
                                    (float(self.button1.text) -
                                     float(self.every_second_income) * 100))
            self.button3.text = "add every second:\n" + str(
                "%.2f" % self.every_second_income)
            self.every_second_income += 0.05

    def to_upgrade(self, args):  # Збільшую кількість очок за один клік на 10%
        if float(self.button1.text) >= self.adder * 10:
            self.button1.text = str(
                "%.2f" % (float(self.button1.text) - self.adder * 10))
            self.adder *= 1.1
            self.button2.text = "Upgrade to 10%\nYour adder is:\n" + str(
                "%.2f" % self.adder)

    def build(
        self
    ):  # Задаємо всі параметри і змінні, а також структуру і розміщення елементів
        self.title = "Clicker by W.R."
        self.x = 0
        self.adder = 1
        self.upgrade_result = "<--Click here*\n\n\nUpgrade to 10%!\nYour adder is:\n" + str(
            self.adder)
        self.every_second_income = 0.05
        self.button3_text = "add every second:\n" + str(
            self.every_second_income)
        self.gl = GridLayout(cols=2, padding=8)
        self.button1 = Button(  # Чотири основні кнопки для взаємодії
            text="0",
            font_size=30,
            on_press=self.to_click,
            background_color=[1, 1, 1, 1])

        self.button2 = Button(text=self.upgrade_result,
                              font_size=20,
                              on_press=self.to_upgrade,
                              background_color=[.88, .19, .77, 1])
        self.button3 = Button(text=self.button3_text,
                              font_size=20,
                              on_press=self.do_the_update,
                              background_color=[.15, .88, .7, 1])
        self.button4 = Button(text="upgrade time adder\n + 0.05 every second",
                              font_size=20,
                              on_press=self.upgrade_second,
                              background_color=[.88, .19, .77, 1])
        self.gl.add_widget(self.button1)
        self.gl.add_widget(self.button2)
        self.gl.add_widget(self.button3)
        self.gl.add_widget(self.button4)
        self.bl = BoxLayout(orientation="vertical")
        self.bl.add_widget(self.gl)
        self.bl.add_widget(
            Label(text="Розроблено Владиславом Рудиком",
                  size_hint=[1, .05],
                  font_size=18))
        return self.bl
Пример #35
0
class PathfinderGui(App):
    def send_mv_msg(self, btn):
        self.node.sendMove(float(self.x._get_text()),
                           float(self.y._get_text()))

    def send_rot_msg(self, btn):
        self.node.sendRotate(float(self.speed._get_text()))

    def buildMoveBtn(self):
        self.box = BoxLayout(orientation='horizontal',
                             spacing=20,
                             size_hint_y=None)
        self.x = TextInput(hint_text="x", size_hint=(None, None))
        self.x.width = 100
        self.x.height = 30
        self.y = TextInput(hint_text="y", size_hint=(None, None))
        self.y.width = 100
        self.y.height = 30
        self.y.center = (0.5, 0.5)
        self.btn = Button(text='Move',
                          on_release=self.send_mv_msg,
                          size_hint_y=None)
        self.btn.height = 30

        self.box.add_widget(self.x)
        self.box.add_widget(self.y)
        self.box.add_widget(self.btn)

    def buildRotBtn(self):
        self.box_rot = BoxLayout(orientation='horizontal',
                                 spacing=20,
                                 size_hint_y=None)
        self.speed = TextInput(hint_text="speed", size_hint=(None, None))
        self.speed.width = 100
        self.speed.height = 30
        self.btn_rot = Button(text='Rotate',
                              on_release=self.send_rot_msg,
                              size_hint_y=None)
        self.btn_rot.height = 30

        self.box_rot.add_widget(self.speed)
        self.box_rot.add_widget(self.btn_rot)

    def set_namespace(self, namespace):
        self.node.set_namespace(namespace)
        self.dropdown_label.text = 'Selected robot: ' + namespace
        self.dropdown.dismiss()

    def populate_dropdown(self):
        self.dropdown.clear_widgets()
        topics = self.node.get_topic_names_and_types(no_demangle=True)

        anyRobot = False
        for (topic, _) in topics:
            separated = str.split(topic, "/")
            if separated[-1] == "path":
                namespace = separated[1]
                btn = Button(
                    text=namespace,
                    on_release=lambda btn: self.set_namespace(btn.text),
                    size_hint_y=None)
                self.dropdown.add_widget(btn)
                anyRobot = True

        if not anyRobot:
            btn = Button(text="No available robots",
                         size_hint_y=None,
                         disabled=True)
            self.dropdown.add_widget(btn)

    def buildChooseRobotDropdown(self):
        self.box_dropdown = BoxLayout(orientation='horizontal',
                                      spacing=20,
                                      size_hint_y=None)
        self.dropdown_label = Label(text='No robot selected',
                                    size_hint=(1, .4))
        self.dropdown = DropDown(size_hint_y=None)
        self.populate_dropdown()
        self.dropdown_refresh = Button(
            text='Refresh list',
            on_release=lambda _: self.populate_dropdown(),
            size_hint=(1, .4))
        self.dropdown_refresh.width = 50
        self.dropdown_btn = Button(text='Choose robot', size_hint=(1, .4))
        self.dropdown_btn.width = 100

        self.dropdown_btn.bind(on_release=self.dropdown.open)
        self.box_dropdown.add_widget(self.dropdown_refresh)
        self.box_dropdown.add_widget(self.dropdown_btn)
        self.box_dropdown.add_widget(self.dropdown_label)

    def build(self):
        rclpy.init()
        self.node = PathfinderGuiNode()

        self.buildMoveBtn()
        # self.buildRotBtn()
        self.buildChooseRobotDropdown()

        midBox = BoxLayout(orientation='vertical',
                           spacing=20,
                           size_hint_y=None)
        midBox.add_widget(self.box_dropdown)
        midBox.add_widget(self.box)
        # midBox.add_widget(self.box_rot)

        topBox = AnchorLayout(anchor_x='center', anchor_y='center')
        topBox.add_widget(midBox)

        return topBox
Пример #36
0
    def __init__(self, **kwargs):
        super(Otmg, self).__init__(**kwargs)

        self.progs = os.listdir("../../otmp")
        self.prog = "Roman_Numeral_Square_Root"

        self.otm = Otm(" ")
        self.otm.load(self.prog)
        self.alph = self.otm.findchars()

        self.lastloc = 0
        self.movedloc = False
        self.lastleftknob = 0
        self.lastrightknob = 0
        self.lastinput = [" "]
        self.setlast = False

        self.orientation = 'vertical'
        self.padding = 20

        self.row0 = BoxLayout(size_hint=(1, 0.1))
        self.row0.prev = Button(text="Previous", size_hint=(0.25, 1))
        self.row0.prev.bind(on_press=self.prev)
        self.row0.add_widget(self.row0.prev)
        self.row0.title = LabelB(text=self.prog.replace("_", " "),
                                 size_hint=(0.5, 1),
                                 halign='center',
                                 valign='top',
                                 color=(0, 0, 0, 1),
                                 font_size=25,
                                 bcolor=(1, 1, 1, 1))
        self.row0.add_widget(self.row0.title)
        self.row0.nex = Button(text="Next", size_hint=(0.25, 1))
        self.row0.nex.bind(on_press=self.nex)
        self.row0.add_widget(self.row0.nex)
        self.add_widget(self.row0)

        self.row1 = BoxLayout(size_hint=(1, 0.2))
        self.row1.tape = LabelB(text=self.otm.croptape(25),
                                size_hint=(1, 1),
                                halign='center',
                                valign='top',
                                color=(0, 0, 0, 1),
                                font_size=25,
                                bcolor=(210 / 255.0, 105 / 255.0, 30 / 255.0,
                                        1),
                                font_name='Courier New Bold')
        self.row1.add_widget(self.row1.tape)
        self.add_widget(self.row1)

        self.row15 = BoxLayout(size_hint=(1, 0.01))
        self.row15.pointer = LabelB(text='^',
                                    halign='center',
                                    color=(0, 0, 0, 1),
                                    bcolor=(210 / 255.0, 105 / 255.0,
                                            30 / 255.0, 1),
                                    valign='top')
        self.row15.add_widget(self.row15.pointer)
        self.add_widget(self.row15)

        self.row2 = BoxLayout(orientation='horizontal')
        self.row2.it1 = BoxLayout(orientation='vertical')
        self.row2.it2 = BoxLayout(orientation='horizontal')
        self.row2.it3 = BoxLayout(orientation='vertical')

        self.row2.gear_left = Image(source='cw.zip',
                                    anim_delay=-1,
                                    size_hint=(1, 1))
        self.row2.it1.add_widget(self.row2.gear_left)
        self.row2.desc1 = BoxLayout(orientation='horizontal')
        self.row2.actdesc1 = Button(text=" ",
                                    font_size=25,
                                    color=(0, 0, 0, 1),
                                    background_color=(32 / 255.0, 178 / 255.0,
                                                      170 / 255.0, 1),
                                    size_hint=(1, 1),
                                    background_normal='')
        self.row2.actdesc1.bind(on_press=self.write_char)
        self.row2.knob_left = Knob(size=(125, 125),
                                   step=100 / len(self.alph),
                                   knobimg_source="knob/img/knob_metal.png",
                                   marker_img="knob/img/bline.png",
                                   markeroff_color=(0.3, 0.3, 0.3, 1))
        self.row2.knob_left.bind(on_touch_move=self.change_char)
        self.row2.desc1.add_widget(self.row2.knob_left)
        self.row2.desc1.add_widget(self.row2.actdesc1)
        self.row2.it1.add_widget(self.row2.desc1)

        self.row2.it2.program = LabelB(
            text=''.join(txtformat(self.otm.cropprog(3))),
            color=(0, 0, 0, 1),
            halign='left',
            valign='top',
            bcolor=(218 / 255.0, 165 / 255.0, 32 / 255.0, 1),
            size_hint=(0.9, 1),
            font_size=20,
            font_name="Courier New Bold",
            text_size=(200, None))
        self.row2.it2.pointer = LabelB(text='->',
                                       color=(0, 0, 0, 1),
                                       halign='right',
                                       valign='middle',
                                       size_hint=(0.1, 1),
                                       bcolor=(218 / 255.0, 165 / 255.0,
                                               32 / 255.0, 1))
        self.row2.it2.add_widget(self.row2.it2.pointer)
        self.row2.it2.add_widget(self.row2.it2.program)

        self.row2.gear_right = Image(source='cw.zip',
                                     anim_delay=-1,
                                     size_hint=(1, 1))
        self.row2.it3.add_widget(self.row2.gear_right)
        self.row2.desc2 = BoxLayout(orientation='horizontal')
        self.row2.actdesc2 = LabelB(text='Location -->',
                                    color=(0, 0, 0, 1),
                                    bcolor=(32 / 255.0, 178 / 255.0,
                                            170 / 255.0, 1))
        self.row2.knob_right = Knob(size=(125, 125),
                                    knobimg_source="knob/img/knob_metal.png",
                                    marker_img="knob/img/bline.png",
                                    markeroff_color=(0.3, 0.3, 0.3, 1))
        self.row2.knob_right.bind(on_touch_move=self.set_location)
        self.row2.desc2.add_widget(self.row2.actdesc2)
        self.row2.desc2.add_widget(self.row2.knob_right)
        self.row2.it3.add_widget(self.row2.desc2)

        self.row2.add_widget(self.row2.it1)
        self.row2.add_widget(self.row2.it2)
        self.row2.add_widget(self.row2.it3)
        self.add_widget(self.row2)

        self.row3 = BoxLayout(orientation='horizontal', size_hint=(1, 0.3))
        self.row3.slider = OtmgSlider(min=0, max=100, value=0)
        self.row3.add_widget(self.row3.slider)
        self.add_widget(self.row3)

        self.row4 = BoxLayout(orientation='horizontal', size_hint=(1, 0.2))
        self.row4.btn1 = ToggleButton(text='Start/Stop')
        self.row4.btn1.bind(on_press=self.do_startstop)
        self.row4.add_widget(self.row4.btn1)
        self.row4.btn2 = Button(text='Step')
        self.row4.btn2.bind(on_press=self.do_step_request)
        self.row4.add_widget(self.row4.btn2)
        self.row4.btn3 = Button(text='Restart')
        self.row4.btn3.bind(on_press=self.restart)
        self.row4.add_widget(self.row4.btn3)
        self.row4.btn4 = Button(text='Clear')
        self.row4.btn4.bind(on_press=self.do_clear)
        self.row4.add_widget(self.row4.btn4)
        self.row4.btn5 = Button(text='EXIT')
        self.row4.btn5.bind(on_press=self.exit)
        self.row4.add_widget(self.row4.btn5)

        self.add_widget(self.row4)
Пример #37
0
class Otmg(BoxLayout):

    gear_dir = 'cw'
    state = "Stop"

    def __init__(self, **kwargs):
        super(Otmg, self).__init__(**kwargs)

        self.progs = os.listdir("../../otmp")
        self.prog = "Roman_Numeral_Square_Root"

        self.otm = Otm(" ")
        self.otm.load(self.prog)
        self.alph = self.otm.findchars()

        self.lastloc = 0
        self.movedloc = False
        self.lastleftknob = 0
        self.lastrightknob = 0
        self.lastinput = [" "]
        self.setlast = False

        self.orientation = 'vertical'
        self.padding = 20

        self.row0 = BoxLayout(size_hint=(1, 0.1))
        self.row0.prev = Button(text="Previous", size_hint=(0.25, 1))
        self.row0.prev.bind(on_press=self.prev)
        self.row0.add_widget(self.row0.prev)
        self.row0.title = LabelB(text=self.prog.replace("_", " "),
                                 size_hint=(0.5, 1),
                                 halign='center',
                                 valign='top',
                                 color=(0, 0, 0, 1),
                                 font_size=25,
                                 bcolor=(1, 1, 1, 1))
        self.row0.add_widget(self.row0.title)
        self.row0.nex = Button(text="Next", size_hint=(0.25, 1))
        self.row0.nex.bind(on_press=self.nex)
        self.row0.add_widget(self.row0.nex)
        self.add_widget(self.row0)

        self.row1 = BoxLayout(size_hint=(1, 0.2))
        self.row1.tape = LabelB(text=self.otm.croptape(25),
                                size_hint=(1, 1),
                                halign='center',
                                valign='top',
                                color=(0, 0, 0, 1),
                                font_size=25,
                                bcolor=(210 / 255.0, 105 / 255.0, 30 / 255.0,
                                        1),
                                font_name='Courier New Bold')
        self.row1.add_widget(self.row1.tape)
        self.add_widget(self.row1)

        self.row15 = BoxLayout(size_hint=(1, 0.01))
        self.row15.pointer = LabelB(text='^',
                                    halign='center',
                                    color=(0, 0, 0, 1),
                                    bcolor=(210 / 255.0, 105 / 255.0,
                                            30 / 255.0, 1),
                                    valign='top')
        self.row15.add_widget(self.row15.pointer)
        self.add_widget(self.row15)

        self.row2 = BoxLayout(orientation='horizontal')
        self.row2.it1 = BoxLayout(orientation='vertical')
        self.row2.it2 = BoxLayout(orientation='horizontal')
        self.row2.it3 = BoxLayout(orientation='vertical')

        self.row2.gear_left = Image(source='cw.zip',
                                    anim_delay=-1,
                                    size_hint=(1, 1))
        self.row2.it1.add_widget(self.row2.gear_left)
        self.row2.desc1 = BoxLayout(orientation='horizontal')
        self.row2.actdesc1 = Button(text=" ",
                                    font_size=25,
                                    color=(0, 0, 0, 1),
                                    background_color=(32 / 255.0, 178 / 255.0,
                                                      170 / 255.0, 1),
                                    size_hint=(1, 1),
                                    background_normal='')
        self.row2.actdesc1.bind(on_press=self.write_char)
        self.row2.knob_left = Knob(size=(125, 125),
                                   step=100 / len(self.alph),
                                   knobimg_source="knob/img/knob_metal.png",
                                   marker_img="knob/img/bline.png",
                                   markeroff_color=(0.3, 0.3, 0.3, 1))
        self.row2.knob_left.bind(on_touch_move=self.change_char)
        self.row2.desc1.add_widget(self.row2.knob_left)
        self.row2.desc1.add_widget(self.row2.actdesc1)
        self.row2.it1.add_widget(self.row2.desc1)

        self.row2.it2.program = LabelB(
            text=''.join(txtformat(self.otm.cropprog(3))),
            color=(0, 0, 0, 1),
            halign='left',
            valign='top',
            bcolor=(218 / 255.0, 165 / 255.0, 32 / 255.0, 1),
            size_hint=(0.9, 1),
            font_size=20,
            font_name="Courier New Bold",
            text_size=(200, None))
        self.row2.it2.pointer = LabelB(text='->',
                                       color=(0, 0, 0, 1),
                                       halign='right',
                                       valign='middle',
                                       size_hint=(0.1, 1),
                                       bcolor=(218 / 255.0, 165 / 255.0,
                                               32 / 255.0, 1))
        self.row2.it2.add_widget(self.row2.it2.pointer)
        self.row2.it2.add_widget(self.row2.it2.program)

        self.row2.gear_right = Image(source='cw.zip',
                                     anim_delay=-1,
                                     size_hint=(1, 1))
        self.row2.it3.add_widget(self.row2.gear_right)
        self.row2.desc2 = BoxLayout(orientation='horizontal')
        self.row2.actdesc2 = LabelB(text='Location -->',
                                    color=(0, 0, 0, 1),
                                    bcolor=(32 / 255.0, 178 / 255.0,
                                            170 / 255.0, 1))
        self.row2.knob_right = Knob(size=(125, 125),
                                    knobimg_source="knob/img/knob_metal.png",
                                    marker_img="knob/img/bline.png",
                                    markeroff_color=(0.3, 0.3, 0.3, 1))
        self.row2.knob_right.bind(on_touch_move=self.set_location)
        self.row2.desc2.add_widget(self.row2.actdesc2)
        self.row2.desc2.add_widget(self.row2.knob_right)
        self.row2.it3.add_widget(self.row2.desc2)

        self.row2.add_widget(self.row2.it1)
        self.row2.add_widget(self.row2.it2)
        self.row2.add_widget(self.row2.it3)
        self.add_widget(self.row2)

        self.row3 = BoxLayout(orientation='horizontal', size_hint=(1, 0.3))
        self.row3.slider = OtmgSlider(min=0, max=100, value=0)
        self.row3.add_widget(self.row3.slider)
        self.add_widget(self.row3)

        self.row4 = BoxLayout(orientation='horizontal', size_hint=(1, 0.2))
        self.row4.btn1 = ToggleButton(text='Start/Stop')
        self.row4.btn1.bind(on_press=self.do_startstop)
        self.row4.add_widget(self.row4.btn1)
        self.row4.btn2 = Button(text='Step')
        self.row4.btn2.bind(on_press=self.do_step_request)
        self.row4.add_widget(self.row4.btn2)
        self.row4.btn3 = Button(text='Restart')
        self.row4.btn3.bind(on_press=self.restart)
        self.row4.add_widget(self.row4.btn3)
        self.row4.btn4 = Button(text='Clear')
        self.row4.btn4.bind(on_press=self.do_clear)
        self.row4.add_widget(self.row4.btn4)
        self.row4.btn5 = Button(text='EXIT')
        self.row4.btn5.bind(on_press=self.exit)
        self.row4.add_widget(self.row4.btn5)

        self.add_widget(self.row4)

    def exit(self, value):
        sys.exit()

    def write_char(self, value):
        self.otm.tape[self.otm.index] = self.row2.actdesc1.text
        self.otm.moveright()
        self.row1.tape.text = self.otm.croptape(25)

    def change_char(self, val, val2):
        if self.lastleftknob != self.row2.knob_left.value:
            self.row2.actdesc1.text = self.alph[int(
                round(self.row2.knob_left.value / (100 / len(self.alph))) - 1)]
            self.lastleftknob = self.row2.knob_left.value

    def restart(self, val):
        self.otm.tape = self.lastinput
        self.otm.index = 0
        self.otm.state = "0"
        self.row1.tape.text = self.otm.croptape(25)
        self.row2.it2.program.text = ''.join(txtformat(self.otm.cropprog(3)))
        self.setlast = False

    def nex(self, value):
        try:
            self.prog = self.progs[self.progs.index(self.prog) + 1]
        except:
            self.prog = self.progs[0]
        self.do_clear(None)
        self.row0.title.text = self.prog.split(".")[0].replace("_", " ")
        self.otm.load(self.prog.split(".")[0])
        self.alph = self.otm.findchars()
        self.row1.tape.text = self.otm.croptape(25)
        self.row2.it2.program.text = ''.join(txtformat(self.otm.cropprog(3)))

    def prev(self, value):
        try:
            self.prog = self.progs[self.progs.index(self.prog) - 1]
        except:
            self.prog = self.progs[len(self.progs) - 1]

        self.do_clear(None)
        self.row0.title.text = self.prog.split(".")[0].replace("_", " ")
        self.otm.load(self.prog.split(".")[0])
        self.alph = self.otm.findchars()
        self.row1.tape.text = self.otm.croptape(25)
        self.row2.it2.program.text = ''.join(txtformat(self.otm.cropprog(3)))

    def set_location(self, touch, value):
        if self.lastrightknob != self.row2.knob_right.value:
            self.lastrightknob = self.row2.knob_right.value
            if self.state == "Stop":
                self.movedloc = True
                prev = self.otm.index
                self.otm.index = int(
                    round((len(self.otm.tape) / 100) *
                          self.row2.knob_right.value))
                self.row1.tape.text = self.otm.croptape(25)
                if self.otm.index > prev:
                    self.row2.gear_left.source = 'cw.zip'
                    self.row2.gear_right.source = 'cw.zip'
                elif self.otm.index < prev:
                    self.row2.gear_right.source = 'ccw.zip'
                    self.row2.gear_left.source = 'ccw.zip'
                else:
                    return
                self.row2.gear_left.anim_loop = 1
                self.row2.gear_right.anim_loop = 1
                self.row2.gear_left.anim_delay = self.row3.slider.speed()
                self.row2.gear_right.anim_delay = self.row3.slider.speed()
                self.row2.gear_left.anim_delay = 0.01
                self.row2.gear_right.anim_delay = 0.01

    def do_clear(self, value):
        self.otm.__init__()
        self.row1.tape.text = " "
        self.row2.it2.program.text = ""
        self.row2.knob_left.value = 0
        self.row2.knob_right.value = 0
        self.row0.title.text = ""
        self.state = "Stop"
        self.setlast = False
        self.lastinput = [" "]
        self.row2.gear_left.anim_delay = -1
        self.row2.gear_right.anim_delay = -1
        self.row3.slider.value = 0
        self.row4.btn1.state = 'normal'

    def do_step(self, value):
        if not self.setlast:
            self.lastinput = self.otm.tape
            self.setlast = True

        if self.row2.it2.program.text == "Finished!":
            self.state = "Stop"
            self.row2.gear_right.anim_loop = -1
            self.row2.gear_left.anim_loop = -1
            return
        if self.movedloc:
            self.otm.index = self.lastloc
            self.movedloc = False
        self.otm.tick()
        self.row1.tape.text = self.otm.croptape(25)
        self.row2.it2.program.text = ''.join(txtformat(self.otm.cropprog(3)))
        self.lastloc = self.otm.index
        if self.otm.lastdir == 'r':
            self.row2.gear_right.source = 'ccw.zip'
            self.row2.gear_left.source = 'ccw.zip'
        elif self.otm.lastdir == 'l':
            self.row2.gear_left.source = 'cw.zip'
            self.row2.gear_right.source = 'cw.zip'

    def do_step_request(self, value):
        if self.row2.it2.program.text == "Finished!":
            self.state = "Stop"
            self.row2.gear_right.anim_loop = -1
            self.row2.gear_left.anim_loop = -1
            return
        if self.state != "Run":
            self.do_step(None)
            self.row2.gear_left.anim_loop = 1
            self.row2.gear_right.anim_loop = 1
            self.row2.gear_left.anim_delay = self.row3.slider.speed()
            self.row2.gear_right.anim_delay = self.row3.slider.speed()
            self.row2.gear_left.anim_delay = 0.01
            self.row2.gear_right.anim_delay = 0.01

    def do_startstop(self, value):
        self.row2.gear_left.anim_loop = 0
        self.row2.gear_right.anim_loop = 0
        if self.state == "Run":
            self.state = "Stop"
            self.row2.gear_left.anim_delay = -1
            self.row2.gear_right.anim_delay = -1
        elif not self.row2.it2.program.text == "Finished!":
            self.state = "Run"
            Clock.schedule_once(self.runstep_callback, 0.5)
            self.row2.gear_left.anim_delay = self.row3.slider.speed()
            self.row2.gear_right.anim_delay = self.row3.slider.speed()

    def runstep_callback(self, dt):
        if self.state == "Run":
            self.do_step(None)
            Clock.schedule_once(self.runstep_callback,
                                self.row3.slider.speed() * 5)
            self.row2.gear_left.anim_loop = 0
            self.row2.gear_right.anim_loop = 0
            self.row2.gear_left.anim_delay = self.row3.slider.speed()
            self.row2.gear_right.anim_delay = self.row3.slider.speed()
Пример #38
0
 def __init__(self, **kwargs):
     super(Waiting, self).__init__(**kwargs)
     self.settings = kwargs['settings']
     fonLayout = FloatLayout()
     fonWait = Image(source='fonWait.png', allow_stretch=True)
     waitLayout = BoxLayout(orientation='horizontal')
     colsOneLayout = BoxLayout(orientation='vertical', size_hint=(.25, 1))
     colsOneLayout.add_widget(Widget(size_hint=(1, .1)))
     self.blazonImg = Image(allow_stretch=True, size_hint=(1, .5))
     colsOneLayout.add_widget(self.blazonImg)
     colsOneLayout.add_widget(Widget())
     colsTwoLayout = BoxLayout(orientation='vertical', size_hint=(.5, 1))
     label = Label(
         text='[color=C8E3FE][b]Совещание совета безопасности[/b][/color]',
         markup=True,
         font_size=28)
     colsTwoLayout.add_widget(label)
     colsTwoLayout.add_widget(Widget())
     self.waitBtn = RoundedFlatButton(
         text='[color=D7F5FF][b]ПРИСТУПИТЬ К ГОЛОСОВАНИЮ[/b][/color]',
         on_press=self.imReady,
         markup=True,
         font_size=24,
         background_color=[.47, .69, 1, 1],
         background_normal='')
     colsTwoLayout.add_widget(self.waitBtn)
     colsTwoLayout.add_widget(Widget())
     colsTwoLayout.add_widget(Widget())
     colsThreeLayout = BoxLayout(orientation='vertical', size_hint=(.25, 1))
     colsThreeLayout.add_widget(Widget())
     waitLayout.add_widget(colsOneLayout)
     waitLayout.add_widget(colsTwoLayout)
     waitLayout.add_widget(colsThreeLayout)
     fonLayout.add_widget(fonWait)
     fonLayout.add_widget(waitLayout)
     self.add_widget(fonLayout)
     self.bind(on_pre_enter=self.updateBlazonImg)
Пример #39
0
    def __init__(self, **kwargs):
        super(EnterNewIP, self).__init__(**kwargs)
        self.settings = kwargs['settings']
        self.newIP = ''
        fonLayout = FloatLayout()
        fonEnterNewIP = Image(source='fonWait.png', allow_stretch=True)
        enterNewIPLayout = BoxLayout(orientation='horizontal')
        colOne = BoxLayout(size_hint=[.25, 1])
        colTwo = BoxLayout(orientation='vertical', size_hint=[.5, 1])
        colThree = BoxLayout(size_hint=[.25, 1])
        inputIP = Label(
            text=
            '[color=C8E3FE][b]Server not found.\nEnter new IP, please.[/b][/color]',
            markup=True,
            font_size=28,
            size_hint=[1, .3])
        self.textInput = TextInput(multiline=False, size_hint=[1, .05])
        self.textInput.bind(text=self.on_text)
        sendNewIPBtn = RoundedFlatButton(
            on_press=self.sendNewIP,
            text='[color=D7F5FF][b]Test new IP[/b][/color]',
            markup=True,
            font_size=24,
            size_hint=[1, .2],
            background_color=[.47, .69, 1, 1],
            background_normal='')

        colTwo.add_widget(inputIP)
        colTwo.add_widget(self.textInput)
        colTwo.add_widget(Widget(size_hint=[1, .05]))
        colTwo.add_widget(sendNewIPBtn)
        colTwo.add_widget(Widget(size_hint=[1, .4]))
        enterNewIPLayout.add_widget(colOne)
        enterNewIPLayout.add_widget(colTwo)
        enterNewIPLayout.add_widget(colThree)
        fonLayout.add_widget(fonEnterNewIP)
        fonLayout.add_widget(enterNewIPLayout)
        self.add_widget(fonLayout)
Пример #40
0
 def __init__(self, **kwargs):
     super(Answer, self).__init__(**kwargs)
     self.settings = kwargs['settings']
     self.listOfWitgetsOnRightCol = []
     fonLayout = FloatLayout()
     fonAnswer = Image(source='fonAnswer.png', allow_stretch=True)
     answerLayout = BoxLayout(orientation='horizontal')
     colsOneLayout = BoxLayout(orientation='vertical', size_hint=(.69, 1))
     rowsOneInColsOneLayout = BoxLayout(orientation='horizontal',
                                        size_hint=(1, .5))
     self.blazonImg = Image(source='riba_kit.png',
                            allow_stretch=True,
                            size_hint=(.4, 1))
     self.questionLbl = Label(text='ВОПРОС',
                              size_hint=(.6, 1),
                              markup=True,
                              font_size=28,
                              halign='left',
                              valign='center')
     self.questionLbl.bind(size=self.questionLbl.setter('text_size'))
     rowsOneInColsOneLayout.add_widget(Widget(size_hint=(0.05, 1)))
     rowsOneInColsOneLayout.add_widget(self.blazonImg)
     rowsOneInColsOneLayout.add_widget(Widget(size_hint=(0.05, 1)))
     rowsOneInColsOneLayout.add_widget(self.questionLbl)
     colsOneLayout.add_widget(rowsOneInColsOneLayout)
     rowsTwoInColsOneLayout = BoxLayout(orientation='horizontal',
                                        size_hint=(1, .3))
     btnYes = RoundedFlatButton(on_press=self.answerYes,
                                text='[color=D7F5FF][b]ЗА[/b][/color]',
                                markup=True,
                                font_size=24,
                                size_hint=(.7, .5),
                                background_color=[.47, .69, 1, 1],
                                background_normal='')
     btnNo = RoundedFlatButton(on_press=self.answerNo,
                               text='[color=D7F5FF][b]ПРОТИВ[/b][/color]',
                               markup=True,
                               font_size=24,
                               size_hint=(.7, .5),
                               background_color=[.47, .69, 1, 1],
                               background_normal='')
     rowsTwoInColsOneLayout.add_widget(Widget(size_hint=(.2, 1)))
     rowsTwoInColsOneLayout.add_widget(btnYes)
     rowsTwoInColsOneLayout.add_widget(Widget(size_hint=(.1, 1)))
     rowsTwoInColsOneLayout.add_widget(btnNo)
     rowsTwoInColsOneLayout.add_widget(Widget(size_hint=(.2, 1)))
     colsOneLayout.add_widget(rowsTwoInColsOneLayout)
     colsOneLayout.add_widget(Widget(size_hint=(1, .2)))
     self.colsTwoLayout = GridLayout(rows=7,
                                     size_hint=(.31, 1),
                                     row_force_default=True,
                                     row_default_height=150)
     answerLayout.add_widget(colsOneLayout)
     answerLayout.add_widget(Widget(size_hint=(.05, 1)))
     answerLayout.add_widget(self.colsTwoLayout)
     fonLayout.add_widget(fonAnswer)
     fonLayout.add_widget(answerLayout)
     self.bind(on_pre_enter=self.updateColsTwo)
     self.bind(on_pre_enter=self.updateBlazonImg)
     self.add_widget(fonLayout)
Пример #41
0
    def __init__(self, **kwargs):
        '''
        The view part of the MVC. note that some values are passed in the kwargs dict. See below
        Basically, this method will create and layout the gui's widgets
        '''
        super(KivyView, self).__init__(**kwargs)
        self.deviceDescriptors = kwargs['deviceDescriptors']
        self.hubs = kwargs['hubs']
        self.fileInfo = kwargs['fileInfo']
        self.databaseLogger = kwargs['databaseLogger']
        self.widgetsMap = {}
        # the uid of of what's being shown in the output (detail) view to the
        # right of the splitter
        self.outputDetailUid = None
        self.mainButtonListeners = []
        # LAYOUT
        # the right half of the splitter
        outputView = BoxStencil(orientation='vertical')
        self.outputTitle = Label(
            text=" ", font_size=20, color=YELLOW_COLOR, size_hint=(1, .1))
        outputView.add_widget(self.outputTitle)  # add in a title

        self.output = ScrollableLabel()
        outputView.add_widget(self.output)
        buttonGrid = GridLayout(cols=5,size_hint=(1,.15),valign="bottom")
        outputView.add_widget(buttonGrid)

        fileInfoButton = Button(text="File Info")
        buttonGrid.add_widget(fileInfoButton)
        fileInfoButton.bind(on_press=lambda button: self._fileInfo())

        flashStatsButton = Button(text="Flash Stats")
        buttonGrid.add_widget(flashStatsButton)
        flashStatsButton.bind(on_press=lambda button: self._stats("Flasher"))

        hwStatsButton = Button(text="HW Test Stats")
        buttonGrid.add_widget(hwStatsButton)
        hwStatsButton.bind(on_press=lambda button: self._stats("ChipHardwareTest"))

        browseStatsButton = Button(text="Browse Stats")
        buttonGrid.add_widget(browseStatsButton)
        browseStatsButton.bind(on_press=lambda button: self._browseStats())

        powerButton = Button(text=POWER_OFF_TEXT,font_name=FONT_NAME)
        buttonGrid.add_widget(powerButton)
        powerButton.bind(on_press=lambda button: self._powerOff())

        splitter = Splitter(sizable_from='left', min_size=10,
                            max_size=600, keep_within_parent=True, size_hint=(.01, 1))

        # size the columns appropriately
        # 14.0 / rows #adjust font size according to number of rows
        rowSizeFactor = 4.0
        if not SHOW_STATE:
            rowSizeFactor += 1.5
        if HUBS_IN_COLUMNS:
            hubColumns = len(self.hubs)
        else:
            hubColumns = 1

        if HUBS_IN_COLUMNS:
            rowSizeFactor = rowSizeFactor / hubColumns

        mainButtonWidth = 50 * rowSizeFactor
        hubPanels = GridLayout(cols=hubColumns)

        # Layout the grid for the hubs
        cols = 3
        if not SHOW_STATE:
            cols = cols - 1
        for i, hub in enumerate(self.hubs):  # go through the hubs
            # the spliter is way off to the right
            testingView = GridLayout(cols=cols, size_hint=(.99, 1))
            hubPanels.add_widget(testingView)
            # add these to the py grid view. If we want to have many columns,
            # this would add to a sub grid
            addTo = testingView
            # now go through devices
            for key, deviceDescriptor in self.deviceDescriptors.iteritems():
                if deviceDescriptor.hub != hub:
                    continue  # not on this hub, ignore

                widgets = Widgets()
                self.widgetsMap[key] = widgets

                # The main button
                widgets.button = Button(id=key, text=deviceDescriptor.uid, color=DISCONNECTED_COLOR, font_size=30 * rowSizeFactor,
                                        font_name=FONT_NAME, halign="center", size_hint_x=None, width=mainButtonWidth)
                widgets.button.bind(
                    on_press=self._onClickedMainButton.__get__(self, KivyView))
                addTo.add_widget(widgets.button)

                # The state column
                widgets.stateLabel = Label(id=key, text=WAITING_TEXT, color=DISCONNECTED_COLOR, font_size=13 *
                                           rowSizeFactor, font_name=FONT_NAME, halign="center", size_hint_x=None, width=60 * rowSizeFactor)
                if SHOW_STATE:
                    addTo.add_widget(widgets.stateLabel)

                # The label column kists of both text and a progress bar
                # positioned inside a box layout
                stateBox = BoxLayout(orientation='vertical')
                widgets.label = LabelButton(
                    id=key, text='', color=DISCONNECTED_COLOR, font_size=13 * rowSizeFactor, font_name=FONT_NAME, halign="center")
                # show output window if label clicked
                widgets.label.bind(
                    on_press=self._onShowOutput.__get__(self, KivyView))
                stateBox.add_widget(widgets.label)
                widgets.progress = ProgressBar(
                    id=key, value=0, max=1, halign="center", size_hint=(.9, 1.0 / 15))
                stateBox.add_widget(widgets.progress)
                addTo.add_widget(stateBox)

        splitter.add_widget(outputView)
        self.add_widget(hubPanels)
        self.add_widget(splitter)
Пример #42
0
 def __init__(self, **kwargs):
     super(Admin, self).__init__(**kwargs)
     self.settings = kwargs['settings']
     self.red = '[color=DF2447][b]'
     self.green = '[color=01CC8B][b]'
     fonLayout = FloatLayout()
     adminFon = Image(source='adminFon.jpg', allow_stretch=True)
     fonLayout.add_widget(adminFon)
     adminLayout = BoxLayout(orientation='horizontal', spacing=10)
     colOne = BoxLayout(orientation='vertical',
                        spacing=10,
                        size_hint=[.3, 1])
     colTwo = BoxLayout(orientation='vertical',
                        spacing=10,
                        size_hint=[.3, 1])
     riba_kitImg = Image(source='riba_kit.png', allow_stretch=True)
     tridevCarstvoImg = Image(source='tridevCarstvo.png',
                              allow_stretch=True)
     lukomoreImg = Image(source='lukomore.png', allow_stretch=True)
     morskayaDergavaImg = Image(source='morskayaDergava.png',
                                allow_stretch=True)
     shamahanImg = Image(source='shamahan.png', allow_stretch=True)
     self.riba_kitRdyLbl = Label(text=self.red + 'Isn`t ready[/b][/color]',
                                 markup=True,
                                 font_size=24)
     self.tridevCarstvoRdyLbl = Label(text=self.red +
                                      'Isn`t ready[/b][/color]',
                                      markup=True,
                                      font_size=24)
     self.lukomoreRdyLbl = Label(text=self.red + 'Isn`t ready[/b][/color]',
                                 markup=True,
                                 font_size=24)
     self.morskayaDergavaRdyLbl = Label(text=self.red +
                                        'Isn`t ready[/b][/color]',
                                        markup=True,
                                        font_size=24)
     self.shamahanRdyLbl = Label(text=self.red + 'Isn`t ready[/b][/color]',
                                 markup=True,
                                 font_size=24)
     riba_kitBox = BoxLayout(orientation='horizontal', spacing=10)
     tridevCarstvoBox = BoxLayout(orientation='horizontal', spacing=10)
     lukomoreBox = BoxLayout(orientation='horizontal', spacing=10)
     morskayaDergavaBox = BoxLayout(orientation='horizontal', spacing=10)
     shamahanBox = BoxLayout(orientation='horizontal', spacing=10)
     riba_kitBox.add_widget(riba_kitImg)
     riba_kitBox.add_widget(self.riba_kitRdyLbl)
     tridevCarstvoBox.add_widget(tridevCarstvoImg)
     tridevCarstvoBox.add_widget(self.tridevCarstvoRdyLbl)
     lukomoreBox.add_widget(lukomoreImg)
     lukomoreBox.add_widget(self.lukomoreRdyLbl)
     morskayaDergavaBox.add_widget(morskayaDergavaImg)
     morskayaDergavaBox.add_widget(self.morskayaDergavaRdyLbl)
     shamahanBox.add_widget(shamahanImg)
     shamahanBox.add_widget(self.shamahanRdyLbl)
     startBtn = RoundedFlatButton(
         on_press=self.changeStatusVote,
         text='[color=D7F5FF][b]Start next round[/b][/color]',
         markup=True,
         font_size=24,
         size_hint=[1, .3],
         background_color=[.47, .69, 1, 1],
         background_normal='')
     restartBtn = RoundedFlatButton(
         on_press=self.restartApp,
         text='[color=D7F5FF][b]Restart App[/b][/color]',
         markup=True,
         font_size=24,
         size_hint=[1, .3],
         background_color=[.81, .14, .28, 1],
         background_normal='')
     colOne.add_widget(Widget(size_hint=[1, .15]))
     colOne.add_widget(riba_kitBox)
     colOne.add_widget(tridevCarstvoBox)
     colOne.add_widget(lukomoreBox)
     colOne.add_widget(morskayaDergavaBox)
     colOne.add_widget(shamahanBox)
     colOne.add_widget(Widget(size_hint=[1, .15]))
     colTwo.add_widget(Widget(size_hint=[1, .3]))
     colTwo.add_widget(startBtn)
     colTwo.add_widget(Widget(size_hint=[1, .2]))
     colTwo.add_widget(restartBtn)
     colTwo.add_widget(Widget(size_hint=[1, .3]))
     adminLayout.add_widget(Widget(size_hint=[.05, 1]))
     adminLayout.add_widget(colOne)
     adminLayout.add_widget(Widget(size_hint=[.3, 1]))
     adminLayout.add_widget(colTwo)
     adminLayout.add_widget(Widget(size_hint=[.05, 1]))
     fonLayout.add_widget(adminLayout)
     self.add_widget(fonLayout)
     self.bind(on_pre_enter=self.cleanStatusPlayers)
Пример #43
0
    def build(self):
        """In here, we build all the basic for our kivy stuff, like making our layout, initialize our mapview,
        our different buttons and so on, its also in here we call our gpsHandler, and call our placephotovogn"""

        self.logic = Logic(self)
        self.MenuFuncs = MenuFunctions(self)
        self.gpshandler = GpsHandler(self)
        self.offset = 0.001
        """initalizing the few colors in kivy binary"""
        self.Lightred = [1111111111, 0, 0, 1]
        self.black = [0, 0, 0, 1]
        self.green = [0, 1111111, 0, 1]
        """Creating MapView, which let us determ, zoom, lat and lon, essentiel it would be pulling from gps signlas"""
        self.mapview = MapView(zoom=15, lat=56.04,
                               lon=12.457)  #56.0394 , 12.457
        self.person = MapMarker(lat=self.mapview.lat,
                                lon=self.mapview.lon,
                                source='images/car.png')
        self.mapview.add_marker(self.person)
        """Making a layout, as a boxlayout, making it vertical to match our desired design"""
        self.layout = BoxLayout(orientation="vertical")
        """Initializing our buttons, then after connection them to functions, when they are pressed"""
        self.buttonAnmeld = Button(text="ANMELD!",
                                   font_size=100,
                                   color=self.black,
                                   background_color=self.green)
        self.buttonAlert = Button(text="ALARM!",
                                  font_size=200,
                                  color=self.black,
                                  background_color=self.Lightred,
                                  disabled=True,
                                  opacity=0)
        """Binding our botton to a specific function, lambda is so the function wont get called when iniialized"""
        self.buttonAnmeld.bind(on_press=lambda dt: self.logic.FotoVognSpotted(
            self.mapview.lat, self.mapview.lon))
        """Creating the dropdown menu"""
        self.dropdown = DropDown(size_hint_x=0.2)
        """Labels"""
        labels = [
            '  Reset Zoom', '  Zoom In', '  Zoom Out', ' Increase LAT',
            '  Decrease LAT', '  Increase LON', '  Decrease LON', "  Exit"
        ]
        """Functions"""
        functions = [
            self.MenuFuncs.resetZoom, self.MenuFuncs.zoomIn,
            self.MenuFuncs.zoomOut, self.MenuFuncs.IncreaseLat,
            self.MenuFuncs.DecreaseLat, self.MenuFuncs.IncreaseLon,
            self.MenuFuncs.DecreaseLon, self.MenuFuncs.exit
        ]
        """Creating buttons for each label, give them their corresponding function, allign them at  left,
        and last, adding them to the dropdown widget"""
        for label, func in zip(labels, functions):
            self.btn = Button(text=label,
                              size_hint_y=None,
                              height=45,
                              halign="left",
                              valign="middle")
            self.btn.bind(size=self.btn.setter('text_size'))
            self.btn.bind(on_release=func)

            self.dropdown.add_widget(self.btn)
        """Creating our menuMainButton, also alligned at left"""
        self.mainbutton = Button(text='  Menu',
                                 size_hint_y=None,
                                 height=35,
                                 halign="left",
                                 valign="middle",
                                 size_hint_x=0.2)

        self.mainbutton.bind(size=self.mainbutton.setter('text_size'))
        self.mainbutton.bind(on_release=self.dropdown.open)
        """Adding all the different stuff to our layout, in the desired order"""
        self.layout.add_widget(self.mainbutton)
        self.layout.add_widget(self.buttonAnmeld)
        self.layout.add_widget(self.mapview)
        self.layout.add_widget(self.buttonAlert)

        self.logic.PlaceFotoVogn()
        self.gpshandler.run()
        """Returning the layout"""
        return self.layout
Пример #44
0
    def build(self):  # Отрисовка виджетов
        al = AnchorLayout(padding=25)
        bl = BoxLayout(orientation='vertical', size_hint=[.7, .7], spacing=5)

        # lable Login
        self.lbl_login = Label(text="Login", text_size=(400 - 50, 30))
        bl.add_widget(self.lbl_login)

        # text Login
        self.txt_login = TextInput(multiline=False)
        bl.add_widget(self.txt_login)

        # lable Password
        self.lbl_password = Label(text="Password", text_size=(400 - 50, 30))
        bl.add_widget(self.lbl_password)

        # text Password
        self.txt_password = TextInput(multiline=False, password=True)
        bl.add_widget(self.txt_password)

        # footer
        bl_start = BoxLayout(orientation='horizontal', )

        # checkbox
        self.checkbox = CheckBox()
        self.checkbox.bind(active=self.on_checkbox_Active)
        bl_start.add_widget(self.checkbox)

        # info
        self.info = Label()
        bl_start.add_widget(self.info)

        # button Start
        self.btn_start = Button(text='Start', on_press=self.start)
        bl_start.add_widget(self.btn_start)
        bl.add_widget(bl_start)

        al.add_widget(bl)

        return al


#if __name__ == "__main__":
#module("config.json","log.txt")
Пример #45
0
 def build(self):
     fl = BoxLayout(orientation="vertical")
     a = Button(text="press me", height=40, size_hint_y=None)
     a.bind(on_press=callback)
     nav1 = NavigationToolbar2Kivy(canvas)
     nav2 = NavigationToolbar2Kivy(canvas2)
     fl.add_widget(nav1.actionbar)
     fl.add_widget(canvas)
     fl.add_widget(nav2.actionbar)
     fl.add_widget(canvas2)
     fl.add_widget(a)
     return fl
Пример #46
0
    def __init__(self, **kwargs):
        self.nav_drawer = kwargs.pop('nav_drawer')
        self.app = kwargs.pop('app')
        self.micro_sim = kwargs.pop('micro_sim')
        self.dpi = kwargs.pop('dpi')
        super().__init__(**kwargs)
        self.buttons_y_pos = dp(0.2) if self.dpi < 192 else dp(0.1)

        self.first_inst = True
        self.step_assembly = False

        self.ids['left_actions'] = BoxLayout()
        self.orientation = 'vertical'
        self.toolbar_layout = BoxLayout(orientation='vertical')
        self.menu_items = [{
            "viewclass": "MDMenuItem",
            "text": "Save Register/Memory Content",
            "callback": self.open_reg_mem_save_dialog,
        }, {
            "viewclass": "MDMenuItem",
            "text": "Save Editor Content",
            "callback": self.open_editor_save_dialog
        }]
        self.run_window = RunWindow(app=self.app,
                                    micro_sim=self.micro_sim,
                                    dpi=self.dpi)
        self.md_toolbar = MDToolbar(
            title='Semref Micro Sim',
            md_bg_color=self.app.theme_cls.primary_color,
            background_palette='Primary',
            background_hue='500',
            elevation=10,
            ids=self.ids,
            left_action_items=[[
                'dots-vertical', lambda x: self.nav_drawer.toggle_nav_drawer()
            ]])
        self.run_button = MDFillRoundFlatIconButton(
            text='Run',
            icon='run',
            size_hint=(None, None),
            pos_hint={'y': self.buttons_y_pos},
            on_release=self.run_micro_instructions)
        self.debug_button = MDFillRoundFlatIconButton(
            text='Debug',
            icon='android-debug-bridge',
            size_hint=(None, None),
            pos_hint={'y': self.buttons_y_pos},
            on_release=self.run_micro_instructions_step)
        self.refresh_button = MDFillRoundFlatIconButton(
            text='Clear',
            icon='refresh',
            size_hint=(None, None),
            pos_hint={'y': self.buttons_y_pos},
            on_release=self.clear_dialog)
        self.save_button = MDFillRoundFlatIconButton(
            text='Save File',
            icon='download',
            size_hint=(None, None),
            pos_hint={'y': self.buttons_y_pos},
            on_release=lambda x: MDDropdownMenu(
                items=self.menu_items, width_mult=4).open(self.save_button))
        self.pop_button = MDFillRoundFlatIconButton(
            text='Hex Keyboard',
            icon='keyboard-outline',
            size_hint=(None, None),
            pos_hint={'y': self.buttons_y_pos},
            on_release=self.run_window.open_keyboard)
        self.loaded_file = MDIconButton(icon='file-check',
                                        size_hint=(None, None),
                                        pos_hint={'y': self.buttons_y_pos},
                                        theme_text_color='Custom',
                                        text_color=[0, 0.6, 0, 1],
                                        on_release=self.buttons_information)
        self.not_loaded_file = MDIconButton(
            icon='file-alert',
            size_hint=(None, None),
            pos_hint={'y': self.buttons_y_pos},
            theme_text_color='Custom',
            text_color=self.app.theme_cls.accent_dark,
            on_release=self.buttons_information)
        self.md_toolbar.add_widget(self.run_button)
        self.md_toolbar.add_widget(self.debug_button)
        self.md_toolbar.add_widget(self.refresh_button)
        self.md_toolbar.add_widget(self.save_button)
        self.md_toolbar.add_widget(self.pop_button)
        self.add_widget(self.md_toolbar)
        self.add_widget(self.run_window)
        self.add_widget(self.not_loaded_file)
    def __init__(self, **kwargs):
        # 父类构造方法
        super().__init__(**kwargs)

        # 设置背景颜色(可忽略)
        with self.canvas:
            # 背景颜色
            Color(1, 1, 1, 1)
            # 浮动布局矩形 = 矩形(位置=布局位置,大小=布局大小)
            self.rect = Rectangle(pos=self.pos, size=self.size)
            # 浮动布局绑定(位置=布局矩形位置,大小=设置背景尺寸)
            self.bind(pos=self.update_rect, size=self.update_rect)

        # 按钮,根据相对布局的位置,不是最外层线性布局的位置
        # 自定义按钮1
        bt1 = YushiruiButton(
            # 文本
            text='自定义按钮1',
            # 相对位置
            pos_hint={"right": 1, "top": 1},
            # 背景色
            background_color=(0.1, 0.5, 0.6, 1)
        )
        # 自定义按钮2
        bt2 = YushiruiButton(
            # 文本
            text='自定义按钮2',
            # 相对位置
            pos_hint={"x": 0, "top": 1},
            # 背景色
            background_color=(1, 0, 0, 1)
        )
        # 自定义按钮3
        bt3 = YushiruiButton(
            # 文本
            text='自定义按钮3',
            # 相对位置
            pos_hint={"center_x": .5, "center_y": .5},
            # 背景色
            background_color=(0.4, 0.5, 0.6, 1)
        )
        # 自定义按钮4
        bt4 = YushiruiButton(
            # 文本
            text='自定义按钮4',
            # 相对位置
            pos_hint={"x": 0, "y": 0},
            # 背景色
            background_color=(0, 0, 1, 1)
        )
        # 自定义按钮5
        bt5 = YushiruiButton(
            # 文本
            text='自定义按钮5',
            # 相对位置
            pos_hint={"right": 1, "y": 0},
            # 背景色
            background_color=(0.8, 0.9, 0.2, 1)
        )

        # 相对布局
        relative_layout = RelativeLayout()

        # 遍历加组件
        for i in [bt1, bt2, bt3, bt4, bt5]:
            # 加组件(按钮)
            relative_layout.add_widget(i)

        # 加组件,空的BoxLayout占位
        self.add_widget(BoxLayout())
        # 加组件,相对布局
        self.add_widget(relative_layout)
Пример #48
0
class MyApp(App):
    """Main class for all our kivy stuff, there is a few functions in here, update which is called in
    on_start, which call update every 0.1 seconds"""
    def update(self, _):
        """Get gps signals, update them, if its not android, update according to center of mapview"""

        print(self.logic.placedVogne)
        """Check, if its an andorid device, if it is, gps signals are recieved"""
        if not self.gpshandler.androidBool:
            self.latitude = self.mapview.lat
            self.longitude = self.mapview.lon

        else:
            self.latitude = self.gpshandler.my_lat
            self.longitude = self.gpshandler.my_lon

        if not self.logic.alerting:
            for i in self.logic.placedVogne:
                if math.fabs(
                    (float(self.latitude) -
                     float(i[0]))) < self.offset and math.fabs(
                         (float(self.longitude) - float(i[1]))) < self.offset:
                    self.logic.Alert()

        self.person.lat = self.latitude
        self.person.lon = self.longitude

    def on_start(self):
        """When app is started, this is called, which starts a clock calling update"""
        Clock.schedule_interval(self.update, 0.1)

    def build(self):
        """In here, we build all the basic for our kivy stuff, like making our layout, initialize our mapview,
        our different buttons and so on, its also in here we call our gpsHandler, and call our placephotovogn"""

        self.logic = Logic(self)
        self.MenuFuncs = MenuFunctions(self)
        self.gpshandler = GpsHandler(self)
        self.offset = 0.001
        """initalizing the few colors in kivy binary"""
        self.Lightred = [1111111111, 0, 0, 1]
        self.black = [0, 0, 0, 1]
        self.green = [0, 1111111, 0, 1]
        """Creating MapView, which let us determ, zoom, lat and lon, essentiel it would be pulling from gps signlas"""
        self.mapview = MapView(zoom=15, lat=56.04,
                               lon=12.457)  #56.0394 , 12.457
        self.person = MapMarker(lat=self.mapview.lat,
                                lon=self.mapview.lon,
                                source='images/car.png')
        self.mapview.add_marker(self.person)
        """Making a layout, as a boxlayout, making it vertical to match our desired design"""
        self.layout = BoxLayout(orientation="vertical")
        """Initializing our buttons, then after connection them to functions, when they are pressed"""
        self.buttonAnmeld = Button(text="ANMELD!",
                                   font_size=100,
                                   color=self.black,
                                   background_color=self.green)
        self.buttonAlert = Button(text="ALARM!",
                                  font_size=200,
                                  color=self.black,
                                  background_color=self.Lightred,
                                  disabled=True,
                                  opacity=0)
        """Binding our botton to a specific function, lambda is so the function wont get called when iniialized"""
        self.buttonAnmeld.bind(on_press=lambda dt: self.logic.FotoVognSpotted(
            self.mapview.lat, self.mapview.lon))
        """Creating the dropdown menu"""
        self.dropdown = DropDown(size_hint_x=0.2)
        """Labels"""
        labels = [
            '  Reset Zoom', '  Zoom In', '  Zoom Out', ' Increase LAT',
            '  Decrease LAT', '  Increase LON', '  Decrease LON', "  Exit"
        ]
        """Functions"""
        functions = [
            self.MenuFuncs.resetZoom, self.MenuFuncs.zoomIn,
            self.MenuFuncs.zoomOut, self.MenuFuncs.IncreaseLat,
            self.MenuFuncs.DecreaseLat, self.MenuFuncs.IncreaseLon,
            self.MenuFuncs.DecreaseLon, self.MenuFuncs.exit
        ]
        """Creating buttons for each label, give them their corresponding function, allign them at  left,
        and last, adding them to the dropdown widget"""
        for label, func in zip(labels, functions):
            self.btn = Button(text=label,
                              size_hint_y=None,
                              height=45,
                              halign="left",
                              valign="middle")
            self.btn.bind(size=self.btn.setter('text_size'))
            self.btn.bind(on_release=func)

            self.dropdown.add_widget(self.btn)
        """Creating our menuMainButton, also alligned at left"""
        self.mainbutton = Button(text='  Menu',
                                 size_hint_y=None,
                                 height=35,
                                 halign="left",
                                 valign="middle",
                                 size_hint_x=0.2)

        self.mainbutton.bind(size=self.mainbutton.setter('text_size'))
        self.mainbutton.bind(on_release=self.dropdown.open)
        """Adding all the different stuff to our layout, in the desired order"""
        self.layout.add_widget(self.mainbutton)
        self.layout.add_widget(self.buttonAnmeld)
        self.layout.add_widget(self.mapview)
        self.layout.add_widget(self.buttonAlert)

        self.logic.PlaceFotoVogn()
        self.gpshandler.run()
        """Returning the layout"""
        return self.layout
Пример #49
0
    def __init__(self, **kwargs):
        super(InfoDayWidget, self).__init__(**kwargs)
        self.__name__ = "info"
        self.dbName = "infoDay"
        self.size_hint = (.3, .15)
        clock = ClockWidget(size_hint=(1, .7))
        date = DateWidget()
        temp = TempWidget()
        weather = WeatherWidget()
        info = InternationalWidget()

        tempwea = BoxLayout(orientation="horizontal")
        tempwea.add_widget(temp)
        tempwea.add_widget(weather)

        datetemp = BoxLayout(orientation="horizontal",
                             spacing=30,
                             padding=[10, 0, 0, 0],
                             size_hint=(1, 0.25))
        datetemp.add_widget(date)
        datetemp.add_widget(tempwea)

        res = BoxLayout(orientation="vertical",
                        size_hint=(1, .8),
                        padding=[10, 10, 0, 0],
                        spacing=-self.width / 20)
        res.add_widget(clock)
        res.add_widget(datetemp)
        res.add_widget(info)

        self.add_widget(res)
Пример #50
0
    def build(self):
        self.title = "Aurora Reminders"

        main_box_layout = BoxLayout(orientation='vertical',
                                    padding=20,
                                    spacing=10)

        in_box_layout = BoxLayout(orientation='horizontal',
                                  spacing=10,
                                  size_hint_y=0.08)

        chat_view = ScrollableLabel()

        button = Button(text='Record',
                        size_hint_x=0.2,
                        background_normal='',
                        background_color=BUTTON_COLOR,
                        color=hex_to_rgb(WHITE))

        # Interpret user input to retrieve entities for reminder creation
        def interpret_user_response(text, *largs):
            interpret = text.interpret()

            if interpret.intent == 'set_reminder':
                create_event(interpret)
            elif interpret.intent == 'greeting':
                update_chat(get_random_greeting())
            elif text.text.lower() in cancel_intents:
                update_chat("Alright then.")
            else:
                update_chat(get_random_apology())

            return True

        def create_event(interpret):
            if event_mgr.convert_text_to_event(interpret):
                update_chat("Creating your reminder, \"{}\".".format(
                    interpret.entities['task'].capitalize()),
                            confirm=True)
            else:
                update_chat(get_random_apology())

        def play_text_callback(text, *largs):
            Text(text).speech().audio.play()

        def listen_callback(*largs):
            try:
                msg = listen_and_transcribe()
                hide_listen_animation()

                if msg.text != '':
                    update_chat(msg.text, is_user=True)
                    Clock.schedule_once(partial(interpret_user_response, msg),
                                        0.1)
                else:
                    Clock.schedule_once(
                        partial(update_chat, get_random_rep_request(), False,
                                False), 0.1)
            except Exception as e:
                # listen_and_transcribe throws (broken pipe) if silent
                hide_listen_animation()
                Clock.schedule_once(
                    partial(update_chat, get_random_rep_request(), False,
                            False), 0.1)

        def record_user_response(instance):
            # print("Recording audio")
            show_listen_animation()
            Clock.schedule_once(listen_callback, 0)

        def show_listen_animation():
            button.text = listen_msg
            chat_view.text += indicator

        def hide_listen_animation():
            button.text = "Record"
            chat_view.text = chat_view.text[:-len(indicator)]

        def update_chat(text, is_user=False, confirm=False, *largs):
            if is_user:
                chat_view.text += text + '\n\n'
            else:
                response = ""
                if confirm:
                    response += get_random_confirmation()
                response += text

                Clock.schedule_once(partial(play_text_callback, response), 0.1)

                chat_view.text += color_text(response + '\n\n')

        button.bind(on_press=record_user_response)

        main_box_layout.add_widget(chat_view)
        main_box_layout.add_widget(in_box_layout)

        in_box_layout.add_widget(button)

        return main_box_layout
Пример #51
0
        return False
    except:
        return False


def compute_size(maxs, imgw, imgh):
    if imgw > imgh:
        return maxs, maxs * imgh / imgw
    else:
        return maxs * imgw / imgh, maxs


if __name__ == "__main__":
    from kivy.base import runTouchApp
    from kivy.uix.boxlayout import BoxLayout
    from kivy.uix.label import Label

    box = BoxLayout(orientation="vertical")
    fileChooser = FileChooserThumbView(thumbsize=128)
    label = Label(markup=True, size_hint_y=None)
    fileChooser.mylabel = label

    box.add_widget(fileChooser)
    box.add_widget(label)

    def setlabel(instance, value):
        instance.mylabel.text = "[b]Selected:[/b] {0}".format(value)

    fileChooser.bind(selection=setlabel)

    runTouchApp(box)
Пример #52
0
class GameInspector(Screen):
    def __init__(self):
        super(GameInspector, self).__init__(name='GameInspector')
        self.main_layout = BoxLayout(orientation='vertical')
        self.first_row = BoxLayout(orientation='horizontal')
        self.second_row = BoxLayout(orientation='horizontal')
        self.main_layout.add_widget(self.first_row)
        self.main_layout.add_widget(self.second_row)

        self.fps_plot = fps_plot.get_fps_plot()
        self.video = video_player.get_video_player()
        self.screenshot = screenshot.get_screenshot()
        self.config = options.get_config(self.fps_plot, self.video,
                                         self.screenshot)

        self.first_row.add_widget(self.config)
        self.first_row.add_widget(self.fps_plot)
        self.second_row.add_widget(self.video)
        self.second_row.add_widget(self.screenshot)

        self.add_widget(self.main_layout)
Пример #53
0
    def lay_clock(self, clock, list_ti, type_clock):

        ti_yr = TextInput(multiline=False, font_size=12)
        ti_yr.text = clock[0]
        list_ti.append(ti_yr)

        ti_mo = TextInput(multiline=False, font_size=12)
        ti_mo.text = clock[1]
        list_ti.append(ti_mo)

        ti_day = TextInput(multiline=False, font_size=12)
        ti_day.text = clock[2]
        list_ti.append(ti_day)

        ti_hr = TextInput(multiline=False, font_size=12)
        ti_hr.text = clock[3]
        list_ti.append(ti_hr)

        ti_min = TextInput(multiline=False, font_size=12)
        ti_min.text = clock[4]
        list_ti.append(ti_min)

        ti_sec = TextInput(multiline=False, font_size=12)
        ti_sec.text = clock[5]
        list_ti.append(ti_sec)

        ele_time = self.lang['Elements_Time']
        ele_time = ele_time.split(',')

        lb_yr = Label(font_size=12)
        lb_yr.text = ele_time[0]

        lb_mo = Label(font_size=12)
        lb_mo.text = ele_time[1]

        lb_day = Label(font_size=12)
        lb_day.text = ele_time[2]

        lb_hr = Label(font_size=12)
        lb_hr.text = ele_time[3]

        lb_min = Label(font_size=12)
        lb_min.text = ele_time[4]

        lb_sec = Label(font_size=12)
        lb_sec.text = ele_time[5]

        box_lay = BoxLayout()

        lb_type_clock = Label(font_size=12, text=type_clock)

        box_lay.add_widget(lb_type_clock)
        box_lay.add_widget(lb_yr)
        box_lay.add_widget(ti_yr)

        box_lay.add_widget(lb_mo)
        box_lay.add_widget(ti_mo)

        box_lay.add_widget(lb_day)
        box_lay.add_widget(ti_day)

        box_lay.add_widget(lb_hr)
        box_lay.add_widget(ti_hr)

        box_lay.add_widget(lb_min)
        box_lay.add_widget(ti_min)

        box_lay.add_widget(lb_sec)
        box_lay.add_widget(ti_sec)

        return box_lay
 def build(self):
     layout1=BoxLayout(orientation="vertical")
     def evaluate1(self):
         try:
             x=symbols(str(text2.text))
             ans=diff(str(text1.text),x)
             popup1=Popup(title="The answer is",content=Label(text=str(ans)),size_hint=(None,None),size=(300,100))
             popup1.open()
         except:
             popup1=Popup(title="Error!",content=Label(text="Please enter a valid expression"),size_hint=(None,None),size=(300,100))
             popup1.open()
     def evaluate2(self):
         try:
             x=symbols(str(text2.text))
             lower=str(text3.text)
             upper=str(text4.text)
             ans=integrate(str(text1.text),(x,lower,upper))
             popup1=Popup(title="The answer is",content=Label(text=str(ans)),size_hint=(None,None),size=(300,100))
             popup1.open()
         except:
             popup1=Popup(title="Error!",content=Label(text="Please enter a valid expression"),size_hint=(None,None),size=(300,100))
             popup1.open()
         
     label1=Label(text="Differentiator and Integrator",top=layout1.top,font_size=20,size_hint_y=0.2)
     layout1.add_widget(label1)
     label2=Label(text="Type the expression here!",size_hint_y=0.2,font_size=15)
     layout1.add_widget(label2)
     text1=TextInput(size_hint_y=0.15,multiline=False,font_size=20)
     label4=Label(text="Independent variable",size_hint_y=0.2,font_size=15)
     text2=TextInput(size_hint_y=0.1,font_size=20,multiline=False)
     label5=Label(text="Enter the lower limit(for integration)",size_hint_y=0.2,font_size=15)
     text3=TextInput(size_hint_y=0.1,font_size=15)
     label6=Label(text="Enter the upper limit(for integration)",size_hint_y=0.2,font_size=15)
     text4=TextInput(size_hint_y=0.1,font_size=15)
     label7=Label(text="",size_hint_y=0.1,font_size=15)
     layout1.add_widget(text1)
     layout1.add_widget(label4)
     layout1.add_widget(text2)
     layout1.add_widget(label5)
     layout1.add_widget(text3)
     layout1.add_widget(label6)
     layout1.add_widget(text4)
     Button1=Button(text="Differentiate",size_hint=(None,0.1),font_size=15,width=100,on_press=evaluate1)
     Button2=Button(text="Integrate",size_hint=(None,0.1),font_size=15,width=100,on_press=evaluate2)
     label8=Label(text="",size_hint_y=0.1,font_size=15,size_hint_x=0.2)
     label9=Label(text="",size_hint_y=0.1,font_size=15,size_hint_x=0.2)
     layout1.add_widget(label7)
     layout1.add_widget(Button1)
     layout1.add_widget(label8)
     layout1.add_widget(Button2)
     layout1.add_widget(label9)
     return layout1
Пример #55
0
    def make_show_clk(self):

        box_clk_modes = BoxLayout()
        box_clk_modes.size_hint_y = None
        box_clk_modes.height = 85

        box_mode = BoxLayout()
        box_mode.size_hint_x = None
        box_mode.width = 180
        box_mode.orientation = 'vertical'
        bt_remote_reference = ButtonBlack(text=self.lang['Remote_Reference'])
        bt_remote_reference.on_press = self.not_yet_implemented
        bt_remote_reference.width = 150
        lay_setting_bt_remote_reference = BoxLayout()
        lay_setting_bt_remote_reference.add_widget(
            Label(size_hint_x=None, width=10))
        lay_setting_bt_remote_reference.add_widget(bt_remote_reference)

        box_mode.add_widget(lay_setting_bt_remote_reference)

        box_clk_modes.add_widget(box_mode)
        box_clk_modes.add_widget(self.clock())
        box_clk_modes.add_widget(Label(size_hint_x=None, width=10))

        return box_clk_modes
Пример #56
0
    def make_lay_setting_processingZ(self, line_file_asc):

        box_setting_processingZ = BoxLayout()
        box_setting_processingZ.size_hint_y = None
        box_setting_processingZ.height = 30

        box_setting_processingZ.add_widget(Label(text=line_file_asc[0]))

        ti_frequency = TextInput(text=line_file_asc[1])
        ti_frequency.multiline = False
        ti_frequency.size_hint_x = None
        ti_frequency.width = 200
        self.list_ti_frequency.append(ti_frequency)

        ti_mode = TextInput(text=line_file_asc[2])
        ti_mode.multiline = False
        ti_mode.size_hint_x = None
        ti_mode.width = 80
        self.list_ti_mode.append(ti_mode)

        box_setting_processingZ.add_widget(ti_frequency)
        box_setting_processingZ.add_widget(ti_mode)
        box_setting_processingZ.add_widget(Label(size_hint_x=None, width=10))

        return box_setting_processingZ
Пример #57
0
class TabItemFilesAsc(TabbedPanelItem):

    file_asc = ObjectProperty(None)
    lang = ObjectProperty(None)

    def __init__(self, **kwargs):
        super(TabItemFilesAsc, self).__init__(**kwargs)
        self.text = self.file_asc.name
        self.textbt = self.file_asc.name

        self.list_ti_frequency = []
        self.list_ti_mode = []

        self.lay_file_asc = BoxLayout()
        self.lay_file_asc.orientation = 'vertical'

        # ====================== Button Add Line in processingZ ====================
        #  Layout to button add line in processing Z
        box_lay_set_button_add_ss = BoxLayout(size_hint_y=None, height=25)
        box_lay_set_button_add_ss.height = 25
        box_lay_set_button_add_ss.add_widget(Label(size_hint_x=None, width=30))

        # Button for add line in file processingZ
        self.bt_add_ss = ButtonBlack(size_hint_x=None)
        self.bt_add_ss.height = 25
        self.bt_add_ss.width = 25
        self.bt_add_ss.text = '+'
        self.bt_add_ss.on_press = self.add_new_lay_setting_processingZ

        box_lay_set_button_add_ss.add_widget(self.bt_add_ss)
        box_lay_set_button_add_ss.add_widget(Label())
        # ==========================================================================

        self.box_lay_lines_processingZ = BoxLayout()
        self.box_lay_lines_processingZ.orientation = 'vertical'

        # ================================= BoxLayout content file processingZ ======
        # Read file processingZ
        dict_lines = self.read_file_processingZ(self.file_asc)

        # Add line in layout
        for lay in range(self.num_line_file_processingZ):
            self.add_lay_setting_processingZ(dict_lines[str(lay)])
        # ===========================================================================

        # ================================= BoxLayout content clock =================

        self.box_lay_clock = BoxLayout()
        self.box_lay_clock.orientation = 'vertical'

        #            ======= Name File clk
        box_lay_clock_name_clk = BoxLayout()
        box_lay_clock_name_clk.size_hint_y = None
        box_lay_clock_name_clk.height = 30
        box_lay_clock_name_clk.add_widget(Label())
        box_lay_clock_name_clk.add_widget(
            Label(text=self.nameasc_to_nameclk()))
        box_lay_clock_name_clk.add_widget(Label(size_hint_x=None, width=10))

        self.box_lay_clock.add_widget(box_lay_clock_name_clk)
        self.box_lay_clock.add_widget(self.make_show_clk())
        # ==========================================================================

        # ============= BoxLayout Button Save ======================================

        box_lay_set_button_save = BoxLayout()
        box_lay_set_button_save.size_hint_y = None
        box_lay_set_button_save.height = 30
        box_lay_set_button_save.add_widget(Label())

        bt_save = ButtonBlack()
        bt_save.text = self.lang['Save']
        bt_save.on_press = self.save_change

        box_lay_set_button_save.add_widget(Label())
        box_lay_set_button_save.add_widget(bt_save)
        box_lay_set_button_save.add_widget(Label(size_hint_x=None, width=10))

        # Layout setting file asc
        self.lay_file_asc.add_widget(Label(size_hint_y=None, height=10))
        self.lay_file_asc.add_widget(box_lay_set_button_add_ss)
        self.lay_file_asc.add_widget(Label(size_hint_y=None, height=5))
        self.lay_file_asc.add_widget(self.box_lay_lines_processingZ)
        self.lay_file_asc.add_widget(Label())
        self.lay_file_asc.add_widget(self.box_lay_clock)
        self.lay_file_asc.add_widget(Label())
        self.lay_file_asc.add_widget(box_lay_set_button_save)
        self.lay_file_asc.add_widget(Label(size_hint_y=None, height=5))

        self.content = self.lay_file_asc

        self.read_file_clk()

    def close_bubble_not_set(self, bubble):

        time.sleep(1)
        self.lay_file_asc.remove_widget(bubble)

    def open_bubble_not_set(self, ti_not_set):

        float_lay = FloatLayout()
        float_lay.size_hint = None, None
        float_lay.width = 0
        float_lay.height = 0

        bubble_not_set = Bubble()
        bubble_not_set.size_hint = None, None
        bubble_not_set.width = 80
        bubble_not_set.height = 30
        bubble_not_set.center_x = ti_not_set.center_x
        bubble_not_set.center_y = ti_not_set.center_y - 30
        bubble_not_set.arrow_pos = 'top_mid'
        bubble_not_set.background_color = (1, 0, 0, 1)

        bt_not_set = BubbleButton()
        bt_not_set.font_size = 12

        bt_not_set.text = self.lang['Not_Set']

        bubble_not_set.add_widget(bt_not_set)

        float_lay.add_widget(bubble_not_set)

        #self.add_widget(bubble_not_set)
        self.lay_file_asc.add_widget(float_lay)
        parallel_close = threading.Thread(target=self.close_bubble_not_set,
                                          args=(float_lay, ))
        parallel_close.start()

    def save_change(self):

        arq_file_asc = open(
            'PampaMT/band_asc/' + self.file_asc.site + '/band_' +
            self.file_asc.band + '/' + self.file_asc.name, 'w')
        #print('PampaMT/band_asc/' + self.file_asc.site + '/band_' + self.file_asc.band + '/' + self.file_asc.name)

        i = 0
        for number_modes in self.list_ti_frequency:

            if self.list_ti_frequency[i].text == '':
                self.open_bubble_not_set(self.list_ti_frequency[i])

            elif self.list_ti_mode[i].text == '':
                self.open_bubble_not_set(self.list_ti_mode[i])

            else:
                line_save_file_band = self.file_asc.name + ' ' + self.list_ti_frequency[
                    i].text + ' ' + self.list_ti_mode[i].text
                #print(self.file_asc.)
                arq_file_asc.write(line_save_file_band + '\n')
                print(line_save_file_band)
            i += 1

        arq_file_asc.close()

        print('save ')

    def make_show_clk(self):

        box_clk_modes = BoxLayout()
        box_clk_modes.size_hint_y = None
        box_clk_modes.height = 85

        box_mode = BoxLayout()
        box_mode.size_hint_x = None
        box_mode.width = 180
        box_mode.orientation = 'vertical'
        bt_remote_reference = ButtonBlack(text=self.lang['Remote_Reference'])
        bt_remote_reference.on_press = self.not_yet_implemented
        bt_remote_reference.width = 150
        lay_setting_bt_remote_reference = BoxLayout()
        lay_setting_bt_remote_reference.add_widget(
            Label(size_hint_x=None, width=10))
        lay_setting_bt_remote_reference.add_widget(bt_remote_reference)

        box_mode.add_widget(lay_setting_bt_remote_reference)

        box_clk_modes.add_widget(box_mode)
        box_clk_modes.add_widget(self.clock())
        box_clk_modes.add_widget(Label(size_hint_x=None, width=10))

        return box_clk_modes

    def not_yet_implemented(self):
        popup = Popup(size_hint=[None, None])
        popup.height = 70
        popup.width = 200

        popup.title = self.lang['Not_yet_implemented']
        popup.open()

    def clock(self):

        box_lay = BoxLayout()
        box_lay.orientation = 'vertical'

        sampling_rate, clock_reset, clock_zero = self.read_file_clk()

        lay_sampling_rate = self.lay_sampling_rate(sampling_rate)
        lay_clock_reset = self.lay_clock(clock_reset, self.list_ti_clock_reset,
                                         self.lang['Reset'])
        lay_clock_zero = self.lay_clock(clock_zero, self.list_ti_clock_zero,
                                        self.lang['Zero'])

        box_lay.add_widget(LabelWhite(size_hint_y=None, height=1))
        box_lay.add_widget(lay_sampling_rate)
        box_lay.add_widget(LabelWhite(size_hint_y=None, height=1))
        box_lay.add_widget(lay_clock_reset)
        box_lay.add_widget(lay_clock_zero)
        box_lay.add_widget(LabelWhite(size_hint_y=None, height=1))

        return box_lay

    def lay_sampling_rate(self, sampling_rate):

        box_lay = BoxLayout()

        box_lay.add_widget(Label(text=self.lang['Sampling_Rate']))

        rate_s = sampling_rate[0]

        rate_Hz = 1 / float(rate_s)

        text_lb_rate_s = NumberSI()
        text_lb_rate_s.read_number(rate_s)
        text_lb_rate_s.unit = 's'
        text_convert_lb_rate_s = text_lb_rate_s.scientific_notation_to_SI()

        lb_rate_s = Label(text=text_convert_lb_rate_s)

        lb_rate_Hz = Label(text=(str(round(rate_Hz, 2)) + ' Hz'))

        box_lay.add_widget(lb_rate_s)
        box_lay.add_widget(lb_rate_Hz)

        print(rate_s)

        return box_lay

    list_ti_clock_reset = []
    list_ti_clock_zero = []

    def lay_clock(self, clock, list_ti, type_clock):

        ti_yr = TextInput(multiline=False, font_size=12)
        ti_yr.text = clock[0]
        list_ti.append(ti_yr)

        ti_mo = TextInput(multiline=False, font_size=12)
        ti_mo.text = clock[1]
        list_ti.append(ti_mo)

        ti_day = TextInput(multiline=False, font_size=12)
        ti_day.text = clock[2]
        list_ti.append(ti_day)

        ti_hr = TextInput(multiline=False, font_size=12)
        ti_hr.text = clock[3]
        list_ti.append(ti_hr)

        ti_min = TextInput(multiline=False, font_size=12)
        ti_min.text = clock[4]
        list_ti.append(ti_min)

        ti_sec = TextInput(multiline=False, font_size=12)
        ti_sec.text = clock[5]
        list_ti.append(ti_sec)

        ele_time = self.lang['Elements_Time']
        ele_time = ele_time.split(',')

        lb_yr = Label(font_size=12)
        lb_yr.text = ele_time[0]

        lb_mo = Label(font_size=12)
        lb_mo.text = ele_time[1]

        lb_day = Label(font_size=12)
        lb_day.text = ele_time[2]

        lb_hr = Label(font_size=12)
        lb_hr.text = ele_time[3]

        lb_min = Label(font_size=12)
        lb_min.text = ele_time[4]

        lb_sec = Label(font_size=12)
        lb_sec.text = ele_time[5]

        box_lay = BoxLayout()

        lb_type_clock = Label(font_size=12, text=type_clock)

        box_lay.add_widget(lb_type_clock)
        box_lay.add_widget(lb_yr)
        box_lay.add_widget(ti_yr)

        box_lay.add_widget(lb_mo)
        box_lay.add_widget(ti_mo)

        box_lay.add_widget(lb_day)
        box_lay.add_widget(ti_day)

        box_lay.add_widget(lb_hr)
        box_lay.add_widget(ti_hr)

        box_lay.add_widget(lb_min)
        box_lay.add_widget(ti_min)

        box_lay.add_widget(lb_sec)
        box_lay.add_widget(ti_sec)

        return box_lay

    def read_file_clk(self):

        nameclk = self.nameasc_to_nameclk()
        arq_clk = open('DATA/' + nameclk, 'r')

        i = 0
        for line in arq_clk:
            if i == 0:
                sampling_rate = line

            elif i == 1:
                clock_reset = line

            else:
                clock_zero = line

            i += 1

        sampling_rate = sampling_rate.split()
        clock_reset = clock_reset.split()
        clock_zero = clock_zero.split()

        print('')
        print('Clock: ')
        print(sampling_rate)
        print(clock_reset)
        print(clock_zero)

        text_clk = arq_clk.read()
        arq_clk.close()

        return sampling_rate, clock_reset, clock_zero

    def nameasc_to_nameclk(self):

        nameasc = self.file_asc.name
        nameclk = nameasc.replace(".asc", ".clk")

        return nameclk

    def add_new_lay_setting_processingZ(self):

        line_file_asc = [self.file_asc.name, '', '']
        self.num_line_file_processingZ += 1

        self.line_processingZ = self.make_lay_setting_processingZ(
            line_file_asc)
        self.box_lay_lines_processingZ.add_widget(self.line_processingZ)

    def add_lay_setting_processingZ(self, line_file_asc):

        self.line_processingZ = self.make_lay_setting_processingZ(
            line_file_asc)
        self.box_lay_lines_processingZ.add_widget(self.line_processingZ)

    def make_lay_setting_processingZ(self, line_file_asc):

        box_setting_processingZ = BoxLayout()
        box_setting_processingZ.size_hint_y = None
        box_setting_processingZ.height = 30

        box_setting_processingZ.add_widget(Label(text=line_file_asc[0]))

        ti_frequency = TextInput(text=line_file_asc[1])
        ti_frequency.multiline = False
        ti_frequency.size_hint_x = None
        ti_frequency.width = 200
        self.list_ti_frequency.append(ti_frequency)

        ti_mode = TextInput(text=line_file_asc[2])
        ti_mode.multiline = False
        ti_mode.size_hint_x = None
        ti_mode.width = 80
        self.list_ti_mode.append(ti_mode)

        box_setting_processingZ.add_widget(ti_frequency)
        box_setting_processingZ.add_widget(ti_mode)
        box_setting_processingZ.add_widget(Label(size_hint_x=None, width=10))

        return box_setting_processingZ

    num_line_file_processingZ = 0

    def read_file_processingZ(self, file_asc):

        dict_file_processingZ = {}

        print('PampaMT/band_asc/' + file_asc.site + '/band_' + file_asc.band +
              '/' + file_asc.name)

        arq_file_processingZ = open(
            'PampaMT/band_asc/' + file_asc.site + '/band_' + file_asc.band +
            '/' + file_asc.name, 'r')

        for line_all in arq_file_processingZ:

            line = line_all.split()

            dict_file_processingZ[str(self.num_line_file_processingZ)] = line

            self.num_line_file_processingZ += 1

        arq_file_processingZ.close()

        return dict_file_processingZ
Пример #58
0
    def clock(self):

        box_lay = BoxLayout()
        box_lay.orientation = 'vertical'

        sampling_rate, clock_reset, clock_zero = self.read_file_clk()

        lay_sampling_rate = self.lay_sampling_rate(sampling_rate)
        lay_clock_reset = self.lay_clock(clock_reset, self.list_ti_clock_reset,
                                         self.lang['Reset'])
        lay_clock_zero = self.lay_clock(clock_zero, self.list_ti_clock_zero,
                                        self.lang['Zero'])

        box_lay.add_widget(LabelWhite(size_hint_y=None, height=1))
        box_lay.add_widget(lay_sampling_rate)
        box_lay.add_widget(LabelWhite(size_hint_y=None, height=1))
        box_lay.add_widget(lay_clock_reset)
        box_lay.add_widget(lay_clock_zero)
        box_lay.add_widget(LabelWhite(size_hint_y=None, height=1))

        return box_lay
Пример #59
0
    def build(self):
        from kivy.uix.slider import Slider

        def test(*ars):
            gauge.value = s.value

            print(s.value)

        def test_(*ars):

            gauge_.value = s1.value
            print(s.value)

        def callback(instance):
            if (instance == button1):
                print("Change speed to 20km/hr")
                gauge_.value = 20
            elif (instance == button2):
                print("Change speed to 60km/hr")
                gauge_.value = 60
            else:
                print("Change speed to 100km/hr")
                gauge_.value = 100

        box = BoxLayout(orientation='horizontal', spacing=10, padding=10)
        gauge_ = Gauge(value=150, size_gauge=256, size_text=19)

        box.add_widget(gauge_)

        s = Slider(min=0, max=140, value=0)

        s1 = Slider(min=0, max=140, value=0)

        s1.bind(value=test_)
        box.add_widget(s1)

        button1 = Button(text='20Km/hr',
                         font_size=14,
                         size_hint_x=0.3,
                         size_hint_y=0.2)
        button2 = Button(text='60Km/hr',
                         font_size=14,
                         size_hint_x=0.3,
                         size_hint_y=0.2)
        button3 = Button(text='100Km/hr',
                         font_size=14,
                         size_hint_x=0.3,
                         size_hint_y=0.2)

        box.add_widget(button1)
        button1.bind(on_press=callback)

        box.add_widget(button2)
        button2.bind(on_press=callback)

        box.add_widget(button3)
        button3.bind(on_press=callback)

        return box
Пример #60
0
    def __init__(self, **kwargs):
        super(TabItemFilesAsc, self).__init__(**kwargs)
        self.text = self.file_asc.name
        self.textbt = self.file_asc.name

        self.list_ti_frequency = []
        self.list_ti_mode = []

        self.lay_file_asc = BoxLayout()
        self.lay_file_asc.orientation = 'vertical'

        # ====================== Button Add Line in processingZ ====================
        #  Layout to button add line in processing Z
        box_lay_set_button_add_ss = BoxLayout(size_hint_y=None, height=25)
        box_lay_set_button_add_ss.height = 25
        box_lay_set_button_add_ss.add_widget(Label(size_hint_x=None, width=30))

        # Button for add line in file processingZ
        self.bt_add_ss = ButtonBlack(size_hint_x=None)
        self.bt_add_ss.height = 25
        self.bt_add_ss.width = 25
        self.bt_add_ss.text = '+'
        self.bt_add_ss.on_press = self.add_new_lay_setting_processingZ

        box_lay_set_button_add_ss.add_widget(self.bt_add_ss)
        box_lay_set_button_add_ss.add_widget(Label())
        # ==========================================================================

        self.box_lay_lines_processingZ = BoxLayout()
        self.box_lay_lines_processingZ.orientation = 'vertical'

        # ================================= BoxLayout content file processingZ ======
        # Read file processingZ
        dict_lines = self.read_file_processingZ(self.file_asc)

        # Add line in layout
        for lay in range(self.num_line_file_processingZ):
            self.add_lay_setting_processingZ(dict_lines[str(lay)])
        # ===========================================================================

        # ================================= BoxLayout content clock =================

        self.box_lay_clock = BoxLayout()
        self.box_lay_clock.orientation = 'vertical'

        #            ======= Name File clk
        box_lay_clock_name_clk = BoxLayout()
        box_lay_clock_name_clk.size_hint_y = None
        box_lay_clock_name_clk.height = 30
        box_lay_clock_name_clk.add_widget(Label())
        box_lay_clock_name_clk.add_widget(
            Label(text=self.nameasc_to_nameclk()))
        box_lay_clock_name_clk.add_widget(Label(size_hint_x=None, width=10))

        self.box_lay_clock.add_widget(box_lay_clock_name_clk)
        self.box_lay_clock.add_widget(self.make_show_clk())
        # ==========================================================================

        # ============= BoxLayout Button Save ======================================

        box_lay_set_button_save = BoxLayout()
        box_lay_set_button_save.size_hint_y = None
        box_lay_set_button_save.height = 30
        box_lay_set_button_save.add_widget(Label())

        bt_save = ButtonBlack()
        bt_save.text = self.lang['Save']
        bt_save.on_press = self.save_change

        box_lay_set_button_save.add_widget(Label())
        box_lay_set_button_save.add_widget(bt_save)
        box_lay_set_button_save.add_widget(Label(size_hint_x=None, width=10))

        # Layout setting file asc
        self.lay_file_asc.add_widget(Label(size_hint_y=None, height=10))
        self.lay_file_asc.add_widget(box_lay_set_button_add_ss)
        self.lay_file_asc.add_widget(Label(size_hint_y=None, height=5))
        self.lay_file_asc.add_widget(self.box_lay_lines_processingZ)
        self.lay_file_asc.add_widget(Label())
        self.lay_file_asc.add_widget(self.box_lay_clock)
        self.lay_file_asc.add_widget(Label())
        self.lay_file_asc.add_widget(box_lay_set_button_save)
        self.lay_file_asc.add_widget(Label(size_hint_y=None, height=5))

        self.content = self.lay_file_asc

        self.read_file_clk()