當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。