コード例 #1
0
 def masters_ok(self):
     """Checks if master passwords are OK."""
     if not check_beta():
         alert_dialog = MDDialog(
             title='Missing beta password',
             text='I\'ve noticed, that you have not set beta password. It\'s needed for safe password storing.'
                  ' Do you want to provide it by yourself, or let program to randomize it?',
             auto_dismiss=False,
             buttons=[
                 MDFillRoundFlatIconButton(
                     text='Set password',
                     icon='account-key-outline',
                     on_release=lambda x: self.dismiss_and_back(alert_dialog, 'settings')
                 ),
                 MDRoundFlatIconButton(
                     text='Randomize',
                     icon='dice-multiple-outline',
                     on_release=lambda x: [
                         self.reset_beta(),
                         alert_dialog.dismiss()
                     ]
                 )
             ]
         )
         alert_dialog.open()
         return False
     elif not check_alpha():
         alert_dialog = MDDialog(
             title='Missing alpha password',
             text='I\'ve noticed, that you have not set alpha password. It\'s needed for safe password storing.'
                  ' Do you want to provide it by yourself, or let program to randomize it?',
             auto_dismiss=False,
             buttons=[
                 MDFillRoundFlatIconButton(
                     text='Set password',
                     icon='account-key-outline',
                     on_release=lambda x: self.dismiss_and_back(alert_dialog, 'settings')
                 ),
                 MDRoundFlatIconButton(
                     text='Randomize',
                     icon='dice-multiple-outline',
                     on_release=lambda x: [
                         self.reset_alpha(),
                         alert_dialog.dismiss()
                     ]
                 )
             ]
         )
         alert_dialog.open()
         return False
     else:
         return True
コード例 #2
0
 def _verify_dialog(self):
     content_cls = BoxLayout()
     content_cls.add_widget(MDTextField(
         hint_text=self.tr(
             'alpha'
         ).capitalize() + ' ' + self.tr(
             'password'
         ).lower()
     ))
     alert_dialog = MDDialog(
         title=self.tr('confirm_alpha'),
         type='custom',
         auto_dismiss=False,
         content_cls=content_cls,
         buttons=[
             MDFillRoundFlatIconButton(
                 text=self.tr('ok'),
                 on_release=lambda x: [
                     alert_dialog.dismiss(),
                     self.set_confirm(
                         alert_dialog.content_cls.children[0].text
                     ),
                     self._confirm_done()
                 ]
             ),
             MDRoundFlatIconButton(
                 text=self.tr('cancel'),
                 on_release=lambda x: [
                     alert_dialog.dismiss()
                 ]
             )
         ]
     )
     return alert_dialog
コード例 #3
0
ファイル: PyPassword.py プロジェクト: husyn1/Python-Password
 def masters_ok(self):
     """Checks if master passwords are OK."""
     if not check_beta():
         alert_dialog = MDDialog(
             title=self.tr('error_missing_master_title',
                           txt_format=self.tr('beta')),
             text=self.tr('error_missing_master_text'),
             auto_dismiss=False,
             buttons=[
                 MDFillRoundFlatIconButton(
                     text=self.tr('set_password'),
                     icon='account-key-outline',
                     on_release=lambda x: self.dismiss_and_back(
                         alert_dialog, 'settings')),
                 MDRoundFlatIconButton(
                     text=self.tr('randomize'),
                     icon='dice-multiple-outline',
                     on_release=lambda x:
                     [self.reset_beta(),
                      alert_dialog.dismiss()])
             ])
         alert_dialog.open()
         return False
     elif not check_alpha():
         alert_dialog = MDDialog(
             title=self.tr('error_missing_master_title',
                           txt_format=self.tr('alpha')),
             text=self.tr('error_missing_master_text'),
             auto_dismiss=False,
             buttons=[
                 MDFillRoundFlatIconButton(
                     text=self.tr('set_password'),
                     icon='account-key-outline',
                     on_release=lambda x: self.dismiss_and_back(
                         alert_dialog, 'settings')),
                 MDRoundFlatIconButton(
                     text=self.tr('randomize'),
                     icon='dice-multiple-outline',
                     on_release=lambda x:
                     [self.reset_alpha(),
                      alert_dialog.dismiss()])
             ])
         alert_dialog.open()
         return False
     else:
         return True
コード例 #4
0
 def info_about_developer(self):
     my_dialog = MDDialog(title="List of developers:",
                          size_hint=[.8, .4],
                          type="custom",
                          content_cls=InfoAboutDevelopers(),
                          buttons=[
                              MDRoundFlatIconButton(text="Facebook",
                                                    icon="facebook-box",
                                                    on_press=self.face)
                          ])
     my_dialog.open()
