示例#1
0
    def show_emp_breakdown(self, row):
        from views.emp_brkdwn_dlg import EmployeeBreakdownDialog

        emp_id = self.view.get_emp_id(row)
        if not self.emp_dict[emp_id].asns:
            uil.show_msg('No assignments!', 'allocat')
            return

        asns = [asn for asn in self.emp_dict[emp_id].asns if asn.active]

        total = 0
        items = []
        for asn in asns:
            items.append((asn.project, ml.prettify(asn.frum),
                          ml.prettify(asn.thru), asn.effort))
            total += asn.effort

        dlg = EmployeeBreakdownDialog(self.view, -1, items)
        s = '%d assignments for %s' % (len(asns), self.emp_dict[emp_id].name)
        dlg.set_name_lbl(s)

        s = 'Total effort: %d' % total
        dlg.set_total_lbl(s)

        dlg.ShowModal()
        dlg.Destroy()
示例#2
0
def getMonthCtrl(panel, value):
    import wx.lib.masked as masked
    import lib.month_lib as ml

    ctl = masked.TextCtrl(panel,
                          -1,
                          mask='##/##',
                          defaultValue=ml.prettify(value),
                          size=(50, -1),
                          formatcodes='0>')
    ctl.SetFont(wx.Font(9, 70, 90, 90))
    return ctl
示例#3
0
    def show_month_breakdown(self, col, row):
        from views.month_brkdwn_dlg import MonthBreakdownDialog

        emp_id = self.view.get_emp_id(row)
        empName = self.view.get_emp_name(row)
        month = self.view.get_selected_month(col)
        key = str(emp_id) + ':' + month
        if not self.breakdowns[key]:
            uil.show_msg('No assignments!', 'allocat')
            return
        dlg = MonthBreakdownDialog(self.view, -1, empName, ml.prettify(month),
                                   self.breakdowns[key])
        dlg.ShowModal()
        dlg.Destroy()
示例#4
0
 def set_thru(self, value):
     self.thru_ctrl.SetValue(ml.prettify(value))
示例#5
0
 def set_frum(self, value):
     self.frum_ctrl.SetValue(ml.prettify(value))
示例#6
0
    def getLayout(self, panel, prj):
        layout = wx.BoxSizer(wx.VERTICAL)

        nameLayout = wx.BoxSizer(wx.HORIZONTAL)
        lblName = wx.StaticText(panel, wx.ID_ANY, 'Project Name: *')
        self.txtName = wx.TextCtrl(panel, wx.ID_ANY,
                                   uil.displayValue(prj, 'name'),
                                   size=(500, -1))
        nameLayout.Add(lblName, 0, wx.ALL, 5)
        nameLayout.Add(self.txtName, 0, wx.ALL | wx.EXPAND, 5)

        layout.Add(nameLayout, 0, wx.ALL | wx.EXPAND, 5)

        nicknameLayout = wx.BoxSizer(wx.HORIZONTAL)
        lblNickname = wx.StaticText(panel, wx.ID_ANY, 'Nickname: *')
        self.txtNickname = wx.TextCtrl(panel, wx.ID_ANY,
                                       uil.displayValue(prj, 'nickname'), size=(400, -1))
        nicknameLayout.Add(lblNickname, 0, wx.ALL, 5)
        nicknameLayout.Add(self.txtNickname, 0, wx.ALL, 5)

        layout.Add(nicknameLayout, 0, wx.ALL | wx.EXPAND, 5)

        intervalLayout = wx.BoxSizer(wx.HORIZONTAL)
        lblFirstMonth = wx.StaticText(panel, wx.ID_ANY, 'First Month: *')
        value = ml.prettify(uil.displayValue(prj, 'first_month'))
        self.txtFirstMonth = uil.getMonthCtrl(panel, value)
        intervalLayout.Add(lblFirstMonth, 0, wx.ALL, 5)
        intervalLayout.Add(self.txtFirstMonth, 0, wx.ALL, 5)

        lblLastMonth = wx.StaticText(panel, wx.ID_ANY, 'Last Month: *')
        value = ml.prettify(uil.displayValue(prj, 'last_month'))
        self.txtLastMonth = uil.getMonthCtrl(panel, value)
        intervalLayout.Add(lblLastMonth, 0, wx.ALL, 5)
        intervalLayout.Add(self.txtLastMonth, 0, wx.ALL, 5)

        layout.Add(intervalLayout, 0, wx.ALL, 5)

        personsLayout = wx.BoxSizer(wx.HORIZONTAL)

        lblPI = wx.StaticText(panel, wx.ID_ANY, 'PI:')
        pis = [rec for rec in gbl.empRex.values() if rec['investigator'] == 1]
        self.cboPI = uil.ObjComboBox(panel,
                                     pis,
                                     'name',
                                     'Employee',
                                     style=wx.CB_READONLY)
        value = self.ownerRec['PiName'] \
            if self.ownerRec and self.ownerRec['PI'] else ''
        self.cboPI.SetValue(value)
        personsLayout.Add(lblPI, 0, wx.ALL, 5)
        personsLayout.Add(self.cboPI, 0, wx.ALL, 5)

        lblPM = wx.StaticText(panel, wx.ID_ANY, 'PM:')
        pms = [rec for rec in gbl.empRex.values() if rec['investigator'] == 0]
        self.cboPM = uil.ObjComboBox(panel,
                                     pms,
                                     'name',
                                     'Employee',
                                     style=wx.CB_READONLY)
        value = self.ownerRec['PmName'] \
            if self.ownerRec and self.ownerRec['PM'] else ''
        self.cboPM.SetValue(value)
        personsLayout.Add(lblPM, 0, wx.ALL, 5)
        personsLayout.Add(self.cboPM, 0, wx.ALL, 5)

        layout.Add(personsLayout, 0, wx.ALL, 5)

        notesLayout = wx.BoxSizer(wx.VERTICAL)
        lblNotes = wx.StaticText(panel, wx.ID_ANY, 'Notes:')
        self.txtNotes = wx.TextCtrl(panel, wx.ID_ANY, uil.displayValue(prj, 'notes'),
                                    style=wx.TE_MULTILINE, size=(500, 200))
        notesLayout.Add(lblNotes, 0, wx.ALL, 5)
        notesLayout.Add(self.txtNotes, 0, wx.ALL, 5)

        layout.Add(notesLayout, 0, wx.ALL, 5)

        return layout
示例#7
0
 def set_asn_label(self, employee, effort, frum, thru, days):
     s = '%s: %s%% effort, from %s thru %s (%s days)' % (
         employee, effort, ml.prettify(frum), ml.prettify(thru), days)
     self.asn_lbl.SetLabel(s)