Exemple #1
0
    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)
Exemple #2
0
	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)
Exemple #3
0
    def __init__(self):
        super(typerig_filter, self).__init__()

        #self.setStyleSheet(ss_Toolbox_none)

        # - Layers --------------------------
        self.chk_ActiveLayer = QtGui.QCheckBox('Active')
        self.chk_Masters = QtGui.QCheckBox('Masters')
        self.chk_Masks = QtGui.QCheckBox('Masks')
        self.chk_Service = QtGui.QCheckBox('Services')

        self.chk_ActiveLayer.setCheckState(QtCore.Qt.Checked)
        #self.chk_ActiveLayer.setStyleSheet('QCheckBox::indicator:checked {background-color: limegreen; border: 1px Solid limegreen;}')

        self.chk_ActiveLayer.stateChanged.connect(self.refreshLayers)
        self.chk_Masters.stateChanged.connect(self.refreshLayers)
        self.chk_Masks.stateChanged.connect(self.refreshLayers)
        self.chk_Service.stateChanged.connect(self.refreshLayers)

        self.refreshLayers()

        # - Glyphs --------------------------
        self.rad_glyph = QtGui.QRadioButton('Glyph')
        self.rad_window = QtGui.QRadioButton('Window')
        self.rad_selection = QtGui.QRadioButton('Selection')
        self.rad_font = QtGui.QRadioButton('Font')

        self.rad_glyph.toggled.connect(self.refreshMode)
        self.rad_window.toggled.connect(self.refreshMode)
        self.rad_selection.toggled.connect(self.refreshMode)
        self.rad_font.toggled.connect(self.refreshMode)

        self.rad_glyph.setChecked(True)

        self.rad_glyph.setEnabled(True)
        self.rad_window.setEnabled(True)
        self.rad_selection.setEnabled(True)
        self.rad_font.setEnabled(False)

        self.rad_glyph.setToolTip('Affect current glyph')
        self.rad_window.setToolTip('Affect glyphs in active window')
        self.rad_selection.setToolTip('Affect selected glyphs')
        self.rad_font.setToolTip('Affect the entire font')

        # - Fold Button ---------------------
        self.btn_fold = QtGui.QPushButton('^')
        self.btn_unfold = QtGui.QPushButton('Restore Panel')

        self.btn_fold.setFixedHeight(self.chk_ActiveLayer.sizeHint.height() *
                                     2.5)
        self.btn_fold.setFixedWidth(self.chk_ActiveLayer.sizeHint.height())
        self.btn_unfold.setFixedHeight(self.chk_ActiveLayer.sizeHint.height() +
                                       5)

        self.btn_fold.setToolTip('Fold Panel')
        self.btn_unfold.setToolTip('Unfold Panel')

        self.btn_fold.clicked.connect(self.fold)
        self.btn_unfold.clicked.connect(self.fold)
        self.flag_fold = False

        # - Tabs --------------------------
        # -- Dynamically load all tabs
        self.tabs = QtGui.QTabWidget()
        self.tabs.setTabPosition(QtGui.QTabWidget.East)

        # --- Load all tabs from this directory as modules. Check __init__.py
        # --- <dirName>.modules tabs/modules manifest in list format
        for toolName in Panel.modules:
            if ignorePanel not in toolName:
                self.tabs.addTab(eval('Panel.%s.tool_tab()' % toolName),
                                 toolName)

        # - Layouts -------------------------------
        layoutV = QtGui.QVBoxLayout()
        layoutV.setContentsMargins(0, 0, 0, 0)

        self.lay_controller = QtGui.QGridLayout()
        self.fr_controller = QtGui.QFrame()
        self.lay_controller.setContentsMargins(15, 5, 5, 3)

        # -- Build layouts -------------------------------
        self.lay_controller.addWidget(self.chk_ActiveLayer, 0, 0, 1, 1)
        self.lay_controller.addWidget(self.chk_Masters, 0, 1, 1, 1)
        self.lay_controller.addWidget(self.chk_Masks, 0, 2, 1, 1)
        self.lay_controller.addWidget(self.chk_Service, 0, 3, 1, 1)
        self.lay_controller.addWidget(self.btn_fold, 0, 4, 2, 1)
        self.lay_controller.addWidget(self.rad_glyph, 1, 0, 1, 1)
        self.lay_controller.addWidget(self.rad_window, 1, 1, 1, 1)
        self.lay_controller.addWidget(self.rad_selection, 1, 2, 1, 1)
        self.lay_controller.addWidget(self.rad_font, 1, 3, 1, 1)

        layoutV.addWidget(self.btn_unfold)
        self.fr_controller.setLayout(self.lay_controller)

        layoutV.addWidget(self.fr_controller)
        layoutV.addWidget(self.tabs)

        self.btn_unfold.hide()

        # - Set Widget -------------------------------
        self.setLayout(layoutV)
        self.setWindowTitle('%s %s' % (app_name, app_version))
        self.setGeometry(300, 300, 240, 440)
        self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)  # Always on top!!
        #self.setMinimumWidth(300)

        self.show()
