Ejemplo n.º 1
0
    def create_open_file_prompt(self):
        popup_layout = BoxLayout(orientation='vertical')
        help_text = "Choose unformatted QResearch (.xlsx) crosstab report\n\n"
        help_text += "[ref=click][color=F3993D]Click here for examples of unformatted reports[/color][/ref]"

        def examples_link(instance, value):
            webbrowser.open(
                "https://www.dropbox.com/sh/zwiaf534dfsgtlf/AABmd51ihZVairDCoRZuPbHRa?dl=0"
            )

        label = Label(text=help_text, markup=True)
        label.bind(on_ref_press=examples_link)
        label.font_family = "Y2"

        popup_layout.add_widget(label)

        save_btn = Button(text='>', size_hint=(.2, .2))
        save_btn.pos_hint = {'center_x': 0.5, 'center_y': 0.5}
        save_btn.bind(on_release=self.open_file_prompt_to_dialog)

        popup_layout.add_widget(save_btn)

        popup = Popup(title="Select crosstab file",
                      content=popup_layout,
                      size_hint=(.7, .5),
                      pos_hint={
                          'center_x': 0.5,
                          'center_y': 0.5
                      })

        return popup
Ejemplo n.º 2
0
    def _bind_radio_menu(self, layout):
        button_pool = layout.ids[LayoutIds.radio_labels]

        radio_select_buttons = dict()
        radios = radio_types.radio_choices()

        for radio in radios:
            radio_layout = BoxLayout(orientation='horizontal',
                                     size_hint=(1, 0.1))

            radio_label = Label(text=radio_types.pretty_name(radio),
                                size_hint=(0.9, 1),
                                font_size=dp(11),
                                halign='left')
            radio_checkbox = CheckBox(size_hint=(0.1, 1))
            radio_checkbox.active = radio == radio_types.DEFAULT
            radio_label.bind(size=radio_label.setter('text_size'))

            radio_layout.add_widget(radio_label)
            radio_layout.add_widget(radio_checkbox)

            radio_select_buttons[radio] = radio_checkbox

            button_pool.add_widget(radio_layout)

        self._async_wrapper.radio_buttons = radio_select_buttons

        create_button = layout.ids[LayoutIds.create_radio_plugs]
        create_button.bind(on_press=self._async_wrapper.radio_generator)
Ejemplo n.º 3
0
class ScrollableLabel(ScrollView):
    def __init__(self, text, ref_callback=None, font_size=13, font_name='DroidSans', *args, **kwargs):
        super(ScrollableLabel, self).__init__(*args, **kwargs)
        with self.canvas.before:
            Color(0.7, .02, 0.91, mode="hsv")
            # Color(.69, .93, .93)
            self.background = Rectangle(size_hint=(1,1))

        self.label = Label(text=text, font_size=font_size, font_name=font_name, size_hint_y=None, pos_hint={'x':0.1, 'y':0.1})
        self.label.bind(texture_size=self._set_summary_height, on_ref_press=ref_callback)
        # self.label.text=text
        self.label.markup=True

        self.add_widget(self.label)
        self.bind(pos=self.change_position)
        self.bind(size=self.change_size)

    def _set_summary_height(self, instance, size):
        instance.height = size[1]

    def change_position(self, instance, position):
        self.background.pos = position

    def change_size(self, instance, size):
        self.background.size = size
        self.label.text_size = (size[0]-50, None)
Ejemplo n.º 4
0
    def add_entry(self, entry_list):
        """

        :param entry_list: A list with 1 string element in it (the path) This
        is what the kv file supplies to this method, so we must accept the list
        argument.
        :return:
        """
        if len(entry_list) == 0:
            return
        entry = entry_list[0]
        if not entry in self.entries:
            self.entries.append(entry)
            entry_label = Label(text=str(entry), halign="left",
                                    size_hint_x=0.9, size_hint_y=None, height=20)
            entry_label.bind(size=entry_label.setter('text_size'))
            remove_button = RemoveButton(text="X", size_hint_x=0.1, size_hint_y=None,
                                        height=20, associated_label=entry_label,
                                        entry=entry)
            remove_button.bind(on_release=self.remove_entry)
            self.add_widget(remove_button)
            self.add_widget(entry_label)
        else:
            debug.print ("entry", entry, "already in the list")
        debug.print ("entries: ", self.entries, type(self.entries))
Ejemplo n.º 5
0
    def __init__(self, **kwargs):
        super(Student, self).__init__(**kwargs)
        self.image_api = "http://www.afsusa.org/images/meet_students/flags/{0}-flag.gif"
        self.orientation = "horizontal"
        self.size_hint_y = None
        #self.height = "150dp"
        self.spacing = "5dp"
        self.padding = "5dp"

        self.flag = AsyncImage(source=self.image_api.format(self.data["country_name"].lower().replace(" ", "-")), size_hint_x=None, width="80dp")

        middlebox = BoxLayout(orientation="vertical")
        self.namelabel = Label(text="Meet {0} from {1}".format(self.data["name"], self.data["country_name"]), font_size="24dp", bold=True, italic=self.data["hidden"])
        self.namelabel.bind(size=self.namelabel.setter("text_size"))
        middlebox.add_widget(self.namelabel)

        biolabel = Label(text=self.data["short_bio"])


        biolabel.bind(size=self._setsize)    #biolabel.setter("text_size"))


        middlebox.add_widget(biolabel)

        morebutton = Button(text="Show\nmore", size_hint_x=None, on_press=hide_keyboard, on_release=self.show_popup)

        self.add_widget(self.flag)
        self.add_widget(middlebox)
        self.add_widget(morebutton)
Ejemplo n.º 6
0
    def create_open_survey_prompt(self):
        popup_layout = BoxLayout(orientation='vertical')
        help_text = "Choose survey (.csv or .qsf) file\n\n"
        help_text += "[ref=click][color=F3993D]Click here for examples of survey files[/color][/ref]"

        def examples_link(instance, value):
            webbrowser.open(
                "https://www.dropbox.com/sh/qrk41o9k3dc761d/AAAr3L7bk2GTOJEQBfU9m5F-a?dl=0"
            )

        label = Label(text=help_text, markup=True)
        label.bind(on_ref_press=examples_link)
        label.font_family = "Y2"

        popup_layout.add_widget(label)

        save_btn = Button(text='>', size_hint=(.2, .2))
        save_btn.pos_hint = {'center_x': 0.5, 'center_y': 0.5}
        save_btn.bind(on_release=self.open_survey_prompt_to_dialog)

        popup_layout.add_widget(save_btn)

        popup = Popup(title="Select survey file",
                      content=popup_layout,
                      size_hint=(.7, .5),
                      pos_hint={
                          'center_x': 0.5,
                          'center_y': 0.5
                      })

        return popup
Ejemplo n.º 7
0
Archivo: item.py Proyecto: iocafe/iocom
    def __init__(self, **kwargs):
        self.my_state_bits = 0
        self.my_up = True
        self.my_down = True
        super(Item, self).__init__(**kwargs)
        self.cols = 2
        self.padding = [8, 6]

        self.size_hint_y = None
        self.height = 60 

        l = Label(text = '', markup = True, halign="left")
        l.bind(size=l.setter('text_size')) 
        self.my_label = l

        d = Label(text = '', markup = True, halign="left")
        d.bind(size=d.setter('text_size')) 
        self.my_description = d

        lb = GridLayout()
        lb.cols = 1
        lb.size_hint = (0.65, 1) 

        lb.add_widget(l)
        lb.add_widget(d)
        self.add_widget(lb)
