def __init__(self, parent=None): super().__init__(parent) self.ui = Ui_MainWindow() self.ui.setupUi(self) self.ui.calculateButton.clicked.connect(self.find_paths) self.ui.clearButton.clicked.connect(self.ui.tableWidget.clearContents) self.ui.addRowButton.clicked.connect(self.add_row) self.ui.delRowButton.clicked.connect(self.del_row) self.ui.viewResourceButton.clicked.connect(self.start_resource_loading) self.actionHelp = QtGui.QAction('Help', self, statusTip="Help and Docs", triggered=self.help) self.actionHelp.setObjectName("actionHelp") self.ui.menubar.addAction(self.actionHelp) self.actionAbout = QtGui.QAction('About', self, statusTip="About Maven", triggered=self.about) self.actionAbout.setObjectName("actionAbout") self.ui.menubar.addAction(self.actionAbout) self.all_activities = None # created because self.start_resource_levelling can't access all the activities self.result = None self.success = 'No' self.progress = 'Yes' self.resource_level = Level()
def format_ests_and_lsts(self, all_activities): """ Converts all the est's and lst's of all activities in the project to strings because QTableWidget can only display strings :param all_activities: All activities in the project :return: None """ ests = [act.est for act in all_activities] lsts = [act.lst for act in all_activities] for count, (est, lst) in enumerate(zip(ests, lsts)): if est % 1 == 0.0: est_string = QtGui.QTableWidgetItem(str(int(est))) self.ui.tableWidget.setItem(count, 5, est_string) if lst % 1 == 0.0: lst_string = QtGui.QTableWidgetItem(str(int(lst))) self.ui.tableWidget.setItem(count, 6, lst_string)
def display_graph_and_labels(self, visual_path, project_duration): self.ui.scrollArea.setStyleSheet('background-color: #ffffff') self.ui.criticalPathLabel.setWordWrap(True) self.ui.projectDurationLabel.setWordWrap(True) network_pixmap = QtGui.QPixmap('graphs/network_diagram.png') self.ui.networkDiagram.setPixmap(network_pixmap) self.ui.criticalPathLabel.setText(visual_path) self.ui.projectDurationLabel.setText( 'The total duration of the project is {}'.format( int(project_duration)))
def handle_errors(self, message, details): """ :param message: Basic error message to be displayed :param details: Detailed error message to be displayed :return: None """ msgbox = QtGui.QMessageBox() msgbox.setWindowTitle('Error!') msgbox.setText(message) msgbox.setDetailedText(details) msgbox.setStyleSheet( 'background-color: rgb(63, 63, 63); color: #ffffff;') msgbox.exec() self.progress = 'No'