Пример #1
0
 def __init__(self):
     """
     Connects main window and output window for errors.
     """
     self.outputWindow = Window((400, 300), minSize=(1, 1), closable=True)
     self.outputWindow.outputView = OutPutEditor((0, 0, -0, -0),
                                                 readOnly=True)
     self.window = Window((800, 600), minSize=(1, 1), closable=True)
     self.window.drawView = DrawView((0, 32, -0, -0))
     self.scriptPath = None
     self.scriptFileName = None
     self.scriptName = None
     self.initialize()
     self.window.open()
     self.outputWindow.open()
Пример #2
0
        def __init__(self):
            tagGroups = {
                "GSUB": {
                    "aalt", "salt", "ss02", "ccmb", "ccmp", "liga", "dlig",
                    "rvrn", "cpsp"
                },
                "GPOS": {"kern", "mark", "mkmk", "cpsp", "ZZZZ"}
            }
            self.w = Window((300, 500),
                            "TagTest",
                            minSize=(200, 200),
                            autosaveName="TempTagTesttt")
            self.tags = FeatureTagGroup(300,
                                        tagGroups,
                                        callback=self.tagsChanged)

            self.w.tagsScrollView = AligningScrollView(
                (0, 0, 0, -50),
                self.tags,
                drawBackground=False,
                borderType=AppKit.NSNoBorder)
            self.w.mutateButton = Button((10, -30, 100, 20),
                                         "Mutate",
                                         callback=self.mutate)
            self.w.repopulateButton = Button((120, -30, 100, 20),
                                             "Repopulate",
                                             callback=self.repopulate)
            self.w.open()
Пример #3
0
    def __init__(self):
        """Connects main window and output window for errors."""

        for path in getFontPaths():
            name = path.split('/')[-1]
            self.FONTS.append(name)

        self.font = findFont(self.FONTS[0])
        self.context = getContext()
        self.window = Window((800, 600), minSize=(1, 1), closable=True)
        self.window.drawView = DrawView((0, 32, -0, -0))
        self.outputWindow = Window((400, 300), minSize=(1, 1), closable=True)
        self.outputWindow.outputView = OutPutEditor((0, 0, -0, -0), readOnly=True)
        self.initialize()
        self.window.open()
        self.outputWindow.open()
 def __init__(self):
     # debug
     windowname = 'Debug Glyph Metrics UI'
     windows = [w for w in NSApp().orderedWindows() if w.isVisible()]
     for window in windows:
         print(window.title())
         if window.title() == windowname:
             window.close()
     if debug == True:
         self.debug = Window((333, 33), windowname)
         self.debug.bind('close', self.windowSideuiClose)
         self.debug.open()
     # setup
     self.showButtons = False
     self.sbui = None
     # add interface
     addObserver(self, 'addInterface', 'glyphWindowWillOpen')
     addObserver(self, 'updateSelfWindow', 'currentGlyphChanged')
     # toggle visibility of tool ui
     addObserver(self, 'showSideUIonDraw', 'draw')
     addObserver(self, 'hideSideUIonPreview', 'drawPreview')
     # remove UI and window manager when glyph window closes
     # addObserver(self, "observerGlyphWindowWillClose", "glyphWindowWillClose")
     # subscribe to glyph changes
     addObserver(self, "viewDidChangeGlyph", "viewDidChangeGlyph")
    def __init__(self):
        super(BaseWindowController, self).__init__()

        # standard settings
        self.settingsDict = {
            'recordingFolder': False,
            'showVideoAnalysis': False,
            'partAge': 25,
            'useCamera': False,
            'timelag': 0,
            'showPlot': True,
            'exportData': True,
            'pupilFiltering': 1,
            'exportFolder': False,
            'luxFolder': False
        }

        # load settings
        if os.path.isfile("settings.pkl"):
            with open('settings.pkl', 'rb') as s:
                self.settingsDict = pickle.load(s)

        self.plot = plt
        self.w = Window((600, 850), 'Cognitive Worklaod Pupil Analisis')
        self.buildWindow()
        self.updateInterface()

        self.setUpBaseWindowBehavior()
        self.w.open()