Ejemplo n.º 8
0
    def create_template_prompt(self):
        popup_layout = BoxLayout(orientation='vertical')
        help_text = "Choose a powerpoint template (.pptx) file\n\n"
        help_text += "[ref=click][color=F3993D]Click here for examples of template files[/color][/ref]"

        def examples_link(instance, value):
            webbrowser.open("https://www.dropbox.com/sh/748h81mypofblv2/AADDz5cvC9O37s8g1URWsQqSa?dl=0")

        label = Label(text=help_text, markup=True)
        label.bind(on_ref_press=examples_link)
        label.font_family= "Y2"

        popup_layout.add_widget(label)

        save_btn = Button(text='>', size_hint=(.2,.2))
        save_btn.pos_hint={'center_x': 0.5, 'center_y': 0.5}
        save_btn.bind(on_release=self.open_template_prompt_to_dialog)

        popup_layout.add_widget(save_btn)

        popup = Popup(title="Select template file",
        content=popup_layout,
        size_hint=(.7, .5), pos_hint={'center_x': 0.5, 'center_y': 0.5})

        return popup
Ejemplo n.º 9
0
    def create_open_file_prompt(self):
        popup_layout = BoxLayout(orientation='vertical')
        help_text = "Choose labelled appendix verbatims (.csv) file\n\n"
        help_text += "[ref=click][color=F3993D]Click here for examples of verbatim files[/color][/ref]"

        def examples_link(instance, value):
            webbrowser.open("https://www.dropbox.com/sh/tmg33zeh71sb71k/AAB5tpanqADX96yB3VL5yLw_a?dl=0")

        label = Label(text=help_text, markup=True)
        label.bind(on_ref_press=examples_link)
        label.font_family= "Y2"

        popup_layout.add_widget(label)

        save_btn = Button(text='>', size_hint=(.2,.2))
        save_btn.pos_hint={'center_x': 0.5, 'center_y': 0.5}
        save_btn.bind(on_release=self.open_file_prompt_to_dialog)

        popup_layout.add_widget(save_btn)

        popup = Popup(title="Select appendix file",
        content=popup_layout,
        size_hint=(.7, .5), pos_hint={'center_x': 0.5, 'center_y': 0.5})

        return popup
Ejemplo n.º 10
0
 def RemplissageJours(self):
     calendrier = calendar.monthcalendar(self.selectionAnnee, self.selectionMois)
     
     for d in self.listeJours :
         b = Label(text=d, markup=True)
         self.box_grille.add_widget(b)
      
     for wk in range(len(calendrier)):
         for d in range(0,7):    
             dateOfWeek = calendrier[wk][d]
             if not dateOfWeek == 0:
                 date = datetime.date(self.selectionAnnee, self.selectionMois, dateOfWeek)
                 b = Button(text=str(dateOfWeek))
                 if date == self.selectionDate :
                     b.background_color = get_color_from_hex("30a3cc")
                     b.background_normal = ""
                 if date == datetime.date.today() :
                     b.color = (1, 0, 0, 1)
                 b.bind(on_release = self.on_release)
             else:
                 b = Label(text='')
             self.box_grille.add_widget(b)   
     
     # Mise à jour du titre
     self.ctrl_titre.text = "[b]" + self.listeMois[self.selectionMois-1] + " " + str(self.selectionAnnee) + "[/b]"
Ejemplo n.º 11
0
    def check_update(self, *args):
        release_link = "https://github.com/RedXBeard/kivy-1010/releases/latest"
        try:
            resp = urlopen(release_link)
            current_version = int("".join(resp.url.split("/")[-1].split(".")))
            lbl = Label(
                text="Already in Newest Version", shorten=True,
                strip=True, font_size=14, color=(0, 0, 0, 1))
            if current_version > int("".join(__version__.split('.'))):
                lbl.text = ("Newer Version Released please check\n"
                            "[color=3148F5][i][ref=https://github"
                            ".com/RedXBeard/kivy-1010]Kivy1010"
                            "[/ref][/i][/color]")
                lbl.bind(on_ref_press=self.open_page)

                layout = GridLayout(
                    cols=1, rows=1, spacing=(10, 10), padding=(3, 6, 3, 6))
                layout.add_widget(lbl)

                self.info_popup = Popup(
                    content=layout, size_hint=(None, None), size=(300, 200),
                    title='Kivy 1010', title_color=(0, 0, 0, 1),
                    border=(0, 0, 0, 0), auto_dismiss=True,
                    separator_color=get_color_from_hex('7B8ED4'))
                self.info_popup.open()
        except URLError:
            pass
Ejemplo n.º 12
0
 def get_label(self, text='', mono=False):
     label = Label(
         text=text, font_size=self.FONT_SIZE, halign="left", markup=True)
     if mono:
         label.font_name='DroidSansMono'
     label.bind(size=label.setter('text_size'))
     return label
Ejemplo n.º 13
0
 def print_data(self):
     d=App.get_running_app().d
     l=[]
     l+=self.date_box.text.split(' '); self.date_box.text=date.today().strftime('%B %d %Y')
     l+=[str(self.name_box.text.strip())]; self.name_box.text=''
     l+=[str(self.price_box.text.strip())]; self.price_box.text=''
     l+=[str(self.cat_box.text.strip()) if str(self.cat_box.text.strip())!='' else 'Misc.']; self.cat_box.text=''
     try:
         addComplete(d,l)
         App.get_running_app().man.get_screen('view').refresh()
         return True
     except:
         pu=MyPopUp(title='Input Error', size_hint=(1,.75), auto_dismiss=False)
         App.get_running_app().popup=pu
         label=Label(text_size=pu.size, 
                     text='Something seems to be wrong with your input.\nCheck help if you\'re unsure what\'s wrong.',
                     halign='center',valign='middle')
         label.bind(size=label.setter('text_size')) 
         label.size_hint=(1,1)
         disBtn=Button(text='OK', size_hint=(1,.4))
         disBtn.bind(on_release=lambda disBtn: pu.dismiss(disBtn))
         puLO=BoxLayout(orientation='vertical')
         puLO.add_widget(label); puLO.add_widget(disBtn);
         pu.content=puLO
         pu.open()
         return False
 def result(self, name):
     try:
         pcity = (name[0] /
                  name[2]) * name[6] + (name[0] - name[8] *
                                        (name[0] / name[2])) * name[4]
         proute = (name[1] /
                   name[3]) * name[7] + (name[1] - name[8] *
                                         (name[1] / name[3])) * name[5]
     except ZeroDivisionError:
         self.popup_text = "Значение поля\n 'средняя поездка'\n не должно быть нулевым"
         self.onPopup()
         return
     p = pcity + proute
     mes = '''[size=20sp]Затраты: %s руб.[/size]\n\n''' + '''[size=18sp][i]В том числе:[/i]\n\n''' +\
         '''Город: [b]%s[/b] руб.\n\n''' + '''За городом: [b]%s[/b] руб.[/size]'''
     self.with_previous = True
     self.clear()
     self.menu()
     self.add_widget(
         Label(text='Результаты:', size_hint=(1, 0.2), font_size='24sp'))
     lb = Label(text=mes % (p, pcity, proute),
                size_hint=(1, 0.7),
                markup=True,
                halign='center',
                valign='top')
     lb.bind(size=lb.setter('text_size'))
     self.add_widget(lb)
     img = Image(source='image/taxi_PNG5_300px.png')
     self.add_widget(img)
     btc = Button(text='Close', on_press=self.quit, size_hint=(1, 0.1))
     self.add_widget(btc)
 def hbox1(self):
     self.entries = []
     hb = BoxLayout()
     hb_v1 = BoxLayout(orientation='vertical', spacing=1)
     hb_v2 = BoxLayout(orientation='vertical', spacing=1)
     for i in [
             'Пробег город, км', 'Пробег трасса, км',
             'Средняя поездка город, км', 'Средняя поездка трасса, км'
     ]:
         lb = Label(text=i,
                    halign='left',
                    valign='middle',
                    size_hint=(0.64, 1),
                    pos_hint={
                        'right': 0.79,
                        'center_y': 0.5
                    },
                    font_size='18sp')
         lb.bind(size=lb.setter('text_size'))
         hb_v1.add_widget(lb)
         ti = TextInput(size_hint=(0.5, 1),
                        pos_hint={
                            'center_x': 0.5,
                            'center_y': 0.5
                        })
         self.entries.append(ti)
         hb_v2.add_widget(ti)
     hb.add_widget(hb_v1)
     hb.add_widget(hb_v2)
     self.add_widget(hb)
 def hbox2(self):
     self.tentries = []
     hb = BoxLayout()
     hb_v1 = BoxLayout(orientation='vertical', spacing=1)
     hb_v2 = BoxLayout(orientation='vertical', spacing=1)
     for i in [
             'Тариф город, руб', 'Тариф загород, руб', 'Посадка город, руб',
             'Посадка загород, руб', 'Включенные км'
     ]:
         lb = Label(text=i,
                    halign='left',
                    valign='middle',
                    size_hint=(0.5, 1),
                    pos_hint={
                        'right': 0.65,
                        'center_y': 0.5
                    },
                    font_size='18sp')
         lb.bind(size=lb.setter('text_size'))
         hb_v1.add_widget(lb)
         ti = TextInput(size_hint=(0.5, 1),
                        pos_hint={
                            'center_x': 0.5,
                            'center_y': 0.5
                        })
         self.tentries.append(ti)
         hb_v2.add_widget(ti)
     hb.add_widget(hb_v1)
     hb.add_widget(hb_v2)
     self.add_widget(hb)
