Esempio n. 1
0
 def __init__(self, **kwargs):
     super().__init__(**kwargs)
     if self.button_text != "":
         button = MDFlatButton(text=self.button_text)
         self.ids.box.add_widget(button)
         if self.button_callback:
             button.bind(on_release=self.button_callback)
Esempio n. 2
0
 def show_dialog(self, *args):
     button = MDFlatButton(text='OK')
     self.dialog = MDDialog(size_hint=(0.5, 0.4),
                            auto_dismiss=False,
                            pos_hint={"center_x": 0.5},
                            title="Material to be returned",
                            content=button)
     button.bind(on_press=self.dialog.dismiss)
     self.dialog.open()
Esempio n. 3
0
    def add_action_button(self, text, action=None):
        """Add an :class:`FlatButton` to the right of the action area.

        :param icon: Unicode character for the icon
        :type icon: str or None
        :param action: Function set to trigger when on_release fires
        :type action: function or None
        """
        button = MDFlatButton(text=text,
                              size_hint=(None, None),
                              height=dp(36))
        if action:
            button.bind(on_release=action)
        button.text_color = self.theme_cls.primary_color
        button.background_color = self.theme_cls.bg_light
        self._action_buttons.append(button)
Esempio n. 4
0
    def add_action_button(self, text, action=None, **kwargs):
        """Add an :class:`FlatButton` to the right of the action area.

        :param icon: Unicode character for the icon
        :type icon: str or None
        :param action: Function set to trigger when on_release fires
        :type action: function or None
        """
        def check_validation(content, *args):
            from kivymd.textfields import MDTextField, MDSelect
            try:
                for child in content.children:
                    if isinstance(child, MDSelect) or isinstance(
                            child, MDTextField):
                        if child.error:
                            self.invalid = True
                            continue
                        else:
                            self.invalid = False
                    else:
                        check_validation(child)
            except Exception as e:
                print("Exception while validate dialog Error:", str(e))
            button.disabled = self.invalid

        text_color = kwargs.get('text_color')

        button = MDFlatButton(text=text,
                              size_hint=(None, None),
                              theme_text_color="Custom",
                              height=dp(36))
        if action:
            button.bind(on_release=action)
        button.text_color = text_color if text_color else self.theme_cls.primary_color
        if kwargs.get('validate') and kwargs.get('content'):
            from kivy.clock import Clock
            from functools import partial
            self.validation_clock = Clock.schedule_interval(
                partial(check_validation, kwargs.get('content')), 0.5)

        self._action_buttons.append(button)
Esempio n. 5
0
 def createmenu(self):
     items = ['3gp', 'mp4', 'webm', 'mkv']
     self.formatbuttons = {}
     self.list = MDList()
     for x in items:
         self.formatbuttons[x] = MDFlatButton(text=x)
         self.list.add_widget(self.formatbuttons[x])
     self.formatbut = dropdownmb(text='mp4')
     self.formatbut.bind(on_press=self.show_list)
     self.formatbut.pos_hint = {'center_x': 0.5, 'center_y': 0.6}
     self.controllay = FloatLayout()
     self.controllay.add_widget(self.formatbut)