Пример #6
0
 def __init__(self):
     self.w = Window((400, 400), "Mock Window")
     self.w.sheetButton = Button((10, 10, -10, 20),
                                 "Open sheet",
                                 callback=self.buttonCB)
     self.presets = []
     self._createPresetsList()
    def __init__(self):
        self.w = Window((300, 100))
        self.w.inner = Group((10, 10, -10, -10))

        p1 = VanillaSingleValueParameter('main', 10, (0, 100), 'int')
        p2 = VanillaSingleValueParameter('ratio',
                                         10, (0, 100),
                                         'int',
                                         master=p1,
                                         mode='ratio',
                                         dissociable=True)
        p3 = VanillaSingleValueParameter('offset',
                                         10, (0, 100),
                                         'int',
                                         master=p1,
                                         mode='offset',
                                         dissociable=True)

        self.w.inner.p1 = ParameterSliderTextInput(p1, (0, 0, -0, 22),
                                                   'master')
        self.w.inner.p2 = ParameterSliderTextInput(p2, (0, 25, -0, 22),
                                                   'ratio')
        self.w.inner.p3 = ParameterSliderTextInput(p3, (0, 50, -0, 22),
                                                   'offset')
        self.w.open()
Пример #8
0
    def showWindow_(self, sender):
        try:
            from vanilla import Group, Slider, TextBox, Window
            self.windowWidth = 300
            self.windowHeight = 240

            self.w = Window((self.windowWidth, self.windowWidth),
                            "Rotate View",
                            minSize=(self.windowWidth, self.windowWidth + 20))

            self.w.Preview = RoatatePreview((0, 0, -0, -60))
            self.w.controlBox = Group((0, -60, -0, -0))
            self.w.controlBox.slider = Slider((10, 6, -10, 23),
                                              tickMarkCount=17,
                                              callback=self.sliderCallback,
                                              value=0,
                                              minValue=-360,
                                              maxValue=360)
            self.w.controlBox.textBox = TextBox((10, -25, -10, 22),
                                                text="0.00°",
                                                alignment="center")
            self.w.controlBox.slider.getNSSlider().setEnabled_(False)

            self.w.open()
            self.changeGlyph_(None)
            Glyphs.addCallback(
                self.changeGlyph_, UPDATEINTERFACE
            )  #will be called on ever change to the interface
        except:
            print(traceback.format_exc())
 def __init__(self, designSpace, previewCharacter="e"):
     from vanilla import Window
     from tnbits.toolparts.buildvariables.designspaceexplorer import DesignSpaceExplorer
     self.w = Window((1000, 500), "DesignSpace Explorer", minSize=(600, 300))
     self.w.designSpaceExplorer = DesignSpaceExplorer((0, 0, 0, 0), designSpace,
         previewCharacter=previewCharacter)
     self.w.open()
Пример #10
0
    def __init__(self):
        self.master_names = [m.name for m in Glyphs.font.masters][1:]

        item_height = 24.0
        w_width = 350.0
        w_height = item_height * 5
        margin = 10
        next_y = margin
        col_1_width = w_width - (margin * 2)
        item_height = 24

        self.w = Window((w_width, w_height), "Convert Master to Brace Layers")

        next_y = margin
        self.w.master_names_label = TextBox((margin, next_y + 2, col_1_width, item_height), "Master to Convert (Cannot be the first Master)", sizeStyle='regular')
        next_y += item_height
        self.w.master_names = PopUpButton((margin, next_y, col_1_width, item_height), self.master_names)
        next_y += item_height + margin
        selected_master_index = Glyphs.font.masters.index(Glyphs.font.selectedFontMaster)
        self.w.master_names.set(selected_master_index - 1)

        self.w.gobutton = Button((margin + (col_1_width / 4), next_y, col_1_width / 2, item_height), 'Add Brace Layers', callback=self.makeitso)

        self.w.setDefaultButton(self.w.gobutton)

        self.w.open()
