Exemple #1
0
    if not cmp(conf_item, "all"):
        return all_conf
    elif not cmp(conf_item, "rest"):
        return all_conf[0]
    elif not cmp(conf_item, "todo"):
        return all_conf[1]
    else:
        log("该配置项(%s)还未定义." % conf_item, "warn")
        return None


# Script starts from here

if __name__ == "__main__":
    app = QApplication(sys.argv)
    tray_icon = SysTray()
    tray_icon.show()
    tray_icon.showMessage(u"启动通知", u"Kreminder 已经启动,点击系统托盘图标可以获取帮助.", 1, 15000)

    # scheduler of Reminding rest
    rest_config = get_conf("rest")

    if rest_config:
        try:
            rest_remind_scheduler = BackgroundScheduler()
            rest_remind_scheduler.add_job(tray_icon.showMessage, 'interval', \
                                                                minutes = rest_config["interval"], \
                                                                args = [u"休息提醒", rest_config["message"], 1, 15000], \
                                                                id = "remind_rest")
            rest_remind_scheduler.start()
        except Exception, e:
Exemple #2
0

class reloadTodoHandler(FileSystemEventHandler):
    def on_created(self, event):
        logging.warning(
            f'event type: {event.event_type} path: {event.src_path}')

    def on_modified(self, event):
        logging.warning(
            f'event type: {event.event_type} path: {event.src_path}')
        reloadTodos(ti)


if __name__ == '__main__':
    app = QApplication(sys.argv)
    ti = SysTray()
    setIcon(ti)

    addExitAction(ti)
    addSeparator(ti)
    addEditAction(ti)
    addSeparator(ti)
    # todo的内容
    addTodos(ti)
    ti.show()
    ti.showMessage(u"提示", u"程序启动", 2)

    #    import pdb;pdb.set_trace()

    event_handler = reloadTodoHandler()
    event_handler.ti = ti