def __init__(self, **kwargs): gtk.VBox.__init__(self, False, 0) self.top = gtk.HBox(False, 0) self.pack_start(self.top, True, True, 0) self.top.show() self.bottom = gtk.HBox(False, 0) self.pack_start(self.bottom, True, True, 0) self.bottom.show() self.activity_list = ActivityList() self.activity_list.treeview.connect('cursor-changed', self.activity_selected_cb) self.top.pack_start(self.activity_list, False, False, 0) self.activity_list.set_size_request(250, 250) self.activity_list.show() self.challenge_list = ChallengeList() self.top.pack_start(self.challenge_list, True, True, 0) self.challenge_list.set_size_request(700, 250) self.challenge_list.show() self.pathway_list = PathwayList() self.pathway_list._treeview.connect('cursor-changed', self.pathway_selected_cb) self.pathway_list._btn_new_pathway.connect('clicked', self.add_pathway_cb) self.pathway_list._btn_del_pathway.connect('clicked', self.del_pathway_cb) self.bottom.pack_start(self.pathway_list, False, False, 0) self.pathway_list.show() self.pathway_display = PathwayDisplay() self.bottom.pack_start(self.pathway_display, True, True, 0) self.pathway_display.show() self.pathway_display.btn_save_name.connect('clicked', self.update_pathway_name_cb) self.pathway_display.btn_add_before.connect('clicked', self.add_before_cb) self.pathway_display.btn_add_after.connect('clicked', self.add_after_cb) self.pathway_display.btn_add_sametime.connect('clicked', self.add_sametime_cb) self.show()
class PathwayView(gtk.VBox): """ Main window for glycogen, displays activities, challenges, list of pathways and selected pathway. Allows editing of pathways by inserting challenges from the list. """ def __init__(self, **kwargs): gtk.VBox.__init__(self, False, 0) self.top = gtk.HBox(False, 0) self.pack_start(self.top, True, True, 0) self.top.show() self.bottom = gtk.HBox(False, 0) self.pack_start(self.bottom, True, True, 0) self.bottom.show() self.activity_list = ActivityList() self.activity_list.treeview.connect('cursor-changed', self.activity_selected_cb) self.top.pack_start(self.activity_list, False, False, 0) self.activity_list.set_size_request(250, 250) self.activity_list.show() self.challenge_list = ChallengeList() self.top.pack_start(self.challenge_list, True, True, 0) self.challenge_list.set_size_request(700, 250) self.challenge_list.show() self.pathway_list = PathwayList() self.pathway_list._treeview.connect('cursor-changed', self.pathway_selected_cb) self.pathway_list._btn_new_pathway.connect('clicked', self.add_pathway_cb) self.pathway_list._btn_del_pathway.connect('clicked', self.del_pathway_cb) self.bottom.pack_start(self.pathway_list, False, False, 0) self.pathway_list.show() self.pathway_display = PathwayDisplay() self.bottom.pack_start(self.pathway_display, True, True, 0) self.pathway_display.show() self.pathway_display.btn_save_name.connect('clicked', self.update_pathway_name_cb) self.pathway_display.btn_add_before.connect('clicked', self.add_before_cb) self.pathway_display.btn_add_after.connect('clicked', self.add_after_cb) self.pathway_display.btn_add_sametime.connect('clicked', self.add_sametime_cb) self.show() def pathway_selected_cb(self, widget, data=None): pathway_id, pathway = self.pathway_list.get_selected_pathway() self.pathway_display.set_pathway(pathway_id, pathway) self.pathway_display.refresh() def activity_selected_cb(self, widget, data=None): bundle_id = self.activity_list.get_selected_activity_id() self.challenge_list.show_challenges(bundle_id) def add_before_cb(self, widget, data=None): challenge = self.challenge_list.get_selected_challenge() self.pathway_display.add_challenge_before(challenge) def add_after_cb(self, widget, data=None): challenge = self.challenge_list.get_selected_challenge() self.pathway_display.add_challenge_after(challenge) def add_sametime_cb(self, widget, data=None): challenge = self.challenge_list.get_selected_challenge() self.pathway_display.add_challenge_sametime(challenge) def add_pathway_cb(self, widget, data=None): repository = pathwayrepo.get_global_repository() pathway_id = repository.add_pathway(LearningPathway()) self.pathway_list.update() self.pathway_list.set_selected(pathway_id) def del_pathway_cb(self, widget, data=None): self.pathway_list.delete_selected() self.pathway_display.set_pathway(None, None) self.pathway_display.refresh() def update_pathway_name_cb(self, widget, data=None): self.pathway_display.save_pathway_name() self.pathway_list.update()