minor changes in theme dark for front login and windows

This commit is contained in:
Camilo Sarmiento 2020-07-16 13:33:35 -05:00
parent 4fe4326840
commit 2b827e1ab1
8 changed files with 69 additions and 27 deletions

View File

@ -37,11 +37,16 @@ class Login(QDialog):
params = Params(file_config)
self.params = params.params
self.setObjectName('dialog_login')
if self.params.get('tablet_mode') == 'True':
self.tablet_mode = eval(self.params['tablet_mode'])
self.set_style([file_tablet_css])
else:
self.set_style([file_base_css])
if self.params.get('theme'):
file_theme_css = os.path.join(pkg_dir, 'css', self.params['theme'] + '.css')
self.set_style([file_theme_css])
else:
self.set_style([file_base_css])
self.tablet_mode = None
self.init_UI()

View File

@ -88,11 +88,11 @@ class FrontWindow(QMainWindow):
_label_info.setAlignment(Qt.AlignLeft | Qt.AlignVCenter)
status_bar.addWidget(_label_info)
def set_style(self, file_css, base_css=None):
def set_style(self, file_css, theme_css=None):
styles = []
if base_css:
base_css = os.path.join(str(parent), 'css', base_css + '.css')
for style in [base_css or file_base_css, file_css]:
if theme_css:
theme_css = os.path.join(str(parent), 'css', theme_css + '.css')
for style in [theme_css or file_base_css, file_css]:
with open(style, 'r') as infile:
styles.append(infile.read())
self.setStyleSheet(''.join(styles))

View File

@ -6,7 +6,7 @@
QListView {
font: bold 46px;
color: #e7e8e9;
color: #424242;
alignment : center;
}

View File

@ -26,6 +26,16 @@ QAbstractButton {
font : 22px;
}
#field_large_light {
font : 22px;
color : #505C66;
}
#label_large_light {
font : 22px;
color : white;
}
#field_large_gray, #label_large_gray {
font : 22px;
color : rgb(54, 54, 54);

View File

@ -35,6 +35,7 @@ from .constants import (PATH_PRINTERS, DELTA_LOCALE, STRETCH, alignRight,
DIALOG_REPLY_YES, ZERO, FRACTIONS, RATE_CREDIT_LIMIT, SCREENS, FILE_BANNER,
CONVERSION_DIGITS)
INVOICE_TYPE = [('', '')]
class MainWindow(FrontWindow):
@ -45,7 +46,8 @@ class MainWindow(FrontWindow):
CONNECTION = connection
super(MainWindow, self).__init__(connection, params, title)
print('Screen Size: > ', self.screen_size)
self.set_style(SCREENS[self.screen_size], params['theme'])
_theme = params['theme'] if params.get('theme') else None
self.set_style(SCREENS[self.screen_size], _theme)
self.is_clear_right_panel = True
self.payment_ctx = {}
@ -54,7 +56,11 @@ class MainWindow(FrontWindow):
self.ctx = self._context
self.ctx['params'] = params
self.label_color = params['theme'] or 'gray'
self.label_color = 'gray'
self.label_color_2 = ''
if _theme == 'dark':
self.label_color = 'light'
self.label_color_2 = 'orange'
response = self.load_modules()
if response is not True:
d = self.dialog(response)
@ -512,24 +518,25 @@ class MainWindow(FrontWindow):
left_head.addLayout(layout_message, 0)
left_head.addWidget(self.field_sign, 0)
left_head.addWidget(self.field_amount, 0)
if self.shop.get('pos_authorization'):
INVOICE_TYPE.append(('P', self.tr('POS')))
if self.shop.get('credit_note_electronic_authorization'):
INVOICE_TYPE.append(('91', self.tr('NOTA CREDITO ELECTRONICA')))
if self.shop.get('debit_note_electronic_authorization'):
INVOICE_TYPE.append(('92', self.tr('NOTA DEBITO ELECTRONICA')))
if self.shop.get('manual_authorization'):
INVOICE_TYPE.append(('M', self.tr('MANUAL')))
if self.shop.get('computer_authorization'):
INVOICE_TYPE.append(('C', self.tr('COMPUTADOR')))
if self.shop.get('electronic_authorization'):
INVOICE_TYPE.append(('1', self.tr('VENTA ELECTRONICA')))
info_fields = [
('invoice_type', {
'name': self.tr('INVOICE TYPE'),
'placeholder': False,
'type': 'selection',
'on_change': 'action_invoice_type_selection_changed',
'values': [
('', ''),
('C', self.tr('COMPUTADOR')),
('M', self.tr('MANUAL')),
('P', self.tr('POS')),
('1', self.tr('VENTA ELECTRONICA')),
('2', self.tr('VENTA DE EXPORTACION')),
# ('3', self.tr('FACTURA POR CONTINGENCIA FACTURADOR')),
# ('4', self.tr('FACTURA POR CONTINGENCIA DIAN')),
('91', self.tr('NOTA CREDITO ELECTRONICA')),
('92', self.tr('NOTA DEBITO ELECTRONICA')),
],
'values': INVOICE_TYPE,
'size': self.screen_size,
'color': self.label_color
}),
@ -682,14 +689,14 @@ class MainWindow(FrontWindow):
'readonly': True,
'type': 'money',
'size': self.screen_size,
'color': self.label_color
'color': self.label_color_2 or 'blue'
}),
('change', {
'name': self.tr('CHANGE'),
'readonly': True,
'type': 'money',
'size': self.screen_size,
'color': 'orange'
'color': self.label_color_2 or 'orange'
})
]
@ -1580,8 +1587,8 @@ class MainWindow(FrontWindow):
]
def get_product_by_categories(self):
self.allow_categories = [pc for pc in self.product_categories if (
not pc['parent'] and not pc['accounting'])]
self.allow_categories = [pc for pc in self.product_categories if
not pc['parent'] and not pc['accounting']]
for cat in self.allow_categories:
cat['icon'] = get_icon(cat['name_icon'])

View File

@ -25,6 +25,15 @@ QAbstractButton {
#field_default {
font : 18px;
}
#field_medium_light {
font : 18px;
color : #505C66;
}
#label_medium_light {
font : 18px;
color : white;
}
#field_medium_gray, #label_medium_gray {
font : 18px;

View File

@ -34,6 +34,16 @@ QAbstractButton {
min-height : 10px;
}
#field_small_light {
font : 15px;
color : #505C66;
}
#label_small_light {
font : 15px;
color : white;
}
#field_small_gray, #label_small_gray {
font : 15px;
width: auto;

7
pospro
View File

@ -12,7 +12,6 @@ from app import mainwindow
parser = argparse.ArgumentParser(description='Process some integers.')
parser.add_argument('-o', metavar="theme", help='execute argument')
args = parser.parse_args()
print(args.o)
try:
DIR = os.path.abspath(os.path.normpath(os.path.join(__file__,
@ -35,7 +34,10 @@ class Client(object):
self.app.installTranslator(self.translator)
def init_login(self):
login = Login(file_config='config_pos.ini')
_file_config='config_pos.ini'
if args.o:
_file_config = args.o
login = Login(file_config=_file_config)
while not login.connection:
login.run()
@ -44,7 +46,6 @@ class Client(object):
return login.connection, login.params
def main(self, conn, params):
params['theme'] = args.o
mw = mainwindow.MainWindow(conn, params)
self.app.exec_()