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*
/app/*.pyc
/__pycache__
/app/__pycache__
/app/printing/__pycache__

Binary file not shown.

View File

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

View File

@ -65,50 +65,36 @@ class CustomButton(QPushButton):
self.setObjectName(name_style)
rows = []
if icon:
if not title:
self.setIcon(icon)
self.setIconSize(qsize)
else:
pixmap = icon.pixmap(qsize)
label_icon = QLabel()
label_icon.setObjectName('label_icon')
label_icon.setPixmap(pixmap)
label_icon.setAlignment(Qt.AlignCenter | Qt.AlignCenter)
rows.append(label_icon)
pixmap = icon.pixmap(qsize)
label_icon = QLabel()
label_icon.setObjectName('label_icon')
label_icon.setPixmap(pixmap)
label_icon.setAlignment(Qt.AlignCenter | Qt.AlignCenter)
rows.append(label_icon)
if title:
label_title = QLabel(title, self)
label_title.setWordWrap(True)
label_title.setAlignment(Qt.AlignCenter | Qt.AlignCenter)
label_title.setObjectName('label_title')
rows.append(label_title)
rows.append(self.get_label(title))
label_custom_button = None
if desc_extractor:
desc = record.get(desc_extractor)
if not desc:
desc = record.get('rec_name')
if len(desc) > 29:
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)
rows.append(self.get_label(desc))
if len(rows) > 1:
if len(rows) >= 1:
vbox = QVBoxLayout()
for w in rows:
vbox.addWidget(w, 1)
# if label_custom_button:
# label_custom_button.move(vbox.rect().center())
self.setLayout(vbox)
method = getattr(parent, method)
if method and record:
method = partial(method, record)
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:
col_cat = 0
row_cat += 1
# name_button = 'button_' + cat_id
button = CustomButton(
parent=self,
@ -161,7 +160,7 @@ class MenuDash(QWidget):
desc_extractor='name',
record=value,
size=self.button_size,
name_style='category_button'
name_style='toolbar'
)
self.main_categories.addWidget(button, row_cat, col_cat)
col_cat += 1

View File

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