コード例 #1
0
ファイル: Mixer.py プロジェクト: twardoch/TypeRig
    def __init__(self):
        super(mixerHead, self).__init__()

        self.edt_glyphName = QtGui.QLineEdit()
        self.edt_stemV0 = QtGui.QLineEdit('1')
        self.edt_stemV1 = QtGui.QLineEdit('1')
        self.edt_stemH0 = QtGui.QLineEdit('1')
        self.edt_stemH1 = QtGui.QLineEdit('1')

        self.btn_refresh = QtGui.QPushButton('&Refresh')
        self.btn_set_axis = QtGui.QPushButton('Set &Axis')
        self.btn_getVstem = QtGui.QPushButton('Get &V Stems')
        self.btn_getHstem = QtGui.QPushButton('Get &H Stems')

        self.spb_compV = QtGui.QDoubleSpinBox()
        self.spb_compH = QtGui.QDoubleSpinBox()
        self.spb_compV.setValue(0.)
        self.spb_compH.setValue(0.)
        self.spb_compV.setSingleStep(.01)
        self.spb_compH.setSingleStep(.01)

        self.cmb_0 = QtGui.QComboBox()
        self.cmb_1 = QtGui.QComboBox()

        self.chk_italic = QtGui.QPushButton('Italic')
        self.chk_single = QtGui.QPushButton('Anisotropic')
        self.chk_preview = QtGui.QPushButton('Live Preview')

        self.chk_single.setToolTip(
            'Active: Use X and Y sliders to control interpolation.')
        self.chk_single.setCheckable(True)
        self.chk_italic.setCheckable(True)
        self.chk_preview.setCheckable(True)

        self.chk_single.setChecked(False)
        self.chk_italic.setChecked(False)
        self.chk_preview.setChecked(False)

        self.addWidget(QtGui.QLabel('Glyph:'), 0, 0, 1, 1)
        self.addWidget(self.edt_glyphName, 0, 1, 1, 6)
        self.addWidget(self.btn_refresh, 0, 7, 1, 1)
        self.addWidget(QtGui.QLabel('Axis:'), 1, 0, 1, 1)
        self.addWidget(self.cmb_0, 1, 1, 1, 3)
        self.addWidget(self.cmb_1, 1, 4, 1, 3)
        self.addWidget(self.btn_set_axis, 1, 7, 1, 1)
        self.addWidget(QtGui.QLabel('V Stems:'), 2, 0, 1, 1)
        self.addWidget(self.edt_stemV0, 2, 1, 1, 3)
        self.addWidget(self.edt_stemV1, 2, 4, 1, 3)
        self.addWidget(self.btn_getVstem, 2, 7, 1, 1)
        self.addWidget(QtGui.QLabel('H Stems:'), 3, 0, 1, 1)
        self.addWidget(self.edt_stemH0, 3, 1, 1, 3)
        self.addWidget(self.edt_stemH1, 3, 4, 1, 3)
        self.addWidget(self.btn_getHstem, 3, 7, 1, 1)
        self.addWidget(QtGui.QLabel('Adj.V/H:'), 4, 0, 1, 1)
        self.addWidget(self.spb_compV, 4, 1, 1, 3)
        self.addWidget(self.spb_compH, 4, 4, 1, 3)
        self.addWidget(self.chk_italic, 4, 7, 1, 1)
        self.addWidget(QtGui.QLabel('Control:'), 5, 0, 1, 1)
        self.addWidget(self.chk_single, 5, 1, 1, 4)
        self.addWidget(self.chk_preview, 5, 5, 1, 3)
コード例 #2
0
ファイル: Node.py プロジェクト: twardoch/TypeRig
	def __init__(self):
		super(basicOps, self).__init__()
		
		# - Basic operations
		self.btn_insert = QtGui.QPushButton('&Insert')
		self.btn_remove = QtGui.QPushButton('&Remove')
		self.btn_mitre = QtGui.QPushButton('&Mitre')
		self.btn_knot = QtGui.QPushButton('&Overlap')
		self.btn_trapA = QtGui.QPushButton('&Trap')
		self.btn_rebuild = QtGui.QPushButton('Rebuil&d')
						
		self.btn_insert.setMinimumWidth(80)
		self.btn_remove.setMinimumWidth(80)
		self.btn_mitre.setMinimumWidth(80)
		self.btn_knot.setMinimumWidth(80)
		self.btn_trapA.setMinimumWidth(80)
		self.btn_rebuild.setMinimumWidth(80)

		self.btn_insert.setToolTip('Insert Node after Selection\nat given time T.')
		self.btn_remove.setToolTip('Remove Selected Nodes!\nFor proper curve node deletion\nalso select the associated handles!')
		self.btn_mitre.setToolTip('Mitre corner using size X.')
		self.btn_knot.setToolTip('Overlap corner using radius -X.')
		self.btn_trapA.setToolTip('Insert Angular (generic) Ink Trap at node selected')
		self.btn_rebuild.setToolTip('Rebuild corner from nodes selected.')
		
		self.btn_insert.clicked.connect(self.insertNode)
		self.btn_remove.clicked.connect(self.removeNode)
		self.btn_mitre.clicked.connect(lambda: self.cornerMitre(False))
		self.btn_knot.clicked.connect(lambda: self.cornerMitre(True))
		self.btn_trapA.clicked.connect(lambda: self.cornerTrap())
		self.btn_rebuild.clicked.connect(lambda: self.cornerRebuild())

		# - Edit fields
		self.edt_time = QtGui.QLineEdit('0.5')
		self.edt_radius = QtGui.QLineEdit('5')
		self.edt_trap = QtGui.QLineEdit('5, 30, 2')
		
		self.edt_time.setToolTip('Insertion Time.')
		self.edt_radius.setToolTip('Mitre size/Overlap or Round Radius.')
		self.edt_trap.setToolTip('Ink trap: Incision into glyphs flesh, Side depth, Trap size')

		# -- Build: Basic Ops
		self.addWidget(self.btn_insert, 	0, 0)
		self.addWidget(QtGui.QLabel('T:'), 	0, 1)
		self.addWidget(self.edt_time, 		0, 2)
		self.addWidget(self.btn_remove, 	0, 3)

		self.addWidget(self.btn_mitre,		1, 0)
		self.addWidget(QtGui.QLabel('X:'), 	1, 1)
		self.addWidget(self.edt_radius,		1, 2)
		self.addWidget(self.btn_knot,		1, 3)

		self.addWidget(self.btn_trapA,		2, 0)
		self.addWidget(QtGui.QLabel('P:'),	2, 1)
		self.addWidget(self.edt_trap,		2, 2)
		self.addWidget(self.btn_rebuild,		2, 3)
コード例 #3
0
ファイル: Node.py プロジェクト: twardoch/TypeRig
	def __init__(self, aux):
		super(advMovement, self).__init__()

		# - Init
		self.aux = aux
		self.methodList = ['Move', 'Simple Move', 'Interpolated Move', 'Slanted Grid Move', 'Slope walker']
		
		# - Methods
		self.cmb_methodSelector = QtGui.QComboBox()
		self.cmb_methodSelector.addItems(self.methodList)
		self.cmb_methodSelector.setToolTip('Select movement method')
		self.chk_percent = QtGui.QCheckBox('% of BBox')
		self.chk_percent.setToolTip('Interpret new positional coordinates as if they were scaled by percent given in (X,Y)\nEquivalent to affine scaling of selected nodes in respect to the Layers BoundingBox')
		
		# - Arrow buttons
		self.btn_up = QtGui.QPushButton('Up')
		self.btn_down = QtGui.QPushButton('Down')
		self.btn_left = QtGui.QPushButton('Left')
		self.btn_right = QtGui.QPushButton('Right')
		
		self.btn_up.setMinimumWidth(80)
		self.btn_down.setMinimumWidth(80)
		self.btn_left.setMinimumWidth(80)
		self.btn_right.setMinimumWidth(80)

		self.btn_up.clicked.connect(self.onUp)
		self.btn_down.clicked.connect(self.onDown)
		self.btn_left.clicked.connect(self.onLeft)
		self.btn_right.clicked.connect(self.onRight)
		self.chk_percent.clicked.connect(self.toggleInput)
		
		self.edt_offX = QtGui.QLineEdit('1.0')
		self.edt_offY = QtGui.QLineEdit('1.0')
		self.edt_offX.setToolTip('X offset')
		self.edt_offY.setToolTip('Y offset')

		# - Layout
		self.lay_btn = QtGui.QGridLayout()

		self.lay_btn.addWidget(self.cmb_methodSelector, 0, 0, 1, 5)
		self.lay_btn.addWidget(self.chk_percent, 		0, 5, 1, 1)
		self.lay_btn.addWidget(QtGui.QLabel('X:'), 		1, 0, 1, 1)
		self.lay_btn.addWidget(self.edt_offX, 			1, 1, 1, 1)
		self.lay_btn.addWidget(self.btn_up, 			1, 2, 1, 2)
		self.lay_btn.addWidget(QtGui.QLabel('Y:'), 		1, 4, 1, 1)
		self.lay_btn.addWidget(self.edt_offY, 			1, 5, 1, 1)
		self.lay_btn.addWidget(self.btn_left, 			2, 0, 1, 2)
		self.lay_btn.addWidget(self.btn_down, 			2, 2, 1, 2)
		self.lay_btn.addWidget(self.btn_right, 			2, 4, 1, 2)

		self.addLayout(self.lay_btn)