Пример #11
0
    def __init__(self):
        super(VisualReporter, self).__init__()

        self.allFonts = AllFonts()
        self.sortAllFonts()
        self.collectFontNames()

        self.w = Window((0, 0, PLUGIN_WIDTH, 1), PLUGIN_TITLE)

        jumpingY = UI_MARGIN
        self.w.fontsPopUp = PopUpButton(
            (UI_MARGIN, jumpingY, NET_WIDTH,
             vanillaControlsSize['PopUpButtonRegularHeight']),
            self.fontNames,
            callback=None)

        jumpingY += vanillaControlsSize['PopUpButtonRegularHeight'] + UI_MARGIN
        self.w.reportButton = SquareButton(
            (UI_MARGIN, jumpingY, NET_WIDTH,
             vanillaControlsSize['ButtonRegularHeight'] * 1.5),
            'Generate PDF Report',
            callback=self.reportButtonCallback)
        jumpingY += vanillaControlsSize['ButtonRegularHeight'] * 1.5 + UI_MARGIN

        self.setUpBaseWindowBehavior()
        addObserver(self, 'updateFontOptions', "newFontDidOpen")
        addObserver(self, 'updateFontOptions', "fontDidOpen")
        addObserver(self, 'updateFontOptions', "fontWillClose")
        self.w.bind("close", self.windowCloseCallback)
        self.w.resize(PLUGIN_WIDTH, jumpingY)
        self.w.open()
 def __init__(self):
     self.w = Window((350, 600),
                     "Instance Interpolations Report",
                     minSize=(300, 450))
     self.w.textEditor = TextEditor((10, 10, -10, -10),
                                    text=text,
                                    readOnly=True)
     self.w.open()
Пример #13
0
 def __init__(self):
     self.w = Window((550, 140), "Replace named Layer")
     self.w.editText = EditText((10, 15, -10, 22), placeholder="Layer Name", text='{170}')
     self.w.correct_path_direction = CheckBox((10, 50, -10, 18), "Correct Path Direction", value=True, sizeStyle='small')
     self.w.sync_metrics = CheckBox((210, 50, -10, 18), "Sync Metrics", value=True, sizeStyle='small')
     self.w.add_if_missing = CheckBox((10, 70, -10, 18), "Add layer if missing", value=True, sizeStyle='small')
     self.w.copybutton = Button((10, 100, -10, 17), "Replace layer", callback=self.buttonCallback)
     self.w.open()
Пример #14
0
 def __init__(self):
     self.w = Window((300, 500), minSize=(200, 100))
     y = 10
     self.w.g = Group((0, 0, 0, 0))
     for i, tag in enumerate(["liga", "calt", "dlig", "smcp", "kern", "locl"]):
         setattr(self.w.g, f"tag{i}", TagView((10, y, 60, 20), tag, None, self.callback))
         y += 26
     self.w.open()
Пример #15
0
 def __init__(self):
     """
     Connects main window and output window for errors.
     """
     super(CanvasApp, self).__init__()
     self.window = Window((800, 600), minSize=(1, 1), closable=True)
     self.context = getContext('Canvas')
     self.window.open()
     self.run()
Пример #16
0
    def __init__(self):
        self.font = Glyphs.font  # Returns the current that is open in GlyphsApp
        self.currentGlyphName = 'H'
        self.glyph = self.font[self.currentGlyphName].layers[0]
        lsb = int(round(self.glyph.LSB))
        rsb = int(round(self.glyph.RSB))

        pad = 10
        leading = 32
        y = pad
        w = 300
        h = 400
        buttonWidth = 100
        buttonHeight = 48

        self.w = Window((100, 100, w, h), 'DemoWindowTool')
        self.w.doDraw = CheckBox((pad, y, 100, 24),
                                 'Draw',
                                 callback=self.doDrawCallback)

        y += leading
        self.w.leftMarginLabel = TextBox((pad, y, -pad, 24), 'Left margin')
        y += leading / 2
        self.w.leftMarginSlider = Slider(
            (pad, y, -pad - 60, 24),
            minValue=MIN_LSB,
            maxValue=MAX_LSB,
            value=lsb,
            tickMarkCount=10,
            callback=self.leftMarginSliderCallback)
        self.w.leftMarginBox = EditText((-pad - 60 + pad, y, -pad, 24),
                                        callback=self.leftMarginBoxCallback)
        self.w.leftMarginBox.set(str(lsb))

        y += leading
        self.w.rightMarginLabel = TextBox((pad, y, -pad, 24), 'Right margin')
        y += leading / 2
        self.w.rightMarginSlider = Slider(
            (pad, y, -pad - 60, 24),
            minValue=MIN_RSB,
            maxValue=MAX_RSB,
            value=rsb,
            tickMarkCount=10,
            callback=self.rightMarginSliderCallback)
        self.w.rightMarginBox = EditText((-pad - 60 + pad, y, -pad, 24),
                                         callback=self.rightMarginBoxCallback)
        self.w.rightMarginBox.set(str(rsb))

        y = self.w.saveFont = Button((-buttonWidth - pad, -buttonHeight - pad,
                                      buttonWidth, buttonHeight),
                                     'Save',
                                     callback=self.saveFontCallback)

        self.w.open()
