当前位置: 首页>>代码示例>>Python>>正文


Python Person.get_number_of_nights方法代码示例

本文整理汇总了Python中models.Person.get_number_of_nights方法的典型用法代码示例。如果您正苦于以下问题:Python Person.get_number_of_nights方法的具体用法?Python Person.get_number_of_nights怎么用?Python Person.get_number_of_nights使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.Person的用法示例。


在下文中一共展示了Person.get_number_of_nights方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Schedule

# 需要导入模块: from models import Person [as 别名]
# 或者: from models.Person import get_number_of_nights [as 别名]
        u"...D.................UUUUUUN...",
        u"....D.....................N....",
        u".....D...................N.....",
        u"......D.................N......",
        u".......D...............N.......",
        u"........D.............N........",
        u"UUU...UUUUUUU........N.........",
        u"..........D.........N..........",
        u"...........D..UUUUUUUU.........",
        u"............D.....N............",
        u".............D...N.............",
        u"..............D.N..............",
    ]

    first_schedule = Schedule(schedule_name, creation_date, month, year, crew, schedule)

    first_schedule.schedule = fill_the_schedule(
        first_schedule, number_of_working_days, person_per_day, person_per_night
    )

    for no, (name, one_schedule) in enumerate(zip(first_schedule.crew, first_schedule.schedule)):
        person = Person(name, one_schedule)

        print(
            name,
            one_schedule,
            person.get_number_of_nights(),
            person.get_number_of_days(),
            person.get_working_days_number_person(),
        )
开发者ID:piemar1,项目名称:IwonaWorkSchedule,代码行数:32,代码来源:fill_schedule.py

示例2: create_table

# 需要导入模块: from models import Person [as 别名]
# 或者: from models.Person import get_number_of_nights [as 别名]
    def create_table(self):
        """
        Create the table
        """
        data = []

        # tworzenie danych dla pierwszych dwóch wierszy tabeli
        line = ["Lp", "Nazwisko i imię"]
        line.extend([str(no) for no, day in self.month_calendar])
        data.append(line)

        line = ["Lp", "Nazwisko i imię"]
        line.extend([day for no, day in self.month_calendar])
        line.extend(["D", "N", "DN"])
        data.append(line)

        # zbieranie info o columnach danych dla soboty i niedzieli
        weekend_columns = [n for n, elem in enumerate(line) if elem in ["so", "n"]]

        # wypełnianie tabeli dla poszczególnych osób
        for n, (person_name, one_schedule) in enumerate(zip(self.schedule.crew, self.schedule.schedule)):

            line = ["{}.".format(str(n +1 )), person_name]
            line.extend([daywork for daywork in one_schedule])
            one_person = Person(person_name, one_schedule)
            line.append(one_person.get_number_of_days())
            line.append(one_person.get_number_of_nights())
            line.append(one_person.get_working_days_number_person())
            data.append(line)

        # liczba wierszy w tabeli
        row_number = n + 2

        # ustawianie stylu / coloru dla soboty i niedzieli
        color_col = [('BACKGROUND', (col, 0), (col, row_number), colors.lightgrey) for col in weekend_columns]

        col_width = [0.7 * cm, 3.7 * cm]
        col_width.extend(len(self.month_calendar) * [0.6 * cm])
        col_width.extend([0.7 * cm, 0.7 * cm, 0.7 * cm])

        table = Table(data, col_width)

        table.hAlign = "CENTRE"

        # styl tabeli
        mytablestyle = [("FONTNAME", (0,0),(-1,-1), 'Tinos-Regular'),
                        ("FONTSIZE", (0,0),(-1,-1), 8.0),
                        ("SPAN", (0,0), (0,1)),
                        ("SPAN", (1,0), (1,1)),
                        ('ALIGN',(0,0),(-1,-1),'CENTER'),
                        ('VALIGN',(0,0),(-1,-1),'MIDDLE'),
                        ('FONTNAME', (0,0), (-1,1), 'Tinos-Bold'),
                        ('FONTNAME', (0,0), (1,-1), 'Tinos-Bold'),
                        ('INNERGRID', (0,0), (-1,-1), 0.25, colors.black),
                        ('BOX', (0,0), (-1,-1), 0.25, colors.black)]

        # dodanie do stylu tabeli kolorów dla soboty i niedzieli
        mytablestyle.extend(color_col)

        table.setStyle(TableStyle(mytablestyle))

        self.story.append(Spacer(1, 1*cm))
        self.story.append(table)
        self.story.append(Spacer(1, 0.1*cm))

        header_text = "D - liczba dyżurów dziennych, N - liczba dużurów nocnych, DN - liczba dyżurów w miesiącu"
        p = Paragraph(header_text, styles['myStyleLEFT'])
        self.story.append(Spacer(1, 0.5*cm))
        self.story.append(p)
开发者ID:piemar1,项目名称:IwonaWorkSchedule,代码行数:71,代码来源:write_pdf.py


注:本文中的models.Person.get_number_of_nights方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。