コード例 #1
0
    def __init__(self, parent=True):
        super(TaskManager, self).__init__(parent)

        self.parent = parent
        self.setWindowTitle('Task Manager')
        self.layout = VBoxLayout()
        line1 = HBoxLayout()
        line2 = HBoxLayout()

        self.infoGrp = GroupBox('Task Info')
        self.taskInfo = TaskInfo(self)
        self.infoGrp.setLayout(self.taskInfo)
        line1.addWidget(self.infoGrp)

        self.detailsGrp = GroupBox('Details')
        self.taskDetails = TaskDetails(self)
        self.detailsGrp.setLayout(self.taskDetails)
        line1.addWidget(self.detailsGrp)

        self.layout.addLayout(line1)
        self.layout.addLayout(line2)

        self.okButton = Button({'txt': 'Ok', 'cl': self.executeTask})
        self.cancelButton = Button({'txt': 'Cancel', 'cl': self.hideEvent})
        line2.addWidget(self.okButton)
        line2.addWidget(self.cancelButton)

        self.setLayout(self.layout)
        self.setMinimumWidth(750)
コード例 #2
0
ファイル: TopTab1.py プロジェクト: CGFanTuan/damgteam
class TopTab1(Widget):

    key = 'TopTab1'
    tasks = []

    def __init__(self, buttonManager, parent=None):
        super(TopTab1, self).__init__(parent)

        self.buttonManager = buttonManager
        self.parent = parent

        self.layout = GridLayout()
        self.buildUI()
        self.setLayout(self.layout)

    def buildUI(self):

        self.prjButtons  = self.buttonManager.projectButtonsGroupBox(self.parent)
        self.taskButtons = self.buttonManager.taskButtonsGroupBox(self.parent)
        self.teamButtons = self.buttonManager.teamButtonsGroupBox(self.parent)

        self.update_tasks()

        self.prjGrp      = GroupBox("Project", self.prjButtons, "BtnGrid")
        self.taskGrp     = GroupBox("Task", self.taskButtons, "BtnGrid")
        self.teamGrp     = GroupBox('Team', self.teamButtons, 'BtnGrid')
        self.tabFilter   = TopTap1Filter()
        self.tabFilter.overduedCB.stateChanged.connect(self.overdue)
        self.tabFilter.urgentCB.stateChanged.connect(self.urgent)
        self.tabFilter.safetyCB.stateChanged.connect(self.safety)

        self.layout.addWidget(self.prjGrp, 5, 0, 2, 2)
        self.layout.addWidget(self.taskGrp, 5, 2, 2, 2)
        self.layout.addWidget(self.teamGrp, 5, 4, 2, 2)
        self.layout.addWidget(self.tabFilter, 5, 6, 2, 3)

    def update_tasks(self):
        try:
            self.layout.removeItem(self.taskLayout)
        except AttributeError:
            self.taskLayout = HBoxLayout()
        else:
            for w in self.taskLayout.children():
                self.taskLayout.removeWidget(w)
            self.taskLayout = HBoxLayout()

        tasks = get_file_path(TASK_DIR)

        for t in tasks:
            task = TaskInfo(t)
            self.taskLayout.addWidget(task)
            self.tasks.append(task)
        self.layout.addLayout(self.taskLayout, 1, 0, 3, 9)

    def overdue(self, bool):
        for task in self.tasks:
            if task.task.status == 'Overdued':
                task.setVisible(bool)

    def urgent(self, bool):
        for task in self.tasks:
            if task.task.status == 'Urgent':
                task.setVisible(bool)

    def safety(self, bool):
        for task in self.tasks:
            if task.task.status not in ['Overdued, Urgent']:
                task.setVisible(bool)