示例#1
0
 def displayText(self, value: QVariant, locale: QLocale) -> str:
     """
     Returns a text to display.
     :param value: Value to parse.
     :param locale: Locale format.
     :return: Text to display.
     """
     date = Tools.get_date_from_string(str(value))
     return date.toString(Resources.FORMAT_DATE_DISPLAY)
示例#2
0
    def __get_reminder_event_date(self, index: int) -> QDate:
        query = self.__db.exec(
            Resources.ReminderManager_SELECT_ReminderEventDate % str(index))
        query.next()
        date = query.value(0)
        if not date:
            date = ''

        return Tools.get_date_from_string(date)
示例#3
0
    def setEditorData(self, editor: QWidget, index: QModelIndex):
        """
        Sets data to an editor.
        :param editor: Editor.
        :param index: Model's index.
        """
        date = Tools.get_date_from_string(str(index.data()))
        row = index.row()

        if row not in self.__minimum:
            self.__minimum[row] = date

        editor.setMinimumDate(self.__minimum[row])
        editor.setDate(date)
        Tools.write_verbose_class_method_name(
            self, ItemDelegateDateEdit.setEditorData, "date", str(date))
示例#4
0
    def __get_event_count_to_add(self, event_info: dict) -> int:
        zero = 0
        if not bool(event_info["IsActive"]):
            return zero
        if not bool(event_info["IsCyclic"]):
            return zero
        start_date = Tools.get_date_from_string(str(event_info["StartDate"]))
        current_date = Tools.get_current_date()
        if start_date > current_date:
            return zero
        count_to_add = int(event_info["Count"]) - int(
            event_info["ReminderCount"])
        if count_to_add <= 0:
            return zero

        Tools.write_verbose_class_method_name(
            self, ReminderManager.__get_event_count_to_add, "count_to_add",
            str(count_to_add))
        return count_to_add