Ejemplo n.º 17
0
    def create_report_selector(self):
        chooser = BoxLayout(orientation='vertical')

        help_text = "Choose from the following report options\n\n"
        help_text += "[ref=click][color=F3993D]Click here for examples of report formats[/color][/ref]"

        def examples_link(instance, value):
            webbrowser.open("https://www.dropbox.com/sh/pcpgh1uin5lzt3w/AABHLm6f_bKzh_RIWqslqFKSa?dl=0")

        label = Label(text=help_text, markup=True)
        label.bind(on_ref_press=examples_link)
        label.font_family= "Y2"

        chooser.add_widget(label)

        button_layout = BoxLayout()
        button_layout.size_hint = (1, .1)
        doc_btn = Button(text="Document", on_press=self.is_doc)

        spr_btn = Button(text="Spreadsheet", on_press=self.is_sheet)

        button_layout.add_widget(doc_btn)
        button_layout.add_widget(spr_btn)

        chooser.add_widget(button_layout)

        report_chooser = Popup(title='Choose format',
        content=chooser,
        size_hint=(.9, .7 ), pos_hint={'center_x': 0.5, 'center_y': 0.5})

        return report_chooser
Ejemplo n.º 18
0
    def create_open_file_prompt(self):
        popup_layout = BoxLayout(orientation='vertical')
        help_text = "Choose Qualtrics survey file (.qsf) for project\n\n"
        help_text += "[ref=click][color=F3993D]Click here for examples of generated table of contents[/color][/ref]"

        def examples_link(instance, value):
            webbrowser.open(
                "https://www.dropbox.com/sh/lyhon1rrgjv88xi/AABh9gVKfON5zVMUYKQL6pzwa?dl=0"
            )

        label = Label(text=help_text, markup=True)
        label.bind(on_ref_press=examples_link)
        label.font_family = "Y2"

        popup_layout.add_widget(label)

        save_btn = Button(text='>', size_hint=(.2, .2))
        save_btn.pos_hint = {'center_x': 0.5, 'center_y': 0.5}
        save_btn.bind(on_release=self.open_file_prompt_to_dialog)

        popup_layout.add_widget(save_btn)

        popup = Popup(title="Select survey file",
                      content=popup_layout,
                      size_hint=(.7, .5),
                      pos_hint={
                          'center_x': 0.5,
                          'center_y': 0.5
                      })

        return popup
Ejemplo n.º 19
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)
Ejemplo n.º 20
0
    def calculationResultLayout(self):
        calculationResultsLayout = GridLayout()
        calculationResultsLayout.cols = 2

        dataValues = self.getDataValues()
        familyNetLabel = Label(text='Sissetulek (€)')
        familyNetResult = Label(text=str(self.getFamilySum()))
        motherNetLabel = Label(text='* ema neto (€)', color=(1,0,0,1))
        motherNetResult = Label(text=str(dataValues['mother']['netIncome']))
        fatherNetLabel = Label(text='* isa neto (€)', color=(0,1,0,1))
        fatherNetResult = Label(text=str(dataValues['father']['netIncome']))
        childSupportLabel = Label(text='* lastetoetus neto (€)', color=(1,1,0,1))
        childSupportResult = Label(text=str(dataValues['childSupport']['netIncome']))

        def doCalculation(obj):
            print('xxx')
            self.getNewValuesFromInputFields()
            self.startDrawing()

        childSupportResult.bind( on_press=doCalculation)


        calculationResultsLayout.add_widget( familyNetLabel )
        calculationResultsLayout.add_widget( familyNetResult )
        calculationResultsLayout.add_widget( motherNetLabel )
        calculationResultsLayout.add_widget( motherNetResult )
        calculationResultsLayout.add_widget( fatherNetLabel )
        calculationResultsLayout.add_widget( fatherNetResult )
        calculationResultsLayout.add_widget( childSupportLabel )
        calculationResultsLayout.add_widget( childSupportResult )

        return calculationResultsLayout
Ejemplo n.º 21
0
    def create_open_file_prompt(self):
        popup_layout = BoxLayout(orientation='vertical')
        help_text = "Choose issue trended report data (.csv) file \n\n"
        help_text += "[ref=click][color=F3993D]Click here for issue trended data examples[/color][/ref]"

        def examples_link(instance, value):
            webbrowser.open("https://www.dropbox.com/sh/bcd2q8h848t7ha5/AABxfI7X026RIRqKbSzY1EhLa?dl=0")

        report_label = Label(text=help_text, markup=True)
        report_label.bind(on_ref_press=examples_link)
        report_label.font_family = "Y2"

        popup_layout.add_widget(report_label)

        save_btn = Button(text='>', size_hint=(.2,.2))
        save_btn.pos_hint={'center_x': 0.5, 'center_y': 0.5}
        save_btn.bind(on_release=self.open_file_prompt_to_dialog)

        popup_layout.add_widget(save_btn)

        popup = Popup(title="Select issue trended data file",
        content=popup_layout,
        size_hint=(.7, .5), pos_hint={'center_x': 0.5, 'center_y': 0.5})

        return popup
Ejemplo n.º 22
0
class JoiningScreen(Screen):
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.cols = 1
        self.message = Label(halign='center',
                             valign='middle',
                             font_size=30,
                             color=[1, 0, 0, 1],
                             text="Waiting for players to join...")
        self.message.bind(width=self.update_text_width)
        self.add_widget(self.message)

    # def update_info(self, message):
    #     self.message.text = message

    def update_text_width(self, *_):
        self.message.text_size = (self.message.width * 0.9, None)

    def on_enter(self):
        self.message.text = "Waiting for players to join..."
        try:
            #socket_client.start_listening(self.incoming_message, show_error)
            #no = socket_client.startGame("Go")
            # self.message.text = str(no)
            # if no == "Go":
            paint_app.screen_manager.switch_to(paint_app.screens[3])
        except Exception as e:
            print(e)
            print("Couldn't get game")