コード例 #4
0
ファイル: Node.py プロジェクト: twardoch/TypeRig
	def __init__(self):
		super(breakContour, self).__init__()
			 
		# -- Split button
		self.btn_splitContour = QtGui.QPushButton('&Break')
		self.btn_splitContourClose = QtGui.QPushButton('&Break && Close')
		
		self.btn_splitContour.clicked.connect(self.splitContour)
		self.btn_splitContourClose.clicked.connect(self.splitContourClose)
		
		self.btn_splitContour.setMinimumWidth(80)
		self.btn_splitContourClose.setMinimumWidth(80)

		self.btn_splitContour.setToolTip('Break contour at selected Node(s).')
		self.btn_splitContourClose.setToolTip('Break contour and close open contours!\nUseful for cutting stems and etc.')

		# -- Extrapolate value
		self.edt_expand = QtGui.QLineEdit('0.0')
		#self.edt_expand.setMinimumWidth(30)

		self.edt_expand.setToolTip('Extrapolate endings.')
								
		# -- Build: Split/Break contour
		self.addWidget(self.btn_splitContour, 0, 0)
		self.addWidget(QtGui.QLabel('E:'), 0, 1)
		self.addWidget(self.edt_expand, 0, 2)
		self.addWidget(self.btn_splitContourClose, 0, 3)
コード例 #5
0
ファイル: Layer.py プロジェクト: twardoch/TypeRig
    def __init__(self):
        super(QlayerSelect, self).__init__()

        # - Init

        # -- Head
        self.lay_head = QtGui.QHBoxLayout()
        self.edt_glyphName = QtGui.QLineEdit()
        self.btn_refresh = QtGui.QPushButton('&Refresh')
        self.btn_refresh.clicked.connect(self.refresh)

        self.lay_head.addWidget(QtGui.QLabel('G:'))
        self.lay_head.addWidget(self.edt_glyphName)
        self.lay_head.addWidget(self.btn_refresh)
        self.addLayout(self.lay_head)

        # -- Layer List
        self.lst_layers = QtGui.QListWidget()
        self.lst_layers.setAlternatingRowColors(True)
        self.lst_layers.setMinimumHeight(100)
        #self.lst_layers.setMaximumHeight(100)
        self.lst_layers.setSelectionMode(
            QtGui.QAbstractItemView.ExtendedSelection
        )  # Select multiple items call .selectedItems() to get a QList
        self.addWidget(self.lst_layers)
        self.refresh()
コード例 #6
0
ファイル: Element.py プロジェクト: twardoch/TypeRig
    def __init__(self):
        super(shapeMovement, self).__init__()

        # - Init
        self.methodList = ['Shift', 'Scale', 'Shear']

        # - Methods
        self.cmb_methodSelector = QtGui.QComboBox()
        self.cmb_methodSelector.addItems(self.methodList)
        self.cmb_methodSelector.setToolTip('Select transformation method')

        # - Arrow buttons
        self.btn_up = QtGui.QPushButton('Up')
        self.btn_down = QtGui.QPushButton('Down')
        self.btn_left = QtGui.QPushButton('Left')
        self.btn_right = QtGui.QPushButton('Right')

        self.btn_up.setMinimumWidth(80)
        self.btn_down.setMinimumWidth(80)
        self.btn_left.setMinimumWidth(80)
        self.btn_right.setMinimumWidth(80)

        self.btn_up.clicked.connect(self.onUp)
        self.btn_down.clicked.connect(self.onDown)
        self.btn_left.clicked.connect(self.onLeft)
        self.btn_right.clicked.connect(self.onRight)

        self.edt_offX = QtGui.QLineEdit('1.0')
        self.edt_offY = QtGui.QLineEdit('1.0')
        self.edt_offX.setToolTip('X offset')
        self.edt_offY.setToolTip('Y offset')

        # - Layout
        self.lay_btn = QtGui.QGridLayout()

        self.lay_btn.addWidget(self.cmb_methodSelector, 0, 0, 1, 6)
        self.lay_btn.addWidget(QtGui.QLabel('X:'), 1, 0, 1, 1)
        self.lay_btn.addWidget(self.edt_offX, 1, 1, 1, 1)
        self.lay_btn.addWidget(self.btn_up, 1, 2, 1, 2)
        self.lay_btn.addWidget(QtGui.QLabel('Y:'), 1, 4, 1, 1)
        self.lay_btn.addWidget(self.edt_offY, 1, 5, 1, 1)
        self.lay_btn.addWidget(self.btn_left, 2, 0, 1, 2)
        self.lay_btn.addWidget(self.btn_down, 2, 2, 1, 2)
        self.lay_btn.addWidget(self.btn_right, 2, 4, 1, 2)

        self.addLayout(self.lay_btn)
コード例 #7
0
ファイル: Layer.py プロジェクト: twardoch/TypeRig
    def __init__(self, aux):
        super(QlayerBlend, self).__init__()

        # - Init
        self.aux = aux
        self.currentTime = .0
        self.timeStep = .01

        # - Interface
        # -- Blend active layer to single selected layer
        self.lay_blend = QtGui.QHBoxLayout()
        self.btn_minus = QtGui.QPushButton(' - ')
        self.btn_plus = QtGui.QPushButton(' + ')
        self.btn_minus.setMinimumWidth(75)
        self.btn_plus.setMinimumWidth(75)
        self.btn_minus.clicked.connect(self.blendMinus)
        self.btn_plus.clicked.connect(self.blendPlus)

        self.edt_timeStep = QtGui.QLineEdit()
        self.edt_timeStep.setText(self.timeStep)

        self.btn_minus.setToolTip(
            'Blend Active Layer to selected Layer.\nOriginal Active layer is lost!'
        )
        self.btn_plus.setToolTip(
            'Blend Active Layer to selected Layer.\nOriginal Active layer is lost!'
        )
        self.edt_timeStep.setToolTip('Blend time (0.0 - 1.0) Step.')

        self.lay_blend.addWidget(self.btn_minus)
        self.lay_blend.addWidget(QtGui.QLabel('T:'))
        self.lay_blend.addWidget(self.edt_timeStep)
        self.lay_blend.addWidget(self.btn_plus)

        self.addLayout(self.lay_blend)

        # -- Build Axis from current selected layers and send result to active layer

        self.lay_opt = QtGui.QHBoxLayout()
        self.chk_multi = QtGui.QCheckBox('Use Selected Layers as Axis')
        self.chk_multi.stateChanged.connect(self.setCurrentTime)
        self.chk_width = QtGui.QCheckBox('Fixed Width')

        self.chk_multi.setToolTip(
            'Blend selected layers to Active layer.\nUSAGE:\n- Create blank new layer;\n- Select two layers to build Interpolation Axis;\n- Use [+][-] to blend along axis.\nNote:\n- Selection order is important!\n- Checking/unchecking resets the blend position!'
        )
        self.chk_width.setToolTip('Keep current Advance Width')

        self.lay_opt.addWidget(self.chk_multi)
        self.lay_opt.addWidget(self.chk_width)

        self.addLayout(self.lay_opt)
