Skip to content
Snippets Groups Projects
distribution_edit_controller.py 1.14 KiB
Newer Older
  • Learn to ignore specific revisions
  • from controllers.distribution_overview_controller import DistributionOverview
    from model.team import Team
    
    
    class DistributionEdit(DistributionOverview):
        def __init__(self, mainwindow, distribution, group, parent=None):
    
            """
            :param mainwindow: MainWindow that this belongs to
            :param distribution: Distribution that should be edited
            :param group: Group of the edited distribution
            :param parent: parent widget for qt
            """
    
            teams = {team.name: team.members for team in distribution.teams}
            super(DistributionEdit, self).__init__(mainwindow, teams, group, parent)
            self.distribution = distribution
    
    Jakub Štercl's avatar
    Jakub Štercl committed
            self.distribution_name = distribution.name
            self.titleWidget.label.setText(distribution.name)
    
            """
            save the edited distribution and return back 
            """
    
            teams = []
            for table in self.teamTables:
                team = Team(table.id_, table.name, table.getAllData())
                teams.append(team)
            self.distribution.update(self.distribution_name, teams)
            self.main_window.dataChanged()
            self.main_window.goBack()