Exemple #4
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)
Exemple #5
0
    def __init__(self, aux, upperWidget):
        super(QTextBlockBasic, self).__init__()

        # - Init
        self.aux = aux
        #self.activeFont = pFont()
        self.upperWidget = upperWidget
        '''
		self.active_workspace = pWorkspace()
		self.active_canvas = self.active_workspace.getCanvas() 
		self.active_textBlock = pTextBlock(self.active_workspace.getTextBlockList()[0])
		'''

        # - Widgets
        self.chk_page = QtGui.QCheckBox('Page size:')
        self.chk_size = QtGui.QCheckBox('Width/Height:')
        self.chk_pos = QtGui.QCheckBox('Position X/Y:')
        self.chk_align = QtGui.QCheckBox('Text alignment:')
        self.chk_kegel = QtGui.QCheckBox('Font Size:')

        self.chk_page.setCheckState(QtCore.Qt.Checked)
        self.chk_size.setCheckState(QtCore.Qt.Checked)
        #self.chk_pos.setCheckState(QtCore.Qt.Checked)
        #self.chk_align.setCheckState(QtCore.Qt.Checked)
        self.chk_kegel.setCheckState(QtCore.Qt.Checked)

        self.cmb_pageSizes = QtGui.QComboBox()
        self.cmb_text_align = QtGui.QComboBox()

        self.cmb_pageSizes.addItems(sorted(page_sizes.keys()))
        self.cmb_text_align.addItems(text_align)

        self.cmb_pageSizes.currentTextChanged.connect(self.page_changed)
        self.cmb_text_align.currentTextChanged.connect(self.algn_changed)

        self.spb_font_size = QtGui.QSpinBox()
        self.spb_font_size.setSuffix(' pt')
        self.spb_font_size.setValue(12)

        self.spb_size_w = QtGui.QSpinBox()
        self.spb_size_h = QtGui.QSpinBox()
        self.spb_pos_x = QtGui.QSpinBox()
        self.spb_pos_y = QtGui.QSpinBox()

        self.spb_size_w.setMaximum(9999)
        self.spb_size_h.setMaximum(9999)
        self.spb_pos_x.setMaximum(9999)
        self.spb_pos_y.setMaximum(9999)
        self.spb_pos_x.setMinimum(-9999)
        self.spb_pos_y.setMinimum(-9999)

        self.spb_size_w.setValue(page_sizes[self.cmb_pageSizes.currentText][0])
        self.spb_size_h.setValue(page_sizes[self.cmb_pageSizes.currentText][1])

        self.btn_apply = QtGui.QPushButton('Set Text Block(s)')
        self.btn_clone = QtGui.QPushButton('Clone')
        self.btn_lock = QtGui.QPushButton('Lock')
        self.btn_reformat = QtGui.QPushButton('Reformat')
        self.btn_remove = QtGui.QPushButton('Remove')
        self.btn_stack_v = QtGui.QPushButton('Stack Vertically')
        self.btn_stack_h = QtGui.QPushButton('Stack Horizontally')
        #self.btn_save = QtGui.QPushButton('Save Layout')
        #self.btn_load = QtGui.QPushButton('Load Layout')

        self.btn_apply.clicked.connect(lambda: self.block_action('format'))
        self.btn_clone.clicked.connect(lambda: self.block_action('clone'))
        self.btn_remove.clicked.connect(lambda: self.block_action('remove'))
        self.btn_lock.clicked.connect(lambda: self.block_action('lock'))
        self.btn_reformat.clicked.connect(
            lambda: self.block_action('reformat'))
        self.btn_stack_v.clicked.connect(lambda: self.block_action('stack_v'))
        self.btn_stack_h.clicked.connect(lambda: self.block_action('stack_h'))
        #self.btn_save.clicked.connect(self.save)
        #self.btn_load.clicked.connect(self.load)

        # - Disable for now
        self.cmb_text_align.setEnabled(False)
        self.chk_align.setEnabled(False)

        # - Build layouts
        layoutV = QtGui.QGridLayout()
        layoutV.addWidget(QtGui.QLabel('Text Block: Formatting'), 0, 0, 1, 4)
        layoutV.addWidget(self.chk_page, 1, 0, 1, 2)
        layoutV.addWidget(self.cmb_pageSizes, 1, 2, 1, 2)
        layoutV.addWidget(self.chk_size, 2, 0, 1, 2)
        layoutV.addWidget(self.spb_size_w, 2, 2, 1, 1)
        layoutV.addWidget(self.spb_size_h, 2, 3, 1, 1)
        layoutV.addWidget(self.chk_pos, 3, 0, 1, 2)
        layoutV.addWidget(self.spb_pos_x, 3, 2, 1, 1)
        layoutV.addWidget(self.spb_pos_y, 3, 3, 1, 1)
        layoutV.addWidget(self.chk_align, 4, 0, 1, 2)
        layoutV.addWidget(self.cmb_text_align, 4, 2, 1, 2)
        layoutV.addWidget(self.chk_kegel, 5, 0, 1, 2)
        layoutV.addWidget(self.spb_font_size, 5, 2, 1, 2)
        layoutV.addWidget(self.btn_apply, 6, 0, 1, 4)
        layoutV.addWidget(QtGui.QLabel('Text Block: Tools'), 7, 0, 1, 4)
        layoutV.addWidget(self.btn_clone, 8, 0, 1, 2)
        layoutV.addWidget(self.btn_remove, 8, 2, 1, 2)
        layoutV.addWidget(self.btn_lock, 9, 0, 1, 2)
        layoutV.addWidget(self.btn_reformat, 9, 2, 1, 2)
        layoutV.addWidget(QtGui.QLabel('Text Block: Alignment'), 10, 0, 1, 4)
        layoutV.addWidget(self.btn_stack_h, 11, 0, 1, 2)
        layoutV.addWidget(self.btn_stack_v, 11, 2, 1, 2)
        '''
		layoutV.addWidget(QtGui.QLabel('Text Block: Layout'),		12, 0, 1, 4)
		layoutV.addWidget(self.btn_save, 		13, 0, 1, 2)
		layoutV.addWidget(self.btn_load, 		13, 2, 1, 2)
		'''

        # - Set Widget
        self.addLayout(layoutV)
