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


Python Database.get_current_sheet方法代码示例

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


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

示例1: command

# 需要导入模块: from db import Database [as 别名]
# 或者: from db.Database import get_current_sheet [as 别名]
def command(timebook, config, switch, out, at, resume, messages, **kwargs):
    # get the db
    cfg = parse_config(config)
    db = Database(timebook, cfg)

    if switch:
        commands.switch.switch(db, switch)
        sheet = switch
    else:
        sheet = db.get_current_sheet()

    timestamp = parse_date_time_or_now(at)

    if out:
        commands.out.out(db, timestamp)

    if db.get_active_info(sheet):
        parser.error("the timesheet is already active")

    message = " ".join(messages)

    most_recent_clockout = db.get_most_recent_clockout(sheet)
    if most_recent_clockout:
        (previous_timestamp, previous_description) = most_recent_clockout
        if timestamp < previous_timestamp:
            parser.error("error: time periods could end up overlapping")
        if resume:
            if message:
                parser.error('"--resume" sets the note, so you cannot also ' "supply the message")
            message = previous_description

    _in(db, sheet, timestamp, message)
开发者ID:davisd,项目名称:timebook3,代码行数:34,代码来源:in.py

示例2: command

# 需要导入模块: from db import Database [as 别名]
# 或者: from db.Database import get_current_sheet [as 别名]
def command(timebook, config, sheet, **kwargs):
    # get the db
    cfg=parse_config(config)
    db=Database(timebook, cfg)

    switch_to_default=False

    current_sheet = db.get_current_sheet()
    if not sheet or sheet == current_sheet:
        switch_to_default=True
    if not sheet:
        sheet = current_sheet

    try:
        confirm=(input('Delete timesheet "%s"? [y/N]: ' % sheet).strip().lower() == 'y')
    except(KeyboardInterrupt, EOFError):
        confirm=False

    if not confirm:
        print('cancelled')
        return None

    kill(db, sheet)
    if switch_to_default:
        commands.switch.switch(db, 'default')
开发者ID:davisd,项目名称:timebook3,代码行数:27,代码来源:kill.py

示例3: command

# 需要导入模块: from db import Database [as 别名]
# 或者: from db.Database import get_current_sheet [as 别名]
def command(timebook, config, rate, sheet, **kwargs):
    # get the db
    cfg=parse_config(config)
    db=Database(timebook, cfg)

    sheet = sheet or db.get_current_sheet()
    if sheet not in db.get_sheet_names():
        parser.error('%s is not a known timesheet' % sheet)

    money(db, sheet, rate)
开发者ID:davisd,项目名称:timebook3,代码行数:12,代码来源:money.py

示例4: command

# 需要导入模块: from db import Database [as 别名]
# 或者: from db.Database import get_current_sheet [as 别名]
def command(timebook, config, at, sheet, **kwargs):
    # get the db
    cfg=parse_config(config)
    db=Database(timebook, cfg)

    sheet = sheet or db.get_current_sheet()
    timestamp = parse_date_time_or_now(at)

    if sheet not in db.get_sheet_names():
        parser.error('%s is not a known timesheet' % sheet)

    end(db, sheet, timestamp)
开发者ID:davisd,项目名称:timebook3,代码行数:14,代码来源:end.py

示例5: command

# 需要导入模块: from db import Database [as 别名]
# 或者: from db.Database import get_current_sheet [as 别名]
def command(timebook, config, sheet, start, end, billing, format, money, **kwargs):
    # get the db
    cfg=parse_config(config)
    db=Database(timebook, cfg)

    sheet = sheet or db.get_current_sheet()

    start_timestamp = parse_date_time(start) if start else None
    end_timestamp = parse_date_time(end) if end else None

    if billing:
        if start or end:
            parser.error('if you specify --billing, you cannot specify a start ' \
                'or end ')

        billing_time = db.get_billing_start_time(sheet)

        if billing_time:
            start_timestamp = billing_time

    display(db, sheet, start_timestamp, end_timestamp, format, money)
开发者ID:davisd,项目名称:timebook3,代码行数:23,代码来源:display.py

示例6: command

# 需要导入模块: from db import Database [as 别名]
# 或者: from db.Database import get_current_sheet [as 别名]
def command(timebook, config, switch, start_time, end_time, messages, **kwargs):
    # get the db
    cfg=parse_config(config)
    db=Database(timebook, cfg)

    if switch:
        commands.switch.switch(db, switch)
        sheet = switch
    else:
        sheet = db.get_current_sheet()

    timestamp_in=parse_date_time(start_time)
    timestamp_out=parse_date_time(end_time)

    current_start = db.get_start_time(sheet)
    if current_start:
        if timestamp_out > current_start[1]:
            parser.error('cannot put this entry into the timesheet because ' \
                'it may cause overlap with the active timer - clock out first')

    message = ' '.join(messages)

    put(db, sheet, timestamp_in, timestamp_out, message)
开发者ID:davisd,项目名称:timebook3,代码行数:25,代码来源:put.py


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