Пример #1
0
 def shareFile(self):
     studentsIndex = self.studentListView.selectedIndexes()
     if studentsIndex not in Util.EMPTY_VALUES:
         fileName = QtWidgets.QFileDialog.getOpenFileName(self,
                 'Choose a file to share', Util.homeDirectory(), None)[0]
         if fileName not in Util.EMPTY_VALUES:
             for index in studentsIndex:
                 student = index.data(role=1111)
                 if student:
                     student.shareFile(fileName, self.multicastPort)
                 else:
                     print('No student selected')
         else:
             print('Share file canceled')
     else:
         QtWidgets.QMessageBox.warning(self, 'Select a student',
                 'You must select at least on student.')
Пример #2
0
    def login(self):
        loginDialog = LoginDialog(self)
        if loginDialog.exec_():
            teacherName = loginDialog.teacherName.text()
            self.broadcastServer = BroadcastServer('255.255.255.255',
                    self.broadcastPort, teacherName, self.publisherPort, parent=self)
            self.broadcastServer.start()

            self.ip = Util.ipAddress()

            self.publisher = Controller.Publisher(self.ip, self.publisherPort, parent=self)
            self.publisher.start()

            self.reply = Controller.Reply(self.ip, self.replyPort, parent=self)
            self.reply.start()

            self.multicastServer = MulticastServer(self.ip, self.multicastPort, parent=self)
            self.multicastServer.start()