def __init__(self): super(MainWindow, self).__init__() self.setGeometry(100, 100, 800, 600) # Read Style sheet style_sheet_file = qc.QFile('scheme.qss') style_sheet_file.open(qc.QFile.ReadOnly) self.setStyleSheet(qc.QLatin1String(style_sheet_file.readAll()))
def useQLatin1String(string): try: latinString = QtCore.QLatin1String(string) except: # Using python 3 QString is not implemented. Native python # string should be used return extendedStr(string) return latinString
def __init__(self): qg.QDialog.__init__(self) self.setWindowFlags(qc.Qt.WindowStaysOnTopHint) self.setWindowTitle('Interpolate It') self.setObjectName('InterpolateIt') self.setFixedWidth(314) style_sheet_file = qc.QFile(os.path.join(os.path.dirname(__file__), 'stylesheets', 'scheme.qss')) style_sheet_file.open(qc.QFile.ReadOnly) self.setStyleSheet(qc.QLatin1String(style_sheet_file.readAll())) self.setLayout(qg.QVBoxLayout()) self.layout().setContentsMargins(0,0,0,0) self.layout().setSpacing(0) scroll_area = qg.QScrollArea() scroll_area.setWidgetResizable(True) scroll_area.setFocusPolicy(qc.Qt.NoFocus) scroll_area.setHorizontalScrollBarPolicy(qc.Qt.ScrollBarAlwaysOff) self.layout().addWidget(scroll_area) main_widget = qg.QWidget() main_widget.setObjectName('InterpolateIt') main_layout = qg.QVBoxLayout() main_layout.setContentsMargins(5,5,5,5) main_layout.setAlignment(qc.Qt.AlignTop) main_widget.setLayout(main_layout) scroll_area.setWidget(main_widget) self.interp_layout = qg.QVBoxLayout() self.interp_layout.setContentsMargins(0,0,0,0) self.interp_layout.setSpacing(0) self.interp_layout.setAlignment(qc.Qt.AlignTop) main_layout.addLayout(self.interp_layout) button_layout = qg.QHBoxLayout() button_layout.setContentsMargins(0,0,0,0) button_layout.setAlignment(qc.Qt.AlignRight) main_layout.addLayout(button_layout) add_button = DT_ButtonThin('New..') button_layout.addWidget(add_button) new_widget = InterpolateWidget() new_widget.hideCloseButton() self.interp_layout.addWidget(new_widget) self._interp_widgets = [] self._interp_widgets.append(new_widget) self._dock_widget = self._dock_name = None add_button.clicked.connect(self.add) self._callback_id = om.MEventMessage.addEventCallback('SceneOpened', self.clearAll) del_callback = partial(om.MMessage.removeCallback, self._callback_id) self.destroyed.connect(del_callback)
def getQssFile(qssFile): qss = QtCore.QString('') result = False f = QtCore.QFile(qssFile) if f.open(QtCore.QFile.ReadOnly): qss = QtCore.QLatin1String(f.readAll()) result = True f.close() return result, qss