Exemple #6
0
    def __init__(self, parentWidget):
        super(WKernGroups, self).__init__()

        # - Init
        self.upper_widget = parentWidget
        self.active_font = pFont()
        self.kern_group_data = {}  #self.active_font.kerning_groups_to_dict()

        # - Interface
        lbl_name = QtGui.QLabel('Kerning classes')
        lbl_act = QtGui.QLabel('Actions (selected items):')
        lbl_name.setMaximumHeight(20)
        lbl_act.setMaximumHeight(20)

        self.cmb_layer = QtGui.QComboBox()
        self.cmb_layer.addItems(self.active_font.masters())
        self.cmb_layer.currentIndexChanged.connect(
            lambda: self.update_data(self.kern_group_data))

        self.btn_apply = QtGui.QPushButton('Apply changes')
        self.btn_write = QtGui.QPushButton('Write changes')
        self.btn_reset = QtGui.QPushButton('Clear font classes')

        self.btn_apply.clicked.connect(lambda: self.apply_changes(False))
        self.btn_write.clicked.connect(lambda: self.apply_changes(True))
        self.btn_reset.clicked.connect(lambda: self.reset_classes())

        self.tab_groupKern = GroupTableView()

        # - Menus & Actions
        # -- Main Database actions
        self.menu_data = QtGui.QMenu('Class Data', self)
        act_data_open = QtGui.QAction('Open TypeRig Classes (JSON)', self)
        act_data_save = QtGui.QAction('Save TypeRig Classes (JSON)', self)
        act_data_import = QtGui.QAction('Import FontLab Classes (JSON)', self)
        act_data_export = QtGui.QAction('Export FontLab Classes (JSON)', self)
        act_data_import_font = QtGui.QAction('Import Classes from Font', self)
        act_data_build_composite = QtGui.QAction(
            'Build Classes from References', self)
        act_data_reset = QtGui.QAction('Reset Font Class Data', self)
        act_data_write = QtGui.QAction('Write class data to Font', self)

        self.menu_data.addAction(act_data_open)
        self.menu_data.addAction(act_data_save)
        self.menu_data.addSeparator()
        self.menu_data.addAction(act_data_import)
        self.menu_data.addAction(act_data_export)
        self.menu_data.addSeparator()
        self.menu_data.addAction(act_data_import_font)
        self.menu_data.addAction(act_data_build_composite)
        self.menu_data.addSeparator()
        self.menu_data.addAction(act_data_reset)
        self.menu_data.addAction(act_data_write)

        act_data_open.triggered.connect(lambda: self.file_load_groups(True))
        act_data_save.triggered.connect(lambda: self.file_save_groups(True))
        act_data_import.triggered.connect(lambda: self.file_load_groups(False))
        #act_data_export.triggered.connect()
        act_data_import_font.triggered.connect(lambda: self.from_font())
        act_data_build_composite.triggered.connect(
            lambda: self.from_composites())
        act_data_reset.triggered.connect(lambda: self.reset_classes())
        act_data_write.triggered.connect(lambda: self.apply_changes(True))

        # -- Main Class actions
        self.menu_class = QtGui.QMenu('Class Management', self)
        act_class_add = QtGui.QAction('Add new class', self)
        act_class_find = QtGui.QAction('Find and replace class names', self)
        act_class_copy = QtGui.QAction('Duplicate classes', self)
        act_class_merge = QtGui.QAction('Merge classes to new', self)
        act_class_mdel = QtGui.QAction('Merge and remove classes', self)
        act_class_del = QtGui.QAction('Remove classes', self)

        self.menu_class.addAction(act_class_add)
        self.menu_class.addAction(act_class_find)
        self.menu_class.addAction(act_class_copy)
        self.menu_class.addAction(act_class_merge)
        self.menu_class.addAction(act_class_mdel)
        self.menu_class.addAction(act_class_del)

        act_class_add.triggered.connect(lambda: self.class_add_new())
        act_class_find.triggered.connect(lambda: self.class_find_replace())
        act_class_copy.triggered.connect(lambda: self.class_copy())
        act_class_merge.triggered.connect(lambda: self.class_merge(False))
        act_class_mdel.triggered.connect(lambda: self.class_merge(True))
        act_class_del.triggered.connect(lambda: self.class_del())

        # -- Change class type
        self.menu_type = QtGui.QMenu('Class Type', self)
        act_type_Left = QtGui.QAction('Set KernLeft (1st)', self)
        act_type_Right = QtGui.QAction('Set KernRight (2nd)', self)
        act_type_Both = QtGui.QAction('Set KernBothSide (1st and 2nd)', self)
        act_type_toggle = QtGui.QAction('Toggle class type', self)

        act_type_Left.triggered.connect(lambda: self.set_type('KernLeft'))
        act_type_Right.triggered.connect(lambda: self.set_type('KernRight'))
        act_type_Both.triggered.connect(lambda: self.set_type('KernBothSide'))
        act_type_toggle.triggered.connect(lambda: self.toggle_type())

        self.menu_type.addAction(act_type_Left)
        self.menu_type.addAction(act_type_Right)
        self.menu_type.addAction(act_type_Both)
        self.menu_type.addAction(act_type_toggle)

        # -- Modify Members
        self.menu_memb = QtGui.QMenu('Class Members', self)
        act_memb_sel = QtGui.QAction('Select Glyphs', self)
        act_memb_clean = QtGui.QAction('Cleanup', self)
        act_memb_upper = QtGui.QAction('Members to uppercase', self)
        act_memb_lower = QtGui.QAction('Members to lowercase', self)
        act_memb_strip = QtGui.QAction('Strip member suffixes', self)
        act_memb_suff = QtGui.QAction('Add suffix to members', self)
        act_memb_addglyphs = QtGui.QAction('Selected glyphs to members', self)

        act_memb_sel.triggered.connect(lambda: self.memb_select())
        act_memb_clean.triggered.connect(lambda: self.memb_cleanup())
        act_memb_upper.triggered.connect(lambda: self.memb_change_case(True))
        act_memb_lower.triggered.connect(lambda: self.memb_change_case(False))
        act_memb_strip.triggered.connect(lambda: self.memb_stripSuffix())
        act_memb_suff.triggered.connect(lambda: self.memb_addSuffix())
        act_memb_addglyphs.triggered.connect(lambda: self.memb_addGlyphs())

        self.menu_memb.addAction(act_memb_sel)
        self.menu_memb.addAction(act_memb_clean)
        self.menu_memb.addAction(act_memb_upper)
        self.menu_memb.addAction(act_memb_lower)
        self.menu_memb.addAction(act_memb_strip)
        self.menu_memb.addAction(act_memb_suff)
        self.menu_memb.addAction(act_memb_addglyphs)

        # - Table auto preview selection
        self.chk_preview = QtGui.QCheckBox('Auto select/preview class.')
        self.tab_groupKern.selectionModel().selectionChanged.connect(
            lambda: self.auto_preview())

        # - Build
        self.lay_grid = QtGui.QGridLayout()
        self.lay_grid.addWidget(lbl_name, 0, 0, 1, 42)
        self.lay_grid.addWidget(QtGui.QLabel('Master:'), 0, 40, 1, 2)
        self.lay_grid.addWidget(self.cmb_layer, 0, 42, 1, 6)
        self.lay_grid.addWidget(self.tab_groupKern, 1, 0, 9, 42)
        self.lay_grid.addWidget(self.chk_preview, 2, 42, 1, 6)
        self.lay_grid.addWidget(self.btn_apply, 1, 42, 1, 6)
        self.lay_grid.addWidget(self.btn_reset, 8, 42, 1, 6)
        self.lay_grid.addWidget(self.btn_write, 9, 42, 1, 6)

        for i in range(1, 8):
            self.lay_grid.setRowStretch(i, 2)

        self.setLayout(self.lay_grid)
