def change_coaches(self): """ Метод реализует функционал замены преподавателей для события. """ title = self.tr('Coaches') http = self.params.http if not http.request('/api/coach/', 'GET'): QMessageBox.critical( self, title, self.tr('Unable to fetch: %s') % http.error_msg) return status, coach_list = http.piston() if 'ALL_OK' == status: def coaches_callback(uuid_list): self.event_object.set_coaches( filter(lambda x: x.get('uuid') in uuid_list, coach_list)) dialog = ShowCoaches(self, callback=coaches_callback) dialog.setModal(True) dialog.initData(self.event_object, coach_list) if QDialog.Accepted == dialog.exec_(): # отображаем изменения на интерфейсе self.initData(self.event_object, self.event_index) # update schedule model to immediate refresh this event model = self.event_index.model() model.change(self.event_object, self.event_index)
def change_coaches(self): """ Метод реализует функционал замены преподавателей для события. """ title=self.tr('Coaches') http = self.params.http if not http.request('/api/coach/', 'GET'): QMessageBox.critical(self, title, self.tr('Unable to fetch: %s') % http.error_msg) return status, coach_list = http.piston() if 'ALL_OK' == status: def coaches_callback(uuid_list): self.event_object.set_coaches( filter(lambda x: x.get('uuid') in uuid_list, coach_list) ) dialog = ShowCoaches(self, callback=coaches_callback) dialog.setModal(True) dialog.initData(self.event_object, coach_list) if QDialog.Accepted == dialog.exec_(): # отображаем изменения на интерфейсе self.initData(self.event_object, self.event_index) # update schedule model to immediate refresh this event model = self.event_index.model() model.change(self.event_object, self.event_index)
def changeCoaches(self): def coaches_callback(coach_id_list): from library import dictlist_keyval # get the coach descriptions' list using its id list coaches_dictlist = dictlist_keyval(self.parent.static['coaches'], 'id', coach_id_list) self.schedule_object.set_coaches(coaches_dictlist) dialog = ShowCoaches(self, {'http': self.http}) dialog.setCallback(coaches_callback) dialog.setModal(True) dialog.initData(self.schedule) dialog.exec_() # update the dialog's info self.initData(self.schedule_object, self.schedule_index) # update schedule model to immediate refresh this event model = self.parent.schedule.model() model.change(self.schedule_object, self.schedule_index)