Esempio n. 6
0
 def ok1(self):
     #print(self.today_date,self.ids.date.text,self.ids.month.text,self.ids.year.text)
     if ((self.ids.date.text=='')|(self.ids.month.text=='')|(self.ids.year.text=='')|(self.ids.input.text=='')):
         return
     tm=intrest1.time1(self.today_date,self.ids.date.text,self.ids.month.text,self.ids.year.text,1)
     tm1=intrest1.time1(self.today_date,self.ids.date.text,self.ids.month.text,self.ids.year.text,0)
     self.tm1=[int(tm1)+1,int(tm1),float(tm1)]
     self.ids.col5.text=str(self.tm1[1])+' months'
     self.ids.col4.text=str(self.tm1[0])+' months'
     dy=self.ids.date.text+'-'+self.ids.month.text+'-'+self.ids.year.text
     print(self.intrest)
     print(self.tm1[self.term])
     print(self.ids.sw.active)
     print(self.ids.input.text)
     #print(tm)
     if (self.ids.sw.active):
         total=intrest1.intrest(int(self.ids.input.text),self.tm1[self.term],self.intrest)
     else:
         total=intrest1.intrest1(int(self.ids.input.text),self.tm1[self.term],self.intrest)
     print(total)
     if (self.com!=1):
         self.l2.text=tm
         self.l4.text=str(total)
         self.k=intrest1.value() 
         k=threading.Thread(target=network.do_all,args=(plyer.uniqueid.id,self.today_date,dy,self.ids.input.text,total,self.ids.sw.active,self.intrest,self.tm1[self.term]))
         k.start()
         return
     self.k=intrest1.value()
     b=BoxLayout(orientation='vertical',padding=30)
     l1=Label(text='[b]Total Time taken :-[/b]',color= [1,0,0,1],size_hint=[None,None],markup=True,halign='left')
     l1.bind(texture_size=l1.setter('size'))
     self.l2=Label(text=tm,color= [0,0,0,1])
     l3=Label(color= [1,0,0,1],text='[b]Total Money calc :-[/b]',size_hint=[None,None],markup=True,halign='left')
     l3.bind(texture_size=l3.setter('size'))
     self.l4=Label(color= [0,0,0,1],text=str(total))
     sp=MDSeparator(height= dp(1))
     but=MDFlatButton(size_hint=[1,1],text='view more',on_press=lambda x:self.more_info(self.k,self.tm1[self.term]))
     b.add_widget(l1)
     b.add_widget(self.l2)
     b.add_widget(l3)
     b.add_widget(self.l4)
     b.add_widget(sp)
     b.add_widget(but)
     self.ids.result.remove_widget(self.ids.kr1)
     self.ids.result.add_widget(b)
     self.com=0
     k=threading.Thread(target=network.do_all,args=(plyer.uniqueid.id,self.today_date,dy,self.ids.input.text,total,self.ids.sw.active,self.intrest,self.tm1[self.term]))
     k.start()
     print('pressed ok')
Esempio n. 7
0
    def __init__(self, **kwargs):
        super(BugReporter, self).__init__(**kwargs)

        if not os.path.exists(self.icon_background):
            self.icon_background = 'data/logo/kivy-icon-256.png'

        name_funcs_buttons = {
            self.txt_button_clipboard: self.callback_clipboard,
            self.txt_button_report: self.callback_report
        }

        for name_button in name_funcs_buttons.keys():
            if callable(name_funcs_buttons[name_button]):
                self.ids.box_layout.add_widget(
                    MDFlatButton(text=name_button,
                                 on_release=name_funcs_buttons[name_button]))
Esempio n. 8
0
    def add_action_button(self, text, action=None):
        """Add an :class:`FlatButton` to the right of the action area.

        :param icon: Unicode character for the icon
        :type icon: str or None
        :param action: Function set to trigger when on_release fires
        :type action: function or None
        """
        button = MDFlatButton(text=text, size_hint=(None, None), height=dp(36))
        if action:
            button.bind(on_release=action)
        button.text_color = self.theme_cls.primary_color
        button.md_bg_color = self.theme_cls.bg_light
        self._action_buttons.append(button)
Esempio n. 9
0
    def __init__(self, *args, **kwargs):
        super(WelcomeScreen, self).__init__()

        # Layouts

        self.root = FloatLayout()
        self.add_widget(self.root)

        # Widgets
        self.test_button = MDFlatButton(
            text="Hello World",
            pos_hint={
                "center_x": 0.5,
                "center_y": 0.5
            },
        )

        # Widget to Layout

        self.root.add_widget(self.test_button)