コード例 #5
0
 def del_password(self, password=None, force=False):
     if password is None:
         password = self.root.ids.del_password_alias.text.capitalize()
     self.root.ids.del_password_alias.text = ''
     if not force and len(password) == 0:
         result_dialog = SimpleDialog(
             title=self.tr('whoops'),
             text=self.tr('error_no_alias'),
             alert_text=self.tr('ok')
         ).alert()
     elif not force and len(password) < 3:
         result_dialog = SimpleDialog(
             title=self.tr('whoops'),
             text=self.tr('error_alias_too_short', txt_format='3'),
             alert_text=self.tr('ok')
         ).alert()
     else:
         to_del = get_one_password(password)
         if to_del is None:
             result_dialog = SimpleDialog(
                 title=self.tr('warning'),
                 text=self.tr('error_not_exists'),
                 alert_text=self.tr('ok')
             ).alert()
         elif type(to_del) is not bytes:
             result_dialog = SimpleDialog(
                 title=self.tr('warning'),
                 text=self.tr('error_bad_format'),
                 alert_text=self.tr('ok')
             ).alert()
         else:
             result_dialog = MDDialog(
                 title=self.tr('warning'),
                 text=self.tr('confirm_delete', txt_format=password),
                 auto_dismiss=False,
                 buttons=[
                     MDFillRoundFlatIconButton(
                         text=self.tr('yes'),
                         icon='check-circle-outline',
                         on_release=lambda x: [
                             self._del_password_confirm(password),
                             result_dialog.dismiss()
                         ]
                     ),
                     MDRoundFlatIconButton(
                         text=self.tr('no'),
                         icon='close-circle-outline',
                         on_release=lambda x: self.dismiss_and_back(
                             result_dialog
                         )
                     )
                 ]
             )
     result_dialog.open()
コード例 #6
0
    def result(self, obj):
        if (self.name_input.text != "" and self.height_input.text != "" and self.weight_input.text != ""):
            bmi = float(self.weight_input.text) / (float(self.height_input.text) * float(self.height_input.text))
            if 25.0 <= bmi <= 30.0:
                report = "Overweight"
            elif bmi > 30.0:
                report = "Obese"
            elif bmi < 18.5:
                report = "Underweight"
            else:
                report = "Healthy"

            self.dialog = MDDialog(title="BMI Report", text=self.name_input.text + " ,your BMI is " + str(
                round(bmi, 2)) + " and you are in " + report + " category",
                                   size_hint=(0.8, 1),
                                   buttons=[MDRoundFlatIconButton(icon="close", text="close", on_release=self.close)])
            self.dialog.open()
        else:
            self.dialog = MDDialog(title="Error", text="Enter the details", size_hint=(0.8, 1),
                                   buttons=[MDRoundFlatIconButton(icon="close", text="close", on_release=self.close)])
            self.dialog.open()
コード例 #7
0
    def info_about_new_funck(self):
        my_dialog_2 = MDDialog(
            title="About Project:",
            text=
            "My project is built using a buildozer based on python and kivymd (kivy, plyer). In the future, features such as qrcode reader and barcode will be added to the project. The rest of the information and updates can be found on github.",
            size_hint=[.8, .3],
            buttons=[
                MDRoundFlatIconButton(text="GITHUB",
                                      icon="github-circle",
                                      on_press=self.github,
                                      width=160)
            ])

        my_dialog_2.open()
コード例 #8
0
 def del_password(self, password=None):
     if password is None:
         password = self.root.ids.del_password_alias.text.capitalize()
     self.root.ids.del_password_alias.text = ''
     if len(password) == 0:
         result_dialog = SimpleDialog(
             title='Whoops!',
             text='Please provide password alias at first.'
         ).alert()
     elif len(password) < 3:
         result_dialog = SimpleDialog(
             title='Whoops!',
             text='Password alias has to be at least 3 characters long.'
         ).alert()
     else:
         to_del = get_one_password(password)
         if to_del is None:
             result_dialog = SimpleDialog(
                 title='Warning!',
                 text='That password do not exists in database'
             ).alert()
         elif type(to_del) is not bytes:
             result_dialog = SimpleDialog(
                 title='Warning!',
                 text='An critical error has occurred. Passwords are saved to local database in wrong way.'
             ).alert()
         else:
             result_dialog = MDDialog(
                 title='Attention',
                 text=f'Do you really want to delete "{password}" password?',
                 auto_dismiss=False,
                 buttons=[
                     MDFillRoundFlatIconButton(
                         text='Yes',
                         icon='check-circle-outline',
                         on_release=lambda x: [
                             self._del_password_confirm(password),
                             result_dialog.dismiss()
                         ]
                     ),
                     MDRoundFlatIconButton(
                         text='No',
                         icon='close-circle-outline',
                         on_release=lambda x: self.dismiss_and_back(result_dialog)
                     )
                 ]
             )
     result_dialog.open()
