presik_pos/app/tools.py

27 lines
513 B
Python
Raw Normal View History

2020-04-19 17:54:08 +02:00
import os
from PyQt5.QtGui import QIcon
2021-01-26 21:45:15 +01:00
from PyQt5.QtWidgets import QDesktopWidget
2020-04-19 17:54:08 +02:00
current_dir = os.path.dirname(__file__)
def get_icon(name):
2021-04-12 18:29:53 +02:00
path_icon = os.path.join(current_dir, 'share', name + '.svg')
return QIcon(path_icon)
2020-04-19 17:54:08 +02:00
def to_numeric(number):
return str(round(number, 2))
def to_float(number, digits):
return str(round(number, 4))
2021-01-26 21:45:15 +01:00
def get_screen():
screen = QDesktopWidget().screenGeometry()
width = screen.width()
height = screen.height()
return width, height