コード例 #8
0
ファイル: Guide.py プロジェクト: twardoch/TypeRig
    def __init__(self):
        super(QGlyphTag, self).__init__()

        # - Widget & Layout
        self.edt_tagString = GLineEdit()
        self.edt_tagString.setPlaceholderText('Glyph tags')
        self.edt_tagString.setToolTip('A comma separated list of tags.')

        self.edt_tagStringNode = QtGui.QLineEdit()
        self.edt_tagStringNode.setPlaceholderText('Node name')
        self.edt_tagStringNode.setToolTip('A single node name.')

        self.btn_tagGlyph = QtGui.QPushButton('Glyph')
        self.btn_tagWindow = QtGui.QPushButton('Window')
        self.btn_tagSelection = QtGui.QPushButton('Selection')

        self.btn_tagNodes = QtGui.QPushButton('Glyph')
        self.btn_tagWindowNodes = QtGui.QPushButton('Window')
        self.btn_tagNodesClear = QtGui.QPushButton('Clear')

        self.btn_tagGlyph.clicked.connect(lambda: self.tag_glyphs('G'))
        self.btn_tagWindow.clicked.connect(lambda: self.tag_glyphs('W'))
        self.btn_tagSelection.clicked.connect(lambda: self.tag_glyphs('S'))
        self.btn_tagNodes.clicked.connect(lambda: self.tag_nodes('G'))
        self.btn_tagWindowNodes.clicked.connect(lambda: self.tag_nodes('W'))
        self.btn_tagNodesClear.clicked.connect(
            lambda: self.edt_tagStringNode.clear())

        self.btn_tagGlyph.setToolTip('Add tags to current glyph.')
        self.btn_tagWindow.setToolTip(
            'Add tags to all glyphs in current Glyph window.')
        self.btn_tagSelection.setToolTip(
            'Add tags to current selection in Font window.')
        self.btn_tagNodes.setToolTip(
            'Add name selected nodes at current glyph.')
        self.btn_tagWindowNodes.setToolTip(
            'Add name to selected nodes at all glyphs in current Glyph window.'
        )
        self.btn_tagNodesClear.setToolTip('Clear/Reset input filed.')

        # - Build
        self.addWidget(QtGui.QLabel('Glyph tagging:'), 1, 0, 1, 9)
        self.addWidget(self.edt_tagString, 2, 0, 1, 9)
        self.addWidget(self.btn_tagGlyph, 3, 0, 1, 3)
        self.addWidget(self.btn_tagWindow, 3, 3, 1, 3)
        self.addWidget(self.btn_tagSelection, 3, 6, 1, 3)
        self.addWidget(QtGui.QLabel('Node naming:'), 4, 0, 1, 9)
        self.addWidget(self.edt_tagStringNode, 5, 0, 1, 9)
        self.addWidget(self.btn_tagNodes, 6, 0, 1, 3)
        self.addWidget(self.btn_tagWindowNodes, 6, 3, 1, 3)
        self.addWidget(self.btn_tagNodesClear, 6, 6, 1, 3)
コード例 #9
0
ファイル: Outline.py プロジェクト: twardoch/TypeRig
    def __init__(self):
        super(QContourSelect, self).__init__()

        # -- Init
        self.table_dict = {0: {0: None}}  # Empty table
        self.layer_names = []  # Empty layer list
        #self.table_columns = 'N,Shape,Contour,X,Y,Type,Relative'.split(',')
        self.table_columns = 'N,Sh,Cn,X,Y,Type,Rel'.split(',')

        # -- Widgets
        self.lay_head = QtGui.QGridLayout()

        self.edt_glyphName = QtGui.QLineEdit()
        self.cmb_layer = QtGui.QComboBox()

        self.btn_refresh = QtGui.QPushButton('&Refresh')
        self.btn_apply = QtGui.QPushButton('&Apply')
        self.btn_apply.setEnabled(False)

        # -- Build Layout
        self.lay_head.addWidget(QtGui.QLabel('G:'), 0, 0, 1, 1)
        self.lay_head.addWidget(self.edt_glyphName, 0, 1, 1, 5)
        self.lay_head.addWidget(self.btn_refresh, 0, 6, 1, 2)
        self.lay_head.addWidget(QtGui.QLabel('L:'), 1, 0, 1, 1)
        self.lay_head.addWidget(self.cmb_layer, 1, 1, 1, 5)
        self.lay_head.addWidget(self.btn_apply, 1, 6, 1, 2)
        self.addLayout(self.lay_head)

        # -- Node List Table
        self.tab_nodes = trTableView(self.table_dict)

        self.addWidget(self.tab_nodes)
        self.refresh()  # Build Table

        self.btn_refresh.clicked.connect(lambda: self.refresh())
        self.cmb_layer.currentIndexChanged.connect(lambda: self.changeLayer())

        # -- Table Styling
        self.tab_nodes.horizontalHeader().setStretchLastSection(False)
        self.tab_nodes.setSortingEnabled(True)
        self.tab_nodes.horizontalHeader().sortIndicatorChanged.connect(
            lambda: self.tab_nodes.resizeColumnsToContents())
        self.tab_nodes.verticalHeader().hide()
        self.tab_nodes.resizeColumnsToContents()
        self.tab_nodes.selectionModel().selectionChanged.connect(
            self.selectionChanged)
        self.tab_nodes.itemChanged.connect(self.valueChanged)
コード例 #10
0
ファイル: Layer.py プロジェクト: twardoch/TypeRig
    def __init__(self, aux):
        super(QlayerBasic, self).__init__()

        # - Init
        self.aux = aux

        # -- Basic Tool buttons
        self.lay_buttons = QtGui.QGridLayout()
        self.btn_add = QtGui.QPushButton('Add')
        self.btn_del = QtGui.QPushButton('Remove')
        self.btn_dup = QtGui.QPushButton('Duplicate')
        self.btn_setServ = QtGui.QPushButton('Service')
        self.btn_setMask = QtGui.QPushButton('Mask')
        self.btn_setWire = QtGui.QPushButton('Wireframe')
        #self.btn_dup.setEnabled(False)

        self.btn_add.setToolTip('Add new layer with name')
        self.btn_dup.setToolTip('Duplicate selected with suffix')
        self.btn_del.setToolTip('Delete selected layers')
        self.btn_setServ.setToolTip('Set selected layers as Service')
        self.btn_setWire.setToolTip('Set selected layers as Wireframe')

        self.edt_name = QtGui.QLineEdit('New')
        self.edt_name.setToolTip('Name or suffix')

        self.btn_add.clicked.connect(self.addLayer)
        self.btn_dup.clicked.connect(self.duplicateLayers)
        self.btn_del.clicked.connect(self.deleteLayers)
        self.btn_setMask.clicked.connect(self.addMaskLayers)

        self.btn_setServ.clicked.connect(lambda: self.setLayer('Service'))
        self.btn_setWire.clicked.connect(lambda: self.setLayer('Wireframe'))

        self.lay_buttons.addWidget(QtGui.QLabel('Suffix/Name:'), 0, 0, 1, 1)
        self.lay_buttons.addWidget(self.edt_name, 0, 1, 1, 2)
        self.lay_buttons.addWidget(self.btn_add, 1, 0, 1, 1)
        self.lay_buttons.addWidget(self.btn_del, 1, 1, 1, 1)
        self.lay_buttons.addWidget(self.btn_dup, 1, 2, 1, 1)
        self.lay_buttons.addWidget(self.btn_setServ, 2, 0, 1, 1)
        self.lay_buttons.addWidget(self.btn_setMask, 2, 1, 1, 1)
        self.lay_buttons.addWidget(self.btn_setWire, 2, 2, 1, 1)

        self.addLayout(self.lay_buttons)
