Minor fixes

This commit is contained in:
Oscar Alvarez 2020-12-31 11:02:27 -05:00
parent 0d01101760
commit 8054c385da
6 changed files with 21 additions and 44 deletions

1
.gitignore vendored
View File

@ -24,6 +24,7 @@ yarn-error.log*
package-lock* package-lock*
/app/*.pyc
/__pycache__ /__pycache__
/app/__pycache__ /app/__pycache__
/app/printing/__pycache__ /app/printing/__pycache__

Binary file not shown.

View File

@ -40,7 +40,6 @@ class StartButtons(QVBoxLayout):
] ]
columns = 4 columns = 4
rows = 2 rows = 2
name_style = 'toolbar'
positions = [(i, j) for i in range(rows) for j in range(columns)] positions = [(i, j) for i in range(rows) for j in range(columns)]
for position, value in zip(positions, values): for position, value in zip(positions, values):
@ -51,7 +50,7 @@ class StartButtons(QVBoxLayout):
icon=get_icon(value[3]), icon=get_icon(value[3]),
title=value[1], title=value[1],
method=value[2], method=value[2],
name_style=name_style name_style='toolbar'
) )
grid.addWidget(button, *position) grid.addWidget(button, *position)

View File

@ -65,10 +65,6 @@ class CustomButton(QPushButton):
self.setObjectName(name_style) self.setObjectName(name_style)
rows = [] rows = []
if icon: if icon:
if not title:
self.setIcon(icon)
self.setIconSize(qsize)
else:
pixmap = icon.pixmap(qsize) pixmap = icon.pixmap(qsize)
label_icon = QLabel() label_icon = QLabel()
label_icon.setObjectName('label_icon') label_icon.setObjectName('label_icon')
@ -77,38 +73,28 @@ class CustomButton(QPushButton):
rows.append(label_icon) rows.append(label_icon)
if title: if title:
label_title = QLabel(title, self) rows.append(self.get_label(title))
label_title.setWordWrap(True)
label_title.setAlignment(Qt.AlignCenter | Qt.AlignCenter)
label_title.setObjectName('label_title')
rows.append(label_title)
label_custom_button = None
if desc_extractor: if desc_extractor:
desc = record.get(desc_extractor) desc = record.get(desc_extractor)
if not desc: if not desc:
desc = record.get('rec_name') desc = record.get('rec_name')
if len(desc) > 29: rows.append(self.get_label(desc))
desc = desc[0:29]
if len(rows) > 0:
label_custom_button = QLabel(desc, self)
label_custom_button.setAlignment(Qt.AlignCenter | Qt.AlignCenter)
label_custom_button.setObjectName('label_custom_button')
label_custom_button.setWordWrap()
rows.append(label_custom_button)
else:
# FIX ADD WORDWRAP
self.setText(desc)
if len(rows) > 1: if len(rows) >= 1:
vbox = QVBoxLayout() vbox = QVBoxLayout()
for w in rows: for w in rows:
vbox.addWidget(w, 1) vbox.addWidget(w, 1)
# if label_custom_button:
# label_custom_button.move(vbox.rect().center())
self.setLayout(vbox) self.setLayout(vbox)
method = getattr(parent, method) method = getattr(parent, method)
if method and record: if method and record:
method = partial(method, record) method = partial(method, record)
self.clicked.connect(method) self.clicked.connect(method)
def get_label(self, name):
label_title = QLabel(name)
label_title.setWordWrap(True)
label_title.setAlignment(Qt.AlignCenter | Qt.AlignCenter)
label_title.setObjectName('label_custom_button')
return label_title

View File

@ -151,7 +151,6 @@ class MenuDash(QWidget):
if col_cat > num_cat_cols - 1: if col_cat > num_cat_cols - 1:
col_cat = 0 col_cat = 0
row_cat += 1 row_cat += 1
# name_button = 'button_' + cat_id
button = CustomButton( button = CustomButton(
parent=self, parent=self,
@ -161,7 +160,7 @@ class MenuDash(QWidget):
desc_extractor='name', desc_extractor='name',
record=value, record=value,
size=self.button_size, size=self.button_size,
name_style='category_button' name_style='toolbar'
) )
self.main_categories.addWidget(button, row_cat, col_cat) self.main_categories.addWidget(button, row_cat, col_cat)
col_cat += 1 col_cat += 1

View File

@ -51,16 +51,8 @@
#label_custom_button { #label_custom_button {
font: 14pt; font: 14pt;
height: 30px; height: 30px;
padding-top: 5px; color: rgb(70, 70, 70);
padding-left: auto;
padding-right: auto;
margin-left: auto;
margin-right: auto;
background-color: rgb(70, 70, 70);
/* color: rgb(70, 70, 70); */
color: rgb(193, 41, 41);
text-align: center; text-align: center;
width: 100%;
} }
#label_icon { #label_icon {
@ -69,7 +61,6 @@
} }
#category_button { #category_button {
font-family: "DejaVu Sans";
border-style: groove; border-style: groove;
font: 10pt; font: 10pt;
color: rgb(80, 80, 80); color: rgb(80, 80, 80);
@ -93,6 +84,7 @@
#toolbar { #toolbar {
border-style: groove; border-style: groove;
color: rgb(80, 80, 80);
font: 15pt; font: 15pt;
background-color: white; background-color: white;
max-height: 85px; max-height: 85px;