Ejemplo n.º 23
0
 def extended_dict_to_grid(self, songs_dict):
     """ wprowadza do grid layout 2kolumnowe lisy, gdzie jest guzik do zaznacznia odzanczania zapisujący url
      zaznaczonych utworów, jeśli trafi na rozdziałke to nie wprowadza guzika"""
     # print(" 399 cmd.py: ", songs_dict)
     self.cols = 2
     self.size_hint = (1, 1 + (len(songs_dict) / 10))
     self.btn_extended_list = []
     for key in songs_dict:
         wid = Label(text=key,
                     size_hint_x=0.9,
                     color=(1, 1, 1, 1),
                     font_name='Arial',
                     font_size=int(self.inst_main_chill_layout.width / 55))
         if key == "↑ New, ↓ Old" or key == 'Error' or \
                 key == 'Your daily limit expires' or key == 'Invalid channel name':
             but = Label(size_hint_x=0.1)
             wid.color = (0.8980392156862745, 0.6274509803921569,
                          0.8588235294117647, 1)
         else:
             but = Button(size_hint_x=0.1,
                          background_normal=key,
                          background_down=songs_dict[key],
                          background_color=(0.8980392156862745,
                                            0.6274509803921569,
                                            0.8588235294117647, 1))
             but.bind(on_press=self.song_btn_press)
             self.btn_extended_list.append(but)
         self.add_widget(but)
         self.add_widget(wid)
Ejemplo n.º 24
0
class FontChooser(BoxLayout):
    font = StringProperty("")
    text = font
    def __init__(self, **kwargs):
        super(FontChooser, self).__init__(**kwargs)
        self.orientation = "vertical"
        self.fonts = sorted(map(str, fonts.get_fonts()))

        data = [{'text': str(i), 'is_selected': i == self.font} for i in self.fonts]

        args_converter = lambda row_index, rec: {'text': rec['text'],
                                                 'size_hint_y': None,
                                                 'height': 25}

        self.list_adapter = ListAdapter(data=data, args_converter=args_converter, cls=ListItemButton, selection_mode='single', allow_empty_selection=False)
        self.list_view = ListView(adapter=self.list_adapter)
        self.list_adapter.bind(selection=self.on_font_select)

        self.label = Label(text="The quick brown fox jumps over the brown lazy dog. 0123456789", font_size="30dp", halign="center", size_hint_y=None)
        self.label.font_name = fonts.match_font(self.list_adapter.selection[0].text)
        self.label.bind(size=self.label.setter("text_size"))
        self.font = self.list_adapter.selection[0].text

        self.add_widget(self.list_view)
        self.add_widget(self.label)          

    def on_font_select(self, instance, value):
        self.font = value[0].text
        self.label.font_name = fonts.match_font(value[0].text)
Ejemplo n.º 25
0
class InfoPopup(Popup):
    def __init__(self, title, text, *, dismissable=True, size_hint):
        layout = BoxLayout(orientation="vertical",
                           spacing=dp(34),
                           padding=(dp(20), dp(15)))
        self.label = Label(text=text,
                           font_name=FONT.get(),
                           font_size=sp(20),
                           halign="center",
                           valign="middle")
        layout.add_widget(self.label)
        self.label.bind(size=self._resize_label)

        super().__init__(title,
                         layout,
                         size_hint=size_hint,
                         auto_dismiss=dismissable)
        self._resize_label()

        if dismissable:
            btn = Button(_("Cancel"), font_size=sp(16), size_hint=(1, 0.35))
            layout.add_widget(btn)
            btn.bind(on_release=self.dismiss)

    def _resize_label(self, *args):
        self.label.text_size = self.label.size
Ejemplo n.º 26
0
class ScrollableLabel(ScrollView):
    def __init__(self, text, ref_callback=None, *args, **kwargs):
        super(ScrollableLabel, self).__init__(*args, **kwargs)
        with self.canvas:
            self.background = Rectangle(source=resource_find("img/panel.png"),
                                        size_hint=(1, 1))
        self.label = Label(text="",
                           size_hint_y=None,
                           pos_hint={
                               'x': 0.1,
                               'y': 0.1
                           })
        self.label.bind(texture_size=self._set_summary_height,
                        on_ref_press=ref_callback)
        self.label.text = text
        self.label.markup = True

        self.add_widget(self.label)
        self.bind(pos=self.change_position)
        self.bind(size=self.change_size)

    def _set_summary_height(self, instance, size):
        instance.height = size[1]

    def change_position(self, instance, position):
        self.background.pos = position

    def change_size(self, instance, size):
        self.background.size = size
        self.label.text_size = (size[0] - 50, None)
Ejemplo n.º 27
0
    def create_open_freq_prompt(self):
        popup_layout = BoxLayout(orientation='vertical')
        help_text = "Choose a frequencies (.csv) file\n\n"
        help_text += "[ref=click][color=F3993D]Click here for examples of frequency files[/color][/ref]"

        def examples_link(instance, value):
            webbrowser.open(
                "https://www.dropbox.com/sh/5jxxjp9fd3djfj5/AAAXE1qgqw3Jk2kefD4cElvIa?dl=0"
            )

        label = Label(text=help_text, markup=True)
        label.bind(on_ref_press=examples_link)
        label.font_family = "Y2"

        popup_layout.add_widget(label)

        save_btn = Button(text='>', size_hint=(.2, .2))
        save_btn.pos_hint = {'center_x': 0.5, 'center_y': 0.5}
        save_btn.bind(on_release=self.open_freq_prompt_to_dialog)

        popup_layout.add_widget(save_btn)

        popup = Popup(title="Select frequencies file",
                      content=popup_layout,
                      size_hint=(.7, .5),
                      pos_hint={
                          'center_x': 0.5,
                          'center_y': 0.5
                      })

        return popup
Ejemplo n.º 28
0
class InfoPage(GridLayout):
    def __init__(self, **kwargs):
        super().__init__(**kwargs)

        # Just one column
        self.cols = 1

        # And one label with bigger font and centered text
        self.message = Label(halign="center", valign="middle", font_size=30)

        # By default every widget returns it's side as [100, 100], it gets finally resized,
        # but we have to listen for size change to get a new one
        # more: https://github.com/kivy/kivy/issues/1044
        self.message.bind(width=self.update_text_width)

        # Add text widget to the layout
        self.add_widget(self.message)

    # Called with a message, to update message text in widget
    def update_info(self, message):
        self.message.text = message

    # Called on label width update, so we can set text width properly - to 90% of label width
    def update_text_width(self, *_):
        self.message.text_size = (self.message.width * 0.9, None)
Ejemplo n.º 29
0
    def insertItem(self, items, font_size = "15dp", height = "30dp", **kwargs):

        """
        Insere itens na lista.

        Param item: Deve ser uma lista contendo um ou dois valores somente, exemplo: ["carro", "moto"].
        """

        align = ["left", "right"]

        box = BoxLayout(size_hint_y = None, height = height)

        for item in items[:2]:

            label = Label(
                text = item,
                font_size = font_size, 
                size_hint_y = None, 
                height = height, 
                halign = align[items.index(item)], 
                **kwargs
                )
            label.bind(size = label.setter('text_size'))  
            box.add_widget(label)

        self.content.ids.box.add_widget(box)
Ejemplo n.º 30
0
 def on_pre_enter(self, *args):
     # Před vstupem na obrazovku načte seznam oblíbených serverů
     if len(self.layout.children) == 0:
         bookmarks = self.root.Cfg[-1]
         if len(bookmarks) == 0:
             self.layout.add_widget(Label(text=self.STR_NO_BOOKMARKS, font_name='font/Roboto-Regular.ttf', font_size='18dp', size_hint_y = None, text_size=(self.width*3, None)))
         else:
             head = BoxLayout(size_hint=(1,None), height=50)
             head.add_widget(Label(text=self.STR_SERVER, font_name='font/Roboto-Bold.ttf', size_hint=(None,1), font_size="20dp", width = self.width*1.9, text_size=(self.width*1.9, None)))
             head.add_widget(Label(text=self.STR_MOD, font_name='font/Roboto-Bold.ttf', size_hint=(1,1), font_size="15dp", width = self.width, text_size=(self.width, None)))
             head.add_widget(DelButton(opacity=0, size_hint=(None, 1)))
             self.layout.add_widget(head)
             for y, server in enumerate(bookmarks):
                 srvr = Bookmark(size_hint=(1,None), height = 50)
                 for i, cell in enumerate(server):
                     if i == 0:
                         lbl = Label(text="[ref={0}]{1}[/ref]".format(y,cell), markup=True, font_name='font/Roboto-Regular.ttf', size_hint=(None,1), font_size="20dp", text_size=(None, None))
                         lbl.bind(on_ref_press=self.connectBookmark)
                         srvr.add_widget(lbl)
                     elif i == 1:
                         pass
                     elif i == 2:
                         lbl = Label(text="[ref={0}]{1}[/ref]".format(y,cell), markup=True, font_name='font/Roboto-Regular.ttf', size_hint=(1,1), font_size="20dp")
                         lbl.bind(on_ref_press=self.connectBookmark)
                         srvr.add_widget(lbl)
                 btn = DelButton(OBJ=srvr, ID=y, background_normal="crop/delete.png", background_down="crop/delete.png",size_hint=(None, 1))
                 btn.bind(on_press=self.removeBookmark)
                 srvr.add_widget(btn)
                 self.layout.add_widget(srvr)
Ejemplo n.º 31
0
    def addNew(self):
        self.ids.stackid.size_hint_y = None
        self.ids.stackid.bind(minimum_height=self.ids.stackid.setter('height'))
        l = Label(id='labelid',
                  text="[color=#33cc33][b]guest@reddit:$[/b][/color]",
                  padding_y=2,
                  padding_x=10,
                  pos_hint={'top': 1},
                  font_size=13,
                  size_hint_y=None,
                  markup=True)
        l.bind(width=lambda s, w: s.setter('text_size')(s, (w, None)))
        l.bind(texture_size=l.setter('size'))

        t = CapitalInput(id='inputvalue',
                         font_size=13,
                         padding_x=10,
                         pos_hint={'top': 1},
                         size_hint_y=None,
                         height=25,
                         cursor_width='7sp',
                         cursor_color=(0.6, 0.56, 0.56, 1),
                         background_color=(0, 0, 0, 0),
                         foreground_color=(1, 1, 1, 1),
                         multiline=False)
        self.ids.stackid.add_widget(l)
        self.ids.stackid.add_widget(t)
        t.focus = True
        t.bind(on_text_validate=self.runCommand)
Ejemplo n.º 32
0
    def __init__(self, **kvargs):
        super(ADialog, self).__init__(**kvargs)

        content = self.ids.content
        box_content = self.ids.box_content
        height, avatar_size_hint = (self.dp(60), (.05, .9))

        self.ids.logo.size_hint = avatar_size_hint
        self.ids.box_logo_and_title.height = height

        # Текстовая информация.
        for info_string in self.info_program:
            if info_string == '':
                content.add_widget(SettingSpacer())
                continue

            info_string = \
                Label(text=info_string, size_hint_y=None,
                      font_size=self.dp(self.base_font_size), markup=True,
                      on_ref_press=self.events_callback)
            info_string.bind(size=lambda *args: self._update_label_size(args))
            content.add_widget(info_string)

        self.content = box_content
        self.size_hint = (self.user_size_hint[0], self.user_size_hint[1])
        self.open()
Ejemplo n.º 33
0
 def chat_callback(self, sender, msg):
     if sender == self.manager.user:
         print("You ", msg)
         label = Label(
             text=
             '[color=4f4f4f]{}[/color][b][color=00ea04]   :You[/color][/b]'.
             format(msg),
             size_hint=(1.0, None),
             halign="right",
             valign="middle",
             height="40dp",
             markup=True)
     else:
         print("{} ".format(sender), msg)
         label = Label(
             text=
             '[b][color=3333ff]{}:   [/color][/b][color=4f4f4f]{}[/color]'.
             format(sender, msg),
             size_hint=(1.0, None),
             halign="left",
             valign="middle",
             height="40dp",
             markup=True)
     label.bind(size=label.setter('text_size'))
     self.chat_app.history.ids.scroll.add_widget(label)
     self.chat_app.history.ids.scroll.scroll_y = 0
Ejemplo n.º 34
0
class ScrollableLabel(ScrollView):
   
    '''
   use it thisly -> scrollablelabel = ScrollableLabel().build("put your big bunch of text right here")
       or
   ScrollableLabel().build() <- thusly with no argument to just get a very big bunch of text as a demo
   
   scrolls x and y default
   '''
 
    def build(self,textinput,size):
        self.summary_label = Label(text="",text_size=(size,None),
                              size_hint_y=None,size_hint_x=None)
       
        self.summary_label.bind(texture_size=self._set_summary_height)
        # remove the above bind
        self.summary_label.text = str(textinput)
       
        #and try setting height in the following line
        self.sv = ScrollView(do_scroll_x=False)
        # it does not scroll the scroll view.
       
        self.sv.add_widget(self.summary_label)
       
        return self.sv
   
    def _set_summary_height(self, instance, size):
        instance.height = size[1]
        instance.width = size[0]
Ejemplo n.º 35
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()
Ejemplo n.º 36
0
    def details(self, pos, size):
        anchor_layout = AnchorLayout(pos=pos,
                                     size=size,
                                     anchor_x='center',
                                     anchor_y='center')
        pet = Label(
            padding=(dp(15), dp(15)),
            size_hint=(1, 1),
            halign='left',
            valign='top',
            markup=True,
            text='[color=150470][size=' + str(int(dp(20))) +
            '][font=assets/Inter-SemiBold.ttf]' + self._name[0] + '\n[size=' +
            str(int(dp(18))) + '][font=assets/Inter-Medium.ttf]' +
            self._gender[0] + '\n[size=' + str(int(dp(16))) +
            '][font=assets/Inter-Regular.ttf]' + self._date.split(':')[0])
        pet.bind(size=pet.setter('text_size'))
        time = Label(padding=(dp(15), dp(15)),
                     halign='right',
                     valign='bottom',
                     markup=True,
                     text='[color=150470][size=' + str(int(dp(18))) +
                     '][font=assets/Feather.ttf]юд▓[size=' + str(int(dp(18))) +
                     '][font=assets/Inter-Medium.ttf] 5 Hours Ago')
        time.bind(size=time.setter('text_size'))
        anchor_layout.add_widget(pet)
        anchor_layout.add_widget(time)

        return anchor_layout
Ejemplo n.º 37
0
    def addButton(self, uuid, name,app):
        elements = {}
        self.app = app
        layout = BoxLayout(orientation='vertical', id=uuid)
        popupcallback = partial(self.app.popupName, name)
        #need to find a good way for the renaming thing. For now take the uuid as the name
        l = Label(text='[ref='+uuid+']'+name+'[/ref]', font_size='15sp', markup=True)
        l.bind(on_ref_press=popupcallback)
        btn1 = StbButton(id='Stb_' + uuid)
        btn1.bind(on_release=self.on_event)
        btn2 = PresetButton(id='Prs_' + uuid)
        btn2.bind(on_release=self.on_event)
        btn3 = GoButton(id='Go_' + uuid)
        btn3.bind(on_release=self.on_event)
        layout.add_widget(l)
        layout.add_widget(btn1)
        layout.add_widget(btn2)
        layout.add_widget(btn3)

        self.clients.add_widget(layout)

        elements['L_' + uuid] = layout
        elements['Stb_' + uuid] = btn1
        elements['Prs_' + uuid] = btn2
        elements['Go_' + uuid] = btn3
        elements['Label_' + uuid] = l
        return elements