コード例 #11
0
ファイル: Mixer.py プロジェクト: twardoch/TypeRig
    def __init__(self):
        super(mixerTail, self).__init__()

        self.edt_width_0 = QtGui.QLineEdit()
        self.edt_width_1 = QtGui.QLineEdit()
        self.edt_width_t = QtGui.QLineEdit()
        self.edt_height_0 = QtGui.QLineEdit()
        self.edt_height_1 = QtGui.QLineEdit()
        self.edt_height_t = QtGui.QLineEdit()

        self.edt_width_0.setReadOnly(True)
        self.edt_width_1.setReadOnly(True)
        self.edt_width_t.setReadOnly(True)
        self.edt_height_0.setReadOnly(True)
        self.edt_height_1.setReadOnly(True)
        self.edt_height_t.setReadOnly(True)

        self.edt_width_0.setPlaceholderText('BBox width')
        self.edt_width_1.setPlaceholderText('BBox width')
        self.edt_width_t.setPlaceholderText('BBox width')
        self.edt_height_0.setPlaceholderText('BBox height')
        self.edt_height_1.setPlaceholderText('BBox height')
        self.edt_height_t.setPlaceholderText('BBox height')

        self.addWidget(QtGui.QLabel(''), 0, 0, 1, 1)
        self.addWidget(QtGui.QLabel('Master 0'), 0, 1, 1, 3)
        self.addWidget(QtGui.QLabel('Master 1'), 0, 4, 1, 3)
        self.addWidget(QtGui.QLabel('Result'), 0, 7, 1, 1)
        self.addWidget(QtGui.QLabel('Width:'), 1, 0, 1, 1)
        self.addWidget(self.edt_width_0, 1, 1, 1, 3)
        self.addWidget(self.edt_width_1, 1, 4, 1, 3)
        self.addWidget(self.edt_width_t, 1, 7, 1, 1)
        self.addWidget(QtGui.QLabel('Height'), 2, 0, 1, 1)
        self.addWidget(self.edt_height_0, 2, 1, 1, 3)
        self.addWidget(self.edt_height_1, 2, 4, 1, 3)
        self.addWidget(self.edt_height_t, 2, 7, 1, 1)
コード例 #12
0
    def __init__(self, aux):
        super(QanchorBasic, self).__init__()

        # - Init
        self.aux = aux
        self.types = 'Anchor PinPoint'.split(' ')
        self.posY = 'Exact,Shift,Above,Below,Center,Baseline'.split(',')
        self.posX = 'Exact,Shift,Left,Right,Center,Highest,Highest Left,Highest Right,Lowest,Lowest Left,Lowest Right'.split(
            ',')
        posYvals = (None, 'S', 'T', 'B', 'C', None)
        posXvals = (None, 'S', 'L', 'R', 'C', 'AT', 'ATL', 'ATR', 'A', 'AL',
                    'AR')
        self.posYctrl = dict(zip(self.posY, posYvals))
        self.posXctrl = dict(zip(self.posX, posXvals))

        # -- Basic Tool buttons
        self.lay_grid = QtGui.QGridLayout()
        self.btn_anchorCopy = QtGui.QPushButton('Copy')
        self.btn_anchorPaste = QtGui.QPushButton('Paste')
        self.btn_clearSel = QtGui.QPushButton('Clear Selected')
        self.btn_clearAll = QtGui.QPushButton('Clear All')
        self.btn_anchorAdd = QtGui.QPushButton('Add')
        self.btn_anchorMov = QtGui.QPushButton('Move')
        self.chk_italic = QtGui.QCheckBox('Use Italic Angle')

        # -- Edit fields
        self.edt_anchorName = ALineEdit()
        self.edt_simpleX = QtGui.QLineEdit()
        self.edt_simpleY = QtGui.QLineEdit()
        self.edt_autoT = QtGui.QLineEdit()

        self.edt_simpleX.setToolTip(
            'Layer Order: ' +
            ', '.join(self.aux.wLayers))  # helper for layer order
        self.edt_simpleY.setToolTip(
            'Layer Order: ' +
            ', '.join(self.aux.wLayers))  # helper for layer order
        self.btn_anchorCopy.setToolTip(
            'Copy selected Anchors from layers choosen.')
        self.btn_anchorPaste.setToolTip('Paste Anchors at layers choosen.')

        self.edt_anchorName.setPlaceholderText('New Anchor')
        self.edt_simpleX.setText('0')
        self.edt_simpleY.setText('0')
        self.edt_autoT.setText('5')

        # -- Combo box
        self.cmb_posX = QtGui.QComboBox()
        self.cmb_posY = QtGui.QComboBox()
        self.cmb_type = QtGui.QComboBox()

        self.cmb_posX.addItems(self.posX)
        self.cmb_posY.addItems(self.posY)
        self.cmb_type.addItems(self.types)
        self.cmb_type.setEnabled(False)

        # -- Constrains
        self.btn_clearSel.setMinimumWidth(90)
        self.btn_clearAll.setMinimumWidth(90)
        self.edt_anchorName.setMinimumWidth(50)
        self.edt_simpleX.setMinimumWidth(30)
        self.edt_simpleY.setMinimumWidth(30)

        # -- Link functions
        self.btn_clearAll.clicked.connect(lambda: self.clearAnchors(True))
        self.btn_clearSel.clicked.connect(lambda: self.clearAnchors(False))
        self.btn_anchorAdd.clicked.connect(lambda: self.addAnchors(False))
        self.btn_anchorMov.clicked.connect(lambda: self.addAnchors(True))
        self.btn_anchorCopy.clicked.connect(lambda: self.copyAnchors(False))
        self.btn_anchorPaste.clicked.connect(lambda: self.copyAnchors(True))

        # - Build layout
        self.lay_grid.addWidget(QtGui.QLabel('Anchor actions:'), 0, 0, 1, 4)
        self.lay_grid.addWidget(self.btn_anchorCopy, 1, 0, 1, 4)
        self.lay_grid.addWidget(self.btn_anchorPaste, 1, 4, 1, 4)
        self.lay_grid.addWidget(self.btn_clearSel, 2, 0, 1, 4)
        self.lay_grid.addWidget(self.btn_clearAll, 2, 4, 1, 4)
        self.lay_grid.addWidget(QtGui.QLabel('Add/move anchor:'), 3, 0, 1, 4)
        self.lay_grid.addWidget(QtGui.QLabel('N:'), 4, 0, 1, 1)
        self.lay_grid.addWidget(self.edt_anchorName, 4, 1, 1, 3)
        self.lay_grid.addWidget(self.cmb_type, 4, 4, 1, 4)
        self.lay_grid.addWidget(QtGui.QLabel('X:'), 5, 0, 1, 1)
        self.lay_grid.addWidget(self.cmb_posX, 5, 1, 1, 3)
        self.lay_grid.addWidget(self.edt_simpleX, 5, 4, 1, 4)
        self.lay_grid.addWidget(QtGui.QLabel('Y:'), 6, 0, 1, 1)
        self.lay_grid.addWidget(self.cmb_posY, 6, 1, 1, 3)
        self.lay_grid.addWidget(self.edt_simpleY, 6, 4, 1, 4)
        self.lay_grid.addWidget(QtGui.QLabel('Tolerance:'), 7, 1, 1, 2)
        self.lay_grid.addWidget(self.edt_autoT, 7, 3, 1, 1)
        self.lay_grid.addWidget(self.chk_italic, 7, 4, 1, 1)
        self.lay_grid.addWidget(self.btn_anchorAdd, 8, 0, 1, 4)
        self.lay_grid.addWidget(self.btn_anchorMov, 8, 4, 1, 4)

        # - Build
        self.addLayout(self.lay_grid)
コード例 #13
0
ファイル: Guide.py プロジェクト: twardoch/TypeRig
    def __init__(self):
        super(QDropGuide, self).__init__()

        # -- Editi fileds
        self.edt_guideName = QtGui.QLineEdit()
        self.edt_guideName.setPlaceholderText('New Guideline')

        self.edt_guideTag = GLineEdit()
        self.edt_guideTag.setPlaceholderText('Tag')

        # -- Combo box
        self.cmb_select_V = QtGui.QComboBox()
        self.cmb_select_H = QtGui.QComboBox()
        self.cmb_select_color = QtGui.QComboBox()

        self.cmb_select_V.addItems(['BBox width', 'Adv. width'])
        self.cmb_select_H.addItems([
            'BBox height', 'X-Height', 'Caps Height', 'Ascender', 'Descender',
            'Adv. height'
        ])

        colorNames = QtGui.QColor.colorNames()
        for i in range(len(colorNames)):
            self.cmb_select_color.addItem(colorNames[i])
            self.cmb_select_color.setItemData(i, QtGui.QColor(colorNames[i]),
                                              QtCore.Qt.DecorationRole)

        self.cmb_select_color.setCurrentIndex(colorNames.index('red'))

        self.cmb_select_color.setMinimumWidth(40)
        self.edt_guideName.setMinimumWidth(40)
        self.edt_guideTag.setMinimumWidth(40)

        # -- SpinBox
        self.spb_prc_V = QtGui.QSpinBox()
        self.spb_prc_V.setMaximum(100)
        self.spb_prc_V.setSuffix('%')
        self.spb_prc_V.setMinimumWidth(45)

        self.spb_prc_H = QtGui.QSpinBox()
        self.spb_prc_H.setMaximum(100)
        self.spb_prc_H.setSuffix('%')
        self.spb_prc_H.setMinimumWidth(45)

        self.spb_unit_V = QtGui.QSpinBox()
        self.spb_unit_V.setMaximum(100)
        self.spb_unit_V.setMinimum(-100)
        self.spb_unit_V.setSuffix(' U')
        self.spb_unit_V.setMinimumWidth(45)

        self.spb_unit_H = QtGui.QSpinBox()
        self.spb_unit_H.setMaximum(100)
        self.spb_unit_H.setMinimum(-100)
        self.spb_unit_H.setSuffix(' U')
        self.spb_unit_H.setMinimumWidth(45)

        # -- Button
        self.btn_dropGuide = QtGui.QPushButton('&Drop')
        self.btn_dropFlipX = QtGui.QPushButton('Drop: Flip &X')
        self.btn_dropFlipY = QtGui.QPushButton('Drop: Flip &Y')
        self.btn_dropLayer_V = QtGui.QPushButton('Vertical')
        self.btn_dropLayer_H = QtGui.QPushButton('Horizontal')

        self.btn_dropGuide.setToolTip(
            'Drop guideline between any two selected nodes.\nIf single node is selected a vertical guide is\ndropped (using the italic angle if present).'
        )
        self.btn_dropFlipX.setToolTip(
            'Drop flipped guideline between any two selected nodes.')
        self.btn_dropFlipY.setToolTip(
            'Drop flipped guideline between any two selected nodes.')

        self.btn_dropGuide.clicked.connect(lambda: self.drop_guide_nodes(
            (1, 1)))
        self.btn_dropFlipX.clicked.connect(lambda: self.drop_guide_nodes(
            (-1, 1)))
        self.btn_dropFlipY.clicked.connect(lambda: self.drop_guide_nodes(
            (1, -1)))
        self.btn_dropLayer_V.clicked.connect(self.drop_guide_V)
        self.btn_dropLayer_H.clicked.connect(self.drop_guide_H)

        # - Build
        self.addWidget(QtGui.QLabel('Name:'), 1, 0, 1, 4)
        self.addWidget(QtGui.QLabel('Tag:'), 1, 4, 1, 4)
        self.addWidget(QtGui.QLabel('Color:'), 1, 8, 1, 4)
        self.addWidget(self.edt_guideName, 2, 0, 1, 4)
        self.addWidget(self.cmb_select_color, 2, 8, 1, 4)
        self.addWidget(self.edt_guideTag, 2, 4, 1, 4)
        self.addWidget(QtGui.QLabel('Selected Nodes:'), 3, 0, 1, 9)
        self.addWidget(self.btn_dropGuide, 4, 0, 1, 4)
        self.addWidget(self.btn_dropFlipX, 4, 4, 1, 4)
        self.addWidget(self.btn_dropFlipY, 4, 8, 1, 4)
        self.addWidget(QtGui.QLabel('Glyph Layer:'), 5, 0, 1, 9)
        self.addWidget(self.cmb_select_V, 6, 0, 1, 4)
        self.addWidget(self.spb_prc_V, 6, 4, 1, 2)
        self.addWidget(self.spb_unit_V, 6, 6, 1, 2)
        self.addWidget(self.btn_dropLayer_V, 6, 8, 1, 4)
        self.addWidget(self.cmb_select_H, 7, 0, 1, 4)
        self.addWidget(self.spb_prc_H, 7, 4, 1, 2)
        self.addWidget(self.spb_unit_H, 7, 6, 1, 2)
        self.addWidget(self.btn_dropLayer_H, 7, 8, 1, 4)
コード例 #14
0
	def __init__(self, parentWidget):
		super(WFontZones, self).__init__()

		# - Init
		self.grid = QtGui.QGridLayout()
		self.upperWidget = parentWidget
		self.activeFont = pFont()
		self.zoneData = {master:self.activeFont.zonesToTuples(master) for master in self.activeFont.masters()}

		# - Interface
		self.btn_apply = QtGui.QPushButton('Apply Changes')
		self.btn_reset = QtGui.QPushButton('Reset')
		self.btn_open = QtGui.QPushButton('Open')
		self.btn_save = QtGui.QPushButton('Save')
		self.btn_new = QtGui.QPushButton('Add New')
		self.btn_del = QtGui.QPushButton('Delete')

		self.cmb_layer = QtGui.QComboBox()
		self.cmb_layer.addItems(['All Layers'] + self.activeFont.masters())

		self.edt_pos = ZLineEdit()
		self.edt_width = QtGui.QLineEdit()
		self.edt_pos.setPlaceholderText('Position')
		self.edt_width.setPlaceholderText('Width')

		self.btn_apply.clicked.connect(self.applyChanges)
		self.btn_reset.clicked.connect(self.resetChanges)
		self.btn_save.clicked.connect(self.exportZones)
		self.btn_open.clicked.connect(self.importZones)
		self.btn_new.clicked.connect(self.addZone)
		self.btn_del.clicked.connect(self.delZone)

		self.tree_fontZones = WTreeWidget(self.zoneData)

		# - Build
		lbl_name = QtGui.QLabel('Font Zones (Local)')
		lbl_name.setMaximumHeight(20)
		self.grid.addWidget(lbl_name, 			0, 0, 	1, 24)
		self.grid.addWidget(self.tree_fontZones,1, 0, 	6, 18)
		
		self.grid.addWidget(self.cmb_layer,		1, 18, 	1, 3)
		self.grid.addWidget(self.edt_pos,		2, 18, 	1, 3)
		self.grid.addWidget(self.edt_width,		3, 18, 	1, 3)
		self.grid.addWidget(self.btn_new,		4, 18, 	1, 3)
		self.grid.addWidget(self.btn_del,		5, 18, 	1, 3)

		self.grid.addWidget(self.btn_save,		1, 21, 	1, 3)
		self.grid.addWidget(self.btn_open,		2, 21, 	1, 3)
		self.grid.addWidget(self.btn_reset,		4, 21, 	1, 3)
		self.grid.addWidget(self.btn_apply,		5, 21, 	1, 3)
		
		'''
		self.grid.setRowStretch(0,0)		
		for i in range(1,6):
			self.grid.setRowStretch(i,6)

		self.grid.setColumnStretch(0,18)
		self.grid.setColumnStretch(18,3)
		self.grid.setColumnStretch(21,3)
		'''

		self.setLayout(self.grid)
コード例 #15
0
ファイル: String.py プロジェクト: twardoch/TypeRig
    def __init__(self):
        super(QStringGen, self).__init__()

        # - Init data
        val_fillerLeft, val_fillerRight = zip(*fillerList)
        self.defEncoding = 'utf-8'
        self.glyphNames = baseGlyphset

        # -- Init Interface
        self.edt_inputA = QtGui.QLineEdit()
        self.edt_inputB = QtGui.QLineEdit()
        self.edt_suffixA = QtGui.QLineEdit()
        self.edt_suffixB = QtGui.QLineEdit()

        self.edt_output = QtGui.QTextEdit()
        self.edt_sep = QtGui.QLineEdit()

        self.edt_inputA.setToolTip(
            'Manual Glyph names input. [SPACE] delimited.\nNOTE: This field overrides the input combo box!'
        )
        self.edt_inputB.setToolTip(
            'Manual Glyph names input. [SPACE] delimited.\nNOTE: This field overrides the input combo box!'
        )
        self.edt_suffixA.setToolTip('Suffix to be added to each glyph name.')
        self.edt_suffixB.setToolTip('Suffix to be added to each glyph name.')

        self.edt_sep.setText('/')

        #self.edt_inputA.setEnabled(False)
        #self.edt_inputB.setEnabled(False)

        self.cmb_fillerPattern = QtGui.QComboBox()
        self.cmb_inputA = QtGui.QComboBox()
        self.cmb_inputB = QtGui.QComboBox()
        self.cmb_fillerLeft = QtGui.QComboBox()
        self.cmb_fillerRight = QtGui.QComboBox()
        self.cmb_join = QtGui.QComboBox()

        self.cmb_inputA.addItems(sorted(self.glyphNames.keys()))
        self.cmb_inputB.addItems(sorted(self.glyphNames.keys()))

        self.cmb_fillerPattern.setEditable(True)
        self.cmb_fillerLeft.setEditable(True)
        self.cmb_fillerRight.setEditable(True)

        self.cmb_join.addItems(joinOpt.keys())
        self.cmb_fillerPattern.addItems(filler_patterns)

        self.cmb_inputA.setToolTip('Glyph names list.')
        self.cmb_inputB.setToolTip('Glyph names list.')
        self.cmb_fillerLeft.setToolTip('Left Filler String.')
        self.cmb_fillerRight.setToolTip('Right Filler String.')
        self.cmb_join.setToolTip('Joining method for generated string pairs.')
        self.edt_sep.setToolTip('Glyph Separator.')
        self.cmb_fillerPattern.setToolTip(
            'Generator pattern expression.\n<< Filed names >> in any order, [SPACE] separated.'
        )

        self.cmb_fillerLeft.addItems(val_fillerLeft)
        self.cmb_fillerRight.addItems(val_fillerRight)

        self.btn_genCopy = QtGui.QPushButton('Generate')
        self.btn_genUni = QtGui.QPushButton('Unicode Str.')
        self.btn_populate = QtGui.QPushButton('&Populate lists')
        self.btn_clear = QtGui.QPushButton('&Rest fields')
        self.btn_glyphNames = QtGui.QPushButton('Get Selected Names')

        self.btn_genCopy.setToolTip(
            'Generate the pair string using Glyph Names and send it to the clipboard.'
        )
        self.btn_genUni.setToolTip(
            'Generate the pair string using Unicode Characters and send it to the clipboard.'
        )
        self.btn_populate.setToolTip(
            'Populate name lists with existing glyph names in active font.')
        self.btn_clear.setToolTip('Clear all manual input fields.')
        self.btn_glyphNames.setToolTip(
            'Get Names of currently selected glyphs.')

        self.btn_clear.clicked.connect(self.clear)
        self.btn_populate.clicked.connect(self.populate)
        self.btn_genCopy.clicked.connect(self.generate)
        self.btn_genUni.clicked.connect(self.generateUni)
        self.btn_glyphNames.clicked.connect(self.getNames)

        # - Build
        self.addWidget(QtGui.QLabel('A:'), 0, 0, 1, 1)
        self.addWidget(self.cmb_inputA, 0, 1, 1, 5)
        self.addWidget(QtGui.QLabel('Suffix:'), 0, 6, 1, 1)
        self.addWidget(self.edt_suffixA, 0, 7, 1, 2)
        self.addWidget(self.edt_inputA, 1, 1, 1, 8)
        self.addWidget(QtGui.QLabel('B:'), 2, 0, 1, 1)
        self.addWidget(self.cmb_inputB, 2, 1, 1, 5)
        self.addWidget(QtGui.QLabel('Suffix:'), 2, 6, 1, 1)
        self.addWidget(self.edt_suffixB, 2, 7, 1, 2)
        self.addWidget(self.edt_inputB, 3, 1, 1, 8)
        self.addWidget(QtGui.QLabel('FL:'), 4, 0, 1, 1)
        self.addWidget(self.cmb_fillerLeft, 4, 1, 1, 8)
        self.addWidget(QtGui.QLabel('FR:'), 5, 0, 1, 1)
        self.addWidget(self.cmb_fillerRight, 5, 1, 1, 8)
        self.addWidget(QtGui.QLabel('E:'), 6, 0, 1, 1)
        self.addWidget(self.cmb_fillerPattern, 6, 1, 1, 8)
        self.addWidget(QtGui.QLabel('Join:'), 7, 0, 1, 1)
        self.addWidget(self.cmb_join, 7, 1, 1, 5)
        self.addWidget(QtGui.QLabel('Sep.:'), 7, 6, 1, 1)
        self.addWidget(self.edt_sep, 7, 7, 1, 2)
        self.addWidget(QtGui.QLabel(''), 8, 0, 1, 1)
        self.addWidget(self.btn_populate, 9, 1, 1, 5)
        self.addWidget(self.btn_clear, 9, 6, 1, 3)
        self.addWidget(self.btn_genCopy, 10, 1, 1, 5)
        self.addWidget(self.btn_genUni, 10, 6, 1, 3)
        self.addWidget(QtGui.QLabel('OUT:'), 11, 0, 1, 1)
        self.addWidget(self.edt_output, 11, 1, 4, 8)
        self.addWidget(self.btn_glyphNames, 16, 1, 4, 8)

        self.setColumnStretch(0, 0)
        self.setColumnStretch(1, 2)
        self.setColumnStretch(6, 0)
        self.setColumnStretch(7, 1)
