Exemplo n.º 1
0
 def _parse_era(self, text, tmp_dict):
     name = tmp_dict.pop("tmp_name")
     start = self._parse_time(tmp_dict.pop("tmp_start"))
     end = self._parse_time(tmp_dict.pop("tmp_end"))
     color = parse_color(tmp_dict.pop("tmp_color"))
     ends_today = self._parse_optional_bool(tmp_dict, "tmp_ends_today")
     era = Era().update(start, end, name, color)
     era.set_ends_today(ends_today)
     self.db.save_era(era)
Exemplo n.º 2
0
 def _parse_era(self, text, tmp_dict):
     name = tmp_dict.pop("tmp_name")
     start = self._parse_time(tmp_dict.pop("tmp_start"))
     end = self._parse_time(tmp_dict.pop("tmp_end"))
     color = parse_color(tmp_dict.pop("tmp_color"))
     ends_today = self._parse_optional_bool(tmp_dict, "tmp_ends_today")
     era = Era().update(start, end, name, color)
     era.set_ends_today(ends_today)
     self.db.save_era(era)
Exemplo n.º 3
0
def a_gregorian_era_with(start=None, end=None, time=ANY_TIME, name="foo",
                         color=(128, 128, 128), time_type=GregorianTimeType(),
                         ends_today=False):
    """Create an :doc:`Era <timelinelib_canvas_data_era>` object."""
    if start and end:
        start = human_time_to_gregorian(start)
        end = human_time_to_gregorian(end)
    else:
        start = human_time_to_gregorian(time)
        end = human_time_to_gregorian(time)
    era = Era().update(start, end, name, color)
    era.set_ends_today(ends_today)
    return era
Exemplo n.º 4
0
def a_gregorian_era_with(start=None, end=None, time=ANY_TIME, name="foo",
                         color=(128, 128, 128), time_type=GregorianTimeType(),
                         ends_today=False):
    """Create an :doc:`Era <timelinelib_canvas_data_era>` object."""
    if start and end:
        start = human_time_to_gregorian(start)
        end = human_time_to_gregorian(end)
    else:
        start = human_time_to_gregorian(time)
        end = human_time_to_gregorian(time)
    era = Era().update(start, end, name, color)
    era.set_ends_today(ends_today)
    return era
Exemplo n.º 5
0
Arquivo: db.py Projeto: luzpaz/gnumed
 def _create_era_wrapper(self, id_):
     immutable_era = self._immutable_db.eras.get(id_)
     return Era(
         db=self._db,
         id_=id_,
         immutable_value=immutable_era,
     )
Exemplo n.º 6
0
def a_numeric_era_with(start=None,
                       end=None,
                       time=ANY_NUM_TIME,
                       name="foo",
                       color=(128, 128, 128)):
    """Create an :doc:`Era <timelinelib_canvas_data_era>` object."""
    if not (start or end):
        start = time
        end = time
    return Era().update(start, end, name, color)