Skip to content

Commit

Permalink
agrega la opcion de copiar todo el listado para cada solapa del reporte
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomas Gonzalez Dowling committed Aug 11, 2018
1 parent 1e2e32f commit 9004f48
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 9 deletions.
27 changes: 27 additions & 0 deletions report_screen.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QApplication
from PyQt5.QtWidgets import QDialog
from PyQt5.QtGui import QIcon
from ui.ui_report import Ui_Report
Expand All @@ -17,9 +18,35 @@ def __init__(self, parent=None):

self.setWindowTitle("Actualizador de precios - Comtom Tech")

self.btn_copy_notmatched.clicked.connect(self.copyAll)
self.btn_copy_notfound.clicked.connect(self.copyAll)
self.btn_copy_notupdated.clicked.connect(self.copyAll)

def copyAll(self):
if self.sender().objectName() == 'btn_copy_notmatched':
widget = self.lst_notmatched
elif self.sender().objectName() == 'btn_copy_notfound':
widget = self.lst_notfound
else:
widget = self.lst_notupdated

items = ""
for index in range(widget.count()):
items += "%s\n" % widget.item(index).text()

cb = QApplication.clipboard()
cb.clear(mode=cb.Clipboard)
cb.setText(items, mode=cb.Clipboard)

def updateValues(self, updated_list, failed_list, code_not_found_list, description_not_found_list, not_uptated_list):
for item in code_not_found_list:
self.lst_notfound.addItem(item)
# para usar qtablewidget
# rowPosition = self.lst_notfound.rowCount()
# self.lst_notfound.setColumnCount(2)
# self.lst_notfound.insertRow(rowPosition)
# self.lst_notfound.setItem(rowPosition, 0, QTableWidgetItem(item.split(',')[0]))
# self.lst_notfound.setItem(rowPosition, 1, QTableWidgetItem(item.split(',')[1]))

