コード例 #1
0
 def is_valid(self):
     if self.long.text().strip() in subjects():
         self.long.setStyleSheet('Background: red')
     else:
         self.long.setStyleSheet('Background: white')
     if self.short.text().strip() in subjects(True):
         self.short.setStyleSheet('Background: red')
     else:
         self.short.setStyleSheet('Background: white')
コード例 #2
0
 def get_subjects(self):
     liste = []
     subjects_dict = subjects()
     subjects_list = sorted([(long, short)
                             for long, short in subjects_dict.items()])
     for l, s in subjects_list:
         long = QLineEdit(l)
         short = QLineEdit(s)
         liste.append((long, short))
     return liste
コード例 #3
0
 def get_subjects(self):
     liste = []
     for s in subjects():
         label = QLabel(f'    {s}')
         spin = QSpinBox()
         spin.setValue(0)
         spin.setMaximum(6)
         spin.setMinimum(0)
         liste.append((label, spin))
     return liste
コード例 #4
0
 def add(self):
     subs = []
     index = []
     for i, o in enumerate(self.subjects):
         if o.isChecked():
             index.append(i)
     for i, o in enumerate(subjects()):
         if i in index:
             subs.append(subjects()[o])
     if not subs or not self.name.text() or not self.short.text(
     ) or not self.hours.value():
         return
     self.mainwidget.mainwindow.allteachers.add_teacher(
         None, self.name.text(), self.short.text(), int(self.hours.value()),
         subs)
     self.mainwidget._refresh()
     self.mainwidget.mainwindow.statusBar().showMessage(
         f'Lehrer {self.name.text()} hinzugefügt')
     self.mainwidget.mainwindow.changed = True
     self.accept()
コード例 #5
0
 def add(self):
     subs = {}
     for i, o in enumerate(self.subjects):
         hours = int(o[1].text())
         name = o[0].text().strip()
         if hours:
             subs[subjects()[name]] = [hours, 'null']
     if not subs or not self.name.text() or not self.level.text(
     ) or not self.valid:
         return
     self.mainwidget.mainwindow.allclasses.add_class(
         None, int(self.level.text()), self.name.text(), subs)
     self.mainwidget._refresh()
     self.mainwidget.mainwindow.statusBar().showMessage(
         f'Klasse {self.level.text()}{self.name.text()} hinzugefügt')
     self.mainwidget.mainwindow.changed = True
     self.accept()
コード例 #6
0
 def create_form_GB(self):
     self.formGroupBox = QGroupBox("Informationen")
     self.layout = QFormLayout()
     self.name, self.short = QLineEdit(), QLineEdit()
     self.subjects = [QCheckBox(s) for s in subjects()]
     self.layout.addRow(QLabel("Name:"), self.name)
     self.layout.addRow(QLabel("Kürzel:"), self.short)
     self.layout.addRow(QLabel("Fächer:"), self.subjects[0])
     for s in self.subjects[1:]:
         self.layout.addRow(QLabel(''), s)
     self.hours = QSlider(Qt.Horizontal)
     self.hours.setMinimum(1)
     self.hours.setMaximum(28)
     self.hours.setValue(22)
     self.hours.setTickPosition(QSlider.TicksAbove)
     self.hours.setTickInterval(1)
     self.hours.valueChanged.connect(self.update_label)
     self.hours_edit = QLineEdit('22')
     self.hours_edit.textChanged.connect(self.update_hours)
     self.layout.addRow(QLabel('Anzahl Stunden:'), QLabel(''))
     self.layout.addRow(self.hours_edit, self.hours)
     self.formGroupBox.setLayout(self.layout)
コード例 #7
0
ファイル: maingui.py プロジェクト: lfreist/deputat
 def _class_info_item(self, short: str, info: list, obj):
     layout = QHBoxLayout()
     try:
         name = subjects(True)[short]
     except KeyError as error:
         print(error)
     hours = str(info[0])
     teacher = info[1]
     name_label = QLabel(name)
     hours_label = QLabel(hours)
     teacher_selection = QComboBox()
     available_teachers = self._list_available_teachers(short)
     teacher_selection.addItems(available_teachers)
     if obj.subjects[short][1] == teacher:
         for i in available_teachers:
             if teacher in i:
                 teacher_selection.setCurrentText(i)
     teacher_selection.activated.connect(lambda: self.teacher_added(
         obj, teacher_selection.currentText(), short))
     layout.addWidget(name_label)
     layout.addWidget(hours_label)
     layout.addWidget(teacher_selection)
     return layout