Пример #17
0
 def __init__(self):
     # create a window
     self.w = Window((400, 400), minSize=(200, 200))
     # add a slider
     self.w.slider = Slider((10, 10, -10, 22), callback=self.sliderCallback)
     # add a drawBox view
     self.w.drawBotCanvas = DrawView((0, 40, -0, -0))
     # draw something
     self.drawIt()
     # open the window
     self.w.open()
Пример #18
0
	def __init__( self, titles ):
		self.button = ''
		margin = 10
		size = 40
		self.w = Window( ( len( titles ) * ( margin + size ) + margin, 2 * margin + size ), "Symmetrify" )
		top = margin
		left = margin

		for title in titles:
			button = SquareButton( ( left, top, size, size ), title, callback = self.buttonCallback )
			setattr( self.w, title, button )
			left += size + margin
Пример #19
0
    def __init__(self):
        self.glyph = None  # Typical RoboFont function
        self.updating = False

        pad = 10
        leading = 32
        y = pad
        w = 500
        h = 500
        c1 = 150
        c2 = 200
        bh = 24  # Button height
        leading = bh + pad / 2

        self.w = Window((100, 100, w, h), 'Final tool window', minSize=(w, h))
        self.w.fontList = List((pad, pad, c2, -w / 2), [],
                               doubleClickCallback=self.openFontCallback,
                               selectionCallback=self.update)

        y = pad
        self.w.fixTabWidths = Button((-c1 - pad, y, c1, bh),
                                     'Fix tab widths',
                                     callback=self.fixTabWidthsCallback)
        self.w.fixTabWidths.enable(False)

        y += leading
        self.w.fixNegativeWidths = Button(
            (-c1 - pad, y, c1, bh),
            'Fix negative widths',
            callback=self.fixNegativeWidthsCallback)
        self.w.fixNegativeWidths.enable(False)

        y += leading
        self.w.fixMissingComponentsWidths = Button(
            (-c1 - pad, y, c1, bh),
            'Fix missing components',
            callback=self.fixMissingComponentCallback)
        self.w.fixMissingComponentsWidths.enable(False)

        self.w.selectFolder = Button((-c1 - pad, -pad - bh, c1, bh),
                                     'Select fonts',
                                     callback=self.selectFontFolder)

        self.w.canvas = Canvas((pad, -w / 2 - pad, -pad, -w / 4),
                               delegate=self)

        self.w.report = EditText((pad, -w / 4 + pad, -pad, -pad),
                                 readOnly=False)

        self.w.bind('close', self.windowCloseCallback)
        self.w.open()

        self.dirPath = self.selectFontFolder()
    def __init__(self):
        self.verboten = {
            'right': ['napostrophe', 'Omegadasiavaria'],
            'left': ['ldot', 'Ldot', 'ldot.sc', 'sigmafinal'],
            'both': ['*.tf', '*.tosf', '.notdef', 'NULL', 'CR']
        }
        self.category = None
        self.messages = []
        self.interpolated_fonts = dict()
        self.use_real = True
        self.use_selection = False
        self.ignore_red = False
        self.current_glyph = None
        self.leftside_kerning_groups = None
        self.rightside_kerning_groups = None
        self.all_kern_categories = self.get_all_kern_categories()
        self.categories_leftside = self.get_categorised_glyphs('left')
        self.categories_rightside = self.get_categorised_glyphs('right')

        item_height = 24.0
        w_width = 300.0
        w_height = item_height * (7 + len(self.all_kern_categories))
        margin = 10
        next_y = margin
        col_1_width = w_width - (margin * 2)
        item_height = 24

        radio_height = item_height * len(self.all_kern_categories)

        self.w = Window((w_width, w_height), "Make Kerning Strings")

        self.w.text_1 = TextBox((margin, next_y, w_width, item_height), "Kern with:", sizeStyle='regular')
        next_y += item_height
        self.w.radioCategories = RadioGroup((margin, next_y, col_1_width, radio_height), self.all_kern_categories, sizeStyle='regular')
        self.w.radioCategories.set(0)
        next_y += radio_height + margin

        self.w.use_real = CheckBox((margin, next_y, col_1_width, item_height), "Use real words", value=True, sizeStyle='regular')
        next_y += item_height

        self.w.use_selected = CheckBox((margin, next_y, col_1_width, item_height), "Use the selected glyphs verbatum", value=False, sizeStyle='regular')
        next_y += item_height

        self.w.ignore_red = CheckBox((margin, next_y, col_1_width, item_height), "Ignore red marked glyphs", value=False, sizeStyle='regular')
        next_y += item_height + margin

        self.w.gobutton = Button((margin + (col_1_width / 4), next_y, col_1_width / 2, item_height), 'Make Strings', callback=self.makeitso)

        self.w.setDefaultButton(self.w.gobutton)
        self.w.center()
        self.w.open()