コード例 #16
0
ファイル: Corner.py プロジェクト: twardoch/TypeRig
	def __init__(self, parentWidget):
		super(QSmartCorner, self).__init__()
		self.upper_widget = parentWidget

		# -- Init
		self.active_font = pFont()
		self.builder = None
		self.font_masters = self.active_font.masters()
		self.empty_preset = lambda row: OrderedDict([(row, OrderedDict([('Preset', 'Preset %s' %row)] + [(master, '0') for master in self.font_masters]))])
		self.table_dict = self.empty_preset(0)
		self.last_preset = 0

		# -- Widgets
		self.lay_head = QtGui.QGridLayout()

		self.edt_glyphName = QtGui.QLineEdit()
		self.edt_glyphName.setPlaceholderText('Glyph name')

		# -- Buttons
		self.btn_getBuilder = QtGui.QPushButton('Set &Builder')
		self.btn_findBuilder = QtGui.QPushButton('&From Font')
		self.btn_addPreset = QtGui.QPushButton('Add')
		self.btn_delPreset = QtGui.QPushButton('Remove')
		self.btn_resetPreset = QtGui.QPushButton('Reset')
		self.btn_loadPreset = QtGui.QPushButton('&Load Presets')
		self.btn_savePreset = QtGui.QPushButton('&Save Presets')
		self.btn_apply_smartCorner = QtGui.QPushButton('&Apply Smart Corner')
		self.btn_remove_smartCorner = QtGui.QPushButton('R&emove Smart Corner')
		self.btn_remove_presetCorner = QtGui.QPushButton('&Find and Remove')

		self.btn_apply_smartCorner.setToolTip('Apply Smart Corner preset on SELECTED nodes.')
		self.btn_remove_smartCorner.setToolTip('Remove Smart Corner on SELECTED nodes.')
		self.btn_remove_presetCorner.setToolTip('Find and remove all Smart Corners that equal the currently selected preset.')


		self.btn_apply_round = QtGui.QPushButton('&Round')
		self.btn_apply_mitre = QtGui.QPushButton('&Mitre')
		self.btn_apply_overlap = QtGui.QPushButton('&Overlap')
		self.btn_apply_trap = QtGui.QPushButton('&Trap')
		self.btn_rebuild = QtGui.QPushButton('Rebuild corner')

		self.btn_getBuilder.setMinimumWidth(70)
		self.btn_findBuilder.setMinimumWidth(70)
		self.btn_apply_round.setMinimumWidth(70)
		self.btn_apply_mitre.setMinimumWidth(70)
		self.btn_apply_overlap.setMinimumWidth(70)
		self.btn_apply_trap.setMinimumWidth(70)
		self.btn_rebuild.setMinimumWidth(70)

		self.btn_addPreset.setMinimumWidth(70)
		self.btn_delPreset.setMinimumWidth(70)
		self.btn_loadPreset.setMinimumWidth(140)
		self.btn_savePreset.setMinimumWidth(140)
		self.btn_apply_smartCorner.setMinimumWidth(140)
		self.btn_remove_smartCorner.setMinimumWidth(140)
		self.btn_remove_presetCorner.setMinimumWidth(140)

		self.btn_getBuilder.setCheckable(True)
		self.btn_getBuilder.setChecked(False)
		self.btn_findBuilder.setEnabled(False)
		self.btn_apply_round.setEnabled(False)

		self.btn_getBuilder.clicked.connect(lambda: self.getBuilder())
		self.btn_addPreset.clicked.connect(lambda: self.preset_modify(False))
		self.btn_delPreset.clicked.connect(lambda: self.preset_modify(True))
		self.btn_resetPreset.clicked.connect(lambda: self.preset_reset())
		self.btn_loadPreset.clicked.connect(lambda: self.preset_load())
		self.btn_savePreset.clicked.connect(lambda: self.preset_save())

		self.btn_apply_smartCorner.clicked.connect(lambda: self.apply_SmartCorner(False))
		self.btn_remove_smartCorner.clicked.connect(lambda: self.apply_SmartCorner(True))
		self.btn_remove_presetCorner.clicked.connect(lambda: self.remove_SmartCorner())
		
		#self.btn_apply_round.clicked.connect(lambda: self.apply_round())
		self.btn_apply_mitre.clicked.connect(lambda: self.apply_mitre(False))
		self.btn_apply_overlap.clicked.connect(lambda: self.apply_mitre(True))
		self.btn_apply_trap.clicked.connect(lambda: self.apply_trap())
		self.btn_rebuild.clicked.connect(lambda: self.rebuild())

		# -- Preset Table
		self.tab_presets = trTableView(None)
		self.preset_reset()			

		# -- Build Layout
		self.lay_head.addWidget(QtGui.QLabel('Value Presets:'), 0,0,1,8)
		self.lay_head.addWidget(self.btn_loadPreset,			1,0,1,4)
		self.lay_head.addWidget(self.btn_savePreset,			1,4,1,4)
		self.lay_head.addWidget(self.btn_addPreset,				2,0,1,2)
		self.lay_head.addWidget(self.btn_delPreset,				2,2,1,2)
		self.lay_head.addWidget(self.btn_resetPreset,			2,4,1,4)
		self.lay_head.addWidget(self.tab_presets,				3,0,5,8)

		self.lay_head.addWidget(QtGui.QLabel('Corner Actions:'),10, 0, 1, 8)
		self.lay_head.addWidget(self.btn_apply_round,			11, 0, 1, 2)
		self.lay_head.addWidget(self.btn_apply_mitre,			11, 2, 1, 2)
		self.lay_head.addWidget(self.btn_apply_overlap,			11, 4, 1, 2)
		self.lay_head.addWidget(self.btn_apply_trap,			11, 6, 1, 2)
		self.lay_head.addWidget(self.btn_rebuild,				12, 0, 1, 8)

		self.lay_head.addWidget(QtGui.QLabel('Smart Corner:'),	13,0,1,8)
		self.lay_head.addWidget(QtGui.QLabel('Builder: '),		14,0,1,1)
		self.lay_head.addWidget(self.edt_glyphName,				14,1,1,3)
		self.lay_head.addWidget(self.btn_getBuilder,			14,4,1,2)
		self.lay_head.addWidget(self.btn_findBuilder,			14,6,1,2)
		self.lay_head.addWidget(self.btn_remove_smartCorner,	15,0,1,4)
		self.lay_head.addWidget(self.btn_remove_presetCorner,	15,4,1,4)
		self.lay_head.addWidget(self.btn_apply_smartCorner,		16,0,1,8)

		self.addLayout(self.lay_head)
コード例 #17
0
ファイル: Layer.py プロジェクト: twardoch/TypeRig
    def __init__(self, aux):
        super(QlayerMultiEdit, self).__init__()

        # - Init
        self.aux = aux
        self.backup = {}
        self.contourClipboard = {}

        # -- Edit fileds
        self.edt_shift = QtGui.QLineEdit('0.0, 0.0')
        self.edt_scale = QtGui.QLineEdit('100, 100')
        self.edt_slant = QtGui.QLineEdit('0.0')
        self.edt_rotate = QtGui.QLineEdit('0.0')

        self.edt_shift.setToolTip('Translate Layer by X, Y (comma separated)')
        self.edt_scale.setToolTip(
            'Scale Layer by X percent, Y percent(comma separated)')
        self.edt_slant.setToolTip('Slant/Shear degrees')
        self.edt_rotate.setToolTip('Rotate degrees')

        # -- Quick Tool buttons
        self.lay_buttons = QtGui.QGridLayout()
        self.btn_unfold = QtGui.QPushButton('Unfold Layers')
        self.btn_restore = QtGui.QPushButton('Fold Layers')
        self.btn_copy = QtGui.QPushButton('Copy Outline')
        self.btn_paste = QtGui.QPushButton('Paste Outline')
        self.btn_transform = QtGui.QPushButton('Transform Layer')
        self.btn_transform_shape = QtGui.QPushButton('Transform Elements')

        self.btn_restore.setEnabled(False)
        self.btn_paste.setEnabled(False)

        self.btn_unfold.setToolTip(
            'Reposition selected layers side by side. Selection order does matter!'
        )
        self.btn_restore.setToolTip('Restore Layer Metrics.')
        self.btn_copy.setToolTip(
            'Copy selected outline to cliboard for each of selected layers.')
        self.btn_paste.setToolTip(
            'Paste outline from cliboard layer by layer (by name). Non existing layers are discarded! New Element is created upon Paste!'
        )
        self.btn_transform.setToolTip('Affine transform selected layers')

        self.btn_unfold.clicked.connect(self.unfold)
        self.btn_restore.clicked.connect(self.restore)
        self.btn_copy.clicked.connect(self.copy)
        self.btn_paste.clicked.connect(self.paste)
        self.btn_transform.clicked.connect(lambda: self.transform(False))
        self.btn_transform_shape.clicked.connect(lambda: self.transform(True))

        self.lay_buttons.addWidget(self.btn_unfold, 0, 0, 1, 4)
        self.lay_buttons.addWidget(self.btn_restore, 0, 4, 1, 4)
        self.lay_buttons.addWidget(self.btn_copy, 1, 0, 1, 4)
        self.lay_buttons.addWidget(self.btn_paste, 1, 4, 1, 4)
        self.lay_buttons.addWidget(QtGui.QLabel('Translate:'), 2, 0, 1, 2)
        self.lay_buttons.addWidget(QtGui.QLabel('Scale:'), 2, 2, 1, 2)
        self.lay_buttons.addWidget(QtGui.QLabel('Shear:'), 2, 4, 1, 2)
        self.lay_buttons.addWidget(QtGui.QLabel('Rotate:'), 2, 6, 1, 2)
        self.lay_buttons.addWidget(self.edt_shift, 3, 0, 1, 2)
        self.lay_buttons.addWidget(self.edt_scale, 3, 2, 1, 2)
        self.lay_buttons.addWidget(self.edt_slant, 3, 4, 1, 2)
        self.lay_buttons.addWidget(self.edt_rotate, 3, 6, 1, 2)
        self.lay_buttons.addWidget(self.btn_transform, 4, 0, 1, 4)
        self.lay_buttons.addWidget(self.btn_transform_shape, 4, 4, 1, 4)

        self.addLayout(self.lay_buttons)
