fix style, modified image insert

master3.3
Denis Spiridonov 12 years ago
parent b2fac43ac0
commit b4a28ff72a

@ -1209,9 +1209,9 @@ class MainFrame(QtGui.QWidget):
self.table_widget.setHorizontalHeaderLabels([''] + table.head.string)
self.table_widget.horizontalHeader().setStyleSheet \
("QHeaderView {background-color: #E4E1E0;"
("QHeaderView {background-color: transparent;"
"border: none;}"
'QHeaderView::section {background-color: transparent;}')
'QHeaderView::section {background-color: #ffffff;}')
self.table_widget.setStyleSheet("QTableWidget {"
@ -1556,15 +1556,15 @@ class MainFrame(QtGui.QWidget):
table.model().removeRow(i)
break
table.minus_but.setDisabled(True)
if not table.rowCount():
table.setRowCount(1)
for column in range(table.columnCount()):
# for readonly view
table.setEditTriggers \
(QtGui.QAbstractItemView.NoEditTriggers)
tablewidgetitem = QtGui.QTableWidgetItem('')
table.setItem(0, column, tablewidgetitem)
self.add_select_check(table)
# if not table.rowCount():
# table.setRowCount(1)
# for column in range(table.columnCount()):
# # for readonly view
# table.setEditTriggers \
# (QtGui.QAbstractItemView.NoEditTriggers)
# tablewidgetitem = QtGui.QTableWidgetItem('')
# table.setItem(0, column, tablewidgetitem)
# self.add_select_check(table)
# Resize table
self.resize_table(table)
return wrapper
@ -1593,7 +1593,7 @@ class MainFrame(QtGui.QWidget):
h += table.rowHeight(row_in_table)
table.setFixedHeight(h)
table.horizontalHeader().resizeSections\
(QtGui.QHeaderView.ResizeMode.ResizeToContents)
(QtGui.QHeaderView.ResizeMode.ResizeToContents)
############# End add Table
def print_brief(self, GroupField, x):
y = 0
@ -2019,6 +2019,10 @@ class MainFrame(QtGui.QWidget):
elif typefield in ['check', 'check_tristate']:
if text == 'auto' or not text:
text = ''
elif text.lower() == 'yes':
text = 'on'
elif text.lower() == 'no':
text = 'off'
elif typefield in ['password']:
text = self.view_dict[field.name].item(i,j).data(1)

@ -19,6 +19,7 @@ from PySide import QtGui, QtCore
import os, time, urllib2
from calculate.api.client.function import create_obj
from calculate.lib.utils.files import readLinesFile
import Image
class TopMenu(QtGui.QPushButton):
def __init__(self, label, images, parent = None):
@ -1200,7 +1201,7 @@ class SelectList(QtGui.QGroupBox):
self.grid = QtGui.QGridLayout(self)
self.grid.setContentsMargins(0, 0, 0, 0)
self.grid.setSpacing(4)
self.grid.setAlignment(QtCore.Qt.AlignTop)
self.grid.setAlignment(QtCore.Qt.AlignTop | QtCore.Qt.AlignLeft)
if add_ability:
plus_but = QtGui.QPushButton(self)
@ -1230,7 +1231,7 @@ class SelectList(QtGui.QGroupBox):
self.recover_but.setIcon(QtGui.QIcon.fromTheme('edit-clear'))
except:
self.recover_but.setText('R')
self.recover_but.setToolTip(_('Recover Table'))
self.recover_but.clicked.connect(self.recover_list)
@ -1271,7 +1272,7 @@ class SelectList(QtGui.QGroupBox):
self.CheckBoxList.append(item)
self.resize(self.sizeHint())
self.setStyleSheet("QGroupBox {"
'padding-top: 24px; padding-bottom: 0px;'
'padding-top: 8px; padding-bottom: 0px;'
'padding-left: 5px; padding-right: 5px;'
'border: 1px solid transparent;'
'border-top-color: gray;'
@ -2336,17 +2337,27 @@ class ImageLabel(QtGui.QLabel):
break
style = ''
if repeat.lower() == 'no':
if len(list_data) == 3:
# top_image = os.path.join(image_path, list_data[2])
# if os.path.isfile(os.path.join(image_path, list_data[2]))
color1 = list_data[1]
color2 = color1
elif len(list_data) > 3:
color1, color2 = list_data[-2:]
if len(list_data) > 1:
style = "background-color: qlineargradient(x1: 0, y1: 0, " + \
"x2: 0, y2: 1, stop: 0 %s, stop: 1 %s);" %(color1, color2)
# if repeat.lower() == 'no':
if len(list_data) == 3:
print list_data[2]
fix_image_path = os.path.join(image_path, list_data[2])
if os.path.isfile(fix_image_path):
layout = QtGui.QHBoxLayout(self)
fix_image = QtGui.QLabel(self)
fix_image.setStyleSheet("background-image: url(%s); " \
%fix_image_path)
img = Image.open(fix_image_path)
fix_image.setFixedWidth(img.size[0])
layout.addWidget(fix_image)
layout.setContentsMargins(0,0,0,0)
layout.setAlignment(QtCore.Qt.AlignLeft)
elif len(list_data) > 3:
color1, color2 = list_data[-2:]
style = "background-color: qlineargradient(x1: 0, y1: 0, " + \
"x2: 0, y2: 1, stop: 0 %s, stop: 1 %s);" %(color1, color2)
style += "background-image: url(%s); " %image
style += "background-attachment: fixed; "
style += "background-repeat: %s; " %repeat_dict[repeat.lower()]

Loading…
Cancel
Save