using clipboard
This commit is contained in:
parent
22ffcf9f05
commit
f4f4c5d14a
3 changed files with 28 additions and 33 deletions
12
changelog.md
12
changelog.md
|
@ -1,5 +1,17 @@
|
||||||
# Changelog GarageCalc1
|
# Changelog GarageCalc1
|
||||||
|
|
||||||
|
## [0.7.3] - 2021-07-12
|
||||||
|
## Added
|
||||||
|
- Nutzung der Zwischenablage
|
||||||
|
|
||||||
|
## [0.7.2] - 2021-07-09
|
||||||
|
## Changed
|
||||||
|
- Ressourcen befinden sich nun in der Ressourcendatei
|
||||||
|
|
||||||
|
## [0.7.1] - 2021-07-09
|
||||||
|
## Fixed
|
||||||
|
- Sprachdatei unvollständig
|
||||||
|
|
||||||
## [0.7] - 2021-07-09
|
## [0.7] - 2021-07-09
|
||||||
## Added
|
## Added
|
||||||
- Einheiten können pro Zelle mit F3 eingegben/editiert/umgerechnet werden
|
- Einheiten können pro Zelle mit F3 eingegben/editiert/umgerechnet werden
|
||||||
|
|
|
@ -62,6 +62,8 @@ class TableWidget(QTableWidget):
|
||||||
self.default_uom_length = uom_length
|
self.default_uom_length = uom_length
|
||||||
self.default_uom_mass = uom_mass
|
self.default_uom_mass = uom_mass
|
||||||
|
|
||||||
|
self.clipboard_data: list = None
|
||||||
|
|
||||||
# self.setSelectionMode(QAbstractItemView.ContiguousSelection)
|
# self.setSelectionMode(QAbstractItemView.ContiguousSelection)
|
||||||
self.setSelectionMode(QAbstractItemView.SingleSelection)
|
self.setSelectionMode(QAbstractItemView.SingleSelection)
|
||||||
|
|
||||||
|
@ -232,7 +234,6 @@ class TableWidget(QTableWidget):
|
||||||
|
|
||||||
if item:
|
if item:
|
||||||
self.dlg.efValue.setText(item.text())
|
self.dlg.efValue.setText(item.text())
|
||||||
print("UOM of the cell:", item.data(Qt.UserRole))
|
|
||||||
self.dlg.cmbUOM.setCurrentText(item.data(Qt.UserRole))
|
self.dlg.cmbUOM.setCurrentText(item.data(Qt.UserRole))
|
||||||
if item.data(Qt.UserRole):
|
if item.data(Qt.UserRole):
|
||||||
self.old_uom = item.data(Qt.UserRole)
|
self.old_uom = item.data(Qt.UserRole)
|
||||||
|
@ -300,38 +301,17 @@ class TableWidget(QTableWidget):
|
||||||
item.setToolTip(None)
|
item.setToolTip(None)
|
||||||
|
|
||||||
def item_paste(self):
|
def item_paste(self):
|
||||||
if self.clipboard_data:
|
clip_text = qApp.clipboard().text().rstrip('\n').split("\t")
|
||||||
cur_row = self.currentRow()
|
|
||||||
cur_col = self.currentColumn()
|
|
||||||
# ask_confirmation = True
|
|
||||||
|
|
||||||
if self.row_selected:
|
cur_row = self.currentRow()
|
||||||
cur_col = 0
|
cur_col = self.currentColumn()
|
||||||
|
|
||||||
col = 0
|
col = 0
|
||||||
if len(self.clipboard_data) == 1:
|
|
||||||
data = self.clipboard_data[0]
|
|
||||||
item = QTableWidgetItem(data)
|
|
||||||
|
|
||||||
self.setItem(cur_row, cur_col, item)
|
for data in clip_text:
|
||||||
item.setSelected(True)
|
item = QTableWidgetItem(data)
|
||||||
else:
|
self.setItem(cur_row, cur_col+col, item)
|
||||||
for data in self.clipboard_data:
|
col += 1
|
||||||
item = QTableWidgetItem(data)
|
|
||||||
# if item:
|
|
||||||
# if len(item.text()) >0:
|
|
||||||
# if ask_confirmation:
|
|
||||||
# msg = QCoreApplication.translate("TableWidget", "Zelle enthält bereits Daten. Überschreiben?")
|
|
||||||
# reply = QMessageBox.question(self, QCoreApplication.translate("TableWidget", "Überschreiben"), msg, \
|
|
||||||
# QMessageBox.Yes | QMessageBox.No, QMessageBox.Yes)
|
|
||||||
# if reply == QMessageBox.No:
|
|
||||||
# return False
|
|
||||||
|
|
||||||
# ask_confirmation = False
|
|
||||||
self.setItem(cur_row, col, item)
|
|
||||||
item.setSelected(True)
|
|
||||||
|
|
||||||
col += 1
|
|
||||||
|
|
||||||
def item_cut(self):
|
def item_cut(self):
|
||||||
self.item_copy()
|
self.item_copy()
|
||||||
|
@ -354,9 +334,12 @@ class TableWidget(QTableWidget):
|
||||||
|
|
||||||
self.sel_ranges = self.selectedRanges()
|
self.sel_ranges = self.selectedRanges()
|
||||||
|
|
||||||
self.clipboard_data = []
|
clipboard_data = []
|
||||||
for idx in sel_idx:
|
for idx in sel_idx:
|
||||||
self.clipboard_data.append(idx.data())
|
clipboard_data.append(idx.data(Qt.DisplayRole))
|
||||||
|
|
||||||
|
clip_text = "\t".join(str(text or "") for text in clipboard_data)
|
||||||
|
qApp.clipboard().setText(clip_text)
|
||||||
|
|
||||||
def item_del(self, ask_cofirmation=True):
|
def item_del(self, ask_cofirmation=True):
|
||||||
sel_idx = self.selectionModel().selectedIndexes()
|
sel_idx = self.selectionModel().selectedIndexes()
|
||||||
|
|
|
@ -30,7 +30,7 @@ from utils import show_about, resource_path, str_iff, fit_col_widths, convert_uo
|
||||||
from clsTableWidget import TableWidget
|
from clsTableWidget import TableWidget
|
||||||
|
|
||||||
# Local globals
|
# Local globals
|
||||||
APP_VERSION = "v0.7.2"
|
APP_VERSION = "v0.7.3"
|
||||||
|
|
||||||
DIR_CURRENT = os.getcwd()
|
DIR_CURRENT = os.getcwd()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue