fix view image
This commit is contained in:
parent
4f27f1982f
commit
0ae5361364
|
@ -2,7 +2,7 @@
|
|||
# from PyQt5.QtWidgets import QLabel, QWidget, QDesktopWidget
|
||||
# from PyQt5.QtCore import Qt, QByteArray
|
||||
# from PyQt5.QtGui import QPixmap
|
||||
from PySide6.QtWidgets import QLabel, QWidget
|
||||
from PySide6.QtWidgets import QLabel, QWidget, QHBoxLayout
|
||||
from PySide6.QtCore import Qt, QByteArray
|
||||
from PySide6.QtGui import QPixmap, QGuiApplication
|
||||
|
||||
|
@ -45,6 +45,8 @@ class Image(QLabel):
|
|||
if kind == 'bytes':
|
||||
ba = QByteArray.fromBase64(img)
|
||||
self.pixmap.loadFromData(ba)
|
||||
if kind == 'qimage':
|
||||
self.pixmap.convertFromImage(img)
|
||||
else:
|
||||
self.pixmap.loadFromData(img.data)
|
||||
self.setPixmap(self.pixmap)
|
||||
|
@ -56,6 +58,11 @@ class Image(QLabel):
|
|||
|
||||
def activate(self):
|
||||
self.free_center()
|
||||
qlabel = QLabel()
|
||||
qlabel.setPixmap(self.pixmap)
|
||||
qhVox = QHBoxLayout()
|
||||
qhVox.addWidget(qlabel)
|
||||
self.parent.setLayout(qhVox)
|
||||
self.parent.show()
|
||||
|
||||
def free_center(self):
|
||||
|
|
|
@ -76,7 +76,7 @@ SALE_FIELDS = [
|
|||
'invoice_type', 'consumer', 'delivery_party', 'table_assigned'
|
||||
]
|
||||
|
||||
KIND = [
|
||||
KIND_REST = [
|
||||
# ('', ''),
|
||||
('take_away', 'PARA LLEVAR'),
|
||||
('delivery', 'DOMICILO'),
|
||||
|
@ -84,6 +84,12 @@ KIND = [
|
|||
('catering', 'CATERING')
|
||||
]
|
||||
|
||||
KIND_RETAIL = [
|
||||
# ('', ''),
|
||||
('take_away', 'PARA LLEVAR'),
|
||||
('delivery', 'DOMICILO'),
|
||||
]
|
||||
|
||||
TYPE_VEHICLE = [
|
||||
('', ''),
|
||||
('motorcycle', 'Motorcycle'),
|
||||
|
|
16
app/main.py
16
app/main.py
|
@ -10,6 +10,7 @@ from packaging.version import parse as parse_version
|
|||
from decimal import Decimal
|
||||
from datetime import datetime, timedelta, date
|
||||
from collections import OrderedDict
|
||||
from PySide6 import QtGui
|
||||
from PySide6.QtCore import Qt
|
||||
from PySide6.QtWidgets import (
|
||||
QLabel, QHBoxLayout, QVBoxLayout,
|
||||
|
@ -35,7 +36,7 @@ from .store import StoreView
|
|||
from .constants import (
|
||||
PATH_PRINTERS, DELTA_LOCALE, STRETCH, alignRight, alignLeft, alignCenter,
|
||||
alignHCenter, DIALOG_REPLY_NO, ZERO, RATE_CREDIT_LIMIT, CONVERSION_DIGITS,
|
||||
SALE_FIELDS, KIND, DIALOG_REPLY_YES,
|
||||
SALE_FIELDS, KIND_REST, KIND_RETAIL, DIALOG_REPLY_YES,
|
||||
)
|
||||
from .dialogs import DialogDeliveryParty
|
||||
import time
|
||||
|
@ -402,6 +403,11 @@ class AppWindow(FrontWindow):
|
|||
|
||||
# LEFT TABLE COMPONENTS
|
||||
self.buttons_function = ButtonsFunction(self)
|
||||
|
||||
if self.enviroment == 'restaurant':
|
||||
KIND = KIND_REST
|
||||
else:
|
||||
KIND = KIND_RETAIL
|
||||
|
||||
info_fields = [
|
||||
('party', {
|
||||
|
@ -1569,7 +1575,7 @@ class AppWindow(FrontWindow):
|
|||
agent, = self.Agent.find([
|
||||
('id', '=', self.field_agent_id),
|
||||
])
|
||||
if commission <= agent['plan']['percentage']:
|
||||
if commission <= agent['plan.']['percentage']:
|
||||
self.Sale.write([self._sale['id']], {
|
||||
'agent': self.field_agent_id,
|
||||
'commission': int(commission),
|
||||
|
@ -2142,8 +2148,10 @@ class AppWindow(FrontWindow):
|
|||
if not product['image']:
|
||||
return
|
||||
|
||||
b64image = product['image'].encode()
|
||||
image.set_image(b64image, kind='bytes')
|
||||
image_64_decode = base64.b64decode(product['image'])
|
||||
image_ = QtGui.QImage()
|
||||
image_.loadFromData(image_64_decode , 'PNG')
|
||||
image.set_image(image_, kind='qimage')
|
||||
image.activate()
|
||||
|
||||
def on_selected_stock_product(self):
|
||||
|
|
Loading…
Reference in New Issue