def ui_waitWindowShow(self): if not self.ui_WND_wait: self.ui_WND_wait = QtGui.QWidget() layout = QtGui.QHBoxLayout() layout.setContentsMargins(0, 0, 0, 0) self.ui_WND_wait.setLayout(layout) label = QtGui.QLabel('Searching...') label.setAlignment(QtCore.Qt.AlignHCenter | QtCore.Qt.AlignVCenter) label.setFrameStyle(QtGui.QFrame.Panel | QtGui.QFrame.Raised) layout.addWidget(label) self.ui_WND_wait.setWindowFlags(QtCore.Qt.Popup) parentTopLeft = self.ui_QT_TBL_searchResult.mapToGlobal( self.ui_QT_TBL_searchResult.rect().topLeft()) parentX = parentTopLeft.x() parentY = parentTopLeft.y() parentWidth = self.ui_QT_TBL_searchResult.rect().width() waitWndWidth = parentWidth * WAIT_WND_WIDTH_RATIO waitWndX = parentX + (parentWidth - waitWndWidth) / 2 self.ui_WND_wait.move(waitWndX, parentY + WAIT_WND_TOP_OFFSET) self.ui_WND_wait.resize(waitWndWidth, WAIT_WND_HEIGHT) self.ui_WND_wait.show() self.ui_WND_wait.raise_() self.ui_WND_wait.repaint()
def initModels(self): self.model = QtGui.QStandardItemModel() self.filterModel = QtCore.QSortFilterProxyModel() self.filterModel.setSortCaseSensitivity(QtCore.Qt.CaseInsensitive) self.filterModel.setSourceModel(self.model) self.ui.uiTBL_textures.setModel(self.filterModel) self.filterModel.setFilterKeyColumn(1) self.model.setColumnCount(len(com.TABLE_COLUMN_NAMES)) for i, col in enumerate(com.TABLE_COLUMN_NAMES): self.model.setHeaderData(i, QtCore.Qt.Horizontal, col, QtCore.Qt.DisplayRole)
def createUI(self): self.setText('Fly Camera. Press "h" for help') self.setCheckable(True) self.setChecked(True) self.mainBtnWidth = 250 self.mainBtnHeight = 30 self.mainBtnLeft = 0 self.mainBtnTop = self.mainWinQObject.geometry().height() - self.mainBtnHeight self.resize(self.mainBtnWidth, self.mainBtnHeight) self.move(self.mainBtnLeft, self.mainBtnTop) font = QtGui.QFont() font.setFamily("Segoe UI") font.setPointSize(11) font.setBold(True) font.setWeight(75) font.setStyleStrategy(QtGui.QFont.PreferAntialias) self.setFont(font) # self.setStyleSheet('QPushButton:checked {color: #000000; background-color: #ffae00}') self.show() self.raise_()
margin-bottom:1px; margin-left:1px; padding:3px } """ if QtGui and m: from fxpt.fx_utils.qt_font_creator import QtFontCreator from fxpt.fx_utils.utils import getFxUtilsDir qtFontCreator = QtFontCreator(getFxUtilsDir() + '/proggy_tiny_sz.ttf', 12) FONT_MONOSPACE_QFONT = qtFontCreator.getQFont() FONT_MONOSPACE_LETTER_SIZE = qtFontCreator.getLetterSize('i') FILE_EXISTS_STRINGS = { False: (' No', QtGui.QColor(225, 75, 75)), True: (' Yes', QtGui.QColor(140, 220, 75)) } ASSIGNED_COLORS = { False: QtGui.QPalette().color(QtGui.QPalette.Disabled, QtGui.QPalette.WindowText), True: QtGui.QPalette().color(QtGui.QPalette.Active, QtGui.QPalette.WindowText) } COL_IDX_EXIST = 0 COL_IDX_FILENAME = 1 COL_IDX_ATTR = 2 TABLE_COLUMN_NAMES = ('Exists', 'Filename', 'Attribute')
def __init__(self): QtCore.QSortFilterProxyModel.__init__(self) self.model = QtGui.QStandardItemModel() self.initModel() self.setSourceModel(self.model)
def __init__(self, name): self.name = name self.active = False self.searchDesc = None self.model = QtGui.QStandardItemModel() self.initModel()
def getLetterSize(self, letter): return QtGui.QFontMetrics(self.qFont).width(letter)
def qFontFromFile(self): fontID = QtGui.QFontDatabase.addApplicationFont(self.filename) fontFamily = QtGui.QFontDatabase.applicationFontFamilies(fontID)[0] return QtGui.QFont(fontFamily, self.size)