예제 #1
0
def update_timeline(timeline, content=None):
    if content is None:
        timeline.add_widget(
            Label(text="[b]. . .[/b]",
                  markup=True,
                  size_hint_y=None,
                  height=20))
    else:
        msg = TextInput(
            text=content,
            size_hint_y=None,
            font_name=FONTS['timeline'],
            readonly=True,
        )
        msg.background_color = choice(
            COLORS
        ) if SETTINGS['ui']['flags']['enable-item-random-color'] else (1, 1, 1,
                                                                       1)
        msg.foreground_color = [0, 0, 0, 1]

        # TODO >_<
        msg.size = (_Window.width,
                    msg.line_height * len(content.splitlines()) +
                    msg.line_spacing * (len(content.splitlines()) - 1) +
                    msg.padding[1] + msg.padding[3])
        timeline.add_widget(msg)
예제 #2
0
    def update_timeline(self, content=None, room_alias=None):
        if content is None:
            self.timeline.add_widget(
                Label(text="[b]. . .[/b]",
                      markup=True,
                      size_hint_y=None,
                      height=20))
        else:
            room_item = TextInput(
                text=content,
                size_hint_y=None,
                font_name=FONTS['timeline'],
                readonly=True,
            )
            room_item.background_color = choice(COLORS) if SETTINGS['ui'][
                'flags']['enable-item-random-color'] else (1, 1, 1, 1)
            room_item.foreground_color = [0, 0, 0, 1]
            room_item.bind(
                focus=lambda this, value: self._item_click(this, value))

            room_item.size = (
                _Window.width,
                room_item.line_height * len(content.splitlines()) +
                room_item.line_spacing * (len(content.splitlines()) - 1) +
                room_item.padding[1] + room_item.padding[3])
            room_item.to_room = room_alias
            self.timeline.add_widget(room_item)
예제 #3
0
파일: main.py 프로젝트: Mau21710/Mentor
 def build(self):
     """config = ConfigParser()
     config.read('conf.ini')
     self.config = Settings()
     # s.add_json_panel('My custom panel', config, 'settings_custom.json')"""
     self.icon = 'images/ic_launcher.png'
     self.osc_activities = []
     self.speechs = []
     self.osc_id = osc.listen(ipAddr='0.0.0.0', port=activity_port)
     self.count_requests = 0
     self.timer_value = "40.10.10.1"
     if platform == 'android':
         from android import AndroidService
         service = AndroidService('Mentor Service', 'running')
         service.start('service started')
         self.service = service
         self.folder_music = "/storage/emulated/legacy/Music/PerAttivita"
     elif platform == 'win':
         self.folder_music = "C:\\Mao\\Progetti\\Musica\\MusicaSuNexus\\PerAttivita"
     else:
         self.folder_music = ".\\music"
     Logger.info("Folder music: {}".format(self.folder_music))
     self.sequences = mentor_lib.Sequences()
     self.sequences.load_sequences()
     self.root = MentorWidget()
     text_input = TextInput(text=self.timer_value, font_size=40, multiline=False)  #, size_hint=(None, None))  # font_size=20,
     text_input.foreground_color = [1, 1, 1, 1]
     text_input.background_color = [0, 0, 0, 0]
     text_input.shorten_from = 'center'
     #text_input.center_x = True
     #text_input.center_y = True
     text_input.bind(text=self.on_text_input_text)
     self.root.ids.grid_main.add_widget(text_input)
     btn = Button(text="Custom Timer")  #, size_hint_y=None, height=40)
     #btn.height = text_input.content_height
     btn.bind(on_press=partial(self.start_sequence, "timer"))
     self.root.ids.grid_main.add_widget(btn)
     for title in self.sequences.titles:
         btn = Button(text=title)#, size_hint_y=None, height=40)
         btn.bind(on_press=partial(self.start_sequence, title))
         self.root.ids.grid_main.add_widget(btn)
     #if len(self.sequences.titles)%2:
     #    btn = Button(text="_     _", id='pippo')  #, size_hint_y=None, height=40)
     #    self.root.ids.grid_main.add_widget(btn)
     #self.start_sequence_ok = False
     #self.sequence_buttons = []
     #for i in self.sequences.titles:
         #self.sequence_buttons.append(Button(text=str(i)))
         #self.sequence_buttons[-1].bind(on_press=self.start_sequence(str(i)))
         #self.sequence_buttons[-1].bind(on_release=self.start_sequence(str(i)))
         #btn.bind(state=self.start_sequence(str(i)))
         #btn.bind(on_release=self.root.start_sequence(btn.text))
         #self.root.ids.grid_main.add_widget(self.sequence_buttons[-1])
         #self.root.ids.grid_main.add_widget(Button(text=str(i), on_press=self.start_sequence(str(i))))
     #self.start_sequence_ok = True
     osc.init()
     osc.bind(self.osc_id, self.msg_from_server, '/msg')
     osc.bind(self.osc_id, self.root.write_cockpit, '/osd')
     Clock.schedule_interval(self.timed_ops, .1)
     return self.root