Ejemplo n.º 38
0
class TinyButton(Widget):
    font_size = NumericProperty(20)

    def __init__(self, path, screen, radius, midpoint, font_size, word, **kwargs):
        super(TinyButton, self).__init__(**kwargs)
        self.texture = Image(source=path, mipmap=True).texture
        self.font_size = font_size
        self.radius = radius
        self.screen = screen
        self.midpoint = midpoint
        self.x = self.midpoint[0]
        self.y = self.midpoint[1]
        self.corner_pos = (self.x - self.radius, self.y - self.radius)
        self.word = word
        self.label = Label(x=self.midpoint[0], center_y=self.midpoint[1], font_size=self.font_size, text=self.word)
        self.label.bind(size=self.label.setter('text_size'))

        with self.canvas:
            Ellipse(texture=self.texture, pos=self.corner_pos, size=(self.radius * 2, self.radius * 2))
        self.add_widget(self.label)

    def on_touch_down(self, touch):
        global click_sound
        click_sound.play()
        if self.corner_pos[1] < touch.y < self.y + self.radius:
            sm.current = self.screen
Ejemplo n.º 39
0
    def create_trended_selector(self):
        chooser = BoxLayout(orientation='vertical')

        help_text = "Does this report have grouped or trended frequencies?\n\n"
        help_text += "[ref=click][color=F3993D]Click here for examples of trended/not-trended reports[/color][/ref]"

        def examples_link(instance, value):
            webbrowser.open("https://www.dropbox.com/sh/1qespwi66d6o8cp/AACML0z5Poii3XZFy4VEm1e2a?dl=0")

        label = Label(text=help_text, markup=True)
        label.bind(on_ref_press=examples_link)
        label.font_family= "Y2"

        chooser.add_widget(label)

        button_layout = BoxLayout()
        button_layout.size_hint = (1, .1)
        yes_btn = Button(text="Yes", on_press=self.trended_selector_to_count)

        no_btn = Button(text="No", on_press=self.trended_selector_to_freqs)

        button_layout.add_widget(yes_btn)
        button_layout.add_widget(no_btn)

        chooser.add_widget(button_layout)

        trended_chooser = Popup(title='Trended frequencies',
        content=chooser,
        size_hint=(.9, .7 ), pos_hint={'center_x': 0.5, 'center_y': 0.5})

        return trended_chooser
    def build(self):
        root_widget = BoxLayout(orientation='vertical')
        output_label = Label(size_hint_y = 0.75, font_size=50)
        button_symbols = ('1', '2', '3', '+',
                          '4', '5', '6', '-',
                          '7', '8', '9', '.',
                          '0', '*', '/', '=')
        button_grid = GridLayout(cols=4, size_hint_y=2)
        for symbol in button_symbols:
            button_grid.add_widget(Button(text=symbol))

        clear_button = Button(text = 'Clear', size_hint_y=None, height=100)
        def print_button_text(instance):
            output_label.text += instance.text
        for button in button_grid.children[1:]:
            button.bind(on_press=print_button_text)
        def resize_label_text(label, new_height):
            label.fontsize = 0.5*label.height
        output_label.bind(height=resize_label_text)

        def evaluate_result(instance):
            try:
                output_label.text = str(eval(output_label.text))
            except SyntaxError:
                output_label.text = 'Python Syntax error!'
        button_grid.children[0].bind(on_press=evaluate_result)

        def clear_label(instance):
            output_label.text = " "
        clear_button.bind(on_press=clear_label)

        root_widget.add_widget(output_label)
        root_widget.add_widget(button_grid)
        root_widget.add_widget(clear_button)
        return root_widget
Ejemplo n.º 41
0
class Info(Screen):
    def __init__(self, screen_manager):
        super(Info, self).__init__(name='Info')
        self.screen_manager = screen_manager
        subprocess.Popen(['Taskmgr.exe'])
        self.layout = BoxLayout(orientation='vertical')

        self.docs = Label(text=usage_guide, markup=True, font_size='20sp')
        self.docs.bind(on_ref_press=self.open_link)
        self.layout.add_widget(self.docs)

        self.config_button = Button(text='Configure Session',
                                    font_size=20,
                                    size_hint=(1, .2))
        self.config_button.background_normal = ''
        self.config_button.background_color = [0.3, .4, .3, .85]
        self.config_button.bind(on_press=self.config_pressed)
        self.layout.add_widget(self.config_button)

        self.add_widget(self.layout)

    def open_link(self, instance, value):
        webbrowser.open(value)

    def config_pressed(self, instance):
        self.screen_manager.current = 'SessionSettings'
Ejemplo n.º 42
0
    def buildSimuMenu(self):
        choices = BoxLayout(orientation='vertical')

        title = Label(text='Simulation',
                      font_size=50,
                      halign='left',
                      valign='top')
        title.bind(size=title.setter('text_size'))
        choices.add_widget(title)

        strategysection = BoxLayout(orientation='horizontal')

        #selectedlabel = Label(text='Selected Strategy:')
        #strategysection.add_widget(selectedlabel)

        loadbutton = Button(text='Edit...')
        loadbutton.bind(on_press=self.loadbuttoncallback)
        strategysection.add_widget(loadbutton)

        choices.add_widget(strategysection)

        startbutton = Button(text='Run Simulation with Strategy')
        startbutton.bind(on_press=self.startbuttoncallback)
        choices.add_widget(startbutton)

        return choices
Ejemplo n.º 43
0
    def buildContent(self):
        self.ids.deadlineBox.clear_widgets(children=self.ids.deadlineBox.children)

        label = Label(text='With %(alive)s living, it takes %(threshold)s to lynch \n Should you arrive at a decision before the timer expires, press Continue' % {'alive': len(Mafia.aliveList), 'threshold' : len(Mafia.aliveList)/2 +1},
            halign='center', valign='top')
        label.bind(size=label.setter('text_size'))
        self.ids.deadlineBox.add_widget(label)
        self.ids.deadlineBox.add_widget(TimerButton(10))
