Пример #1
0
 def create_main_layout(self, wrong_login=False):
     if wrong_login:
         self.main_layout.add_widget(
             FontFittingLabel(
                 markup=True,
                 color=(1, 1, 1, 1),
                 size_hint_y=0.20,
                 text="[b][color=FF0000]Zły login lub hasło![/color][/b]"))
     self.__username_input = TextInput(
         multiline=False,
         id='Username',
         focus=False,
         size_hint_y=0.20,
         on_text_validate=lambda a: self.focus_password())
     self.__password_input = TextInput(
         multiline=False,
         id='Password',
         focus=False,
         size_hint_y=0.20,
         password=True,
         on_text_validate=lambda a: self.parent.handle_login(
             self.__username_input.text, str(hash(a.text))))
     self.main_layout.add_widget(
         FontFittingLabel(text="Login:"******"Hasło:",
                          **self.credential_label_properties))
     self.main_layout.add_widget(self.__password_input)
     self.main_layout.add_widget(
         FontFittingButton(on_press=lambda a: self.parent.handle_login(
             self.__username_input.text, self.__password),
                           **self.loginbutton_properties))
     self.__password_input.text = self.__username_input.text = ''
Пример #2
0
 def setup_input_fields(self):
     self.main_layout.add_widget(FontFittingLabel(text="Stare haslo:"))
     self.main_layout.add_widget(TextInput(id='old', focus=False, password=True, multiline=False,
                                           on_text_validate=lambda a: self.focus_input('new')))
     self.focus_input('old')
     self.main_layout.add_widget(FontFittingLabel(text="Nowe haslo:"))
     self.main_layout.add_widget(TextInput(id='new', focus=False, password=True, multiline=False,
                                           on_text_validate=lambda a: self.focus_input('repeated')))
     self.main_layout.add_widget(FontFittingLabel(text="Powtorz Nowe haslo:"))
     self.main_layout.add_widget(TextInput(id='repeated', focus=False, password=True, multiline=False,
                                           on_text_validate=lambda a: self.confirm()))
Пример #3
0
 def setup_input_fields(self):
     self.main_layout.add_widget(FontFittingLabel(text="Login:"******"Imie:"))
     self.main_layout.add_widget(TextInput(id='firstname', focus=False, multiline=False,
                                           on_text_validate=lambda a: self.focus_input('lastname')))
     self.main_layout.add_widget(FontFittingLabel(text="Nazwisko:"))
     self.main_layout.add_widget(TextInput(id='lastname', focus=False, multiline=False,
                                           on_text_validate=lambda a: schedule_task(schedule_task(
                                               CreateUser(firstname=self.get_child('firstname').text,
                                                          lastname=self.get_child('lastname').text,
                                                          login=self.get_child('login').text),
                                               instance=self))))
Пример #4
0
 def display_error(self, msg):
     self.main_layout.clear_widgets()
     self.main_layout.add_widget(
         FontFittingLabel(
             text="[b][color=FF0000]{}[/color][/b]".format(msg),
             markup=True))
     self.setup_widgets()
Пример #5
0
    def show_earnings(self, total_earns):
        period = self.choosen.text
        self.main_layout.clear_widgets()
        self.setup_widgets()
        if total_earns is None:
            total_earns = 0

        self.main_layout.add_widget(
            FontFittingLabel(text="Okres: {}".format(period),
                             color=self.header_font_color))
        self.main_layout.add_widget(
            FontFittingLabel(text="Zarobione łącznie: {}".format(total_earns),
                             color=self.header_font_color))
        self.main_layout.add_widget(
            FontFittingLabel(text="Na czysto: {}".format(total_earns / 2),
                             color=self.header_font_color))
Пример #6
0
 def assign_users(self, users):
     self.main_layout.add_widget(FontFittingLabel(text='Wybierz użytkownika:'))
     super(UserRemovingPopup, self).assign_users(users)
     self.confirm_button = FontFittingButton(text="Usuń konto", size_hint=(1, 1),
                                             on_press=lambda a:
                                             ConfirmationPopup(confirmed_function=self.remove_choosen,
                                                               func_args=tuple([self.choosen])).open())
     self.main_layout.add_widget(self.confirm_button)
Пример #7
0
 def setup_option_buttons(self):
     today = "{}/{}/{}".format(gmtime().tm_year, gmtime().tm_mon, gmtime().tm_mday)
     self.main_layout.add_widget(FontFittingLabel(text='Grafik z dnia {}'.format(self.day), size_hint_y=None,
                                                  height=self.buttons_height,
                                                  color=self.header_font_color))
     self.main_layout.add_widget(FontFittingButton(text='Pokaz dzisiejszy', size_hint_y=None,
                                                   height=self.buttons_height,
                                                   on_press=lambda a: self.refresh(today),
                                                   **self.configuration_buttons_properties))
Пример #8
0
 def create_main_layout(self):
     layout = BoxLayout(orientation='vertical', size_hint=(0.8, 0.8))
     layout.add_widget(
         FontFittingLabel(text=self.error_msg, text_size=self.size))
     layout.add_widget(
         FontFittingButton(text="X",
                           text_size=self.size,
                           on_press=lambda a: self.exit()))
     return layout