Пример #21
0
    def __init__(self):
        item_height = 24.0
        w_width = 500.0
        w_height = item_height * 12
        margin = 10
        next_y = margin
        col_1_width = w_width - (margin * 2)
        item_height = 24

        self.get_prefs('copyMetricsFromFont.pref')

        self.available_layers = dict(
            ('{} - {}'.format(os.path.basename(font.filepath), master), master)
            for font in Glyphs.fonts for master in font.masters)

        self.w = Window((w_width, w_height), "Copy Metrics")

        self.w.hText_2 = TextBox((margin, next_y, col_1_width, item_height),
                                 "Copy metrics from this font/layer:",
                                 sizeStyle='regular')
        next_y += item_height
        self.w.available_layers = PopUpButton(
            (margin, next_y, col_1_width, item_height),
            sorted(self.available_layers.keys()
                   ))  # , callback=self.update_brace_value)
        next_y += item_height + margin
        metrics_options = [
            'Left sidebearing Only',
            'Right sidebearing Only',
            'Width Only (keep LSB)',
            'Width Only (assign proportionally)',
            "Left sidebearing and Width",
            "Left sidebearing and Right sidebearing",
            'Width and Right sidebearing',
        ]
        self.w.metrics_to_copy = RadioGroup(
            (margin, next_y, col_1_width, item_height * len(metrics_options)),
            metrics_options)
        self.w.metrics_to_copy.set(int(self.prefs.get('metrics_to_copy', 0)))
        next_y += item_height * len(metrics_options) + margin

        self.w.gobutton = Button(
            (margin + (col_1_width / 4), next_y, col_1_width / 2, item_height),
            'Copy Metrics',
            callback=self.makeitso)
        next_y += item_height

        self.w.setDefaultButton(self.w.gobutton)
        self.w.open()