예제 #4
0
파일: main.py 프로젝트: sziaru/in-matrix
def update_timeline(timeline, content=None):
    if content is None:
        timeline.add_widget(Label(text="[b]. . .[/b]", markup=True, size_hint_y=None, height=20))
    else:
        msg = TextInput(text=content,
            size_hint_y=None,
            font_name=FONTS['timeline'],
            readonly=True,
        )
        msg.background_color = choice(COLORS) if SETTINGS['ui']['flags']['enable-item-random-color'] else (1, 1, 1, 1)
        msg.foreground_color = [0, 0, 0, 1]
        
        # TODO >_<
        msg.size = (_Window.width, 
            msg.line_height * len(content.splitlines())
            + msg.line_spacing * (len(content.splitlines()) - 1)
            + msg.padding[1] + msg.padding[3])
        timeline.add_widget(msg)
예제 #5
0
파일: main.py 프로젝트: sziaru/in-matrix
 def update_timeline(self, content=None, room_alias=None):
     if content is None:
         self.timeline.add_widget(Label(text="[b]. . .[/b]", markup=True, size_hint_y=None, height=20))
     else:
         room_item = TextInput(text=content,
             size_hint_y=None,
             font_name=FONTS['timeline'],
             readonly=True,
         )
         room_item.background_color = choice(COLORS) if SETTINGS['ui']['flags']['enable-item-random-color'] else (1, 1, 1, 1)
         room_item.foreground_color = [0, 0, 0, 1]
         room_item.bind(focus=lambda this, value: self._item_click(this, value))
         
         room_item.size = (_Window.width, 
             room_item.line_height * len(content.splitlines())
             + room_item.line_spacing * (len(content.splitlines()) - 1)
             + room_item.padding[1] + room_item.padding[3])
         room_item.to_room = room_alias
         self.timeline.add_widget(room_item)
예제 #6
0
    def build(self):

        layout = FloatLayout()

        label_p = Label()
        label_p.text = '''Conversor de Números Inteiros\nRetorna um texto representando o número por extenso.\n O número deve estar entre 0 e 999999999999999999.'''
        label_p.pos_hint = {'center_x': 0.5, 'top': 0.98}
        label_p.size_hint = (0.7, (1 / 4))
        label_p.halign = 'center'
        label_p.font_size = 20
        label_p.color = [1, 1, 1, 1]

        texto_area = TextInput()
        texto_area.pos_hint = {'x': 0.05, 'y': 0.40}
        texto_area.size_hint = (0.6, (1 / 4))
        texto_area.background_color = [1, 1, 1, 1]
        texto_area.input_filter = 'int'
        texto_area.hint_text = "Digite um número natural..."
        texto_area.hint_text_color = (1, 0, 0, 1)
        texto_area.multiline = False
        texto_area.font_size = '23sp'

        texto_area_f = TextInput()
        texto_area_f.pos_hint = {'center_x': 0.5, 'y': 0.03}
        texto_area_f.size_hint = (0.99, (1 / 3))
        texto_area_f.background_color = [1, 1, 1, 1]
        texto_area_f.readonly = True
        texto_area_f.cursor_blink = False
        texto_area_f.font_size = '20sp'
        texto_area_f.foreground_color = (0, 0, 0, 1)

        botao_1 = Button()
        botao_1.text = "CONVERTER"
        botao_1.pos_hint = {'x': 0.65, 'y': 0.40}
        botao_1.size_hint = (0.15, (1 / 4))
        botao_1.background_color = (0, 0, 0, 1)
        botao_1.background_normal = ''

        botao_copia = Button()
        botao_copia.text = "COPIAR"
        botao_copia.pos_hint = {'x': 0.80, 'y': 0.40}
        botao_copia.size_hint = (0.15, (1 / 4))
        botao_copia.background_color = (0, 0, 0, 1)
        botao_copia.background_normal = ''

        layout.add_widget(label_p)
        layout.add_widget(texto_area)
        layout.add_widget(texto_area_f)
        layout.add_widget(botao_1)
        layout.add_widget(botao_copia)

        Window.size = (800, 300)
        Window.clearcolor = (0.2, 0.8, 1, 1)

        def copia_texto():
            texto_area_f.copy(data=texto_area_f.text)

        def ver_num():
            if texto_area.text == "":
                texto_area_f.text = 'Vazio'
            else:
                if int(texto_area.text) >= 0 and int(
                        texto_area.text) <= 999999999999999999:
                    texto_area_f.text = num_exten(int(texto_area.text))
                else:
                    texto_area.text = ""
                    texto_area_f.text = ""

        botao_1.on_press = ver_num
        botao_copia.on_press = copia_texto
        return layout
예제 #7
0
    def __init__(self, **kw):
        super().__init__(**kw)
        layout = BoxLayout()
        layout.orientation = "vertical"
        layout.opacity = 1.0
        layout.padding = 20
        layout.spacing = 20
        grid = GridLayout()
        grid.spacing = 10
        grid.cols = 2

        #RENDSZAM
        rendszamgomb = Button(text="Rendszám:", size_hint=(1.0, 0.1))
        rendszamgomb.pos_hint = {"center_x": 0.5, 'y': 0.0}
        rendszamgomb.color = (1.0, 1.0, 1.0, 1)
        rendszamgomb.bind(on_press=self.clearRendszammezo)
        grid.add_widget(rendszamgomb)

        rendszammezo = TextInput(multiline=False, write_tab=False)
        rendszammezo.foreground_color = (0.0, 0.0, 0.0, 5)
        rendszammezo.background_color = (1.0, 1.0, 1.0, 5)
        rendszammezo.font_size = 30
        rendszammezo.font_name = "Roboto-Bold"
        layout.rendszammezo = rendszammezo
        grid.add_widget(rendszammezo)

        #ÉVJÁRAT
        evjaratgomb = Button(text="Évjárat:", size_hint=(1.0, 0.1))
        evjaratgomb.pos_hint = {"center_x": 0.5, 'y': 0.0}
        evjaratgomb.color = (1.0, 1.0, 1.0, 1)
        evjaratgomb.bind(on_press=self.clearEvjaratmezo)
        grid.add_widget(evjaratgomb)

        evjaratmezo = TextInput(multiline=False, write_tab=False)
        evjaratmezo.foreground_color = (0.0, 0.0, 0.0, 5)
        evjaratmezo.background_color = (1.0, 1.0, 1.0, 5)
        evjaratmezo.font_size = 30
        evjaratmezo.font_name = "Roboto-Bold"
        layout.evjaratmezo = evjaratmezo
        grid.add_widget(evjaratmezo)

        #Tipus
        tipusgomb = Button(text="Típus:", size_hint=(1.0, 0.1))
        tipusgomb.pos_hint = {"center_x": 0.5, 'y': 0.0}
        tipusgomb.bind(on_press=self.clearTipusmezo)
        grid.add_widget(tipusgomb)

        tipusmezo = TextInput(multiline=False, write_tab=False)
        tipusmezo.foreground_color = (0.0, 0.0, 0.0, 5)
        tipusmezo.background_color = (1.0, 1.0, 1.0, 5)
        tipusmezo.font_size = 30
        tipusmezo.font_name = "Roboto-Bold"
        layout.tipusmezo = tipusmezo
        grid.add_widget(tipusmezo)

        #ÁR
        argomb = Button(text="Ár:", size_hint=(1.0, 0.1))
        argomb.pos_hint = {"center_x": 0.5, 'y': 0.0}
        argomb.bind(on_press=self.clearArmezo)
        grid.add_widget(argomb)

        armezo = TextInput(multiline=False, write_tab=False)
        armezo.foreground_color = (0.0, 0.0, 0.0, 5)
        armezo.background_color = (1.0, 1.0, 1.0, 5)
        armezo.font_size = 30
        armezo.font_name = "Roboto-Bold"
        layout.armezo = armezo
        grid.add_widget(armezo)

        layout.add_widget(grid)

        #Gomb
        button1 = Button(text="Hozzáadás", size_hint=(1.0, 0.3))
        button1.background_color = (1.5, 1.5, 1.5, 1)
        button1.bind(on_press=self.checkFieldsAndPrintData)
        layout.add_widget(button1)

        button2 = Button(text="Lista", size_hint=(1.0, 0.3))
        button2.background_color = (1.5, 1.5, 1.5, 1)
        button2.bind(on_press=self.showDetails)
        layout.add_widget(button2)

        self.layout = layout
        self.add_widget(layout)
        self.bind(on_leave=self.clearOnLeave)