Skip to content

Commit

Permalink
added app.cut_copy_mode, closes #1622
Browse files Browse the repository at this point in the history
  • Loading branch information
fzumstein committed Jun 23, 2021
1 parent 4d6a6e3 commit 7168106
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
9 changes: 9 additions & 0 deletions xlwings/_xlmac.py
Expand Up @@ -173,6 +173,15 @@ def status_bar(self):
def status_bar(self, value):
self.xl.status_bar.set(value)

@property
def cut_copy_mode(self):
modes = {kw.cut_mode: 'cut', kw.copy_mode: 'copy'}
return modes.get(self.xl.cut_copy_mode.get())

@cut_copy_mode.setter
def cut_copy_mode(self, value):
self.xl.cut_copy_mode.set(value)


class Books:

Expand Down
9 changes: 9 additions & 0 deletions xlwings/_xlwindows.py
Expand Up @@ -447,6 +447,15 @@ def status_bar(self):
def status_bar(self, value):
self.xl.StatusBar = value

@property
def cut_copy_mode(self):
modes = {2: 'cut', 1: 'copy'}
return modes.get(self.xl.CutCopyMode)

@cut_copy_mode.setter
def cut_copy_mode(self, value):
self.xl.CutCopyMode = value


class Books:

Expand Down
14 changes: 14 additions & 0 deletions xlwings/main.py
Expand Up @@ -443,6 +443,20 @@ def status_bar(self):
def status_bar(self, value):
self.impl.status_bar = value

@property
def cut_copy_mode(self):
"""
Gets or sets the status of the cut or copy mode.
Accepts ``False`` for setting and returns ``None``, ``copy`` or ``cut`` when getting the status.
.. versionadded:: 0.23.5
"""
return self.impl.cut_copy_mode

@cut_copy_mode.setter
def cut_copy_mode(self, value):
self.impl.cut_copy_mode = value

def __repr__(self):
return "<Excel App %s>" % self.pid

Expand Down

0 comments on commit 7168106

Please sign in to comment.