Exemple #7
0
    def __init__(self, aux):
        super(QlayerTools, self).__init__()

        # - Init
        self.aux = aux

        # -- Mode checks
        self.lay_checks = QtGui.QGridLayout()
        self.chk_outline = QtGui.QCheckBox('Outline')
        self.chk_guides = QtGui.QCheckBox('Guides')
        self.chk_anchors = QtGui.QCheckBox('Anchors')
        self.chk_lsb = QtGui.QCheckBox('LSB')
        self.chk_adv = QtGui.QCheckBox('Advance')
        self.chk_rsb = QtGui.QCheckBox('RSB')

        # -- Set States
        self.chk_outline.setCheckState(QtCore.Qt.Checked)
        self.chk_adv.setCheckState(QtCore.Qt.Checked)

        # -- Build
        self.lay_checks.addWidget(self.chk_outline, 0, 0)
        self.lay_checks.addWidget(self.chk_guides, 0, 1)
        self.lay_checks.addWidget(self.chk_anchors, 0, 2)
        self.lay_checks.addWidget(self.chk_lsb, 1, 0)
        self.lay_checks.addWidget(self.chk_adv, 1, 1)
        self.lay_checks.addWidget(self.chk_rsb, 1, 2)

        self.addLayout(self.lay_checks)

        # -- Quick Tool buttons
        self.lay_buttons = QtGui.QGridLayout()
        self.btn_swap = QtGui.QPushButton('Swap')
        self.btn_copy = QtGui.QPushButton('Copy')
        self.btn_paste = QtGui.QPushButton('Paste')
        self.btn_clean = QtGui.QPushButton('Remove')
        self.btn_unlock = QtGui.QPushButton('Unlock')
        self.btn_expand = QtGui.QPushButton('Expand')

        #self.btn_unlock.setEnabled(False)
        self.btn_expand.setEnabled(False)

        self.btn_swap.setToolTip('Swap Selected Layer with Active Layer')
        self.btn_copy.setToolTip('Copy Active Layer to Selected Layer')
        self.btn_paste.setToolTip('Paste Selected Layer to Active Layer')
        self.btn_clean.setToolTip('Remove contents from selected layers')
        self.btn_unlock.setToolTip(
            'Unlock all locked references.\nSHIFT+Click will lock all references.'
        )
        self.btn_expand.setToolTip(
            'Expand transformations for selected layers')

        self.btn_swap.clicked.connect(self.swap)
        self.btn_copy.clicked.connect(self.copy)
        self.btn_paste.clicked.connect(self.paste)
        self.btn_clean.clicked.connect(self.clean)
        self.btn_unlock.clicked.connect(self.unlock)
        #self.btn_expand.clicked.connect(self.expand)

        self.lay_buttons.addWidget(self.btn_swap, 0, 0, 1, 1)
        self.lay_buttons.addWidget(self.btn_copy, 0, 1, 1, 1)
        self.lay_buttons.addWidget(self.btn_paste, 0, 2, 1, 1)
        self.lay_buttons.addWidget(self.btn_clean, 1, 0, 1, 1)
        self.lay_buttons.addWidget(self.btn_unlock, 1, 1, 1, 1)
        self.lay_buttons.addWidget(self.btn_expand, 1, 2, 1, 1)

        self.addLayout(self.lay_buttons)
Exemple #8
0
    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)