for item in description_not_found_list:
self.lst_notmatched.addItem(item)
Expand Down
57 changes: 54 additions & 3 deletions ui/report.ui
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="contextMenuPolicy">
<enum>Qt::ActionsContextMenu</enum>
</property>
<property name="currentIndex">
<number>0</number>
</property>
Expand Down Expand Up @@ -115,6 +118,22 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::MultiSelection</enum>
</property>
</widget>
<widget class="QToolButton" name="btn_copy_notmatched">
<property name="geometry">
<rect>
<x>607</x>
<y>0</y>
<width>60</width>
<height>40</height>
</rect>
</property>
<property name="text">
<string>Copiar</string>
</property>
</widget>
</widget>
<widget class="QWidget" name="tab_2">
Expand All @@ -130,18 +149,34 @@
<height>451</height>
</rect>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::MultiSelection</enum>
</property>
</widget>
<widget class="QLabel" name="lbl_notfound">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>651</width>
<width>601</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Los siguientes productos no se han encontrado (tal vez deba dar de alta el producto manualmente)</string>
<string>Los siguientes productos no se han encontrado (debe dar de alta el producto manualmente)</string>
</property>
</widget>
<widget class="QToolButton" name="btn_copy_notfound">
<property name="geometry">
<rect>
<x>615</x>
<y>0</y>
<width>51</width>
<height>40</height>
</rect>
</property>
<property name="text">
<string>Copiar</string>
</property>
</widget>
</widget>
Expand All @@ -158,8 +193,11 @@
<height>441</height>
</rect>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::MultiSelection</enum>
</property>
</widget>
<widget class="QLabel" name="lbl_notfound_2">
<widget class="QLabel" name="lbl_notupdated">
<property name="geometry">
<rect>
<x>10</x>
Expand All @@ -172,6 +210,19 @@
<string>Los siguientes productos no han sido enviados en el listado del proveedor (consultar precio)</string>
</property>
</widget>
<widget class="QToolButton" name="btn_copy_notupdated">
<property name="geometry">
<rect>
<x>615</x>
<y>0</y>
<width>51</width>
<height>40</height>
</rect>
</property>
<property name="text">
<string>Copiar</string>
</property>
</widget>
</widget>
</widget>
</item>
Expand Down
28 changes: 22 additions & 6 deletions ui/ui_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def setupUi(self, Report):
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.tabWidget.sizePolicy().hasHeightForWidth())
self.tabWidget.setSizePolicy(sizePolicy)
self.tabWidget.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
self.tabWidget.setObjectName("tabWidget")
self.tab = QtWidgets.QWidget()
self.tab.setObjectName("tab")
Expand All @@ -54,25 +55,37 @@ def setupUi(self, Report):
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.lst_notmatched.sizePolicy().hasHeightForWidth())
self.lst_notmatched.setSizePolicy(sizePolicy)
self.lst_notmatched.setSelectionMode(QtWidgets.QAbstractItemView.MultiSelection)
self.lst_notmatched.setObjectName("lst_notmatched")
self.btn_copy_notmatched = QtWidgets.QToolButton(self.tab)
self.btn_copy_notmatched.setGeometry(QtCore.QRect(607, 0, 60, 40))
self.btn_copy_notmatched.setObjectName("btn_copy_notmatched")
self.tabWidget.addTab(self.tab, "")
self.tab_2 = QtWidgets.QWidget()
self.tab_2.setObjectName("tab_2")
self.lst_notfound = QtWidgets.QListWidget(self.tab_2)
self.lst_notfound.setGeometry(QtCore.QRect(-1, 40, 671, 451))
self.lst_notfound.setSelectionMode(QtWidgets.QAbstractItemView.MultiSelection)
self.lst_notfound.setObjectName("lst_notfound")
self.lbl_notfound = QtWidgets.QLabel(self.tab_2)
self.lbl_notfound.setGeometry(QtCore.QRect(10, 10, 651, 20))
self.lbl_notfound.setGeometry(QtCore.QRect(10, 10, 601, 20))
self.lbl_notfound.setObjectName("lbl_notfound")
self.btn_copy_notfound = QtWidgets.QToolButton(self.tab_2)
self.btn_copy_notfound.setGeometry(QtCore.QRect(615, 0, 51, 40))
self.btn_copy_notfound.setObjectName("btn_copy_notfound")
self.tabWidget.addTab(self.tab_2, "")
self.tab_5 = QtWidgets.QWidget()
self.tab_5.setObjectName("tab_5")
self.lst_notupdated = QtWidgets.QListWidget(self.tab_5)
self.lst_notupdated.setGeometry(QtCore.QRect(-1, 40, 661, 441))
self.lst_notupdated.setSelectionMode(QtWidgets.QAbstractItemView.MultiSelection)
self.lst_notupdated.setObjectName("lst_notupdated")
self.lbl_notfound_2 = QtWidgets.QLabel(self.tab_5)
self.lbl_notfound_2.setGeometry(QtCore.QRect(10, 10, 631, 20))
self.lbl_notfound_2.setObjectName("lbl_notfound_2")
self.lbl_notupdated = QtWidgets.QLabel(self.tab_5)
self.lbl_notupdated.setGeometry(QtCore.QRect(10, 10, 631, 20))
self.lbl_notupdated.setObjectName("lbl_notupdated")
self.btn_copy_notupdated = QtWidgets.QToolButton(self.tab_5)
self.btn_copy_notupdated.setGeometry(QtCore.QRect(615, 0, 51, 40))
self.btn_copy_notupdated.setObjectName("btn_copy_notupdated")
self.tabWidget.addTab(self.tab_5, "")
self.verticalLayout.addWidget(self.tabWidget)

Expand All @@ -87,9 +100,12 @@ def retranslateUi(self, Report):
self.lbl_updated.setText(_translate("Report", "XXXX productos actualizados"))
self.lbl_title.setText(_translate("Report", "Actualizacion completada"))
self.lbl_notmatched.setText(_translate("Report", "Los siguientes productos no coinciden con la descripcion (codigo dado de alta)"))
self.btn_copy_notmatched.setText(_translate("Report", "Copiar"))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), _translate("Report", "Producto con error"))
self.lbl_notfound.setText(_translate("Report", "Los siguientes productos no se han encontrado (tal vez deba dar de alta el producto manualmente)"))
self.lbl_notfound.setText(_translate("Report", "Los siguientes productos no se han encontrado (debe dar de alta el producto manualmente)"))
self.btn_copy_notfound.setText(_translate("Report", "Copiar"))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), _translate("Report", "Codigo Inexistente"))
self.lbl_notfound_2.setText(_translate("Report", "Los siguientes productos no han sido enviados en el listado del proveedor (consultar precio)"))
self.lbl_notupdated.setText(_translate("Report", "Los siguientes productos no han sido enviados en el listado del proveedor (consultar precio)"))
self.btn_copy_notupdated.setText(_translate("Report", "Copiar"))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_5), _translate("Report", "No actualizados"))

0 comments on commit 9004f48

Please sign in to comment.