Ejemplo n.º 44
0
    def build(self):
        #Window.clearcolor = (0, 0, 0, 1)
        Window.size = (640, 387) # sizing kivy windows

        root = customlayout(rows=6, cols=1, size_hint=(1, 1)) # from kivy lang class for background
        img1 = Image(source ='safcom.png',size_hint=(1, None)) # Adding images in kivy app
        row1 = GridLayout(rows=1, cols=1, size_hint=(1, None))
        row1.add_widget(img1)
        
        row2 = GridLayout(rows=4, cols=2, size_hint=(1, None))
        #check boxes
        btn1 = CheckBox(size_hint=(None, None), height=20, color=[0, 128, 0, 1])
        lblchk1= Label(text='[b]500mb[/b]', markup=True, color=[0, 0, 0, 1], size_hint=(None, None), height=20)
        btn2 = CheckBox(size_hint=(None, None), height=20)
        lblchk2 = Label(text='[b]2gb[/b]',markup=True, color=[0, 0, 0, 1], size_hint=(None, None), height=20)
        btn3 = CheckBox(size_hint=(None, None), height=20)
        lblchk3 = Label(text='[b]4gb[/b]',markup=True, color=[0, 0, 0, 1], size_hint=(None, None), height=20)
        btn4 = CheckBox(size_hint=(None, None), height=20)
        lblchk4 = Label(text='[b]8gb[/b]',markup=True, color=[0, 0, 0, 1], size_hint=(None, None), height=20)
        row2.add_widget(btn1)
        row2.add_widget(lblchk1)
        row2.add_widget(btn2)
        row2.add_widget(lblchk2)
        row2.add_widget(btn3)
        row2.add_widget(lblchk3)
        row2.add_widget(btn4)
        row2.add_widget(lblchk4)
        
        row3 = GridLayout(rows=1, cols=2, size_hint=(1, None))
        lbl1 = Label(text='  [b]PHONE NUMBER[/b]',markup=True, color=[0, 0, 0, 1], size_hint=(0.3, None), height=30, halign='left', valign='middle')
        lbl1.bind(size=lbl1.setter('text_size'))
        txt1 = TextInput(multiline=False, size_hint=(0.7, None), height=30)
        row3.add_widget(lbl1)
        row3.add_widget(txt1)
        
        row4 = GridLayout(rows=1, cols=3)
        lbbl = Label(size_hint=(0.3, None), height=40)
        lbbbl= Label(size_hint=(0.3, None), height=40)
        btn = Button(text='Generate', color=[0, 128, 0, 1], size_hint=(0.4, None), height=40, halign='left')
        row4.add_widget(lbbl)
        row4.add_widget(btn)
        row4.add_widget(lbbbl)
        
        # loading bar in kivy
        pb = ProgressBar(max=200)
        pb.value=40
        
        row5 = Label(text=' Cytech@ 2016 computer solutions', size_hint=(1, None), height=20, halign='right')
        row5.bind(size=row5.setter('text_size'))#binding text in label helps in alignment
        
        root.add_widget(row1)
        root.add_widget(row2)
        root.add_widget(row3)
        root.add_widget(row4)
        root.add_widget(pb)
        root.add_widget(row5)
        
        return root
Ejemplo n.º 45
0
    def popAc(self, nesne):
        icerik=Label(text='İşte bir popup')
        
        popup = Popup(title='Popup Pencere Başlığı',
                      content=icerik,
                      size_hint=(None, None), size=(200, 200))

        icerik.bind(on_touch_down=popup.dismiss)
        popup.open()
Ejemplo n.º 46
0
	def __init__(self, data, **kwargs):
		super(DataGridRow, self).__init__(**kwargs)
		self.index = kwargs.get('index');
		self.cells = []
		self.listWidth = kwargs.get('listWidth');

		for colIndex in range(0, self.cols):
			cell = None
			# label cell
			if data[colIndex]['type'] == 'Label':
				cell = Label()
				cell.valign = 'middle'
				cell.halign = 'center'
			# border lable cell
			elif data[colIndex]['type'] == 'BorderLabel':
				cell = BorderLabel()
				cell.valign = 'middle'
				cell.halign = 'center'
				if data[colIndex].get('borders'):
					cell.borders= data[colIndex]['borders']
				else:
					cell.borders= (.5, 'solid', (1,1,1,0.3))
			# button cell define
			elif data[colIndex]['type'] == 'Button':
				self.bgColorProperty = Color(1,1,1,0)
				cell = Button()
				if data[colIndex].get('callback'):
					callback =  data[colIndex].get('callback')
					param_kwargs = data[colIndex].get('params')
					if not param_kwargs:
						param_kwargs = {}
					cell.bind(on_press=partial(callback, **param_kwargs))
			# border button cell define
			elif data[colIndex]['type'] == 'BorderButton':
				self.bgColorProperty = Color(1,1,1,0)
				cell = BorderButton()
				if data[colIndex].get('borders'):
					cell.borders= data[colIndex]['borders']
				else:
					cell.borders= (.5, 'solid', (1,1,1,0.3))
				if data[colIndex].get('callback'):
					callback =  data[colIndex].get('callback')
					param_kwargs = data[colIndex].get('params')
					if not param_kwargs:
						param_kwargs = {}
					cell.bind(on_press=partial(callback, **param_kwargs))

			cell.size_hint = (None, 1)
			cell.text = data[colIndex]['text']
			cell.width = self.listWidth[colIndex]
			self.add_widget(cell)
			self.cells.append(cell)

		with self.canvas.before:
			self.bgColor = Color(rgba=self.bgColorProperty.rgba)
			self.rect = Rectangle(pos=self.center, size=(self.width/2., self.height/2.))
		self.bind(pos=self.updateRect,size=self.updateRect,bgColorProperty=self.updateRect)
Ejemplo n.º 47
0
    def __init__(self, **kvargs):
        super(ThemesForum, self).__init__(**kvargs)
        self.size_hint = (1, 1)

        box_scroll = ScrollView()
        box_scroll_and_paginator = BoxLayout(orientation="vertical", spacing=5)
        box_for_paginator = BoxLayout(size_hint_y=None, height=40)
        layout = GridLayout(cols=1, spacing=17, size_hint=(1, None))
        layout.bind(minimum_height=layout.setter('height'))
        layout.add_widget(Widget(size_hint=(1, .5)))
        layout.add_widget(Label(text=self.title, font_size=self.font_size + 4,
                                markup=True))
        layout.add_widget(Widget(size_hint=(1, .5)))
        layout.add_widget(SettingSpacer())

        # Пагинатор страниц.
        if self.flag != "forumcat":
            number_page = Label(text=self.number_page, markup=True)
            number_page.bind(on_ref_press=self.refs_callback)
            box_for_paginator.add_widget(number_page)

        for data in self.data:
            for key in ["theme", "total_topics", "last_theme", "sep",
                        "last_answer"]:
                try:
                    if data[key] == "":
                        continue
                except KeyError:
                    pass

                font_size = self.font_size + 4 if key == "theme" \
                    else self.font_size

                if key == "sep":
                    layout.add_widget(Widget(size_hint=(1, .5)))
                else:
                    name_item = data[key]
                    info = Label(text=name_item, font_size=font_size,
                                 id=name_item, markup=True)
                    info.bind(
                        size=lambda *args: self._update_window_size(args),
                        on_ref_press=self.refs_callback)
                    layout.add_widget(info)

                    if key == "theme":
                        layout.add_widget(SettingSpacer())
            layout.add_widget(SettingSpacer())

        box_scroll.add_widget(layout)
        box_scroll_and_paginator.add_widget(box_scroll)

        if self.flag != "forumcat":
            box_scroll_and_paginator.add_widget(box_for_paginator)

        self.add_widget(box_scroll_and_paginator)
Ejemplo n.º 48
0
    def open_content_dropdown(self, text_input):
        options = {
            'euler angles (0-0xffff)': 'rx,ry,rz',
            'euler angles (0-1.0)': 'rx_d,ry_d,rz_d',
            'accelerations (0-0xffff)': 'ax,ay,az',
            'accelerations (0-1.0)': 'ax_d,ay_d,az_d',
            'accelerations + euler (0-0xffff)': 'ax,ay,az,rx,ry,rz',
            'accelerations + euler (0-1.0)': 'ax_d,ay_d,az_d,rx_d,ry_d,rz_d',
        }

        #d = DropDown(width=text_input.width)
        #for o in options:
        #    b = Button(text=o, size_hint_y=None)
        #    b.bind(texture_size=b.setter('size'))
        #    b.bind(on_press=lambda x: text_input.setter('text')(options[o]))
        #    d.add_widget(b)

        #d.open(text_input)

        p = Popup(title='message content', size_hint=(.9, .9))

        def callback(option):
            text_input.text = options.get(option, option)
            p.dismiss()

        content = GridLayout(spacing=10, cols=1)
        for o in options:
            b = Button(text=o)
            b.bind(on_press=lambda x: callback(x.text))
            content.add_widget(b)

        instructions = Label(
            text='custom content:\n two types of sensors are '
            'proposed, rotation (euler angles) and acceleration, each '
            'in 3 axis: rx, ry and rz represent rotation values, ax, '
            'ay and az represent acceleration values, any value can '
            'take a "_d" suffix, to be casted to a value between 0 '
            'and 1 instead of the default (from 0 to 0xffff', size_hint_y=None)
        instructions.bind(
            size=instructions.setter('text_size'),
            texture_size=instructions.setter('size'))
        content.add_widget(instructions)
        ti = TextInput(
            text=text_input.text,
            multiline=False,
            input_type='text',
            keyboard_suggestions=False)
        content.add_widget(ti)
        b = Button(text='set custom')
        b.bind(on_press=lambda x: callback(ti.text))
        content.add_widget(b)

        p.add_widget(content)
        p.open()
