예제 #1
0
    def btn_release_register(self):
        username = self.tf_username.text
        email = self.tf_email.text
        password = self.tf_password.text
        repeated_password = self.tf_repeated_password.text

        if len(username) == 0 or len(email) == 0 or len(password) == 0:
            self.show_error_message("Please fill all fields")
            return

        if not is_valid_email(email):
            self.show_error_message("Please fill in a valid email address")
            self.tf_email.text = ""
            return

        if password != repeated_password:
            self.show_error_message("Passwords are not equal")
            self.tf_password.text = ""
            self.tf_repeated_password.text = ""
            return

        status = interface.register(username, password, email)
        if status.was_successful():
            logger_gui.info("Successfully registered")
            screens.screen_manager.do_login()
        else:
            logger_gui.info(f"Failed to register: {status.get_text()}")
            self.show_error_message(status.get_text())
예제 #2
0
 def remove_synchronization(self, local_path: NormalizedPath):
     for i in range(len(self.data)):  # TODO: enumerate
         if self.data[i]['local_path'] == local_path:
             logger_gui.info(f"Remove synchronization: {local_path}")
             interface.remove_synchronization(local_path)
             self.data.pop(i)
             break
예제 #3
0
def _open_gui_from_thread():
    """Opens the GUI.

    Must be called from the GUI thread.
    """
    logger_gui.info(f"Opening GUI: _open_settings={_open_settings}")
    _cleanup_kivy()
    gui_main.main(**_open_settings)
예제 #4
0
def close_gui():
    """Closes the GUI window."""
    global _app_is_running
    if _app_is_running:
        logger_gui.info(f"Close GUI")
        App.get_running_app().stop()
        _after_close_gui()
    else:
        logger_gui.info(f"Requests to close GUI but app is already closed")
예제 #5
0
 def __init__(self, start_screen: screens.ScreenName,
              authentication_only: bool, **kwargs):
     super().__init__(**kwargs)
     logger_gui.info(
         f"Open app: start_screen={start_screen}, authentication_only={authentication_only}"
     )
     assert (authentication_only and not program_state.is_authenticated_at_server.is_running()) \
         or not authentication_only, "GUI called with authentication only but user is already authenticated"
     assert not authentication_only or (authentication_only and start_screen == screens.LOGIN_MANUAL), \
         "Argument combination is not allowed: authentication_only and start_screen != LOGIN_MANUAL"
     self.start_screen = start_screen
     self.authentication_only = authentication_only
예제 #6
0
def open_gui(authentication_only=False, opened_by: gui_main.Opener = gui_main.CLIENT):
    """Opens the GUI window.

    If the thread for the gui is not already running it is started here.
    """
    global _app_is_running
    if not program_state.gui.is_running():
        start_gui_thread()
    if not _app_is_running:
        logger_gui.info(f"Requests to open GUI: authentication_only={authentication_only}, opened_by={opened_by}")
        _open_gui_event.set()
        _open_settings["authentication_only"] = authentication_only
        _open_settings["opened_by"] = opened_by
        _app_is_running = True
    else:
        logger_gui.info(f"Requests to open GUI but app is already running")
예제 #7
0
 def on_stop(self):
     logger_gui.info("Closed gui")