コード例 #9
0
    def __init__(self, solver, **kwargs):
        super().__init__(**kwargs)
        self.text = 'Gallery Solver'
        self.icon = 'folder-image'

        # -- UI
        self.__big_layout = MDBoxLayout(padding=20,
                                        spacing=20,
                                        orientation="vertical")
        self.add_widget(self.__big_layout)
        self.__big_layout.add_widget(
            MDLabel(text='Gallery Solver',
                    halign='center',
                    font_style="H5",
                    size_hint_y=0.15))

        # - Image Layout
        self.__image_layout = MyImageWidget(size_hint_y="0.75",
                                            id="image",
                                            source='uix/assets/AI.png')

        self.__big_layout.add_widget(self.__image_layout)

        # - File Manager for image selection
        # Window.bind(on_keyboard=self.events)

        self.manager_open = False
        self.file_manager = MDFileManager(
            exit_manager=self.exit_manager,
            select_path=self.select_path,
            # preview=True,
        )
        self.__image_selection_button = MDRoundFlatIconButton(
            on_release=self.file_manager_open,
            pos_hint={
                "top": 0.4,
                "center_x": 0.5
            })
        self.__image_selection_button.text = "Select An Image !"
        self.__image_selection_button.icon = "image"

        # self.__actual_image_path = None

        self.__big_layout.add_widget(self.__image_selection_button)

        # - Solver
        self.__solver = solver
コード例 #10
0
ファイル: gfs.py プロジェクト: FoyerSociety/GFS-KivyMD
    def close_cotis_Dialog(self, btn):
        if btn.text == "OK":
            new_card = MDCard(orientation="vertical",
                              padding="15dp",
                              size_hint=(None, None),
                              size=("180dp", "220dp"),
                              pos_hint={
                                  "center_x": 0.80,
                                  "center_y": 0.31
                              })

            new_card.add_widget(
                MDFloatingActionButton(
                    icon="alert",
                    user_font_size="14sp",
                    theme_text_color="Custom",
                    text_color=get_color_from_hex("#ffffff"),
                    md_bg_color=get_color_from_hex("#faaf00"),
                    elevation_normal=0))
            new_card.add_widget(
                MDLabel(text=self.motifs_cotis.text,
                        pos_hint={
                            "x": 0.30,
                            "y": 0.75
                        },
                        font_size='18sp'))
            new_card.add_widget(
                MDRoundFlatIconButton(icon="currency-eur",
                                      text=self.argent_cotis.text,
                                      pos_hint={
                                          "center_x": 0.5,
                                          "center_y": 0.5
                                      },
                                      font_size='17sp',
                                      margin="30dp"))
            new_card.add_widget(
                MDIconButton(icon="trash-can",
                             theme_text_color="Custom",
                             font_size="18sp",
                             text_color=get_color_from_hex("#071f38"),
                             pos_hint={
                                 "center_x": 0.5,
                                 "center_y": 0.3
                             }))
            self.INTERFACE.ids.Cotisation.add_widget(new_card)
        self.dialog.dismiss()
コード例 #11
0
ファイル: PyPassword.py プロジェクト: husyn1/Python-Password
 def reset_beta(self):
     confirm_dialog = MDDialog(
         title=self.tr('warning'),
         text=self.tr('confirm_randomize_beta'),
         auto_dismiss=False,
         buttons=[
             MDFillRoundFlatIconButton(
                 text=self.tr('yes'),
                 icon='check-circle-outline',
                 on_release=lambda x: [
                     self.change_master('beta', urandom(16)),
                     confirm_dialog.dismiss()
                 ]),
             MDRoundFlatIconButton(
                 text=self.tr('no'),
                 icon='close-circle-outline',
                 on_release=lambda x: confirm_dialog.dismiss())
         ])
     confirm_dialog.open()
コード例 #12
0
 def reset_beta(self):
     confirm_dialog = MDDialog(
         title='Warning!',
         text='This will randomize beta password. It will be super safe, but you probably will not be able to'
              ' re-enter this password later. Do you want to continue?',
         auto_dismiss=False,
         buttons=[
             MDFillRoundFlatIconButton(
                 icon='check-circle-outline',
                 text='Yes',
                 on_release=lambda x: [
                     self.change_master('beta', urandom(16)),
                     confirm_dialog.dismiss()
                 ]
             ),
             MDRoundFlatIconButton(
                 icon='close-circle-outline',
                 text='No',
                 on_release=lambda x: confirm_dialog.dismiss()
             )
         ]
     )
     confirm_dialog.open()
コード例 #13
0
    def create_switch_control(self, text, app):
        self.switch_state = True if text == 'ON' else False
        grid = MDGridLayout(spacing=3, padding=3, cols=3)
        self.switch = MySwitch(width=dp(64), active=self.switch_state)
        self.switch.bind(on_press=self.switch_callback)

        self.parameter_label = LabelButton(
            text=text,
            font_size=40,
            halign='center',
            theme_text_color="Custom",
            text_color=(1, 0, 0, 1) if not self.switch.active else
            (0, 1, 0, 1),
            on_release=self.commit_parameter_value)
        commit_btn = MDRoundFlatIconButton(
            text="Commit",
            md_bg_color=app.theme_cls.primary_color,
            on_release=self.commit_parameter_value)
        self.popup_container.clear_widgets()
        grid.add_widget(self.parameter_label)
        grid.add_widget(self.switch)
        grid.add_widget(commit_btn)
        self.popup_container.add_widget(grid)