Ejemplo n.º 49
0
Archivo: misc.py Proyecto: 2xR/legacy
def fps_label(update_interval=1.0, bbox_color=(0, 0, 0, .2), **kwargs):
    """Creates a label displaying the number of frames per second."""
    label = Label(**kwargs)
    label.bind(texture_size=label.setter("size"))
    show_bbox(label, color=bbox_color)

    def update(dt):
        label.text = "%.01f FPS" % Clock.get_fps()

    Clock.schedule_interval(update, update_interval)
    return label
Ejemplo n.º 50
0
    def getUI(self):
        """get the ui element"""
        result = Label()
        skin = sm.getSkin('label', self.asset)
        result.text_size = sm.getControlSize(skin, self.asset)
        result.bind(texture_size=self.setter('size'))
        if self.value:
            result.text = self.value

        self.uiEl = result
        self.prepareUiElement()
        return result
Ejemplo n.º 51
0
 def load_command(command):
     for line in wrap(command, int(Save.maxWrap*self.user_maxWrap)).splitlines():
         label = Label(text=line, halign='left', size_hint=(1,None), height=45, color=self.user_input_color, font_name = self.user_font)
         label.bind(size=label.setter('text_size')) 
         resize_one(label)  
         grid.add_widget(label)
     text.text = ''
     if Save.currentFunction[0]!=None:
         f = Save.currentFunction[0]
         new_response(prin(f(command)))
     else:
         new_response(parse(game.pc, command))
     scroll.scroll_y = 0
class AlternateApp(App):
    c = 0
    def build(self):
        self.main = Label(text='Programming is fun.')
        self.main.bind(on_touch_down=self.alternate)
        return self.main

    def alternate(self, instance, touch):
        if self.c == 0:
            self.main.text = 'It is fun to programme.'
        else:
            self.main.text = 'Programming is fun.'
        self.c = 1-self.c
Ejemplo n.º 53
0
 def display_out(self, uid, out='out'):
     process = self.processes[uid]
     p = Popup(size_hint=(.95, .95),
               title='std%s %s' % (out, process['label'].text))
     sc = ScrollView()
     content = Label(text=process[out], size_hint=(None, None))
     sc.bind(width=content.setter('width'))
     content.bind(width=lambda c, w:
                  content.setter('text_size')(c, (w, None)))
     content.bind(texture_size=content.setter('size'))
     sc.add_widget(content)
     p.add_widget(sc)
     p.open()
Ejemplo n.º 54
0
class AutoLineBreakLabel(GridLayout):
	def __init__(self, text, width=300, markup=True, valign='top', halign='left', **kwargs):
		super(AutoLineBreakLabel, self).__init__(**kwargs)
		self.size_hint = (None, None)
		self.width = width
		self.cols = 1
		self.pos_hint = {'center_x': .5, 'center_y': .5}
		self.bind(minimum_height=self.setter('height'))
		self.label = Label(text=text, size_hint=(1, None), halign=halign, valign=valign, markup=markup)
		self.label.bind(width=lambda obj, value:
							self.label.setter('text_size')(obj, (value, None)))
		self.label.bind(texture_size=self.label.setter('size'))
		self.add_widget(self.label)
Ejemplo n.º 55
0
 def build(self):
     global summary_lbl, history_lbl
     root = BoxLayout(spacing=3, orientation='vertical')
     root.add_widget(Form())
     history_lbl = Label(text='History:', halign="left", valign="top")
     history_lbl.bind(size=history_lbl.setter('text_size'))
     summary_lbl = Label(text='Summary: 0', halign="left", valign="top")
     summary_lbl.bind(size=summary_lbl.setter('text_size'))
     summary_lbl.size_hint = (1, None)
     summary_lbl.size = (0, 50)
     root.add_widget(summary_lbl)
     root.add_widget(history_lbl)
     root.add_widget(Widggg())
     return root
Ejemplo n.º 56
0
    def test_markup_pos(self):
        from kivy.uix.label import Label
        from kivy.uix.gridlayout import GridLayout

        lbl = Label(text="TextToTest")
        lbl.bind(text_size=lbl.setter('size'))
        mrkp = Label(text="TextToTest", markup=True)
        mrkp.bind(text_size=mrkp.setter('size'))

        grid = GridLayout(rows=1, size_hint=(1, 1))
        grid.add_widget(lbl)
        grid.add_widget(mrkp)

        self.render(grid, 2)
Ejemplo n.º 57
0
class MenuWidget(FloatLayout):
        def __init__(self, **kwargs):
                super(MenuWidget, self).__init__(**kwargs)

                default_choice = "demo_tiles"
                self.choices = {
                        "demo_text": "Text drawing",
                        "demo_bounce": "Basic physics simulation",
                        "demo_starship": "'Endless' scrolling background and animation",
                        "demo_tiles": "Tile map scrolling",
                        "demo_pong": "Simple Pong game",
                        "demo_breakout": "Breakout implemented with physical mover",
                        "demo_collision": "Optimized collision checking demo/test",
                        "demo_collision_1": "Simple collision test case",
                        "demo_control_1": "Demonstrates a more complex control scheme",
                        }

                layout = StackLayout(orientation="tb-lr", padding=[10, 20, 10, 20])

                layout.add_widget(Image(source="assets/img/ui/logo.png", size_hint=(1, 0.4)))

                layout.add_widget(Label(text="Choose demo:", size_hint=(1, 0.1)))

                self.spinner = Spinner(text=default_choice, values=[x for x in self.choices.iterkeys()], size_hint=(1, 0.1))
                layout.add_widget(self.spinner)
                self.spinner.bind(text=self.show_selected_value)

                self.description_label = Label(text=self.choices[default_choice], valign="middle", halign="center", size_hint=(1, 0.3))
                self.description_label.bind(size=self.description_label.setter("text_size"))
                layout.add_widget(self.description_label)

                run_button = Button(text="Run", size_hint=(1, 0.1))
                run_button.bind(state=self.on_run)
                layout.add_widget(run_button)

                self.add_widget(layout)

        def show_selected_value(self, spinner, value):
                self.description_label.text = self.choices[value]

        def on_run(self, instance, value):
                if self.parent:
                        parent = self.parent
                        parent.remove_widget(self)

                        state = None
                        exec("state = %s.create(float(Window.width), float(Window.height), float(tile_size))" % self.spinner.text)

                        parent.add_widget(ScreenWidget(state))
Ejemplo n.º 58
0
 def displayFailure(self):
     pu=MyPopUp(title="Failure..", size_hint=(1,.75))
     blo=BoxLayout(orientation='vertical', spacing="5dp")
     lab=Label(text_size=pu.size, text='There are no entries with that name\n'+\
                   'Check your input, or use the normal add function',
               valign='middle', halign='center'
               )
     lab.bind(size=lab.setter('text_size')) 
     lab.size_hint=(1,1)        
     blo.add_widget(lab)
     stayBtn=Button(text='OK', size_hint=(1,.33))
     stayBtn.bind(on_release=pu.dismiss)
     blo.add_widget(stayBtn)
     pu.content=blo
     pu.open()