def updateDisabledWidgets(self, msg=None): # subscriptions: # - newCorpus receive(self.updateDisabledWidgets, msg) for menuItem in self.disabledMenuItems: menuItem.Enable(True)
def updateAutoFolded(self, msg=None): receive(self.updateAutoFolded, msg) if self.viewMenu.isChecked("Auto Fold Equals"): from_graph = self.aligner.get_from_graph() to_graph = self.aligner.get_to_graph() from_equal_nodes, to_equal_nodes = \ self.aligner.get_auto_fold_equal_nodes() for from_node in from_equal_nodes: self.dotGraphPair.from_subgraph._fold_node( from_graph, from_node) for to_node in to_equal_nodes: self.dotGraphPair.to_subgraph._fold_node(to_graph, to_node) else: # Unfolding only the auto-folded nodes is difficult, because one # or more predecessors of an auto-folded nody may have been be # manually folded. We obviously cannot unfold a subtree without # unfolding the folded predecesors as well. Keeping track of these # relations would require a lot of administration. Instead we just # unfold all nodes. self.dotGraphPair.from_subgraph.unfold_all() self.dotGraphPair.to_subgraph.unfold_all()
def initRelationView(self, msg=None): receive(self.initRelationView, msg) sizer = self.GetSizer() sizer.Detach(self.relView) self.relView.Destroy() self.relView = RelationView(self, self.aligner) sizer.Insert(1, self.relView, 0, wx.EXPAND|wx.LEFT|wx.RIGHT|wx.BOTTOM, border=10) sizer.Layout()
def updateSplitterWindow(self, msg=None): # subscriptions: # - newCorpus receive(self.updateSplitterWindow, msg) bottom = self.splitterWindow.GetWindow2() bestSize = bottom.GetBestSize()[1] self.splitterWindow.SetMinimumPaneSize(bestSize) self.splitterWindow.SetSashPosition(-bestSize)
def updateWindowTitle(self, msg=None): # subscriptions: # - newCorpus receive(self.updateWindowTitle, msg) name = self.aligner.get_corpus_filename() if name: self.SetTitle("Algraeph: %s (%s)" % (basename(name), dirname(name))) else: self.SetTitle("Algraeph")
def updateText(self, msg=None): receive(self.updateText, msg) text = self.aligner.get_comment() # text received from aligner has \n for newlines if wx.Platform == "__WXMSW__": text = text.replace("\n", "\r\n") self.SetValue(text)
def updateNodeFocus(self, msg=None): receive(self.updateNodeFocus, msg) from_graph = self.aligner.get_from_graph() to_graph = self.aligner.get_to_graph() from_node = self.aligner.get_from_node() self.dotGraphPair.from_subgraph.update_node_focus(from_node) to_node = self.aligner.get_to_node() self.dotGraphPair.to_subgraph.update_node_focus(to_node)
def updateEdgeFocus(self, msg=None): receive(self.updateEdgeFocus, msg) self.dotGraphPair.clear_edge_focus() from_node = self.aligner.get_from_node() to_node = self.aligner.get_aligned_to_node() self.dotGraphPair.update_edge_focus(from_node, to_node) to_node = self.aligner.get_to_node() from_node = self.aligner.get_aligned_from_node() self.dotGraphPair.update_edge_focus(from_node, to_node)
def updateCoSelectedNode(self, msg=None): receive(self.updateCoSelectedNode, msg) from_node = self.aligner.get_from_node() if from_node: self.aligner.set_from_node(from_node) else: to_node = self.aligner.get_to_node() if to_node: self.aligner.set_to_node(to_node)
def updateStatusbarCounter(self, msg=None): # subscriptions: # - statusDescription receive(self.updateStatusbarCounter, msg) self.statusBar.SetStatusText("%d of %d graph pairs" % self.aligner.get_graph_pair_counter(), 1) name = self.aligner.get_corpus_filename() if name: self.SetTitle("Algraeph: %s (%s)" % ( basename(name), dirname(name))) else: self.SetTitle("Algraeph")
def updateEdgeFocus(self, msg=None): receive(self.updateEdgeFocus, msg) self.dotGraphPair.clear_edge_focus() from_node = self.aligner.get_from_node() to_node = self.aligner.get_aligned_to_node() self.dotGraphPair.update_edge_focus(from_node, to_node) to_node= self.aligner.get_to_node() from_node = self.aligner.get_aligned_from_node() self.dotGraphPair.update_edge_focus(from_node, to_node)
def updateHtmlPage(self, msg=None): """ reload html page and reposition scroll bars """ receive(self.updateHtmlPage, msg) # Backup current scroll positions # This is not perfect, because the size of the image may change # (e.g. with or without dependency relation labels) xpos, ypos = self.GetViewStart() html = get_html() self.SetPage(html) # Restore scroll positions self.Scroll(xpos, ypos)
def updateAutoFolded(self, msg=None): receive(self.updateAutoFolded, msg) if self.viewMenu.isChecked("Auto Fold Equals"): from_graph = self.aligner.get_from_graph() to_graph = self.aligner.get_to_graph() from_equal_nodes, to_equal_nodes = \ self.aligner.get_auto_fold_equal_nodes() for from_node in from_equal_nodes: self.dotGraphPair.from_subgraph._fold_node(from_graph, from_node) for to_node in to_equal_nodes: self.dotGraphPair.to_subgraph._fold_node(to_graph, to_node) else: # Unfolding only the auto-folded nodes is difficult, because one # or more predecessors of an auto-folded nody may have been be # manually folded. We obviously cannot unfold a subtree without # unfolding the folded predecesors as well. Keeping track of these # relations would require a lot of administration. Instead we just # unfold all nodes. self.dotGraphPair.from_subgraph.unfold_all() self.dotGraphPair.to_subgraph.unfold_all()
def updateFolded(self, msg): receive(self.updateFolded, msg) self.dotGraphPair.from_subgraph.update_folded() self.dotGraphPair.to_subgraph.update_folded()
def unfoldAllNodes(self, msg=None): receive(self.unfoldAllNodes, msg) self.dotGraphPair.from_subgraph.unfold_all() self.dotGraphPair.to_subgraph.unfold_all()
def updateImageMap(self, msg=None): """ call graphviz to update the image map """ receive(self.updateImageMap, msg) update_image_map(self.dotGraphPair.to_string())
def updateImageFile(self, msg=None): """ call graphviz to update the image file """ receive(self.updateImageFile, msg) update_image_file(self.dotGraphPair.to_string())
def updateTokens(self, msg=None): receive(self.updateTokens, msg) self.SetValue(self.getTokens())
def updateFromGraph(self, msg=None): receive(self.updateFromGraph, msg) from_graph = self.aligner.get_from_graph() self.dotGraphPair.from_subgraph.update_structure(from_graph)
def updateToGraph(self, msg=None): receive(self.updateToGraph, msg) to_graph = self.aligner.get_to_graph() self.dotGraphPair.to_subgraph.update_structure(to_graph)
def updateAlignment(self, msg=None): receive(self.updateAlignment, msg) from_graph = self.aligner.get_from_graph() to_graph = self.aligner.get_to_graph() graph_pair = self.aligner.get_graph_pair() self.dotGraphPair.update_structure(graph_pair, from_graph, to_graph)
def updateDisabledWidgets(self, msg): # subscriptions: # - newCorpus receive(self.updateDisabledWidgets, msg) self.Enable()
def updateStatusbar(self, msg=None): # subscriptions: # - statusDescription receive(self.updateStatusbar, msg) self.statusBar.SetStatusText(msg.data or "Ready", 0)