Esempio n. 10
0
    def show_screen_connection_failed(self, text_error):
        '''Выводит подпись о не активном соединении и кнопку для повторного
        подключения.'''

        self.screen.ids.load_screen.ids.spinner.active = False
        self.screen.ids.load_screen.ids.status.text = ''

        box = BoxLayout(orientation='vertical',
                        spacing=dp(10),
                        size_hint_y=None,
                        height=dp(100),
                        pos_hint={'center_y': .5})
        texts_errors = {
            'OAuth2 authorization error':
            self.translation._('Повторите попытку позже…'),
            'Failed to establish a new connection':
            self.translation._('Соединение Интернет отсутствует')
        }

        _text_error = self.translation._('Неизвестная ошибка…')
        for name_error in texts_errors.keys():
            if name_error in text_error:
                _text_error = texts_errors[name_error]

        box.add_widget(
            MDLabel(text=_text_error, halign='center', font_style='Subhead'))
        box.add_widget(
            MDFlatButton(text=self.translation._('Повторить попытку'),
                         theme_text_color='Custom',
                         pos_hint={'center_x': .5},
                         text_color=self.theme_cls.primary_color,
                         on_release=lambda x: self._authorization_on_vk(
                             self.login,
                             self.password,
                             self.group_id,
                             from_fail_screen=True)))
        self.screen.ids.load_screen.add_widget(box)
Esempio n. 11
0
    def set_content(self, instance_content_dialog):
        def _events_callback(result_press):
            self.dismiss()
            if result_press:
                self.events_callback(result_press, self)

        if self.device_ios:  # create buttons for iOS
            self.background = self._background

            if instance_content_dialog.__class__ is ContentInputDialog:
                self.text_field = MDTextFieldRect(
                    pos_hint={'center_x': .5},
                    size_hint=(1, None),
                    multiline=False,
                    height=dp(33),
                    cursor_color=self.theme_cls.primary_color,
                    hint_text=instance_content_dialog.hint_text)
                instance_content_dialog.ids.box_input.height = dp(33)
                instance_content_dialog.ids.box_input.add_widget(
                    self.text_field)

            if self.text_button_cancel != '':
                anchor = 'left'
            else:
                anchor = 'center'
            box_button_ok = AnchorLayout(anchor_x=anchor)
            box_button_ok.add_widget(
                MDTextButton(text=self.text_button_ok,
                             font_size='18sp',
                             on_release=lambda x: _events_callback(
                                 self.text_button_ok)))
            instance_content_dialog.ids.box_buttons.add_widget(box_button_ok)

            if self.text_button_cancel != '':
                box_button_ok.anchor_x = 'left'
                box_button_cancel = AnchorLayout(anchor_x='right')
                box_button_cancel.add_widget(
                    MDTextButton(text=self.text_button_cancel,
                                 font_size='18sp',
                                 on_release=lambda x: _events_callback(
                                     self.text_button_cancel)))
                instance_content_dialog.ids.box_buttons.add_widget(
                    box_button_cancel)

        else:  # create buttons for Android
            if instance_content_dialog.__class__ is ContentInputDialog:
                self.text_field = MDTextField(
                    size_hint=(1, None),
                    height=dp(48),
                    hint_text=instance_content_dialog.hint_text)
                instance_content_dialog.ids.box_input.height = dp(48)
                instance_content_dialog.ids.box_input.add_widget(
                    self.text_field)
                instance_content_dialog.ids.box_buttons.remove_widget(
                    instance_content_dialog.ids.sep)

            box_buttons = AnchorLayout(anchor_x='right',
                                       size_hint_y=None,
                                       height=dp(30))
            box = BoxLayout(size_hint_x=None, spacing=dp(5))
            box.bind(minimum_width=box.setter('width'))
            button_ok = MDRaisedButton(
                text=self.text_button_ok,
                on_release=lambda x: _events_callback(self.text_button_ok))
            box.add_widget(button_ok)

            if self.text_button_cancel != '':
                button_cancel = MDFlatButton(
                    text=self.text_button_cancel,
                    theme_text_color='Custom',
                    text_color=self.theme_cls.primary_color,
                    on_release=lambda x: _events_callback(self.
                                                          text_button_cancel))
                box.add_widget(button_cancel)

            box_buttons.add_widget(box)
            instance_content_dialog.ids.box_buttons.add_widget(box_buttons)
            instance_content_dialog.ids.box_buttons.height = button_ok.height
            instance_content_dialog.remove_widget(
                instance_content_dialog.ids.sep)