def on_select_audio_clicked(self):
     # noinspection PyCallByClass
     audio_file_result_tuple = QtWidgets.QFileDialog.getOpenFileName(
         self, "Please choose a wav audio file",
         mc_global.get_user_audio_path(), "Wav files (*.wav)")
     new_file_path_str = audio_file_result_tuple[0]
     if new_file_path_str:
         mc.model.SettingsM.update_breathing_reminder_audio_path(
             new_file_path_str)
     else:
         pass
     self.update_gui_audio_details()
 def on_notif_select_audio_clicked(self):
     # noinspection PyCallByClass
     audio_file_result_tuple = QtWidgets.QFileDialog.getOpenFileName(
         self, self.tr("Please choose a wav audio file"),
         mc_global.get_user_audio_path(), self.tr("Wav files (*.wav)"))
     new_file_path_str = audio_file_result_tuple[0]
     if new_file_path_str:
         new_filename_str = os.path.basename(
             new_file_path_str)  # -we store the name instead of the path
         mc.model.SettingsM.update_breathing_reminder_audio_filename(
             new_filename_str)
     else:
         pass
     self.notif_update_gui_audio_details()
 def on_select_audio_clicked(self):
     # noinspection PyCallByClass
     audio_file_result_tuple = QtWidgets.QFileDialog.getOpenFileName(
         self,
         self.tr("Please choose a wav audio file"),
         mc_global.get_user_audio_path(),
         self.tr("Wav files (*.wav)")
     )
     new_file_path_str = audio_file_result_tuple[0]
     if new_file_path_str:
         mc.model.SettingsM.update_breathing_reminder_audio_path(new_file_path_str)
     else:
         pass
     self.update_gui_audio_details()
 def on_prep_select_audio_clicked(self):
     # noinspection PyCallByClass
     audio_file_result_tuple = QtWidgets.QFileDialog.getOpenFileName(
         self,
         self.tr("Please choose a wav audio file"),
         mc_global.get_user_audio_path(),
         self.tr("Wav files (*.wav)")
     )
     new_file_path_str = audio_file_result_tuple[0]
     if new_file_path_str:
         new_filename_str = os.path.basename(new_file_path_str)  # -we store the name rather than the path
         mc.model.SettingsM.update_prep_reminder_audio_filename(new_filename_str)
     else:
         pass
     self.prep_update_gui_audio_details()
def initial_schema_and_setup(i_db_conn: sqlite3.Connection) -> None:
    # Auto-increment is not needed in our case: https://www.sqlite.org/autoinc.html

    i_db_conn.execute("CREATE TABLE " + Schema.PhrasesTable.name + "(" +
                      Schema.PhrasesTable.Cols.id + " INTEGER PRIMARY KEY, " +
                      Schema.PhrasesTable.Cols.vertical_order +
                      " INTEGER NOT NULL, " + Schema.PhrasesTable.Cols.title +
                      " TEXT NOT NULL, " + Schema.PhrasesTable.Cols.ib_phrase +
                      " TEXT NOT NULL, " + Schema.PhrasesTable.Cols.ob_phrase +
                      " TEXT NOT NULL, " +
                      Schema.PhrasesTable.Cols.ib_short_phrase +
                      " TEXT NOT NULL DEFAULT '', " +
                      Schema.PhrasesTable.Cols.ob_short_phrase +
                      " TEXT NOT NULL DEFAULT ''" + ")")

    i_db_conn.execute("CREATE TABLE " + Schema.RestActionsTable.name + "(" +
                      Schema.RestActionsTable.Cols.id +
                      " INTEGER PRIMARY KEY, " +
                      Schema.RestActionsTable.Cols.vertical_order +
                      " INTEGER NOT NULL, " +
                      Schema.RestActionsTable.Cols.title + " TEXT NOT NULL, " +
                      Schema.RestActionsTable.Cols.image_path +
                      " TEXT NOT NULL" + ")")

    i_db_conn.execute(
        "CREATE TABLE " + Schema.SettingsTable.name + "(" +
        Schema.SettingsTable.Cols.id + " INTEGER PRIMARY KEY, " +
        Schema.SettingsTable.Cols.rest_reminder_active + " INTEGER NOT NULL" +
        " DEFAULT " + str(SQLITE_TRUE_INT) + ", " +
        Schema.SettingsTable.Cols.rest_reminder_interval +
        " INTEGER NOT NULL" + " DEFAULT " +
        str(DEFAULT_REST_REMINDER_INTERVAL_MINUTES_INT) + ", " +
        Schema.SettingsTable.Cols.rest_reminder_audio_path + " TEXT NOT NULL" +
        " DEFAULT '" +
        mc_global.get_user_audio_path(mc_global.WIND_CHIMES_FILENAME_STR) +
        "'" + ", " + Schema.SettingsTable.Cols.rest_reminder_volume +
        " INTEGER NOT NULL" + " DEFAULT " + str(MAX_VOLUME_INT) + ", " +
        Schema.SettingsTable.Cols.rest_reminder_notification_type +
        " INTEGER NOT NULL" + " DEFAULT " +
        str(mc_global.NotificationType.Both.value) + ", " +
        Schema.SettingsTable.Cols.breathing_reminder_active +
        " INTEGER NOT NULL" + " DEFAULT " + str(SQLITE_TRUE_INT) + ", " +
        Schema.SettingsTable.Cols.breathing_reminder_interval +
        " INTEGER NOT NULL" + " DEFAULT " +
        str(DEFAULT_BREATHING_REMINDER_INTERVAL_MINUTES_INT) + ", " +
        Schema.SettingsTable.Cols.breathing_reminder_audio_path +
        " TEXT NOT NULL" + " DEFAULT '" + mc_global.get_user_audio_path(
            mc_global.SMALL_BELL_SHORT_FILENAME_STR) + "'" + ", " +
        Schema.SettingsTable.Cols.breathing_reminder_volume +
        " INTEGER NOT NULL" + " DEFAULT " + str(MAX_VOLUME_INT) + ", " +
        Schema.SettingsTable.Cols.breathing_reminder_notification_type +
        " INTEGER NOT NULL" + " DEFAULT " +
        str(mc_global.NotificationType.Both.value) + ", " +
        Schema.SettingsTable.Cols.breathing_reminder_phrase_setup +
        " INTEGER NOT NULL" + " DEFAULT " +
        str(mc_global.PhraseSetup.Switch.value) + ")")

    db_connection = Helper.get_db_connection()

    db_cursor = db_connection.cursor()
    db_cursor.execute(
        "INSERT OR IGNORE INTO " + Schema.SettingsTable.name + "(" +
        Schema.SettingsTable.Cols.id + ") VALUES (?)",
        (SINGLE_SETTINGS_ID_INT, ))
    # -please note "OR IGNORE"
    db_connection.commit()