Beispiel #1
0
    def on_clipboard_text(self, clipboard, text, data):
        # first check that we have a date selected
        fact = self.fact_tree.get_selected_fact()

        if not fact:
            return

        if isinstance(fact, dt.date):
            selected_date = fact
        else:
            selected_date = fact.date

        fact = Fact(text.decode("utf-8"))

        if not all((fact.activity, fact.start_time, fact.end_time)):
            return

        fact.start_time = fact.start_time.replace(year=selected_date.year,
                                                  month=selected_date.month,
                                                  day=selected_date.day)
        fact.end_time = fact.end_time.replace(year=selected_date.year,
                                              month=selected_date.month,
                                              day=selected_date.day)
        new_id = runtime.storage.add_fact(fact)

        # You can do that?! - copy/pasted an activity
        trophies.unlock("can_do_that")

        if new_id:
            self.fact_tree.select_fact(new_id)
    def on_clipboard_text(self, clipboard, text, data):
        # first check that we have a date selected
        fact = self.fact_tree.get_selected_fact()

        if not fact:
            return

        if isinstance(fact, dt.date):
            selected_date = fact
        else:
            selected_date = fact.date

        fact = Fact(text.decode("utf-8"))

        if not all((fact.activity, fact.start_time, fact.end_time)):
            return

        fact.start_time = fact.start_time.replace(year = selected_date.year,
                                                  month = selected_date.month,
                                                  day = selected_date.day)
        fact.end_time = fact.end_time.replace(year = selected_date.year,
                                              month = selected_date.month,
                                              day = selected_date.day)
        new_id = runtime.storage.add_fact(fact)

        # You can do that?! - copy/pasted an activity
        trophies.unlock("can_do_that")

        if new_id:
            self.fact_tree.select_fact(new_id)
Beispiel #3
0
    def localized_fact(self):
        """makes sure fact is in our date"""
        fact = Fact(self.activity.get_text())
        if fact.start_time:
            fact.start_time = dt.datetime.combine(self.date, fact.start_time.time())

        if fact.end_time:
            fact.end_time = dt.datetime.combine(self.date, fact.end_time.time())

        return fact
Beispiel #4
0
    def localized_fact(self):
        """makes sure fact is in our date"""
        fact = Fact(self.activity.get_text())
        if fact.start_time:
            fact.start_time = dt.datetime.combine(self.date, fact.start_time.time())

        if fact.end_time:
            fact.end_time = dt.datetime.combine(self.date, fact.end_time.time())

        return fact