コード例 #18
0
ファイル: Metrics.py プロジェクト: twardoch/TypeRig
    def __init__(self):
        super(metrics_copy, self).__init__()

        # - Edit Fields
        self.edt_lsb = QtGui.QLineEdit()
        self.edt_adv = QtGui.QLineEdit()
        self.edt_rsb = QtGui.QLineEdit()

        self.edt_lsb.setPlaceholderText('Glyph Name')
        self.edt_adv.setPlaceholderText('Glyph Name')
        self.edt_rsb.setPlaceholderText('Glyph Name')

        # - Spin Box
        self.spb_lsb_percent = QtGui.QSpinBox()
        self.spb_adv_percent = QtGui.QSpinBox()
        self.spb_rsb_percent = QtGui.QSpinBox()
        self.spb_lsb_units = QtGui.QSpinBox()
        self.spb_adv_units = QtGui.QSpinBox()
        self.spb_rsb_units = QtGui.QSpinBox()

        self.spb_lsb_percent.setMaximum(200)
        self.spb_adv_percent.setMaximum(200)
        self.spb_rsb_percent.setMaximum(200)
        self.spb_lsb_units.setMaximum(200)
        self.spb_adv_units.setMaximum(200)
        self.spb_rsb_units.setMaximum(200)
        self.spb_lsb_units.setMinimum(-200)
        self.spb_adv_units.setMinimum(-200)
        self.spb_rsb_units.setMinimum(-200)

        self.spb_lsb_percent.setSuffix('%')
        self.spb_adv_percent.setSuffix('%')
        self.spb_rsb_percent.setSuffix('%')
        self.spb_lsb_units.setSuffix(' u')
        self.spb_adv_units.setSuffix(' u')
        self.spb_rsb_units.setSuffix(' u')

        self.spb_lsb_percent.setMaximumWidth(50)
        self.spb_adv_percent.setMaximumWidth(50)
        self.spb_rsb_percent.setMaximumWidth(50)
        self.spb_lsb_units.setMaximumWidth(50)
        self.spb_adv_units.setMaximumWidth(50)
        self.spb_rsb_units.setMaximumWidth(50)

        self.reset_fileds()

        # - Buttons
        self.btn_copyMetrics = QtGui.QPushButton('&Copy Metrics')
        self.btn_copyMetrics.clicked.connect(self.copyMetrics)

        # - Build

        self.addWidget(QtGui.QLabel('LSB:'), 0, 0, 1, 1)
        self.addWidget(self.edt_lsb, 0, 1, 1, 3)
        self.addWidget(QtGui.QLabel('@'), 0, 4, 1, 1)
        self.addWidget(self.spb_lsb_percent, 0, 5, 1, 1)
        self.addWidget(QtGui.QLabel('+'), 0, 6, 1, 1)
        self.addWidget(self.spb_lsb_units, 0, 7, 1, 1)

        self.addWidget(QtGui.QLabel('RSB:'), 1, 0, 1, 1)
        self.addWidget(self.edt_rsb, 1, 1, 1, 3)
        self.addWidget(QtGui.QLabel('@'), 1, 4, 1, 1)
        self.addWidget(self.spb_rsb_percent, 1, 5, 1, 1)
        self.addWidget(QtGui.QLabel('+'), 1, 6, 1, 1)
        self.addWidget(self.spb_rsb_units, 1, 7, 1, 1)

        self.addWidget(QtGui.QLabel('ADV:'), 2, 0, 1, 1)
        self.addWidget(self.edt_adv, 2, 1, 1, 3)
        self.addWidget(QtGui.QLabel('@'), 2, 4, 1, 1)
        self.addWidget(self.spb_adv_percent, 2, 5, 1, 1)
        self.addWidget(QtGui.QLabel('+'), 2, 6, 1, 1)
        self.addWidget(self.spb_adv_units, 2, 7, 1, 1)

        self.addWidget(self.btn_copyMetrics, 3, 1, 1, 8)
コード例 #19
0
ファイル: __Anchor-Test.py プロジェクト: twardoch/TypeRig
    def __init__(self, aux):
        super(QanchorBasic, self).__init__()

        # - Init
        self.aux = aux
        self.types = 'Anchor PinPoint'.split(' ')
        self.posY = 'Coord,Above,Below,Center,Baseline,Copy'.split(',')
        self.posX = 'Coord,Left,Right,Center,Highest,Lowest'.split(',')
        posYvals = (None, 'T', 'B', 'C', None)
        posXvals = (None, 'L', 'R', 'C', 'AT', 'A')
        self.posYctrl = dict(zip(self.posY, posYvals))
        self.posXctrl = dict(zip(self.posX, posXvals))

        # -- Basic Tool buttons
        self.lay_grid = QtGui.QGridLayout()
        self.btn_clearSel = QtGui.QPushButton('Clear Selected')
        self.btn_clearAll = QtGui.QPushButton('Clear All')
        self.btn_anchorAdd = QtGui.QPushButton('Add')
        self.btn_anchorMov = QtGui.QPushButton('Move')
        self.chk_italic = QtGui.QCheckBox('Use Italic Angle')

        # -- Edit fields
        self.edt_anchorName = ALineEdit()
        self.edt_simpleX = QtGui.QLineEdit()
        self.edt_simpleY = QtGui.QLineEdit()
        self.edt_autoT = QtGui.QLineEdit()

        self.edt_anchorName.setPlaceholderText('New Anchor')
        self.edt_simpleX.setText('0')
        self.edt_simpleY.setText('0')
        self.edt_autoT.setText('5')

        # -- Combo box
        self.cmb_posX = QtGui.QComboBox()
        self.cmb_posY = QtGui.QComboBox()
        self.cmb_type = QtGui.QComboBox()

        self.cmb_posX.addItems(self.posX)
        self.cmb_posY.addItems(self.posY)
        self.cmb_type.addItems(self.types)
        self.cmb_type.setEnabled(False)

        # -- Constrains
        self.btn_clearSel.setMinimumWidth(90)
        self.btn_clearAll.setMinimumWidth(90)
        self.edt_anchorName.setMinimumWidth(50)
        self.edt_simpleX.setMinimumWidth(30)
        self.edt_simpleY.setMinimumWidth(30)

        # -- Link functions
        self.btn_clearAll.clicked.connect(lambda: self.clearAnchors(True))
        self.btn_clearSel.clicked.connect(lambda: self.clearAnchors(False))
        self.btn_anchorAdd.clicked.connect(lambda: self.addAnchors(False))
        self.btn_anchorMov.clicked.connect(lambda: self.addAnchors(True))

        # - Build layout
        self.lay_grid.addWidget(QtGui.QLabel('Remove anchor:'), 0, 0, 1, 4)
        self.lay_grid.addWidget(self.btn_clearSel, 1, 0, 1, 4)
        self.lay_grid.addWidget(self.btn_clearAll, 1, 4, 1, 4)

        self.lay_grid.addWidget(QtGui.QLabel('Add/move anchor:'), 2, 0, 1, 4)
        self.lay_grid.addWidget(QtGui.QLabel('N:'), 3, 0, 1, 1)
        self.lay_grid.addWidget(self.edt_anchorName, 3, 1, 1, 3)
        self.lay_grid.addWidget(self.cmb_type, 3, 4, 1, 4)

        self.lay_grid.addWidget(QtGui.QLabel('X:'), 4, 0, 1, 1)
        self.lay_grid.addWidget(self.cmb_posX, 4, 1, 1, 2)
        self.lay_grid.addWidget(self.edt_simpleX, 4, 3, 1, 1)
        self.lay_grid.addWidget(QtGui.QLabel('Tolerance:'), 4, 4, 1, 1)
        self.lay_grid.addWidget(self.edt_autoT, 4, 5, 1, 3)

        self.lay_grid.addWidget(QtGui.QLabel('Y:'), 5, 0, 1, 1)
        self.lay_grid.addWidget(self.cmb_posY, 5, 1, 1, 2)
        self.lay_grid.addWidget(self.edt_simpleY, 5, 3, 1, 1)
        self.lay_grid.addWidget(self.chk_italic, 5, 4, 1, 4)

        self.lay_grid.addWidget(self.btn_anchorAdd, 6, 0, 1, 4)
        self.lay_grid.addWidget(self.btn_anchorMov, 6, 4, 1, 4)

        # - Build
        self.addLayout(self.lay_grid)