Пример #22
0
    def __init__(self):
        self.font_order = []
        self.position = "left"
        
        L = 0  # left
        T = 0  # top
        W = 200 # width
        H = 300  # height
        p = 10 # padding
        buttonHeight = 20

        title = "☎️ Hotline Glyph"
        self.w = Window((W, H), title, minSize=(W/3, H/3))

        self.w.fileList = List(
            (L, T, -0, -(p * 3 + buttonHeight * 2)),
            self.font_order,
            columnDescriptions=[
                {"title": "✓", "width":20},
                {"title": "File name"},
                ], # files
            showColumnTitles=False,
            allowsMultipleSelection=True,
            enableDelete=True,
            otherApplicationDropSettings = dict(
                type=NSFilenamesPboardType,
                operation=NSDragOperationCopy,
                callback=self.dropCallback),
            dragSettings=dict(type="RangeType", 
                                callback=self.font_list_drag_callback),
            selfDropSettings=dict(type="RangeType", 
                                operation=NSDragOperationMove, 
                                callback=self.font_list_drop_callback)
            )

        self.w.editText = EditText((p, -(p * 2 + buttonHeight * 2), -p, buttonHeight))

        self.w.draw = CheckBox((p, -(p + buttonHeight), -p, buttonHeight), 'show', value=True, callback=self.updateViewCallback)

        self.w.toLeftbutton = SquareButton((-p*6, -(p + buttonHeight), p*2, buttonHeight), "←", sizeStyle='small', callback=self.toLeft)
        self.w.toRightbutton = SquareButton((-p*3, -(p + buttonHeight), p*2, buttonHeight), "➝", sizeStyle='small', callback=self.toRight)

        addObserver(self, "drawPreviewRef", "drawBackground")
        addObserver(self, "drawRef", "drawPreview")

        self.setUpBaseWindowBehavior() # Needed for the windowCloseCallback

        self.w.open()
    def __init__(self):
        item_height = 24.0
        margin = 10
        next_y = margin
        w_width = 400.0
        w_height = item_height * 7 + margin
        col_1_width = w_width - (margin * 2)

        self.this_font = Glyphs.font
        try:
            self.other_font = [f for f in Glyphs.fonts
                               if f != self.this_font][0]
        except IndexError:
            Glyphs.showNotification('Copy kerning for Class from Other Font:',
                                    'There is only 1 file open!')
            raise

        self.other_fonts_classes = self.get_other_fonts_classes()
        self.w = Window((w_width, w_height),
                        "Copy kerning for Class from Other Font")

        self.w.text_1 = TextBox(
            (margin, next_y, w_width, item_height),
            "Copy the kerning for this class to this font:",
            sizeStyle='small')
        next_y += item_height
        self.w.class_to_copy = PopUpButton(
            (margin, next_y, w_width - (margin * 2), item_height),
            self.other_fonts_classes,
            sizeStyle='regular')
        next_y += item_height + item_height

        self.w.copy_for_all = RadioGroup(
            (margin, next_y, w_width, item_height * 2), [
                ' Copy only for the current Master',
                ' Copy for All masters',
            ])
        self.w.copy_for_all.set(0)
        next_y += (item_height * 2) + margin

        self.w.gobutton = Button(
            (margin + (col_1_width / 4), next_y, col_1_width / 2, item_height),
            'Copy',
            callback=self.makeitso)

        self.w.setDefaultButton(self.w.gobutton)
        self.w.center()
        self.w.open()
Пример #24
0
 def __init__(self):
     self.glyph = None # Typical RoboFont function
     self.updating = False
     
     pad = 10
     leading = 32
     y = pad
     w = 300
     h = 400
     buttonWidth = 100
     buttonHeight = 48
     
     self.w = Window((100, 100, w, h), 'Final tool window')
                 
     self.w.bind('close', self.windowCloseCallback)
     self.w.open()
