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


Python MOSES.getWorkCalendarFor方法代码示例

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


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

示例1: applyFilters

# 需要导入模块: import MOSES [as 别名]
# 或者: from MOSES import getWorkCalendarFor [as 别名]
    def applyFilters(self):
        self.leave_table.showDataFrame(None)
        selected_employee_ids = [list(self.employees_list[self.employees_list["Name"] == x]["Employee ID"])[0] for x in self.employees_selection_box.getCheckedItems()]
        if len(selected_employee_ids)<=0:
            self.alertMessage("No Employees Selected","Select at least one employee!")
        else:
            filter_dict = {
                            "Dates": [self.start_date.date().toPyDate(), self.end_date.date().toPyDate()],
                            "Employee IDs": selected_employee_ids
                        }
            time_diff = (filter_dict["Dates"][1] - filter_dict["Dates"][0])
            if datetime.timedelta(days=5) < time_diff < datetime.timedelta(days=30):
                self.alertMessage("Please Wait","The work calendar is being refreshed. This may take a while since you've selected over a week's worth of data.")
            elif time_diff >= datetime.timedelta(days=30):
                self.alertMessage("Please Wait","The work calendar is being refreshed. This will take quite some time longer than usual since you've selected a date range wider than or equal to 30 days.")

            
            self.work_calendar = MOSES.getWorkCalendarFor(self.user_id, self.password, filter_dict)
            self.alertMessage("Success","Retrieved the Work Calendar")
            yellow = QtGui.QColor(200,200,0)
            green = QtGui.QColor(0,153,0)
            red = QtGui.QColor(170,0,0)

            highlight_rules = [
                                {
                                    "Columns": ["Status","Approval"],
                                    "Values": ["Leave","Approved"],
                                    "Color":green
                                },
                                {
                                    "Columns": ["Status","Approval"],
                                    "Values": ["Leave","Pending"],
                                    "Color":  yellow
                                },
                                {
                                    "Columns": ["Status","Approval"],
                                    "Values": ["Leave","Rejected"],
                                    "Color": red
                                },
                                {
                                    "Columns": ["Relaxation","Approval"],
                                    "Values": [[0.01,1.00],"Approved"],
                                    "Color": green
                                },
                                {
                                    "Columns": ["Relaxation","Approval"],
                                    "Values": [[0.01,1.00],"Pending"],
                                    "Color":  yellow
                                },
                                {
                                    "Columns": ["Relaxation","Approval"],
                                    "Values": [[0.01,1.00],"Rejected"],
                                    "Color": red
                                }
                                ]
            self.leave_table.showDataFrame(self.work_calendar,highlight_rules)
            self.leave_table.setSortingEnabled(False)
开发者ID:vinay87,项目名称:oink,代码行数:59,代码来源:LeaveApproval.py

示例2: updateWorkCalendar

# 需要导入模块: import MOSES [as 别名]
# 或者: from MOSES import getWorkCalendarFor [as 别名]
 def updateWorkCalendar(self):
     self.work_calendar_table.showDataFrame(None)
     filter_dict = {
                     "Dates": [self.start_date_edit.date().toPyDate(), self.end_date_edit.date().toPyDate()],
                     "Employee IDs": [self.user_id]
                     }
     self.work_calendar = MOSES.getWorkCalendarFor(self.user_id, self.password, filter_dict)
     yellow = QtGui.QColor(200,200,0)
     green = QtGui.QColor(0,153,0)
     red = QtGui.QColor(170,0,0)
     highlight_rules = [
                             {
                                 "Columns": ["Status","Approval"],
                                 "Values": ["Leave","Approved"],
                                 "Color":green
                             },
                             {
                                 "Columns": ["Status","Approval"],
                                 "Values": ["Leave","Pending"],
                                 "Color":  yellow
                             },
                             {
                                 "Columns": ["Status","Approval"],
                                 "Values": ["Leave","Rejected"],
                                 "Color": red
                             },
                             {
                                 "Columns": ["Relaxation","Approval"],
                                 "Values": [[0.01,1.00],"Approved"],
                                 "Color": green
                             },
                             {
                                 "Columns": ["Relaxation","Approval"],
                                 "Values": [[0.01,1.00],"Pending"],
                                 "Color":  yellow
                             },
                             {
                                 "Columns": ["Relaxation","Approval"],
                                 "Values": [[0.01,1.00],"Rejected"],
                                 "Color": red
                             }
                             ]
     self.work_calendar_table.showDataFrame(self.work_calendar, highlight_rules)
开发者ID:vinay87,项目名称:oink,代码行数:45,代码来源:LeavePlanner.py


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