def __init__(self, parent): cwr = ColorWheelResource() super(ReadmeWidget, self).__init__(parent) self.parent = parent self.setObjectName('color0Widget') self.setStyleSheet(cwr.getStyleSheet('qwidget')) layout = QVBoxLayout() self.setLayout(layout) qf = QFont() qf.setFamily('Alef') qf.setPointSize(12) qfm = QFontMetrics(qf) width = qfm.boundingRect(''.join(['A'] * 55)).width() self.setFixedWidth(width) self.setFixedHeight(600) myTextArea = QTextEdit() myTextArea.setReadOnly(True) myTextArea.setHtml(open('resources/docs/README.html', 'r').read()) layout.addWidget(myTextArea) self.hide() # ## self.setWindowFlags(Qt.CustomizeWindowHint | Qt.WindowCloseButtonHint | Qt.Window) self.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) self.setWindowTitle('README') escAction = QAction(self) escAction.setShortcut('Esc') escAction.triggered.connect(self.hideMe) self.addAction(escAction)
def __init__(self, parent): super(QWidget, self).__init__(parent) self.parent = parent buttonLayout = QGridLayout() self.setLayout(buttonLayout) self.scaleButton = QPushButton("SCALE") self.resetScaleButton = QPushButton("RESET SCALE") self.recenterLastButton = QPushButton("RESET LCOLOR") self.normalizeColorValueButton = QPushButton("NORM CVALUE") self.turnToLineButton = QPushButton("TURN TO LINE") cwr = ColorWheelResource() for but in (self.scaleButton, self.resetScaleButton, self.recenterLastButton, self.normalizeColorValueButton, self.turnToLineButton): but.setStyleSheet(cwr.getStyleSheet('qpushbutton')) buttonLayout.addWidget(self.scaleButton, 0, 0, 1, 1) buttonLayout.addWidget(self.resetScaleButton, 0, 1, 1, 1) buttonLayout.addWidget(self.recenterLastButton, 0, 2, 1, 1) buttonLayout.addWidget(self.normalizeColorValueButton, 0, 3, 1, 1) buttonLayout.addWidget(self.turnToLineButton, 1, 0, 1, 1) buttonLayout.addWidget(QLabel("UNDER CONSTRUCTION"), 1, 1, 1, 3) # ## actions on buttons self.scaleButton.clicked.connect(self.rescaleColor) self.resetScaleButton.clicked.connect(self.resetScaleColor) self.recenterLastButton.clicked.connect(self.recenterLastColor) self.normalizeColorValueButton.clicked.connect(self.normCValue) self.turnToLineButton.clicked.connect(self.turnToLine)
def __init__(self, parent): cwr = ColorWheelResource() super(QWidget, self).__init__(parent) self.parent = parent self.setObjectName('color0Widget') self.setStyleSheet(cwr.getStyleSheet('qwidget')) # self.rotationSlider = QSlider(Qt.Horizontal) self.rotationSlider.setTickInterval(30) self.rotationSlider.setTickPosition(QSlider.TicksAbove) self.rotationSlider.setMinimum(0) self.rotationSlider.setMaximum(360) self.rotationSlider.setValue(0) self.scalingSlider = QSlider(Qt.Horizontal) self.scalingSlider.setTickInterval(20) self.scalingSlider.setTickPosition(QSlider.TicksBelow) self.scalingSlider.setMinimum(-200) self.scalingSlider.setMaximum(200) self.scalingSlider.setValue(0) self.valueSlider = QSlider(Qt.Horizontal) self.valueSlider.setTickInterval(10) self.valueSlider.setTickPosition(QSlider.TicksBelow) self.valueSlider.setMinimum(-100) self.valueSlider.setMaximum(100) self.valueSlider.setValue(0) # self.rotationLabel = QLabel("%03d" % 0) self.scalingLabel = QLabel("%0.3f" % 1.0) self.valueLabel = QLabel("%0.3f" % 0.0) self.settingButton = QPushButton("SET TRANSFORM") cwr = ColorWheelResource() self.settingButton.setStyleSheet(cwr.getStyleSheet('qpushbutton')) # ## actions on sliders and button self.rotationSlider.valueChanged.connect(self.rotateColors) self.scalingSlider.valueChanged.connect(self.scaleColors) self.valueSlider.valueChanged.connect(self.valueColors) self.settingButton.clicked.connect(self.setTransform) # ## initially disabled self.scalingSlider.setEnabled(False) # ## now set the layout self._layoutWidgets()
def __init__(self, parent = None ): super(ColorWheelTableModel, self).__init__(parent) self.colorNames = [] self.headerData = [ 'index', 'name', 'color', 'swatch' ] self.parent = parent self._colorwheel = ColorWheelResource().getColorWheel()
def __init__(self, parent): super(QTableView, self).__init__( parent ) self.parent = parent self.tm = ColorWheelTableModel( self.parent ) self.setModel( self.tm ) self.setItemDelegateForColumn(0, EntryDelegate( self ) ) self.setItemDelegateForColumn(1, NameDelegate( self ) ) self.setItemDelegateForColumn(2, HexColorDelegate( self ) ) self.setItemDelegateForColumn(3, ColorBarDelegate( self ) ) # set style cwr = ColorWheelResource() self.setStyleSheet( cwr.getStyleSheet( 'qtableview' ) ) # show grid self.setShowGrid( True ) # set fixed vertical headers self.verticalHeader().setResizeMode( QHeaderView.Fixed ) self.horizontalHeader().setResizeMode( QHeaderView.Fixed ) qf = self.horizontalHeader().font() qf.setFamily( 'Alef' ) qf.setBold( True ) qf.setPointSize( 9 ) self.horizontalHeader().setFont( qf ) self.verticalHeader().setFont( qf ) self.horizontalHeader().setDefaultAlignment( Qt.AlignLeft ) # hide vertical header self.verticalHeader().setVisible( False ) # disable sorting self.setSortingEnabled( False ) # other stuff self.setSelectionBehavior( QTableView.SelectRows ) # end button scroll to bottom toBotAction = QAction( self ) toBotAction.setShortcut( 'End' ) toBotAction.triggered.connect( self.scrollToBottom ) self.addAction( toBotAction ) # home button scroll to top toTopAction = QAction( self ) toTopAction.setShortcut( 'Home' ) toTopAction.triggered.connect( self.scrollToTop ) self.addAction( toTopAction ) # up one page upOnePageAction = QAction( self ) upOnePageAction.setShortcut( 'PgUp' ) upOnePageAction.triggered.connect( self.scrollUpOnePage ) self.addAction( upOnePageAction ) # down one page downOnePageAction = QAction( self ) downOnePageAction.setShortcut( 'PgDown' ) downOnePageAction.triggered.connect( self.scrollDownOnePage ) self.addAction( downOnePageAction ) # clear selection clearSelectionAction = QAction( self ) clearSelectionAction.setShortcut( 'Ctrl+U' ) clearSelectionAction.triggered.connect( self.clearSelection ) self.addAction( clearSelectionAction ) # ## self.clicked.connect( self.setSelectedColor ) # now put in the name self.addRow( ) # now do final resizing self.setColumnWidth( 0, 50 ) self.setColumnWidth( 1, 90 ) self.setColumnWidth( 2, 80 ) self.setColumnWidth( 3, 80 ) # now selection behavior, only rows, only a single row at a time self.setSelectionBehavior( QAbstractItemView.SelectRows ) self.setSelectionMode( QAbstractItemView.SingleSelection )
def __init__(self, transform=OperationAnimation.HUETRANSFORM): super(OperationSliderAnimation, self).__init__() self.setFixedWidth(500) self.setWindowFlags(Qt.CustomizeWindowHint | Qt.WindowCloseButtonHint | Qt.Window) self.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) self.transform = transform self.setWindowTitle(_nameTable[transform]) self.cwa = ColorWheelAll() # ## avconv_handbrake_dict = find_avconv_handbrake() if avconv_handbrake_dict is None: initQEM = QErrorMessage() initQEM.showMessage( "ERROR, cannot find either ffmpeg/avconv or handbrakeCLI. Exiting..." ) qApp.quit() # ## now some of the data members self.rotationSpeedSlider = QSlider(Qt.Horizontal) self.rotationSpeedSlider.setTickInterval(10) self.rotationSpeedSlider.setTickPosition(QSlider.TicksBelow) self.rotationSpeedSlider.setMinimum(0) self.rotationSpeedSlider.setMaximum(100) self.rotationSpeedSlider.setValue(0) self.rotationSpeedDialog = QLineEdit( "%0.3f" % math.pow(10, 0.01 * self.rotationSpeedSlider.value())) self.rotationSpeedDialog.setFixedWidth(85) # self.startTimeSlider = QSlider(Qt.Horizontal) self.startTimeSlider.setTickInterval(10) self.startTimeSlider.setTickPosition(QSlider.TicksBelow) self.startTimeSlider.setMinimum(0) self.startTimeSlider.setMaximum(100) self.startTimeSlider.setValue(15) self.startTimeDialog = QLineEdit("%0.2f" % (0.01 * self.startTimeSlider.value())) self.startTimeDialog.setFixedWidth(85) # self.endTimeSlider = QSlider(Qt.Horizontal) self.endTimeSlider.setTickInterval(10) self.endTimeSlider.setTickPosition(QSlider.TicksBelow) self.endTimeSlider.setMinimum(0) self.endTimeSlider.setMaximum(100) self.endTimeSlider.setValue(30) self.endTimeDialog = QLineEdit("%0.2f" % (0.01 * self.endTimeSlider.value())) self.endTimeDialog.setFixedWidth(85) # cwr = ColorWheelResource() self.movieName = CustomLabel(self) self.movieButton = QPushButton("MOVIE NAME") self.movieButton.setStyleSheet(cwr.getStyleSheet("qpushbutton")) self.movieName.setStyleSheet(cwr.getStyleSheet("qlabel")) # self.cssFileName = CustomLabel(self) self.cssButton = QPushButton("EXAMPLE CSS FILE") self.cssButton.setStyleSheet(cwr.getStyleSheet("qpushbutton")) self.cssFileName.setStyleSheet(cwr.getStyleSheet("qlabel")) # self.bigRedGoButton = QPushButton("BIG RED GO BUTTON MAKE MOVIE") self.setStyleSheet(cwr.getStyleSheet("qpushbutton")) # self.qem = CustomErrorMessage(self) self.pbar = StupidProgressBar(self) self.pbar.setValue(0.0) # ## now make the layout self._initLayout() # ## add actions self.rotationSpeedDialog.returnPressed.connect(self.setRotationSpeed) self.startTimeDialog.returnPressed.connect(self.setStartTime) self.endTimeDialog.returnPressed.connect(self.setEndTime) self.movieButton.clicked.connect(self.setMovieName) self.cssButton.clicked.connect(self.setCSSFile) self.rotationSpeedSlider.valueChanged.connect(self.rotationSpeed) self.startTimeSlider.valueChanged.connect(self.startTime) self.endTimeSlider.valueChanged.connect(self.endTime) self.bigRedGoButton.clicked.connect(self.bigRedGoRunnable) # quitAction = QAction(self) quitAction.setShortcuts(['Ctrl+Q', 'Esc']) quitAction.triggered.connect(qApp.quit) self.addAction(quitAction)