def process_context_add_event(self, event): application = self.applications[self.appsCombobox.currentIndex()] context = event.obj if not context.application_id == application["id"]: return item = ContextItem(Context(context.to_json())) item.setEditable(False) for key in application: subitem = ModelItem(key, Model(application.schema[key].to_json())) subitem.setEditable(False) item.appendRow(subitem) self.contexts_model.appendRow(item)
def contexts_success(contexts_list): telepat = QtCore.QCoreApplication.instance().telepat_instance telepat.on_update_context = self.on_update_context telepat.on_add_context = self.on_add_context application = self.applications[self.appsCombobox.currentIndex()] self.contexts_model.setHorizontalHeaderLabels(["Contexts"]) self.actionRefresh.setEnabled(True) for ctx in contexts_list: item = ContextItem(ctx) item.setEditable(False) for key in application.schema: subitem = ModelItem(key, Model(application.schema[key].to_json())) subitem.setEditable(False) item.appendRow(subitem) self.contexts_model.appendRow(item)