Exemplo n.º 1
0
 def importRooms(self):
     rooms = ioHandler.getCSVFile('rooms')
     if rooms:
         rooms.pop(0)
         rooms.pop(0)
         blankSchedule = json.dumps(Timetable.generateRawTable())
         for room in rooms:
             Room.Room.insertRoom([room[0], blankSchedule, room[1]])
         self.tabListener(1)
Exemplo n.º 2
0
 def importInstructors(self):
     instructors = ioHandler.getCSVFile('enseignants')
     if instructors:
         instructors.pop(0)
         instructors.pop(0)
         blankSchedule = json.dumps(Timetable.generateRawTable())
         for instructor in instructors:
             Instructor.Instructor.insertInstructor([instructor[0], float(instructor[1]), blankSchedule])
         self.tabListener(0)
 def fillForm(self):
     conn = db.getConnection()
     cursor = conn.cursor()
     cursor.execute('SELECT name, hours, schedule FROM instructors WHERE id = ?', [self.id])
     result = cursor.fetchone()
     conn.close()
     self.parent.lineEditName.setText(str(result[0]))
     self.parent.lineEditHours.setText(str(result[1]))
     # Generate timetable from custom schedule
     self.table = Timetable.Timetable(self.parent.tableSchedule, json.loads(result[2]))
Exemplo n.º 4
0
 def fillForm(self):
     conn = db.getConnection()
     cursor = conn.cursor()
     cursor.execute('SELECT name, schedule, type FROM rooms WHERE id = ?', [self.id])
     result = cursor.fetchone()
     conn.close()
     self.parent.lineEditName.setText(str(result[0]))
     self.table = Timetable.Timetable(self.parent.tableSchedule, json.loads(result[1]))
     if result[2] == 'lec':
         self.parent.radioLec.setChecked(True)
     else:
         self.parent.radioLab.setChecked(True)
Exemplo n.º 5
0
 def fillForm(self):
     conn = db.getConnection()
     cursor = conn.cursor()
     cursor.execute(
         'SELECT name, schedule, stay FROM sections WHERE id = ?',
         [self.id])
     result = cursor.fetchone()
     conn.close()
     self.parent.lineEditName.setText(str(result[0]))
     self.parent.checkStay.setChecked(result[2])
     self.table = Timetable.Timetable(self.parent.tableSchedule,
                                      json.loads(result[1]))
 def __init__(self, id):
     self.id = id
     self.dialog = dialog = QtWidgets.QDialog()
     # From the qt_ui generated UI
     self.parent = parent = Parent.Ui_Dialog()
     parent.setupUi(dialog)
     if id:
         self.fillForm()
     else:
         # Create a new instance of timetable
         self.table = Timetable.Timetable(parent.tableSchedule)
     parent.btnFinish.clicked.connect(self.finish)
     parent.btnCancel.clicked.connect(self.dialog.close)
     dialog.exec_()
Exemplo n.º 7
0
 def __init__(self, id):
     self.id = id
     # New instance of dialog
     self.dialog = dialog = QtWidgets.QDialog()
     # Initialize custom dialog
     self.parent = parent = Parent.Ui_Dialog()
     # Add parent to custom dialog
     parent.setupUi(dialog)
     # Connect timetable widget with custom timetable model
     if id:
         self.fillForm()
     else:
         self.table = Timetable.Timetable(parent.tableSchedule)
     parent.btnFinish.clicked.connect(self.finish)
     parent.btnCancel.clicked.connect(self.dialog.close)
     dialog.exec_()
Exemplo n.º 8
0
 def __init__(self, id):
     self.id = id
     # Array of share IDs to be finalized
     self.shareId = []
     # Array of share IDs to be removed
     self.removeShareId = []
     self.dialog = dialog = QtWidgets.QDialog()
     # From the qt_ui generated UI
     self.parent = parent = Parent.Ui_Dialog()
     parent.setupUi(dialog)
     if id:
         self.fillForm()
     else:
         # Create new instance of timetable
         self.table = Timetable.Timetable(parent.tableSchedule)
     self.setupSubjects()
     parent.btnFinish.clicked.connect(self.finish)
     parent.btnCancel.clicked.connect(self.dialog.close)
     dialog.exec_()