def paste(self): widget = QtGui.QApplication.focusWidget() if not isinstance(widget, QtGui.QTableView): return text = QtGui.QApplication.clipboard().text() with messagebox(self): self.paste_text(widget.parent(), text)
def set_central_widget(self, nrmlfile): self.nrmlfile = nrmlfile with messagebox(self): converter = Converter.from_nrml(nrmlfile) self.tableset = converter.tableset widgetname = converter.__class__.__name__ + 'Widget' widgetclass = getattr(customtableview, widgetname) self.widget = widgetclass(converter.tableset, nrmlfile, self) self.setCentralWidget(self.widget)
def save(self, nrmlfile): # save on current file try: node = self.full_check() except: return with messagebox(self): # save to a temporary file with open(nrmlfile + '~', 'w+') as f: node_to_nrml(node, f) # only if there are no errors rename the file os.rename(nrmlfile + '~', nrmlfile)
def full_check(self): with messagebox(self): return self.tableset.to_node()