Пример #25
0
    def __init__(self):
        self.f = CurrentFont()
        self.u = getKerningPairsFromUFO.UFOkernReader(self.f)
        self.absKerning = int(self.u.absoluteKerning)
        self.amountOfPairs = len(self.u.allKerningPairs)

        self.textString = ('The font has %s flat kerning pairs.\n'
                           'Set at %s points, the absolute amount\n'
                           'of kerning would cover the distance of\n%s.')

        wWidth = 300
        wHeight = 250

        if self.amountOfPairs:
            message = u'CONGRATULATIONS! \U0001F600'
        else:
            message = u'Bummer. \U0001F622'

        self.w = Window((wWidth, wHeight), message)

        self.w.measurementSystem = RadioGroup((20, 15, -10, 20),
                                              ["Metric", "Imperial"],
                                              callback=self.parametersChanged,
                                              isVertical=False)

        self.w._pointSize = TextBox((20, 145, -30, 17), 'Point size:')

        self.w.pointSize = Slider((100, 145, -30, 17),
                                  minValue=0,
                                  maxValue=1000,
                                  callback=self.parametersChanged,
                                  value=12)

        pointSize = int(self.w.pointSize.get())
        absKerning = int(self.absKerning *
                         (pointSize / self.f.info.unitsPerEm))

        self.w.text = TextBox(
            (20, 45, -20, 85),
            self.textString % (self.amountOfPairs, int(
                self.w.pointSize.get()), self.convertToMetric(absKerning)))

        self.w.button = Button((20, -40, -30, 20),
                               "Copy kerning pairs to clipboard",
                               callback=self.button)

        self.w.open()
    def __init__(self):
        self.filters = PenBallFiltersManager()
        self.filters.loadFiltersFromJSON('/'.join([LOCALPATH, JSONFILE]))
        self.glyphNames = []
        self.observedGlyphs = []
        self.cachedFont = RFont(showUI=False)
        self.currentFont = CurrentFont()
        filtersList = self.filters.keys()
        if len(filtersList) > 0:
            self.currentFilterName = filtersList[0]
        else:
            self.currentFilterName = None
        self.fill = True

        self.observers = [
            ('fontChanged', 'fontBecameCurrent'),
            ('fontChanged', 'fontDidOpen'),
            ('fontChanged', 'fontDidClose'),
        ]

        self.w = Window((100, 100, 800, 500), 'PenBall Wizard v{0}'.format(__version__), minSize=(500, 400))
        self.w.filtersPanel = Group((0, 0, 300, -0))
        self.w.filtersPanel.filtersList = List((0, 0, -0, -40), filtersList, selectionCallback=self.filterSelectionChanged, doubleClickCallback=self.filterEdit, allowsMultipleSelection=False, allowsEmptySelection=False, rowHeight=22)
        self.w.filtersPanel.controls = Group((0, -40, -0, 0))
        self.w.filtersPanel.addFilter = SquareButton((0, -40, 100, 40), 'Add filter', sizeStyle='small', callback=self.addFilter)
        self.w.filtersPanel.addFilterChain = SquareButton((100, -40, 100, 40), 'Add operations', sizeStyle='small', callback=self.addFilterChain)
        self.w.filtersPanel.removeFilter = SquareButton((-100, -40, 100, 40), 'Remove filter', sizeStyle='small', callback=self.removeFilter)
        self.w.textInput = EditText((300, 0, -90, 22), '', callback=self.stringInput)
        self.w.generate = SquareButton((-90, 0, 90, 22), 'Generate', callback=self.generateGlyphsToFont, sizeStyle='small')
        self.w.preview = MultiLineView((300, 22, -0, -0))
        self.w.switchFillStroke = SquareButton((-75, -40, 60, 25), 'Stroke', callback=self.switchFillStroke, sizeStyle='small')
        displayStates = self.w.preview.getDisplayStates()
        for key in ['Show Metrics','Upside Down','Stroke','Beam','Inverse','Water Fall','Multi Line']:
            displayStates[key] = False
        for key in ['Fill','Single Line']:
            displayStates[key] = True
        self.w.preview.setDisplayStates(displayStates)

        for callback, event in self.observers:
            addObserver(self, callback, event)

        self.updateControls()

        self.w.bind('close', self.end)
        self.launchWindow()
        self.w.open()
Пример #27
0
    def __init__(self, font):

        self._font = font

        if font.path:
            document = DoodleDocument.alloc().init()
            document.setFileURL_(NSURL.fileURLWithPath_(font.path))

            dc = NSDocumentController.sharedDocumentController()
            dc.addDocument_(document)

        self._canUpdateChangeCount = True

        self.w = Window((250, 500), "SimpleFontWindow", minSize=(200, 300))

        glyphs = sorted(font.keys())

        self.w.glyphs = List((0, 0, -0, -0), glyphs,
                             doubleClickCallback=self.openGlyph)

        toolbarItems = [
            dict(itemIdentifier="spaceCenter",
                 label="Space Center",
                 imageNamed="toolbarSpaceCenterAlternate",
                 callback=self.openSpaceCenter
                 ),
            dict(itemIdentifier="fontInfo",
                 label="Font Info",
                 imageNamed="toolbarFontInfo",
                 callback=self.openFontInfo
                 )
        ]
        self.w.addToolbar(toolbarIdentifier="SimpleToolbar",
                          toolbarItems=toolbarItems)

        windowController = self.w.getNSWindowController()
        windowController.setShouldCloseDocument_(True)
        self._font.UIdocument().addWindowController_(windowController)

        self._font.addObserver(self, "fontChanged", "Font.Changed")

        self.setUpBaseWindowBehavior()
        self.w.open()

        self.openFirstGlyph()
