def __init__(self, session, layer, feature): QUndoCommand.__init__(self, "Change geometry") self.session = session self.layer = layer self.subcentroids = self.session.model_layers.layer_by_name("subcentroids") self.sublinks = self.session.model_layers.layer_by_name("sublinks") self.feature = feature
def __init__(self, textedit2, pos): QUndoCommand.__init__(self) self.item2 = textedit2 self.newpos = self.item2.pos() # 移動後位置 print("init newpos", self.newpos) self.oldpos = pos # 原始位置 print("init oldpos", self.oldpos)
def __init__(self, obj, attrname, newvalue, name=None, parent=None): if name is None: name = "Set %r" % attrname QUndoCommand.__init__(self, name, parent) self.obj = obj self.attrname = attrname self.newvalue = newvalue self.oldvalue = getattr(obj, attrname)
def __init__(self, stack): QUndoCommand.__init__(self) self.stack = stack # Record the field that has changed. self.field = self.stack.edit self.store_cursor = self.field.textCursor() self.text_inserted = self.stack.last_edited self.setText(self.stack.edit_type) self.add_undo = self.stack.add_undo self.add_redo = self.stack.add_redo self.id = -1 self.child_count = 0 #self.corrected_qt_number_of_lines = self.field.corrected_qt_number_of_lines # todo self.text перевести на self.id print('new command') text12345 = self.text() if text12345 == 'symbol' or text12345 == 'enter' or text12345 == 'space': # остальные символы if text12345 == 'symbol': self.id = 1 self.give_position() self.pos3 = self.pos1 + 1 elif text12345 == 'backspace': self.text_inserted = '' #if not self.store_cursor.hasSelection():#no longer need it. i was forsed to not use default event ending # self.store_cursor.setPosition(self.store_cursor.position() - 1, 1) self.give_position() self.pos3 = self.pos1 elif text12345 == 'delete': self.text_inserted = '' #if not self.store_cursor.hasSelection():#the same as backspace. i'll move cursor in event # self.store_cursor.setPosition(self.store_cursor.position() + 1, 1) self.give_position() self.pos3 = self.pos1 elif text12345 == 'cut': # self.text_inserted = '' self.give_position() self.pos3 = self.pos1 elif text12345 == 'insert': self.give_position() self.pos3 = self.pos1 + len(self.text_inserted) elif text12345 == 'replace': self.give_position() self.pos3 = self.pos1 + len(self.text_inserted) elif text12345 == 'glue': print('emaaaa') #self.command_created_only = True print('self.childCount() = ', self.childCount()) return self.command_created_only = True #self.give_line_numbers() print(' self.pos1 = {}, self.pos2 = {}'.format(self.pos1, self.pos2)) self.text_deleted = self.store_cursor.selectedText() print(' selectedText', self.text_deleted) print(' last_edited', self.text_inserted)
def __init__(self, scheme, node, parent=None): QUndoCommand.__init__(self, "Remove %s" % node.title, parent) self.scheme = scheme self.node = node links = scheme.input_links(node) + \ scheme.output_links(node) for link in links: RemoveLinkCommand(scheme, link, parent=self)
def __init__(self, window, tinfo, start, end, first): QUndoCommand.__init__(self) self._tag = tinfo['obj'] self._start = start self._end = end self._x = tinfo['x'] self._y = tinfo['y'] self._window = window self._first = first self._name = tinfo['name']
def __init__(self, row, model, parent, add=True): QUndoCommand.__init__(self) self.row = row self.add = add self.model = model self._parent = parent if add: self.rowdata = [QVariant() for x in model._header] self.setText('Inserted Row %s' % (row + 1)) else: self.rowdata = [QVariant(x) for x in model.rows[row]] self.setText('Removed Row %s' % (row + 1))
def __init__(self, old, new, scene, msg=None, parent=None): QUndoCommand.__init__(self, parent) self.restored = True self.scene = scene self.data_old = old self.data_new = new self.diff = DictDiffer(old, new) self.setText(self.diff.output()) if msg is not None: self.setText(msg)
def __init__(self, row, column, value, model): QUndoCommand.__init__(self) self.old = model.rows[row][column] # to ensure we are working with a QVariant qvar = QVariant(value) self.new = qvar self.row = row self.column = column self.model = model label = str(qvar.value()) if "\n" in label or len(label) > 20: label = str(label).splitlines()[0].rstrip()[:18] + "..." self.setText('Row %s: Set %s = "%s"' % (row + 1, str(model._header[column].value()), label))
def __init__(self, editor, filename, text): QUndoCommand.__init__(self) ChangeFileCommand.fileVersionNumber += 1 self.editor = editor self.filename = filename self.setText(text) info = QFileInfo(filename) dir = info.dir().dirName() file = info.fileName() self.undoFilename = QDir.tempPath( ) + "/FlatSiteBuilder/" + dir + "/" + file + "." + str( ChangeFileCommand.fileVersionNumber) + ".undo" self.redoFilename = QDir.tempPath( ) + "/FlatSiteBuilder/" + dir + "/" + file + "." + str( ChangeFileCommand.fileVersionNumber) + ".redo"
def __init__(self, scheme, annotation, parent=None): QUndoCommand.__init__(self, "Remove annotation", parent) self.scheme = scheme self.annotation = annotation
def __init__(self, scheme, link, parent=None): QUndoCommand.__init__(self, "Remove link", parent) self.scheme = scheme self.link = link
def __init__(self, textedit): QUndoCommand.__init__(self) self.item1 = textedit print("storecommand", self.item1)
def __init__(self, scheme, annotation, old, new, parent=None): QUndoCommand.__init__(self, "Change text", parent) self.scheme = scheme self.annotation = annotation self.old = old self.new = new
def __init__(self, scheme, node, old_name, new_name, parent=None): QUndoCommand.__init__(self, "Rename", parent) self.scheme = scheme self.node = node self.old_name = old_name self.new_name = new_name
def __init__(self, scheme, item, new_line, parent=None): QUndoCommand.__init__(self, "Move arrow", parent) self.scheme = scheme self.item = item self.new_line = new_line self.old_line = (item.start_pos, item.end_pos)
def __init__(self, scheme, item, new_geom, parent=None): QUndoCommand.__init__(self, "Resize", parent) self.scheme = scheme self.item = item self.new_geom = new_geom self.old_geom = item.rect
def __init__(self, window, newtag, selects, first): QUndoCommand.__init__(self) self._newtag = newtag self._selects = selects self._window = window self._first = first
def __init__(self, item, name, use): QUndoCommand.__init__(self) self._name = name self._use = use self._item = item
def __init__(self, scheme, node, parent=None): QUndoCommand.__init__(self, "Add %s" % node.title, parent) self.scheme = scheme self.node = node
def __init__(self, window, tlist, llist, first): QUndoCommand.__init__(self) self._tlist = tlist self._llist = llist self._window = window self._first = first
def __init__(self, window, llist, first=False): QUndoCommand.__init__(self) self._window = window self._llist = llist self._first = first
def __init__(self, window, dlist, llist, first=False): QUndoCommand.__init__(self) self._dlist = dlist # tag list self._llist = llist # line list self._window = window self._first = first
def __init__(self, scheme, node, old, new, parent=None): QUndoCommand.__init__(self, "Move", parent) self.scheme = scheme self.node = node self.old = old self.new = new
def __init__(self, item, tag): QUndoCommand.__init__(self) self._name = tag._name self._use = tag._use self._item = item