Пример #9
0
 def display_results(self, success, success_msg, failure_msg):
     if success and self.modified_logged_user():
         self.bind(on_dismiss=App.get_running_app().root.logout)
         self.confirm_button.bind(on_press=lambda a: self.dismiss(), on_release=lambda a: self.dismiss())
     color, msg = ('00FF00', success_msg) if success else ('FF0000', failure_msg)
     self.main_layout.clear_widgets()
     self.main_layout.add_widget(FontFittingLabel(markup=True,
                                                  text="[b][color={}]{}![/color][/b]".format(color, msg)))
     self.setup_widgets()
     self.refresh_user_possibilities()
Пример #10
0
 def __init__(self):
     super(ConnectionError, self).__init__()
     self.current_screen = App.get_running_app().root.current
     self.current_screen_instance = App.get_running_app().root.get_screen(
         self.current_screen)
     self.connection_error_label = FontFittingLabel(
         text="[color=FF0000][b]Błąd połączenia."
         "Sprawdź dostęp do internetu.[/b][/color]",
         markup=True,
         size_hint=(1, 0.1),
         pos=(0, 0))
Пример #11
0
 def display_results(self, created_successfully):
     self.unfocus_all_inputs()
     self.main_layout.clear_widgets()
     messages = {
         None: ('Nie można utworzyć konta. Wprowadź poprawne dane!', 'FF0000'),
         False: ('Użytkownik juz istnieje.', 'FF0000'),
         True: ('Konto zostało założone poprawnie!', '00FF00')
     }
     message, color = messages[created_successfully]
     self.main_layout.add_widget(FontFittingLabel(text="[b][color={}]{}![/color][/b]".format(color, message),
                                                  markup=True))
     self.setup_widgets()
     self.refresh_user_chooser()
Пример #12
0
 def create_month_chooser(self):
     month_chooser = BoxLayout(orientation="horizontal", size_hint=(1, 0.1))
     displayed_year = self.currently_displayed_month
     month_chooser.add_widget(
         FontFittingButton(text="Poprzedni",
                           on_release=lambda a: self.previous_month()))
     month_chooser.add_widget(
         FontFittingLabel(text="{} {}".format(
             months_of_the_year[displayed_year[1]], displayed_year[0]),
                          color=self.month_header_font_color))
     month_chooser.add_widget(
         FontFittingButton(text="Nastepny",
                           on_release=lambda a: self.next_month()))
     return month_chooser
Пример #13
0
 def setup_period_chooser(self):
     period_chooser = DropDown()
     for x in self.dates:
         period_chooser.add_widget(
             FontFittingButton(
                 text="{}".format(x),
                 size_hint_y=None,
                 height=self.dropdown_height,
                 on_release=lambda a: period_chooser.select(a.text),
                 **self.dropdown_buttons_properties))
     self.choosen = FontFittingButton(text="Dzis",
                                      size_hint=(1, 1),
                                      **self.button_properties)
     self.choosen.bind(
         on_release=lambda a: period_chooser.open(self.choosen))
     period_chooser.bind(
         on_select=lambda instance, z: setattr(self.choosen, 'text', z))
     self.main_layout.add_widget(
         FontFittingLabel(text="Wybierz okres rozliczeniowy:",
                          size_hint=(1, 1),
                          color=self.header_font_color))
     self.main_layout.add_widget(self.choosen)
     self.main_layout.add_widget(
         FontFittingButton(text="Wybierz inny dzień",
                           size_hint=(1, 1),
                           on_press=lambda a: self.choose_other_date(),
                           **self.button_properties))
     self.main_layout.add_widget(
         FontFittingButton(text="Wyswietl",
                           size_hint=(1, 1),
                           on_press=lambda a: self.display_choosen(),
                           **self.button_properties))
     if App.get_running_app().root.logged_user.privileges == 'Admin':
         self.main_layout.add_widget(
             FontFittingButton(
                 text="Wyswietl łączne zarobki",
                 size_hint=(1, 1),
                 on_press=lambda a: self.display_choosen(all_users=True),
                 **self.button_properties))
Пример #14
0
 def assign_users(self, users):
     self.main_layout.add_widget(FontFittingLabel(text='Wybierz uzytkownika i uprawnienia'))
     super(PermissionChanger, self).assign_users(users)
     self.assign_permissions()
Пример #15
0
 def on_successful_change(self):
     self.main_layout.clear_widgets()
     self.main_layout.add_widget(FontFittingLabel(text="[color=00FF00]Hasło zostało zmienione poprawnie.[/color]",
                                                  markup=True))
     self.bind(on_dismiss=App.get_running_app().root.logout)
     self.main_layout.add_widget(FontFittingButton(text="Ok", on_release=lambda a: self.dismiss()))
Пример #16
0
 def on_wrong_attempt(self):
     self.main_layout.clear_widgets()
     self.setup_widgets()
     self.main_layout.add_widget(FontFittingLabel(text="[b][color=FF0000]Nie poprawne dane![/color][/b]",
                                                  markup=True))
Пример #17
0
 def setup_widgets(self):
     super(ConfirmationPopup, self).setup_widgets()
     self.main_layout.add_widget(FontFittingLabel(text='Jestes pewien?'))
     self.main_layout.add_widget(FontFittingButton(text='Tak', on_press=lambda a: self.confirm()))
     self.main_layout.add_widget(FontFittingButton(text='Nie', on_press=lambda a: self.dismiss()))