Пример #28
0
    def __init__(self):
        item_height = 24.0
        w_width = 300.0
        w_height = item_height * 8
        margin = 10
        next_y = margin
        col_1_width = w_width - (margin * 2)
        item_height = 24

        self.messages = []
        self.interpolated_fonts = dict()
        self.current_glyph = None

        self.all_kern_groups = self.get_all_kern_groups()
        self.w = Window((w_width, w_height), "Rename Kern Groups")

        self.w.text_1 = TextBox((margin, next_y, w_width, item_height),
                                "Rename:",
                                sizeStyle='small')
        next_y += item_height
        self.w.nameFind = PopUpButton(
            (margin, next_y, w_width - (margin * 2), item_height),
            self.all_kern_groups,
            sizeStyle='regular')
        next_y += item_height + item_height

        self.w.text_2 = TextBox((margin, next_y, w_width, item_height),
                                "To:",
                                sizeStyle='small')
        next_y += item_height
        self.w.nameReplace = EditText(
            (margin, next_y, w_width - (margin * 2), item_height),
            "",
            sizeStyle='regular')
        next_y += item_height + margin

        self.w.gobutton = Button(
            (margin + (col_1_width / 4), next_y, col_1_width / 2, item_height),
            'Rename',
            callback=self.makeitso)

        self.w.setDefaultButton(self.w.gobutton)
        self.w.center()
        self.w.open()
Пример #29
0
    def __init__(self):
        self.file_name = 'CustomFilter Project Glyph Sets.plist'
        folder_path = os.path.dirname(Glyphs.font.filepath)
        self.file_path = os.path.join(folder_path, self.file_name)

        self.charsets = OrderedDict()
        self.parse_plist()

        self.basic_xml = """<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.08">
<array>
{charsets}
</array>
</plist>"""

        item_height = 24.0
        w_width = 350.0
        w_height = item_height * 7
        margin = 10
        next_y = margin
        col_1_width = w_width - (margin * 2)
        item_height = 24

        self.w = Window((w_width, w_height), "Insert a font as brace layers")

        next_y = margin
        self.w.charset_name_label = TextBox((margin, next_y + 2, col_1_width, item_height), "Character Set Name:", sizeStyle='regular')
        next_y += item_height
        self.w.charset_name = EditText((margin, next_y, col_1_width, item_height), callback=self.check_extant_charsets)
        next_y += item_height + 2
        self.w.extant_warning = TextBox((margin, next_y + 2, col_1_width, item_height), "The Character Set already exists and will be overwritten!", sizeStyle='small')
        self.w.extant_warning.show(False)
        next_y += (item_height * 0.7) + margin

        self.w.reopen = CheckBox((margin, next_y, col_1_width, item_height), "Close and Reopen current file", value=True)
        next_y += item_height + margin

        self.w.gobutton = Button((margin + (col_1_width / 4), next_y, col_1_width / 2, item_height), 'Make Character Set', callback=self.makeitso)

        self.w.setDefaultButton(self.w.gobutton)

        self.w.open()
Пример #30
0
 def __init__(self):
     self.w = Window((300, 400),
                     "SliderTest",
                     autosaveName="SliderTestttt")
     # self.w.slider1 = SliderPlus((10, 10, -10, 50), "Slider 1", 0, 50, 100)
     # self.w.slider2 = SliderPlus((10, 60, -10, 50), "Slider 2", 0, 50, 100)
     info = [("abcd", "The alphabet"), ("xyz ", "The alphabet part 2"),
             ("wdth", "Width"), ("wght", "Weight")]
     self.sliderInfo = {}
     for tag, label in info:
         self.sliderInfo[tag] = (label, 0, 50, 100)
     self.w.sliderGroup = SliderGroup(300,
                                      self.sliderInfo,
                                      continuous=True,
                                      callback=self.sliderGroupCallback)
     self.w.mutateButton = Button((10, -40, 80, 20),
                                  "Mutate",
                                  callback=self.mutateCallback)
     self.w.open()