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

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

Loading…
Cancel
Save