def __init__( self ):
		
		windowWidth  = 306
		windowHeight = 372
		self.w = vanilla.FloatingWindow(
			( windowWidth, windowHeight ), 
			"Family Weights Calculator",
		)

		linePos, inset, lineHeight = 12, 15, 22

		self.w.numStepsText = vanilla.TextBox( (inset, linePos+2, 110, 17), "Number of steps:", sizeStyle='small')

		self.w.numSteps = vanilla.EditText( (inset+110, linePos, 32, 20), int(self.numInstances()), sizeStyle = 'small')

		linePos += lineHeight


		self.w.minStemText = vanilla.TextBox( (inset, linePos+2, 110, 17), "Thin stem width:", sizeStyle='small')
		self.w.minStem = vanilla.EditText( (inset+110, linePos, 32, 20), int(self.minMax()[0]), sizeStyle = 'small')
		
		linePos += lineHeight

		self.w.maxStemText = vanilla.TextBox( (inset, linePos+2, 110, 17), "Black stem width:", sizeStyle='small')
		self.w.maxStem = vanilla.EditText( (inset+110, linePos, 32, 20), int(self.minMax()[1]), sizeStyle = 'small')
		
		linePos += lineHeight+8

		self.w.calcButton = vanilla.Button((inset,linePos, 120, 17), "Calculate", sizeStyle='small', callback=self.calculate)
		self.w.setDefaultButton( self.w.calcButton )


		linePos += lineHeight+6

		self.w.equalColumn = vanilla.TextBox( (inset, linePos+2, 70, 17), "Equal", sizeStyle='small')
		self.w.lucasColumn = vanilla.TextBox( (inset+72, linePos+2, 70, 17), "Luc(as)", sizeStyle='small')
		self.w.impallariColumn = vanilla.TextBox( (inset+144, linePos+2, 70, 17), "Impallari", sizeStyle='small')
		self.w.abrahamColumn = vanilla.TextBox( (inset+216, linePos+2, 70, 17), "Abraham", sizeStyle='small')


		linePos += lineHeight

		self.w.equalList = vanilla.List( (inset, linePos+2, 60, (17*(self.numInstances()+1))+8), self.equalWeights(self.minMax()[0],self.minMax()[1],self.numInstances()))
		self.w.lucasList = vanilla.List( (inset+72, linePos+2, 60, (17*(self.numInstances()+1))+8), self.lucasWeights(self.minMax()[0],self.minMax()[1],self.numInstances()))
		self.w.impallariList = vanilla.List( (inset+144, linePos+2, 60, (17*(self.numInstances()+1))+8), self.impallariWeights(self.minMax()[0],self.minMax()[1],self.numInstances()))
		self.w.abrahamList = vanilla.List( (inset+216, linePos+2, 60, (17*(self.numInstances()+1))+8), self.abrahamWeights(self.minMax()[0],self.minMax()[1],self.numInstances()))
		
		linePos += lineHeight*9 -8

		self.w.applyEqual = vanilla.Button((inset,linePos, 60, 17), "Apply", sizeStyle='small', callback=self.apply)
		self.w.applyLucas = vanilla.Button((inset+72,linePos, 60, 17), "Apply", sizeStyle='small', callback=self.apply)
		self.w.applyImpallari = vanilla.Button((inset+144,linePos, 60, 17), "Apply", sizeStyle='small', callback=self.apply)
		self.w.applyAbraham = vanilla.Button((inset+216,linePos, 60, 17), "Apply", sizeStyle='small', callback=self.apply)
		

		self.w.open()
    def __init__(self):
        self.color = "#FF0000"
        self.w = vanilla.Window((500, 600),
                                "MathShape Exporter",
                                minSize=(300, 200))
        self.w.preview = HTMLView((0, 0, -0, -200))
        self.w.exportButton = vanilla.Button((-150, -30, -10, 20),
                                             "Export",
                                             callback=self.cbExport)
        self.w.previewButton = vanilla.Button((10, -30, -160, 20),
                                              "Preview",
                                              callback=self.cbMakePreview)

        valueWidth = 50
        columnDescriptions = [
            dict(title="Glyphname", key="name", width=100),
            dict(title="Width", key="width"),
            dict(title="Bounds", key="bounds", width=100),
        ]
        self.w.l = vanilla.List((0, -200, -0, -60),
                                self.wrapGlyphs(),
                                columnDescriptions=columnDescriptions)
        self.w.t = vanilla.TextBox((40, -53, -5, 20),
                                   "FontName",
                                   sizeStyle="small")
        self.w.clr = vanilla.ColorWell((10, -55, 20, 20),
                                       callback=self.cbColor,
                                       color=NSColor.redColor())
        self.update()
        self.w.open()
Exemplo n.º 3
0
    def Reload(self, sender=None):
        try:
            try:
                del self.w.List
            except:
                pass

            self.w.List = vanilla.List(
                (0, self.linePos, -0, -0),
                self.listContent(),
                columnDescriptions=self.getColumnHeaders(),
                drawVerticalLines=True,
                enableDelete=True,
                drawFocusRing=True,
                # selectionCallback = self.selectedAction,
                doubleClickCallback=self.openGlyphInFont,
                # editCallback = self.editAction,
            )

            self.w.List.getNSTableView().setToolTip_(
                "Double click to open the selected glyphs in all fonts. You can select more than one line."
            )
        except Exception as e:
            print("Reload Error: %s\n" % e)
            import traceback
            print(traceback.format_exc())
            return None
    def __init__(self):
        self.w = vanilla.FloatingWindow((250, 300),
                                        "Ramsay St. Settings",
                                        minSize=(250, 250),
                                        maxSize=(400, 700))

        self.w.showPreview = vanilla.CheckBox(
            (10, 10, -10, 22),
            "Show Preview",
            value=RamsayStData.showPreview,
            callback=self.showPreviewCallback)

        self.w.fillColorText = vanilla.TextBox((10, 40, 110, 22),
                                               "Fill Color:")
        self.w.fillColor = vanilla.ColorWell((10, 60, 110, 40),
                                             color=RamsayStData.fillColor,
                                             callback=self.fillColorCallback)

        self.w.strokeColorText = vanilla.TextBox((130, 40, -10, 22),
                                                 "Stroke Color:")
        self.w.strokeColor = vanilla.ColorWell(
            (130, 60, -10, 40),
            color=RamsayStData.strokeColor,
            callback=self.strokeColorCallback)

        items = RamsayStData.getItems()
        columnDescriptions = [
            dict(title="Glyph Name", key="glyphName"),
            dict(title="Left", key="left"),
            dict(title="Right", key="right"),
        ]

        self.w.dataList = vanilla.List((10, 110, -10, -40),
                                       items,
                                       columnDescriptions=columnDescriptions,
                                       editCallback=self.dataListEditCallback)

        segmentDescriptions = [dict(title="+"), dict(title="-")]
        self.w.addDel = vanilla.SegmentedButton((12, -30, 60, 20),
                                                segmentDescriptions,
                                                selectionStyle="momentary",
                                                callback=self.addDelCallback)
        self.w.addDel.getNSSegmentedButton().setSegmentStyle_(
            NSSegmentStyleSmallSquare)

        self.w.okButton = vanilla.Button((-70, -30, -15, 20),
                                         "Apply",
                                         callback=self.okCallback,
                                         sizeStyle="small")

        self.w.setDefaultButton(self.w.okButton)

        self.w.closeButton = vanilla.Button((-140, -30, -80, 20),
                                            "Cancel",
                                            callback=self.closeCallback,
                                            sizeStyle="small")
        self.w.closeButton.bind(".", ["command"])
        self.w.closeButton.bind(unichr(27), [])

        self.w.open()
Exemplo n.º 5
0
    def _build_ui(self):
        columnDescriptions = [
            {
                "title": "Delete",
                "cell": vanilla.CheckBoxListCell(),
                "width": 40
            },
            {
                "title": "Description",
                "typingSensitive": True,
                "editable": False,
                "width": 210
            },
            {
                "title": "Size",
                "typingSensitive": True,
                "editable": False,
                "width": 60
            },
            {
                "title": "Key",
                "typingSensitive": True,
                "editable": True,
                "width": 220
            },
            {
                "title": "Location",
                "typingSensitive": True,
                "editable": False,
                "width": 40
            },
        ]
        self._width = 640
        self._height = 300

        self.w = vanilla.Window((self._width, self._height), "UFO Cleaner",
                                (self._width, self._height))
        self.w.key_list = vanilla.List(
            (10, 9, -10, -40),
            self._libkeys,
            columnDescriptions=columnDescriptions,
            drawFocusRing=True,
            #editCallback=self._setDecompose,
            doubleClickCallback=self._open_sheet,
        )
        #self.w.xml = CodeEditor((10, -130, -10, -40), "", lexer="xml")

        self.w.total_size = vanilla.TextBox((10, -30, 240, 20), "")
        self._update_total_size_display()

        self.w.action_button = vanilla.Button(
            (-200, -30, -10, 20),
            "Delete checked items from UFO",
            callback=self._clean_ufo,
            sizeStyle="small",
        )

        self._sheet = False
        self.setUpBaseWindowBehavior()
        self.w.open()
Exemplo n.º 6
0
    def __init__(self):
        f = CurrentFont()
        if f is None:
            return
        if f.path is None:
            print("Save this font first!")
            return

        self.designSpaceModel = f.lib.get(self.designSpaceModelLibKey,
                                          "twobytwo")
        #print "self.designSpaceModel", self.designSpaceModel
        if self.designSpaceModel == "twobytwo":
            self.masterNames = [
                'narrow-thin', 'wide-thin', 'narrow-bold', 'wide-bold'
            ]
        elif self.designSpaceModel == "twobyone":
            self.masterNames = ['narrow-thin', 'wide-thin']
        rgbBlack = NSColor.colorWithDeviceRed_green_blue_alpha_(0, 0, 0, 1)
        rgbWhite = NSColor.colorWithDeviceRed_green_blue_alpha_(
            255, 255, 255, 1)
        self.shapeColor = rgbWhite
        self.backgroundColor = rgbBlack
        self.extrapolateMinValue = 0
        self.extrapolateMaxValue = 1
        self.w = vanilla.Window((500, 600),
                                "Responsive Lettering",
                                minSize=(300, 200))
        self.w.preview = HTMLView((0, 0, -0, -140))
        self.w.exportButton = vanilla.Button((-150, -30, -10, 20),
                                             "Export SVG",
                                             callback=self.cbExport)
        columnDescriptions = [
            dict(title="Glyphname", key="name", width=125),
            dict(title="Width", key="width", width=50),
            dict(title="Height", key="height", width=50),
            dict(title="Bounds?", key="bounds", width=75),
            dict(title="Contours", key="contours", width=50),
            dict(title="Points", key="points", width=50),
        ]
        self.w.l = vanilla.List((0, -140, -0, -40),
                                self.wrapGlyphs(),
                                columnDescriptions=columnDescriptions,
                                doubleClickCallback=self.callbackListClick)
        self.w.t = vanilla.TextBox((70, -27, -160, 20),
                                   "FontName",
                                   sizeStyle="small")
        self.w.backgroundColorWell = vanilla.ColorWell(
            (10, -30, 20, 20),
            callback=self.backgroundColorWellCallback,
            color=rgbBlack)
        self.w.shapeColorWell = vanilla.ColorWell(
            (35, -30, 20, 20),
            callback=self.shapeColorWellCallback,
            color=rgbWhite)

        self.w.bind("became main", self.windowBecameMainCallback)
        self.setColorsFromLib()
        self.update()
        self.w.open()
        self.cbMakePreview(None)
Exemplo n.º 7
0
    def __init__(self, fonts):
        self.fonts = fonts
        self.w = vanilla.Window((1200, 600), minSize=(100, 100))
        _, _, w_width, w_height = self.w.getPosSize()
        prev_height = w_height / 3
        self.w.allFontsGroup = vanilla.Group((0, 0, -0, prev_height))
        self.steps = len(self.fonts)
        step = w_width / self.steps
        for f_index, f in enumerate(self.fonts):
            x = step * f_index
            control = DrawPair((x, 0, step, -0))

            self.kern_list = list(f.kerning.keys())
            initial_pair = self.kern_list[0]
            kern_value = f.kerning.get(initial_pair, 0)
            repr_pair = get_repr_pair(f, initial_pair)
            repr_glyphs = [f[g_name] for g_name in repr_pair]
            control.setGlyphData_kerning(repr_glyphs, kern_value)

            setattr(self.w.allFontsGroup, 'pair_{}'.format(f_index), control)

        display_list = [', '.join(pair) for pair in self.kern_list]
        list_height = w_height - prev_height

        self.w.myList = vanilla.List(
            (0, -list_height, -0, -0),
            display_list,
            allowsMultipleSelection=False,
            selectionCallback=self.list_callback,
        )

        self.w.bind('resize', self.resize_callback)
        self.w.open()
    def __init__(self):
        self.fullMetadata = getExtensionDefault("%s.scriptMetadata" %
                                                KEYPREFIX,
                                                fallback={})
        if not len(self.fullMetadata.keys()):
            # "Restart" window
            self.w = vanilla.Window((500, 160), "Andy’s RoboFont Hacks")
            self.w.hr = vanilla.HorizontalLine((10, -50, -10, 1))
            self.w.restartText = vanilla.TextBox(
                (20, 20, -20, -45),
                text_Bold(
                    "Installed and updated.\nRestart RoboFont to refresh the list of my RoboFont hacks.\n\n    — Andy Clymer"
                ))
            self.w.okButton = vanilla.Button((-120, -35, 100, 20),
                                             "OK",
                                             callback=self.cancelCallback)
            self.w.open()

        else:
            # Full window
            self.w = vanilla.Window((750, 300), "Andy’s RoboFont Hacks")
            columnDescriptions = [{
                "title": "state",
                "width": 20,
                "cell": vanilla.CheckBoxListCell()
            }, {
                "title": "longName"
            }]
            self.w.scriptList = vanilla.List(
                (10, 10, 300, -60), [],
                allowsMultipleSelection=False,
                showColumnTitles=False,
                selectionCallback=self.listSelectionChanged,
                columnDescriptions=columnDescriptions)

            self.defaultTitle = "Andy’s RoboFont Hacks"
            self.defaultText = "A selection of extras that make RoboFont work the way I like it. \n\nEverything is optional, click on one of the names on the left for a description of what the add-on does. Select as many as you like by checking the box to the left of the name, and restart RoboFont to activate.\n\n    — Andy Clymer"
            self.w.descriptionBox = vanilla.Box((320, 10, -10, -60))
            self.w.descriptionBox.title = vanilla.TextBox((5, 5, -10, 25),
                                                          self.defaultTitle)
            self.w.descriptionBox.text = vanilla.TextBox((5, 38, -10, -10),
                                                         self.defaultText)
            #self.w.webView = WebView.alloc().initWithFrame_(((0, 0), (320, 1000)))
            #self.w.scroll = vanilla.ScrollView((320, 10, -10, -60), self.w.webView, hasHorizontalScroller=False, hasVerticalScroller=False)
            #self.w.webView.setMainFrameURL_(self.htmlPath)

            self.w.hr = vanilla.HorizontalLine((10, -50, -10, 1))
            self.w.changeNote = vanilla.TextBox(
                (20, -32, -230, 25),
                text_SmallGray("Any change will require restarting RoboFont."),
                sizeStyle="small")
            self.w.cancelButton = vanilla.Button((-230, -35, 100, 20),
                                                 "Cancel",
                                                 callback=self.cancelCallback)
            self.w.applyButton = vanilla.Button((-120, -35, 100, 20),
                                                "Apply",
                                                callback=self.applyCallback)
            self.populateList()
            self.w.open()
Exemplo n.º 9
0
    def __init__(self):
        # Window 'self.w':
        windowWidth = 600
        windowHeight = 200
        windowWidthResize = 1200  # user can resize width by this value
        windowHeightResize = 1200  # user can resize height by this value
        self.w = vanilla.Window(
            (windowWidth, windowHeight),  # default window size
            "Font Info Overview",  # window title
            minSize=(windowWidth, windowHeight),  # minimum size (for resizing)
            maxSize=(windowWidth + windowWidthResize, windowHeight +
                     windowHeightResize),  # maximum size (for resizing)
            autosaveName=
            "com.mekkablue.FontInfoOverview.mainwindow",  # stores last window position and size
        )

        # List:
        self.w.List = vanilla.List(
            (0, 0, -0, -45),
            self.listContent(),
            columnDescriptions=[{
                "title": kl[0],
                "key": kl[1],
                "editable": True,
                "width": kl[2]
            } for kl in keyList],
            drawVerticalLines=True,
            enableDelete=True,
            drawFocusRing=True,
            # selectionCallback = self.selectedAction,
            # doubleClickCallback = self.doubleclickedAction,
            editCallback=self.editAction)

        # Buttons:
        self.w.reloadButton = vanilla.Button(
            (-130 - 90 - 15, -35, -130 - 15 * 2, -15),
            "Reload",
            sizeStyle='regular',
            callback=self.Reload)
        self.w.applyButton = vanilla.Button((-130 - 15, -35, -15, -15),
                                            "Apply Changes",
                                            sizeStyle='regular',
                                            callback=self.Apply)
        # self.w.setDefaultButton( self.w.reloadButton )

        # Counter:
        self.w.changeCounter = vanilla.TextBox((15, -31, -250, 16),
                                               "Changes: -",
                                               sizeStyle='small')
        self.updateCounter()

        # open the window
        self.w.open()
        self.w.makeKey()
Exemplo n.º 10
0
 def __init__(self):
     width = 300
     
     # Main Window
     self.w = vanilla.Window((width, 400), "Glyph Proofer", minSize=(width, 300), maxSize=(width, 1000))
     
     # Add a drop-able font list
     columnDescriptions = [dict(title="path", formatter=UFOPathFormatter.alloc().init())]
     self.w.fontList = vanilla.List((15, 15, -15, -50), [], columnDescriptions=columnDescriptions, showColumnTitles=False, enableDelete=True, drawFocusRing=False, otherApplicationDropSettings=dict(type=NSFilenamesPboardType, operation=NSDragOperationCopy, callback=self.dropFontCallback))
     
     self.w.makePDFButton = vanilla.Button((-120, -37, -16, 20), "Generate PDF", callback=self.makePDFButtonCallback)
     self.setUpBaseWindowBehavior()
     self.w.open()
    def __init__(self):

        # Window 'self.w':
        windowWidth = 250
        windowHeight = 200
        windowWidthResize = 400  # user can resize width by this value
        windowHeightResize = 650  # user can resize height by this value
        self.w = vanilla.FloatingWindow(
            (windowWidth, windowHeight),  # default window size
            "Parameter Reporter",  # window title
            minSize=(windowWidth, windowHeight),  # minimum size (for resizing)
            maxSize=(windowWidth + windowWidthResize, windowHeight +
                     windowHeightResize),  # maximum size (for resizing)
            autosaveName=
            "com.mekkablue.ParameterReporter.mainwindow"  # stores last window position and size
        )

        # UI ELEMENTS:

        # Filter:
        self.w.filter = vanilla.EditText((10, 10, -10, 19),
                                         "",
                                         sizeStyle='small',
                                         callback=self.ParameterReporterMain)
        self.w.filter.getNSTextField().setToolTip_(
            "Type one or more search terms here. Use * as wildcard.")

        # Listing of Parameters:
        self.w.ParameterList = vanilla.List(
            (0, 40, -0, -0),
            dir(GSLayer),
            autohidesScrollers=False,
            drawVerticalLines=True,
            doubleClickCallback=self.copySelection,
            rowHeight=19,
        )
        self.w.ParameterList.getNSTableView().tableColumns()[0].setWidth_(501)
        self.w.ParameterList.getNSTableView().setToolTip_(
            "Double click an entry to copy the respective parameter into the clipboard."
        )

        # Load Settings:
        if not self.LoadPreferences():
            print(
                "Note: 'Parameter Reporter' could not load preferences. Will resort to defaults."
            )

        # Open window and focus on it:
        self.w.open()
        self.w.makeKey()
        self.ParameterReporterMain(None)
Exemplo n.º 12
0
	def __init__( self ):
		# Window 'self.w':
		windowWidth  = 280
		windowHeight = 190
		windowWidthResize  = 200 # user can resize width by this value
		windowHeightResize = 200   # user can resize height by this value
		self.w = vanilla.Window(
			(windowWidth, windowHeight), # default window size
			"Sort Instances", # window title
			minSize = ( windowWidth, windowHeight ), # minimum size (for resizing)
			maxSize = ( windowWidth + windowWidthResize, windowHeight + windowHeightResize ), # maximum size (for resizing)
			autosaveName = "com.harbortype.SortInstances.mainwindow" # stores last window position and size
		)
		
		# UI elements:
		linePos, inset, lineHeight = 12, 15, 22
		# self.w.text_1 = vanilla.TextBox( (inset-1, linePos+2, 75, 14), "inset", sizeStyle='small' )
		# linePos += lineHeight
		listValues = []
		for i, (tag, name) in enumerate(self.axes.items()):
			listValues.append({"Index": i, "Name": name, "Tag": tag})
		self.w.list_1 = vanilla.List((inset, linePos, -inset, -inset-20-inset),
			listValues,
			columnDescriptions=[
				{"title": "Index", "width": 40},
				{"title": "Tag",   "width": 60},
				{"title": "Name"}],
			allowsMultipleSelection = False,
			allowsEmptySelection = True,
			dragSettings=dict(type=genericListPboardType,
				operation = NSDragOperationMove,
				# allowDropBetweenRows = True,
				# allowDropOnRow = False,
				callback = self.dragCallback),
			selfDropSettings=dict(type=genericListPboardType,
				operation = NSDragOperationMove,
				allowDropBetweenRows = True,
				# allowDropOnRow = False,
				callback = self.selfDropCallback))
		linePos += lineHeight
		
		# Run Button:
		self.w.runButton = vanilla.Button( (-80-inset, -20-inset, -inset, -inset), "Sort", sizeStyle='regular', callback=self.Process )
		self.w.setDefaultButton( self.w.runButton )
		
		# Open window and focus on it:
		self.w.open()
		self.w.makeKey()
Exemplo n.º 13
0
 def fillSheet(self):
     self.w.namesCaption = vanilla.TextBox((5, 10, -10, 20), "Add these glyphs")
     self.w.markGlyphsCheck = vanilla.CheckBox((5, 40, 150, 20), "Mark new glyphs", value=True)
     self.w.selectGlyphsCheck = vanilla.CheckBox((5, 60, 150, 20), "Select new glyphs", value=True)
     cD = [
             {    'title': u"Unicode",
                  'key': 'value',
                  'width': 80},
             {    'title': u"Char",
                  'key': 'string',
                  'width': 60},
             {    'title': u"GNUFL Name",
                  'key': 'name',
                  'width': 200},
         ]
     self.w.proposedNames = vanilla.List((0, 90, 0, -50), [], columnDescriptions=cD)
    def __init__(self, items, message, title, showSearch=False):

        self.items = items

        self.w = _ModalWindow((350, 300), title)
        y = 10
        self.w.infoText = vanilla.TextBox((15, y, -15, 22), message)
        y += 25
        if showSearch:
            self.w.search = vanilla.SearchBox((15, y, -15, 22),
                                              callback=self.searchCallback)
            y += 25
        self.w.itemList = vanilla.List((15, y, -15, -40),
                                       self.items,
                                       allowsMultipleSelection=False)

        self.setUpBaseWindowBehavior()
        self.w.open()
Exemplo n.º 15
0
    def __init__( self ):

        global presets

        try:
            fd = codecs.open('MasterBlaster-presets.txt','r',encoding='utf-8')
            data = fd.read()
            presets = data.split("\n")
        except:    
            # if txt file doesn't load
            presets = [
                u"arrowroot,barley,chervil,dumpling,endive,flaxseed,garbanzo,hijiki,ishtu,jicama,kale,lychee,marjioram,nectarine,oxtail,pizza,quinoa,roquefort,squash,tofu,uppuma,vanilla,wheat,xergis,yogurt,zweiback",
                u"Arrowroot,Barley,Chervil,Dumpling,Endive,Flaxseed,Garbanzo,Hijiki,Ishtu,Jicama,Kale,Lychee,Marjioram,Nectarine,Oxtail,Pizza,Quinoa,Roquefort,Squash,Tofu,Uppuma,Vanilla,Wheat,Xergis,Yogurt,Zweiback",            
                u"ARROWROOT,BARLEY,CHERVIL,DUMPLING,ENDIVE,FLAXSEED,GARBANZO,HIJIKI,ISHTU,JICAMA,KALE,LYCHEE,MARJIORAM,NECTARINE,OXTAIL,PIZZA,QUINOA,ROQUEFORT,SQUASH,TOFU,UPPUMA,VANILLA,WHEAT,XERGIS,YOGURT,ZWEIBACK",
                "00000,00100,00200,00300,00400,00500,00600,00700,00800,00900"
                ]

        wlist = ""

        windowWidth = 340
        windowHeight = 380

        self.w = vanilla.FloatingWindow(
            ( windowWidth, windowHeight ), # default window size
            "MasterBlaster", # window title
            autosaveName = "com.LNP.MasterBlaster.mainwindow" # stores last window position and size
        )


        self.w.titleCustom = vanilla.TextBox((20, 15, -10, 17), "Comma separated list:")
        self.w.inputCustom = vanilla.EditText( (20, 45, 300, 20), "", sizeStyle = 'small')
        self.w.titlePreset = vanilla.TextBox((20, 75, -10, 17), "OR Select preset from local txt file:")
        self.w.presets = vanilla.List((20, 105, 305, 180), presets, doubleClickCallback=self.GoDblC, autohidesScrollers = False, allowsEmptySelection = True, showColumnTitles=True)
        self.w.radioGroup = vanilla.RadioGroup((20, 285, 250, 40),["Stacked", "Side-by-side"],isVertical = False, sizeStyle='regular')
        self.w.runButton = vanilla.Button((20, 330, 120, 30), "List as Masters", sizeStyle='regular', callback=self.GoButton )

        self.w.radioGroup.set(1)

        # Load Settings:
        if not self.LoadP():
            print("Could not load preferences. Will resort to defaults")

        self.w.open()
        self.w.makeKey()
    def __init__(self, connections):
        self.connections = connections
        columns = [{
            "title": x,
            "editable": x != "Left Glyph",
            "width": 40
        } for x in self.connections["colnames"]]
        columns[0]["width"] = 100
        self.w = vanilla.Window((950, 600), "Nastaliq Editor", closable=True)
        self.w.LeftLabel = vanilla.TextBox((-200, 10, 200, 17),
                                           "",
                                           alignment="center")
        self.w.LeftButton = vanilla.Button((-200, 30, 30, 17),
                                           "<",
                                           callback=self.decrement)
        self.w.RightLabel = vanilla.TextBox((-170, 30, 140, 17),
                                            "",
                                            alignment="center")
        self.w.RightButton = vanilla.Button((-30, 30, 30, 17),
                                            ">",
                                            callback=self.increment)
        self.w.myList = vanilla.List(
            (0, 0, -200, -0),
            self.connections["rows"],
            columnDescriptions=columns,
            editCallback=self.editCallback,
            menuCallback=self.menuCallback,
        )
        self.w.myList._clickTarget = VanillaCallbackWrapper(self.clickCallback)
        self.w.myList._tableView.setTarget_(self.w.myList._clickTarget)
        self.w.myList._tableView.setAction_("action:")

        self.w.CompileButton = vanilla.Button((-200, -20, 200, 17),
                                              "Compile",
                                              callback=self.compile)

        self.glyphView = GlyphView.alloc().init()
        self.glyphView.glyphs = []
        self.glyphView.setFrame_(((0, 0), (400, 400)))
        self.w.scrollView = vanilla.ScrollView((-200, 50, 200, 400),
                                               self.glyphView)
        self.selectedPair = None
        self.inAdd = False
        self.w.open()
 def __init__(self):
     self.w = vanilla.Window((170, 320), u"⌘C")
     self.w.l = vanilla.List((0, 0, 0, -120), self.sampleText)
     self.w.copyAsGlyphNames = vanilla.Button((2, -118, -2, 20),
                                              "names",
                                              self.click,
                                              sizeStyle="small")
     self.w.copyAsGlyphNames.tag = "names"
     self.w.copyAsGlyphNames.bind("1", [])
     self.w.copyAsGlyphNamesComma = vanilla.Button((2, -98, -2, 20),
                                                   "quoted names + comma",
                                                   self.click,
                                                   sizeStyle="small")
     self.w.copyAsGlyphNamesComma.tag = "comma"
     self.w.copyAsGlyphNamesComma.bind("2", [])
     self.w.copyAsSlashedNames = vanilla.Button((2, -78, -2, 20),
                                                "slash + name",
                                                self.click,
                                                sizeStyle="small")
     self.w.copyAsSlashedNames.tag = "slash"
     self.w.copyAsSlashedNames.bind("3", [])
     self.w.copyAsUnicode = vanilla.Button((2, -58, -2, 20),
                                           "Unicode text",
                                           self.click,
                                           sizeStyle="small")
     self.w.copyAsUnicode.tag = "unicode"
     self.w.copyAsUnicode.bind("4", [])
     self.w.copyAsFeatureGroup = vanilla.Button((2, -38, -2, 20),
                                                "feature group",
                                                self.click,
                                                sizeStyle="small")
     self.w.copyAsFeatureGroup.tag = "feature"
     self.w.copyAsFeatureGroup.bind("5", [])
     self.w.caption = vanilla.TextBox((6, -15, -5, 20),
                                      "Copy selected names to clipboard",
                                      sizeStyle="mini")
     self.setUpBaseWindowBehavior()
     self.w.bind("became main", self.update)
     self.w.bind("became key", self.update)
     self.update()
     self.w.open()
     self.w.l.setSelection([])
Exemplo n.º 18
0
 def __init__(self):
     
     columnDescriptions = [
         {"title": "Status",
         "width": 40},
         {"title": "Glyph",
         "typingSensitive": True,
         "editable": False},
     ]
     
     self.w = vanilla.FloatingWindow((180, 280), "RoboGit")
     y = 5
     self.w.showGlyphStatusButton = vanilla.Button((10, y , -10, 25), "Show glyph status",
         callback=self.checkGlyphStatus,
         sizeStyle="small",
     )
     y += 26
     self.w.clearGlyphStatusButton = vanilla.Button((10, y , -10, 25), "Clear glyph status",
         callback=self.uncheckGlyphStatus,
         sizeStyle="small",
     )
     y += 30
     self.w.glyphStatusList = vanilla.List((10, y, -10, -10),
         [], #self.fontAnchors.anchorGlyphs.keys(),
         columnDescriptions=columnDescriptions,
         #editCallback=self.updateMarkVisibility,
         doubleClickCallback=self.openGlyphDiffWindow,
         allowsMultipleSelection=True,
         allowsEmptySelection=False,
     )
     
     self.font = CurrentFont()
     
     self.w.clearGlyphStatusButton.enable(False)
     self.w.showGlyphStatusButton.enable(False)
     if self.fontIsVersioned():
         self.w.showGlyphStatusButton.enable(True)
     self.setUpBaseWindowBehavior()
     self.w.open()
Exemplo n.º 19
0
    def __init__(self):

        self.debug = False

        # List of theme data dictionaries
        self.themes = []
        # On launch: go ahead and start loading themes
        self.readThemePrefs()
        self.loadDefaultThemes()
        # On launch: hold aside current preferences for "undo"
        self.backupTheme = {}
        self.makeBackupTheme()
        # Build the list of theme names
        self.themeNames = []

        # Placeholder for the name edit sheet
        self.nameSheet = None

        mid = 280
        # The Vanilla window
        self.w = vanilla.Window((300, 560), "Theme Manager")
        # Theme list
        self.w.themeList = vanilla.List(
            (20, 20, mid - 20, 165),
            self.themeNames,
            selectionCallback=self.listSelectionCallback,
            doubleClickCallback=self.listDoubleClickCallback,
            allowsMultipleSelection=False)
        # Editing list
        extrasHeight = len(NONCOLORKEYS) * 25 + 5
        try:
            colorCell = RFColorCell.alloc().initWithDoubleClickCallback_(
                self.colorDoubleClickCallback)
        except:
            colorCell = RFColorCell.alloc().initWithDoubleClickCallack_(
                self.colorDoubleClickCallback)
        columnDescriptions = [
            dict(title="Color", key="color", cell=colorCell, width=90),
            dict(title="Attribute", key="name")
        ]
        self.w.editingList = vanilla.List(
            (mid + 20, 20, 480, -extrasHeight - 20), [],
            columnDescriptions=columnDescriptions,
            allowsEmptySelection=False,
            allowsMultipleSelection=False,
            enableTypingSensitivity=True,
            rowHeight=20,
            allowsSorting=False)
        # Extra values for editing
        self.w.editingExtras = vanilla.Group(
            (mid + 20, -extrasHeight - 10, -20, -20))
        for i, extra in enumerate(NONCOLORKEYS):
            extraKey, extraName, extraType = extra
            extraEditor = vanilla.EditText((20, i * 25, 50, 20),
                                           sizeStyle="small",
                                           callback=self.setThemeExtra)
            extraTitle = vanilla.TextBox((95, i * 25, -20, 20), extraName)
            setattr(self.w.editingExtras, extraKey, extraEditor)
            setattr(self.w.editingExtras, extraKey + "-title", extraTitle)
        # Buttons
        y = 200
        self.w.buttonNewTheme = vanilla.SquareButton(
            (20, y, 31, 25), "✚", callback=self.newThemeCallback)  # ⌫✕✖︎✗✘★✚
        self.w.buttonNewTheme.getNSButton().setToolTip_("New Theme")
        self.w.buttonRemoveTheme = vanilla.SquareButton(
            (50, y, 31, 25), "✘", callback=self.removeThemeCallback)  #✘+
        self.w.buttonRemoveTheme.getNSButton().setToolTip_("Remove Theme")
        self.w.buttonDuplicateTheme = vanilla.SquareButton(
            (80, y, 30, 25), "❏", callback=self.duplicateTheme)
        self.w.buttonDuplicateTheme.getNSButton().setToolTip_(
            "Duplicate Theme")
        self.w.buttonEditTheme = vanilla.SquareButton(
            (250, y, 30, 25), "✑", callback=self.editThemeCallback)
        self.w.buttonEditTheme.getNSButton().setToolTip_("Edit Theme")

        self.w.buttonImport = vanilla.SquareButton(
            (120, y, 61, 25), "Import", callback=self.importThemeCallback)
        self.w.buttonExport = vanilla.SquareButton(
            (180, y, 60, 25), "Export", callback=self.exportThemeCallback)

        self.w.buttonDuplicateTheme.enable(False)
        self.w.buttonRemoveTheme.enable(False)
        # Preview
        y += 40
        self.w.previewGlyphView = GlyphView((20, y, mid - 20, 270))
        self.w.previewGlyphView.setTheme(self.backupTheme)
        self.w.previewGlyphView.setShowOffCurvePoints(True)
        self.w.previewGlyphView.setShowBlues(True)
        # Apply theme
        y += 280
        self.w.applyButton = vanilla.SquareButton(
            (20, y, mid - 60, 25),
            "Apply theme",
            callback=self.applyThemeCallback)
        self.w.applyButton.enable(False)
        self.w.buttonUndo = vanilla.SquareButton(
            (mid - 30, y, 30, 25), "↩︎",
            callback=self.undoThemeCallback)  # ⤺⟲⎌
        self.w.buttonUndo.getNSButton().setToolTip_("Revert Theme")
        self.w.buttonUndo.enable(False)
        # Give the window a callback to call when the window closes
        self.w.bind("close", self.windowClosedCallback)

        # Open the window
        self.w.open()

        self.rebuildThemeList(setList=True)

        # Load the preview font
        previewFontPath = os.path.join(EXTENSIONBUNDLE.resourcesPath(),
                                       "GlyphPreview.ufo")
        previewFont = OpenFont(previewFontPath, showInterface=False)
        previewGlyph = previewFont["a"]
        self.w.previewGlyphView.set(previewGlyph.naked())
Exemplo n.º 20
0
    def __init__(self):

        self.fontList = []
        self.fontNames = []
        self.fontStems = []
        self.estimatedStems = None  # Estimated stem measurements for the resulting font

        # Glyph groups
        self.groups = []

        # Case info, normalized after editing
        self.normalizedInfo = {}
        self.dataNorms = {
            "scaleH": dict(default=100, dataType=float, scale=0.01),
            "scaleV": dict(default=100, dataType=float, scale=0.01),
            "interpH": dict(default=100, dataType=float, scale=0.01),
            "interpV": dict(default=100, dataType=float, scale=0.01),
            "tracking": dict(default=0, dataType=float, scale=1)
        }

        self.w = vanilla.Window((317, 700),
                                "Scale And Interpolate %s" % VERSION,
                                minSize=(317, 300),
                                maxSize=(317, 969),
                                autosaveName="ScaleAndInterp")  # 882 height

        self.g = vanilla.Group((0, 0, 300, 900))

        step = 10
        self.g.font0title = vanilla.TextBox((10, step, -10, 25),
                                            colorText("Lightest Master (0%)",
                                                      style="bold"))
        self.g.font0choice = vanilla.PopUpButton(
            (10, step + 20, -10, 25),
            self.fontNames,
            callback=self.fontChoiceChanged)
        step += 50
        self.g.font0stemTextUC = vanilla.TextBox((20, step, -10, 20), "")
        self.g.font0stemTextLC = vanilla.TextBox((20, step + 20, -10, 20), "")
        step += 50
        self.g.font1title = vanilla.TextBox((10, step, -10, 25),
                                            colorText("Heaviest Master (100%)",
                                                      style="bold"))
        self.g.font1choice = vanilla.PopUpButton(
            (10, step + 20, -10, 25),
            self.fontNames,
            callback=self.fontChoiceChanged)
        step += 50
        self.g.font1stemTextUC = vanilla.TextBox((20, step, -10, 20), "")
        self.g.font1stemTextLC = vanilla.TextBox((20, step + 20, -10, 20), "")
        step += 50

        self.g.hr1 = vanilla.HorizontalLine((10, step, -10, 1))

        step += 15
        self.g.capsTitle = vanilla.TextBox((10, step, -10, 25),
                                           colorText("Caps", style="bold"))
        step += 25
        self.g.ucGroups = vanilla.PopUpButton((10, step, -10, 25), [])
        step += 35
        columnDescriptions = [
            dict(title="Name"),
            dict(title="Value", editable=True, width=50)
        ]
        capInfo = [
            dict(Name="Scale Horizontal %", attr="scaleH", Value=100),
            dict(Name="Scale Vertical %", attr="scaleV", Value=100),
            dict(Name="Interpolate Horizontal %", attr="interpH", Value=100),
            dict(Name="Interpolate Vertical %", attr="interpV", Value=100),
            dict(Name="Units of tracking", attr="tracking", Value=0)
        ]
        self.g.ucInfo = vanilla.List((10, step, -10, 100),
                                     capInfo,
                                     columnDescriptions=columnDescriptions,
                                     showColumnTitles=False,
                                     editCallback=self.dataChanged)
        step += 110
        self.g.resultStemTextUC = vanilla.TextBox((20, step, -10, 20), "")
        step += 30

        self.g.lcTitle = vanilla.TextBox((10, step, -10, 25),
                                         colorText("Lowercase", style="bold"))
        step += 25
        self.g.lcGroups = vanilla.PopUpButton((10, step, -10, 25), [])
        step += 35
        lcInfo = [
            dict(Name="Scale Horizontal %", attr="scaleH", Value=100),
            dict(Name="Scale Vertical %", attr="scaleV", Value=100),
            dict(Name="Interpolate Horizontal %", attr="interpH", Value=100),
            dict(Name="Interpolate Vertical %", attr="interpV", Value=100),
            dict(Name="Units of tracking", attr="tracking", Value=0)
        ]
        self.g.lcInfo = vanilla.List((10, step, -10, 100),
                                     lcInfo,
                                     columnDescriptions=columnDescriptions,
                                     showColumnTitles=False,
                                     editCallback=self.dataChanged)
        step += 110
        self.g.resultStemTextLC = vanilla.TextBox((20, step, -10, 20), "")
        step += 30

        self.g.otherTitle = vanilla.TextBox((10, step, -10, 25),
                                            colorText("Other glyphs",
                                                      style="bold"))
        step += 25
        self.g.otherRadio = vanilla.RadioGroup((10, step, -10, 70), [
            "Copy from the lightest master",
            "Process at 50% of UC and LC settings", "Skip any other glyphs"
        ],
                                               callback=self.dataChanged)
        self.g.otherRadio.set(2)

        step += 80

        self.g.loadButton = vanilla.SquareButton((100, step, -10, 25),
                                                 "Load settings from UFO",
                                                 callback=self.loadSettings)
        step += 35

        self.g.hr2 = vanilla.HorizontalLine((10, step, -10, 1))
        step += 15
        self.g.skewBox = vanilla.CheckBox(
            (10, step, -10, 25), "Skew Italic glyphs upright before scaling")
        self.g.skewBox.set(True)
        step += 25
        self.g.infoBox = vanilla.CheckBox(
            (10, step, -10, 25), "Interpolate Font Info whenever possible")
        self.g.infoBox.set(True)
        step += 25
        self.g.scaleComponentBox = vanilla.CheckBox(
            (10, step, -10, 25), "Don’t scale component positions")
        self.g.scaleComponentBox.set(True)
        step += 25
        self.g.doKernBox = vanilla.CheckBox((10, step, -10, 25),
                                            "Process Kerning")
        self.g.doKernBox.set(True)
        step += 3
        self.g.testKernButton = vanilla.SquareButton(
            (135, step, -10, 25),
            "Compatibility Test",
            callback=self.kernCompatibilityTestCallback)

        #step += 40
        self.w.buildButton = vanilla.SquareButton(
            (10, -35, -10, 25), "Make Font", callback=self.makeFontCallback)

        # Add the group to a ScrollView
        view = self.g.getNSView()
        self.w.sv = vanilla.ScrollView(
            (0, 0, -0, -45),
            view,
            hasHorizontalScroller=False,
            hasVerticalScroller=True,
            autohidesScrollers=False,
            drawsBackground=False
        )  #backgroundColor=NSColor.windowBackgroundColor())

        # Update the font info before opening
        self.fontsChanged()
        self.dataChanged()

        addObserver(self, "fontsChanged", "fontDidOpen")
        addObserver(self, "fontsChanged", "newFontDidOpen")
        addObserver(self, "fontsChanged", "fontDidClose")
        self.w.bind("close", self.windowClosed)
        self.w.open()
Exemplo n.º 21
0
    def __init__(self, data, unicodeVersionString, versionString, joiningTypes=None):
        self.data = data
        self.dataByCategory = collectSearchCategories(data)
        if joiningTypes is None:
            self.joiningTypes = {}
        else:
            self.joiningTypes = joiningTypes
        self.catNames = sorted(self.dataByCategory.keys())
        self.currentSelection = []
        self._typing = False
        self.unicodeVersion = unicodeVersionString
        
        
        topRow = 80
        catWidth = 320

        self.w = vanilla.Window((1200, 500), 
            ("GlyphBrowser with %s and %s"%(self.unicodeVersion, versionString)), 
            minSize=(800, 500),
            autosaveName = "com.letterror.glyphBrowser.mainWindow",
            )
        columnDescriptions = [
            {    'title': u"",
                 'key': 'col1',
                 'width': 50},
            {    'title': u"",
                 'key': 'col2',
                 'width': 50},
            {    'title': "Categories, ranges, namelists",
                    'key': 'name'},
        ]
        self.w.catNames = vanilla.List((5, topRow, catWidth, -5), [],
            columnDescriptions=columnDescriptions,
            selectionCallback=self.callbackCatNameSelect)
        charWidth = 18
        imageCell = ImageMapImageCell.alloc().init()
        imageCell.setImages(joiningTypesimageMap)
        columnDescriptions = [
            {    'title': u"❡",
                 'key': 'nameinfont',
                 'width': charWidth,
                 },
            {    'title': "#",
                 'key': 'unicodeinfont',
                 'width': charWidth,
                 },

            {    'title': "GNUFL name",
                 'key': 'name',
                 'width': 200, },
            {    'title': "Unicode",
                 'key': 'uniHex',
                 'width': 50},
            {    'title': "Cat",
                 'key': 'category',
                 'width': 30},
            {    'title': "jT",
                 'key': 'joiningType',
                 'width': 50,
                 'cell':imageCell
                 },
            {    'title': "Char",
                 'key': 'string',
                 'width': 30},
            {    'title': "Unicode Description",
                 'key': 'uniName',
                     },
            ]
        self.w.searchBox = vanilla.SearchBox((-200, topRow, -5, 22), "", callback=self.callbackSearch)


        dropSettings = {
            'type': AppKit.NSFilenamesPboardType,
            'callback': self.callbackDropOnLocationList,
            'allowDropBetweenRows': False
        }
        if version >= "3.2":
            self.w.selectedNames = vanilla.List(
                (catWidth+10, topRow, -205, -5),
                [],
                columnDescriptions=columnDescriptions,
                selectionCallback=self.callbackGlyphNameSelect,
                otherApplicationDropSettings=dropSettings,
                menuCallback = self.namesMenu_buildMenu,
            )
        else:
            self.w.selectedNames = vanilla.List(
                (catWidth+10, topRow, -205, -5),
                [],
                columnDescriptions=columnDescriptions,
                selectionCallback=self.callbackGlyphNameSelect,
                otherApplicationDropSettings=dropSettings,
            )
        self.w.selectionUnicodeText = vanilla.EditText((0, 0, -0, topRow-5), placeholder=choice(glyphNameBrowserNames), callback=self.callbackEditUnicodeText)
        s = self.w.selectionUnicodeText.getNSTextField()
        s.setFocusRingType_(NSFocusRingTypeNone)

        self.w.selectionGlyphNames = vanilla.EditText((-200, topRow+28, -5, -300), "Selectable Glyph Names", sizeStyle="small")
        self.checkSampleSize()
        self.w.addGlyphPanelButton = vanilla.Button((-200, -65, -5, 20), "Add to Font", callback=self.callbackOpenGlyphSheet)
        self.w.toSpaceCenter = vanilla.Button((-200, -115, -5, 20), "To Spacecenter", callback = self.toSpaceCenter)
        self.w.lookupSelected = vanilla.Button((-200, -90, -5, 20), "Lookup", callback=self.callbackLookup)
        self.w.progress = vanilla.TextBox((-190, -35, -10, 40), "", sizeStyle="small")
        self.w.bind("became main", self.callbackWindowMain)
        self.w.setDefaultButton(self.w.addGlyphPanelButton)

        self.w.addGlyphPanelButton.enable(False)
        self.w.toSpaceCenter.enable(False)
        self.update()
        self.w.bind("close", self.windowClosing)
        self.w.open()
        self.w.catNames.setSelection([0])
Exemplo n.º 22
0
    def __init__(self, checkForUpdates=False, shouldLoad=True):

        self.w = vanilla.Window((600, 300), "Mechanic 2.0", minSize=(550, 200))

        # building toolbar
        self._toolbarSearch = vanilla.SearchBox((0, 0, 300, 0), callback=self.toolbarSearch)
        self._toolbarSearch.getNSSearchField().setFrame_(((0, 0), (300, 22)))

        toolbarItems = [
            dict(
                itemIdentifier="search",
                label="Search",
                view=self._toolbarSearch.getNSSearchField(),
            ),
            dict(itemIdentifier=NSToolbarFlexibleSpaceItemIdentifier),
            dict(
                itemIdentifier="settings",
                label="Settings",
                imageNamed="prefToolbarMisc",
                callback=self.toolbarSettings,
            ),
        ]

        self.w.addToolbar(toolbarIdentifier="MechanicToolbar", toolbarItems=toolbarItems, addStandardItems=False, displayMode="icon")

        # building extension list

        columnDescriptions = [
            dict(title="", key="extensionController", width=25, cell=MCExtensionCirleCell.alloc().init(), editable=False),
            dict(title="Extension", key="extensionController",
                cell=MCImageTextFieldCell.alloc().init(),
                formatter=MCExtensionDescriptionFormatter.alloc().init(),
                editable=False),
        ]

        self.w.extensionList = vanilla.List((0, 0, -0, -38),
            [],
            columnDescriptions=columnDescriptions,
            showColumnTitles=False,
            selectionCallback=self.extensionListSelectionCallback,
            doubleClickCallback=self.extensionListDoubleClickCallback,
            allowsMultipleSelection=True,
            rowHeight=39
        )

        self.w.checkForUpdates = vanilla.Button((10, -30, 160, 22), "Check For Updates", callback=self.checkForUpdatesCallback, sizeStyle="small")

        self.w.purchaseButton = vanilla.Button((10, -30, 100, 22), "Purchase", callback=self.purchaseCallback)
        self.w.installButton = vanilla.Button((10, -30, 100, 22), "Install", callback=self.installCallback)
        self.w.uninstallButton = vanilla.Button((10, -30, 120, 22), "Uninstall", callback=self.uninstallCallback)
        self.w.updateButton = vanilla.Button((10, -30, 110, 22), "Update", callback=self.updateCallback)
        allButtons = [self.w.purchaseButton, self.w.installButton, self.w.uninstallButton, self.w.updateButton]
        for button in allButtons:
            button.show(False)

        self.w.extensionList.setSelection([])
        self.w.open()

        # flags
        self._shouldCheckForUpdates = checkForUpdates
        self._didCheckForUpdates = False
        self._extensionRepositoryItemsLoaded = False
        self._extensionStoreItemsLoaded = False
        self._canLoadSingleExtensions = True

        # progress updaters
        self._progress = None

        self._wrappedItems = []
        self._extensionsToCheck = []
        self._numExtensionsChecked = 0
        self._extensionsToUpdate = []
        self._numExtensionsUpdated = 0
        self._iconURLs = set()
        self._iconURLsForVisibleRows = set()

        addObserver(self, 'extensionIconDidLoad', EXTENSION_ICON_DID_LOAD_EVENT_KEY)
        addObserver(self, 'extensionDidCheckForUpdates', EXTENSION_DID_CHECK_FOR_UPDATES_EVENT_KEY)
        addObserver(self, 'extensionDidRemoteInstall', EXTENSION_DID_REMOTE_INSTALL_EVENT_KEY)
        addObserver(self, 'extensionDidUninstall', EXTENSION_DID_UNINSTALL_EVENT_KEY)

        if shouldLoad:
            self.loadExtensions()
Exemplo n.º 23
0
    def __init__(self):

        edX = 40
        txX = 70
        sliderY = 18
        spX = 10
        windowWidth = 350
        windowHeight = 260
        windowWidthResize = 3000  # user can resize width by this value
        windowHeightResize = 3000  # user can resize height by this value
        self.w = vanilla.FloatingWindow(
            (windowWidth, windowHeight),  # default window size
            "Instance Slider",  # window title
            minSize=(windowWidth, windowHeight),  # minimum size (for resizing)
            maxSize=(windowWidth + windowWidthResize, windowHeight +
                     windowHeightResize),  # maximum size (for resizing)
            autosaveName=
            "com.Tosche.InstanceSlider.mainwindow"  # stores last window position and size
        )

        # UI elements:

        YOffset = 27
        self.w.add = vanilla.Button((6, -YOffset, 24, 20),
                                    "+",
                                    callback=self.addDelButtons)
        self.w.delete = vanilla.Button((34, -YOffset, 24, 20),
                                       u"–",
                                       callback=self.addDelButtons)
        self.w.revert = vanilla.Button((62, -YOffset, 60, 20),
                                       "Revert",
                                       callback=self.revert)

        LineHeight = 26
        YOffset += LineHeight

        if slider1Min != slider1Max:
            self.w.textY = vanilla.TextBox((spX, -YOffset, txX, 14),
                                           "WeightY",
                                           sizeStyle='small')
            self.w.checkY = vanilla.CheckBox(
                (txX - spX, -YOffset - 3, -10, 18),
                "",
                sizeStyle='small',
                callback=self.checkboxY,
                value=False)
            self.w.sliderY = vanilla.Slider(
                (spX + txX, -YOffset, -spX * 2 - edX, sliderY),
                minValue=slider1Min,
                maxValue=slider1Max,
                tickMarkCount=5,
                sizeStyle="small",
                callback=self.slide,
                continuous=True)
            self.w.editY = vanilla.EditText(
                (-spX - edX, -YOffset, edX, sliderY),
                "0",
                sizeStyle='small',
                callback=self.typeValue)
            YOffset += LineHeight

        if slider3Min != slider3Max:
            self.w.text3 = vanilla.TextBox((spX, -YOffset, txX, 14),
                                           "Custom",
                                           sizeStyle='small')
            self.w.slider3 = vanilla.Slider(
                (spX + txX, -YOffset, -spX * 2 - edX, sliderY),
                minValue=slider3Min,
                maxValue=slider3Max,
                tickMarkCount=5,
                sizeStyle="small",
                callback=self.slide,
                continuous=True)
            self.w.edit3 = vanilla.EditText(
                (-spX - edX, -YOffset, edX, sliderY),
                "0",
                sizeStyle='small',
                callback=self.typeValue)
            YOffset += LineHeight

        if slider2Min != slider2Max:
            self.w.text2 = vanilla.TextBox((spX, -YOffset, txX, 14),
                                           "Width",
                                           sizeStyle='small')
            self.w.slider2 = vanilla.Slider(
                (spX + txX, -YOffset, -spX * 2 - edX, sliderY),
                minValue=slider2Min,
                maxValue=slider2Max,
                tickMarkCount=5,
                sizeStyle="small",
                callback=self.slide,
                continuous=True)
            self.w.edit2 = vanilla.EditText(
                (-spX - edX, -YOffset, edX, sliderY),
                "0",
                sizeStyle='small',
                callback=self.typeValue)
            YOffset += LineHeight

        if slider1Min != slider1Max:
            self.w.text1 = vanilla.TextBox((spX, -YOffset, txX, 14),
                                           "Weight",
                                           sizeStyle='small')
            self.w.slider1 = vanilla.Slider(
                (spX + txX, -YOffset, -spX * 2 - edX, sliderY),
                minValue=slider1Min,
                maxValue=slider1Max,
                tickMarkCount=5,
                sizeStyle="small",
                callback=self.slide,
                continuous=True)
            self.w.edit1 = vanilla.EditText(
                (-spX - edX, -YOffset, edX, sliderY),
                "0",
                sizeStyle='small',
                callback=self.typeValue)
            YOffset += LineHeight

        self.w.list = vanilla.List((0, 0, -0, -(YOffset - 18)),
                                   insList,
                                   selectionCallback=self.listClick,
                                   allowsMultipleSelection=False,
                                   allowsEmptySelection=False,
                                   columnDescriptions=[{
                                       "title":
                                       "Instance",
                                       "width":
                                       self.w.getPosSize()[2] - 215
                                   }, {
                                       "title": "Weight",
                                       "width": 50
                                   }, {
                                       "title": "Width",
                                       "width": 50
                                   }, {
                                       "title": "Custom",
                                       "width": 50
                                   }, {
                                       "title": "WeightY",
                                       "width": 50
                                   }])
        self.w.list._nsObject.setBorderType_(NSNoBorder)
        tableView = self.w.list._tableView
        tableView.setAllowsColumnReordering_(False)
        tableView.unbind_(
            "sortDescriptors")  # Disables sorting by clicking the title bar
        tableView.tableColumns()[0].setResizingMask_(1)
        tableView.tableColumns()[1].setResizingMask_(0)
        tableView.tableColumns()[2].setResizingMask_(0)
        tableView.tableColumns()[3].setResizingMask_(0)
        # setResizingMask_() 0=Fixed, 1=Auto-Resizable (Not user-resizable). There may be more options?
        tableView.setColumnAutoresizingStyle_(5)
        # AutoresizingStyle:
        # 0 Disable table column autoresizing.
        # 1 Autoresize all columns by distributing space equally, simultaneously.
        # 2 Autoresize each table column sequentially, from the last auto-resizable column to the first auto-resizable column; proceed to the next column when the current column has reached its minimum or maximum size.
        # 3 Autoresize each table column sequentially, from the first auto-resizable column to the last auto-resizable column; proceed to the next column when the current column has reached its minimum or maximum size.
        # 4 Autoresize only the last table column. When that table column can no longer be resized, stop autoresizing. Normally you should use one of the sequential autoresizing modes instead.
        # 5 Autoresize only the first table column. When that table column can no longer be resized, stop autoresizing. Normally you should use one of the sequential autoresizing modes instead.

        self.w.line = vanilla.HorizontalLine((0, -(YOffset - 18), -0, 1))
        # Open window and focus on it:
        self.w.open()
        self.w.makeKey()

        # initialisation:
        # set the first instance in preview if there is an instance
        # set the slider and text
        # set preview area if closed
        # redraw
        uiList = self.w.list

        if len(font.instances) > 0:
            if not font.tabs:
                font.newTab("HALOGEN halogen 0123")
            if font.currentTab.previewHeight <= 1.0:
                font.currentTab.previewHeight = 150
            self.setupSliders(font.instances[0], uiList[0])
Exemplo n.º 24
0
    def __init__(self):
        self.mostImportantObjects = (
            "GSLayer",
            "GSAlignmentZone",
            "GSAnchor",
            "GSAnnotation",
            "GSApplication",
            "GSBackgroundImage",
            "GSClass",
            "GSComponent",
            "GSCustomParameter",
            "GSEditViewController",
            "GSGlyphEditView",
            "GSFeature",
            "GSFeaturePrefix",
            "GSFont",
            "GSFontMaster",
            "GSGlyph",
            "GSGlyphInfo",
            "GSGlyphsInfo",
            "GSGuideLine",
            "GSHint",
            "GSInstance",
            "GSNode",
            "GSPath",
            "GSPathSegment",
            "NSBezierPath",
            "NSColor",
            "NSAffineTransform",
            "NSAffineTransformStruct",
            "NSDate",
            "NSImage",
            "NSTextField",
            "NSComboBox",
            "NSPopUpButton",
            "NSButton",
            "FTPointArray",
            "Glyph_g_l_y_f",
            "GSProjectDocument",
        )

        # Window 'self.w':
        windowWidth = 250
        windowHeight = 200
        windowWidthResize = 400  # user can resize width by this value
        windowHeightResize = 650  # user can resize height by this value
        self.w = vanilla.FloatingWindow(
            (windowWidth, windowHeight),  # default window size
            "Method Reporter",  # window title
            minSize=(windowWidth, windowHeight),  # minimum size (for resizing)
            maxSize=(windowWidth + windowWidthResize, windowHeight +
                     windowHeightResize),  # maximum size (for resizing)
            autosaveName=
            "com.mekkablue.MethodReporter.mainwindow"  # stores last window position and size
        )

        # UI ELEMENTS:

        # Method Picker:
        self.w.objectPicker = vanilla.ComboBox(
            (10, 10, 120, 19),
            self.mostImportantObjects,
            sizeStyle='small',
            completes=True,
            continuous=False,
            callback=self.MethodReporterMain)
        self.w.objectPicker.set("GSLayer")
        self.w.objectPicker.getNSComboBox().setToolTip_(
            "Type a class name here. Names will autocomplete.")

        # Filter:
        self.w.text2 = vanilla.TextBox((140, 13, 35, 14),
                                       "Filter:",
                                       sizeStyle='small')
        self.w.filter = vanilla.EditText((180, 10, -10, 19),
                                         "",
                                         sizeStyle='small',
                                         callback=self.MethodReporterMain)
        self.w.filter.getNSTextField().setToolTip_(
            "Type one or more search terms here. Case is ignored. Use * as wildcard at beginning, middle or end of term. Multiple search terms are AND concatendated."
        )

        # Listing of methods:
        self.w.methodList = vanilla.List(
            (0, 40, -0, -0),
            self.methodList("GSLayer"),
            autohidesScrollers=False,
            drawVerticalLines=True,
            doubleClickCallback=self.copySelection,
            rowHeight=19,
        )
        self.w.methodList.getNSTableView().tableColumns()[0].setWidth_(501)
        self.w.methodList.getNSTableView().setToolTip_(
            "Double click an entry to copy it to the clipboard and display its help() in Macro Window."
        )

        # Load Settings:
        if not self.LoadPreferences():
            print(
                "Note: 'Method Reporter' could not load preferences. Will resort to defaults"
            )

        # Open window and focus on it:
        self.w.open()
        self.w.makeKey()
        self.MethodReporterMain(None)
    def __init__(self):
        self.fontAnchors = FontAnchors(CurrentFont())
        self.showPreview = getExtensionDefault(
            "%s.%s" % (extensionID, "preview"), True)
        nscolor = getDefaultColor("glyphViewPreviewFillColor")
        self.preview_color = (nscolor.redComponent(), nscolor.greenComponent(),
                              nscolor.blueComponent(),
                              nscolor.alphaComponent())

        columnDescriptions = [
            {
                "title": "Show",
                "cell": vanilla.CheckBoxListCell(),
                "width": 35
            },
            {
                "title": "Name",
                "typingSensitive": True,
                "editable": False
            },
        ]

        self.w = vanilla.FloatingWindow((170, 490),
                                        "Anchor Overlay",
                                        closable=False)

        y = 10
        self.w.showAnchors_label = vanilla.TextBox((10, y, -10, 20),
                                                   "Show anchors:",
                                                   sizeStyle="small")
        y += 25
        self.w.showAnchors = vanilla.List(
            (10, y, -10, 150),
            self.fontAnchors.getAnchorNames(),
            columnDescriptions=columnDescriptions,
            drawFocusRing=True,
            editCallback=self.updateAnchorVisibility,
            doubleClickCallback=self.selectGlyphsWithAnchorName,
            selectionCallback=self.updateAnchoredGlyphsList,
        )
        y += 160
        self.w.markAnchors_label = vanilla.TextBox((10, y, 150, 20),
                                                   "Show mark glyphs:",
                                                   sizeStyle="small")
        y += 25
        self.w.markAnchors = vanilla.List(
            (10, y, 150, 180),
            [],  #self.fontAnchors.anchorGlyphs.keys(),
            columnDescriptions=columnDescriptions,
            editCallback=self.updateMarkVisibility,
            doubleClickCallback=self.gotoGlyph,
            allowsMultipleSelection=False,
            allowsEmptySelection=False,
        )
        y += 188
        #self.w.drawPreview = vanilla.CheckBox((10, y, -10, -10), "Show in preview mode",
        #    callback=self.setShowPreview,
        #    value=self.showPreview,
        #    sizeStyle="small"
        #)

        #self.w.displayAnchors = vanilla.CheckBox((10, y+25, -10, -10), "Show anchors",
        #    callback=self.setShowAnchors,
        #    value=getGlyphViewDisplaySettings()["Anchors"],
        #    sizeStyle="small"
        #)

        y += 2
        self.w.alignAnchors_label = vanilla.TextBox((10, y, -10, -10),
                                                    "Align selected anchors:",
                                                    sizeStyle="small")

        y += 21
        self.w.centerXButton = vanilla.Button(
            (10, y, 72, 25),
            "Points X",
            callback=self.centerAnchorX,
            sizeStyle="small",
        )
        self.w.centerYButton = vanilla.Button(
            (88, y, 72, 25),
            "Points Y",
            callback=self.centerAnchorY,
            sizeStyle="small",
        )

        y += 26
        self.w.baselineButton = vanilla.Button(
            (10, y, 46, 25),
            "base",
            callback=self.moveAnchorBaseline,
            sizeStyle="small",
        )
        self.w.xheightButton = vanilla.Button(
            (62, y, 46, 25),
            "x",
            callback=self.moveAnchorXheight,
            sizeStyle="small",
        )
        self.w.capheightButton = vanilla.Button(
            (114, y, 46, 25),
            "cap",
            callback=self.moveAnchorCapheight,
            sizeStyle="small",
        )

        self.setUpBaseWindowBehavior()
        self.addObservers()

        self.w.showAnchors.setSelection([])
        self.w.open()
Exemplo n.º 26
0
    def __init__(self):
        edX = 40
        txX = 70
        sliderY = 18
        spX = 10
        axisX = 60
        windowWidth = 350
        windowHeight = 260
        windowWidthResize = 3000  # user can resize width by this value
        windowHeightResize = 3000  # user can resize height by this value
        self.w = vanilla.FloatingWindow(
            (windowWidth, windowHeight),  # default window size
            "Instance Slider",  # window title
            minSize=(windowWidth, windowHeight),  # minimum size (for resizing)
            maxSize=(windowWidth + windowWidthResize, windowHeight +
                     windowHeightResize),  # maximum size (for resizing)
            autosaveName=
            "com.Tosche.InstanceSlider.mainwindow"  # stores last window position and size
        )

        YOffset = 27
        self.w.add = vanilla.Button((6, -YOffset, 24, 20),
                                    "+",
                                    callback=self.addDelButtons)
        self.w.delete = vanilla.Button((34, -YOffset, 24, 20),
                                       "–",
                                       callback=self.addDelButtons)
        self.w.revert = vanilla.Button((62, -YOffset, 60, 20),
                                       "Revert",
                                       callback=self.revert)

        global av
        LineHeight = 26
        YOffset += LineHeight
        axisCount = len([v for v in av if v[0] != ""])

        self.w.textY = vanilla.TextBox((spX, -YOffset, txX, 14),
                                       "WeightY",
                                       sizeStyle='small')
        self.w.checkY = vanilla.CheckBox((txX - spX, -YOffset - 3, -10, 18),
                                         "",
                                         sizeStyle='small',
                                         callback=self.checkboxY,
                                         value=False)
        self.w.sliderY = vanilla.Slider(
            (spX + txX, -YOffset, -spX * 2 - edX, sliderY),
            minValue=av[0][1],
            maxValue=av[0][2],
            tickMarkCount=5,
            sizeStyle="small",
            callback=self.slide,
            continuous=True)
        self.w.editY = vanilla.EditText((-spX - edX, -YOffset, edX, sliderY),
                                        "0",
                                        sizeStyle='small',
                                        callback=self.typeValue)
        YOffset += LineHeight

        move = -LineHeight * 2

        move -= LineHeight if axisCount == 6 else 0
        self.w.text5 = vanilla.TextBox((spX, move, txX, 14),
                                       av[5][0],
                                       sizeStyle='small')
        self.w.slider5 = vanilla.Slider(
            (spX + txX, move, -spX * 2 - edX, sliderY),
            minValue=av[5][1],
            maxValue=av[5][2],
            tickMarkCount=5,
            sizeStyle="small",
            callback=self.slide,
            continuous=True)
        self.w.edit5 = vanilla.EditText((-spX - edX, move, edX, sliderY),
                                        "0",
                                        sizeStyle='small',
                                        callback=self.typeValue)

        move -= LineHeight if axisCount >= 5 else 0
        self.w.text4 = vanilla.TextBox((spX, move, txX, 14),
                                       av[4][0],
                                       sizeStyle='small')
        self.w.slider4 = vanilla.Slider(
            (spX + txX, move, -spX * 2 - edX, sliderY),
            minValue=av[4][1],
            maxValue=av[4][2],
            tickMarkCount=5,
            sizeStyle="small",
            callback=self.slide,
            continuous=True)
        self.w.edit4 = vanilla.EditText((-spX - edX, move, edX, sliderY),
                                        "0",
                                        sizeStyle='small',
                                        callback=self.typeValue)

        move -= LineHeight if axisCount >= 4 else 0
        self.w.text3 = vanilla.TextBox((spX, move, txX, 14),
                                       av[3][0],
                                       sizeStyle='small')
        self.w.slider3 = vanilla.Slider(
            (spX + txX, move, -spX * 2 - edX, sliderY),
            minValue=av[3][1],
            maxValue=av[3][2],
            tickMarkCount=5,
            sizeStyle="small",
            callback=self.slide,
            continuous=True)
        self.w.edit3 = vanilla.EditText((-spX - edX, move, edX, sliderY),
                                        "0",
                                        sizeStyle='small',
                                        callback=self.typeValue)

        move -= LineHeight if axisCount >= 3 else 0
        self.w.text2 = vanilla.TextBox((spX, move, txX, 14),
                                       av[2][0],
                                       sizeStyle='small')
        self.w.slider2 = vanilla.Slider(
            (spX + txX, move, -spX * 2 - edX, sliderY),
            minValue=av[2][1],
            maxValue=av[2][2],
            tickMarkCount=5,
            sizeStyle="small",
            callback=self.slide,
            continuous=True)
        self.w.edit2 = vanilla.EditText((-spX - edX, move, edX, sliderY),
                                        "0",
                                        sizeStyle='small',
                                        callback=self.typeValue)

        move -= LineHeight if axisCount >= 2 else 0
        self.w.text1 = vanilla.TextBox((spX, move, txX, 14),
                                       av[1][0],
                                       sizeStyle='small')
        self.w.slider1 = vanilla.Slider(
            (spX + txX, move, -spX * 2 - edX, sliderY),
            minValue=av[1][1],
            maxValue=av[1][2],
            tickMarkCount=5,
            sizeStyle="small",
            callback=self.slide,
            continuous=True)
        self.w.edit1 = vanilla.EditText((-spX - edX, move, edX, sliderY),
                                        "0",
                                        sizeStyle='small',
                                        callback=self.typeValue)

        move -= LineHeight if axisCount >= 1 else 0
        self.w.text0 = vanilla.TextBox((spX, move, txX, 14),
                                       av[0][0],
                                       sizeStyle='small')
        self.w.slider0 = vanilla.Slider(
            (spX + txX, move, -spX * 2 - edX, sliderY),
            minValue=av[0][1],
            maxValue=av[0][2],
            tickMarkCount=5,
            sizeStyle="small",
            callback=self.slide,
            continuous=True)
        self.w.edit0 = vanilla.EditText((-spX - edX, move, edX, sliderY),
                                        "0",
                                        sizeStyle='small',
                                        callback=self.typeValue)

        YOffset += LineHeight * axisCount

        av = [v for v in av if v[0] != ""]
        axisElements = [
            [self.w.text0, self.w.slider0, self.w.edit0],
            [self.w.text1, self.w.slider1, self.w.edit1],
            [self.w.text2, self.w.slider2, self.w.edit2],
            [self.w.text3, self.w.slider3, self.w.edit3],
            [self.w.text4, self.w.slider4, self.w.edit4],
            [self.w.text5, self.w.slider5, self.w.edit5],
        ]

        for els in axisElements[len(av):]:
            els[0].show(False)
            els[1].show(False)
            els[2].show(False)

        self.usedAxisElements = axisElements[:len(av)]

        # TODO: disable WeightY if Weight doesn't exist
        if "Weight" not in [a[0] for a in av]:
            self.w.checkY.enable(False)

        columnTitles = [{
            "title": "Instance",
            "width": self.w.getPosSize()[2] - axisX * (len(av) + 1)
        }]
        for i in range(len(av)):
            columnTitles += [{"title": av[i][0], "width": axisX}]

        self.w.list = vanilla.List((0, 0, -0, -(YOffset - 18)),
                                   insList,
                                   selectionCallback=self.listClick,
                                   allowsMultipleSelection=False,
                                   allowsEmptySelection=False,
                                   columnDescriptions=columnTitles)
        self.w.list._nsObject.setBorderType_(NSNoBorder)
        tableView = self.w.list._tableView
        tableView.setAllowsColumnReordering_(False)
        tableView.unbind_(
            "sortDescriptors")  # Disables sorting by clicking the title bar
        for i in range(len(av)):
            if i == 0:
                tableView.tableColumns()[i].setResizingMask_(1)
            else:
                tableView.tableColumns()[i].setResizingMask_(0)
            # setResizingMask_() 0=Fixed, 1=Auto-Resizable (Not user-resizable). There may be more options?

        tableView.setColumnAutoresizingStyle_(5)
        # AutoresizingStyle:
        # 0 Disable table column autoresizing.
        # 1 Autoresize all columns by distributing space equally, simultaneously.
        # 2 Autoresize each table column sequentially, from the last auto-resizable column to the first auto-resizable column; proceed to the next column when the current column has reached its minimum or maximum size.
        # 3 Autoresize each table column sequentially, from the first auto-resizable column to the last auto-resizable column; proceed to the next column when the current column has reached its minimum or maximum size.
        # 4 Autoresize only the last table column. When that table column can no longer be resized, stop autoresizing. Normally you should use one of the sequential autoresizing modes instead.
        # 5 Autoresize only the first table column. When that table column can no longer be resized, stop autoresizing. Normally you should use one of the sequential autoresizing modes instead.

        self.w.line = vanilla.HorizontalLine((0, -(YOffset - 18), -0, 1))
        self.w.open()
        self.w.makeKey()

        # initialisation:
        # set the first instance in preview if there is an instance
        # set the slider and text
        # set preview area if closed
        # redraw
        uiList = self.w.list

        if len(f.instances) > 0:
            if f.currentTab == None:
                f.newTab("HALOGEN halogen 0123")
            if f.currentTab.previewHeight <= 20.0:
                f.currentTab.previewHeight = 150
            self.setupSliders(0, uiList[0])
Exemplo n.º 27
0
def get_ui(window_controller, title):

    glyph_column_descriptions = [
        {
            "title": "Layers",
            "cell": vanilla.CheckBoxListCell(),
            "width": 35,
            "editable": False,
        },
        {
            "title": "Name",
            "typingSensitive": True,
            "editable": False,
        },
    ]

    layer_column_descriptions = [
        {
            "title": "Index",
            "key": "layer_index",
            "width": 45,
            "editable": True,
        },
        {
            "title": "ColorIndex",
            "key": "layer_color_index",
            "width": 45,
            "editable": True,
        },
        # {
        #     "title": "Color",
        #     "binding": "selectedValue",
        #     "cell": vanilla.PopUpButtonListCell([]),
        #     "width": 30,
        #     "editable": True,
        # },
        {
            "title": "Layer Glyph",
            "typingSensitive": True,
            "editable": True,
        },
    ]

    palette_column_descriptions = [
        {
            "title": "Index",
            # "cell": IntType, #TODO
            "width": 60,
            "typingSensitive": True,
        },
        {
            "title":
            "Color",
            "cell":
            RFColorCell.alloc().initWithDoubleClickCallback_(
                window_controller.paletteEditColorCell),
            "typingSensitive":
            False,
            "editable":
            False,
        },
    ]

    layer_drop_settings = {
        "type": NSColorPboardType,
        "allowDropBetweenRows": False,
        "allowDropOnRow": True,
        "callback": window_controller._callback_layer_drop,
    }

    col2 = int(round(window_width / 2))
    y = 10

    w = vanilla.Window((window_width, 496), "%s - RoboChrome" % title)
    w.preview = Canvas(
        (10, y, 320, 200),
        canvasSize=(318, 200),
        hasHorizontalScroller=False,
        hasVerticalScroller=False,
        delegate=window_controller,
    )
    w.paletteswitch = vanilla.PopUpButton(
        (340, y, -10, 20),
        [],
        callback=window_controller._paletteSwitchCallback,
    )
    w.colorpalette = vanilla.List(
        (340, y + 30, -10, 170),
        [],
        columnDescriptions=palette_column_descriptions,
        drawFocusRing=True,
        editCallback=window_controller.paletteEdit,
        selectionCallback=window_controller._callback_color_select_in_palette,
        allowsMultipleSelection=False,
        enableDelete=True,
    )
    w.addPalette = vanilla.GradientButton(
        (340, 215, 24, 24),
        imagePath="../resources/iconColorFontPalette.pdf",
        callback=window_controller.paletteDuplicate,
    )
    w.deletePalette = vanilla.GradientButton(
        (363, 215, 24, 24),
        imagePath="../resources/iconColorFontPaletteMinus.pdf",
        callback=window_controller.paletteDelete,
    )
    w.addColorToPalette = vanilla.GradientButton(
        (410, 215, 24, 24),
        imagePath="../resources/iconColorFontPlus.pdf",
        callback=window_controller.addColorToPalette,
    )
    y += 210
    w.glyph_list_label = vanilla.TextBox((10, y, 120, 20),
                                         "Glyphs with layers:",
                                         sizeStyle="small")
    w.glyph_list_search_box = vanilla.SearchBox(
        (118, y - 3, 114, 20),
        placeholder="Filter glyphs",
        callback=window_controller._callback_update_ui_glyph_list,
        sizeStyle="small",
    )
    w.colorChooser = vanilla.ColorWell(
        (240, y - 4, 40, 22),
        callback=window_controller._callback_color_changed_foreground,
        color=window_controller.color,
    )
    w.colorbgChooser = vanilla.ColorWell(
        (290, y - 4, 40, 22),
        color=window_controller.colorbg,
        callback=window_controller._callback_color_changed_background)
    w.colorPaletteColorChooser = vanilla.ColorWell(
        (450, y - 4, 40, 22),
        callback=window_controller._callback_color_changed_layer,
        color=window_controller.color,
    )
    y += 25
    w.glyph_list = vanilla.List(
        (10, y, col2 - 10, 150),
        [],
        columnDescriptions=glyph_column_descriptions,
        drawFocusRing=True,
        #editCallback=None,
        doubleClickCallback=window_controller._callback_goto_glyph,
        selectionCallback=window_controller._callback_ui_glyph_list_selection,
        allowsMultipleSelection=False,
    )
    w.layer_list = vanilla.List(
        (col2 + 10, y, -10, 150),
        [],
        columnDescriptions=layer_column_descriptions,
        drawFocusRing=True,
        editCallback=window_controller._callback_layer_edit,
        enableDelete=True,
        selectionCallback=window_controller._callback_layer_select,
        allowsMultipleSelection=False,
        otherApplicationDropSettings=layer_drop_settings,
    )
    y += 160
    w.show_only_glyphs_with_layers = vanilla.CheckBox(
        (10, y, 176, 20),
        "Show only glyphs with layers",
        callback=window_controller._callback_set_show_only_glyphs_with_layers,
        value=window_controller.show_only_glyphs_with_layers,
        sizeStyle="small")
    w.add_layer_button = vanilla.GradientButton(
        (col2 + 10, y - 10, 24, 24),
        imagePath="../resources/iconColorFontPlus.pdf",
        callback=window_controller._callback_layer_add,
    )
    # w.add_svg_button = vanilla.Button(
    #     (col2+43, y-10, 60, 24),
    #     "Add SVG",
    #     callback=window_controller._choose_svg_to_import,
    #     sizeStyle="small"
    # )
    y += 28
    w.selectButton = vanilla.Button(
        (10, y, col2 - 10, 20),
        "Select glyphs with layers",
        callback=window_controller._callback_select_glyphs_in_font_window,
    )
    w.auto_palette_button = vanilla.Button(
        (col2 + 10, y, 110, 20),
        "Mix palette",
        callback=window_controller._callback_auto_palette,
    )
    w.png_button = vanilla.Button(
        (380, y, 110, 20),
        "Export PNG",
        callback=window_controller._choose_png_to_export,
    )
    y += 31
    w.toggleSettingsButton = vanilla.Button(
        (10, y, 115, 20),
        "Settings...",
        callback=window_controller._callback_toggle_settings,
    )
    w.auto_layer_button = vanilla.Button(
        (135, y, 115, 20),
        "Auto layers",
        callback=window_controller._callback_auto_layers,
    )
    w.import_button = vanilla.Button(
        (col2 + 10, y, 110, 20),
        "Import font",
        callback=window_controller._choose_file_to_import,
    )
    w.export_button = vanilla.Button(
        (380, y, 110, 20),
        "Export to font",
        callback=window_controller._choose_file_to_export,
    )

    return w
Exemplo n.º 28
0
    def __init__(self):
        self.mostImportantObjects = [
            "GSLayer",
            "GSAlignmentZone",
            "GSAnchor",
            "GSAnnotation",
            "GSApplication",
            "GSBackgroundImage",
            "GSClass",
            "GSComponent",
            "GSCustomParameter",
            "GSEditViewController",
            "GSGlyphEditView",
            "GSFeature",
            "GSFeaturePrefix",
            "GSFont",
            "GSFontMaster",
            "GSGlyph",
            "GSGlyphInfo",
            "GSGuideLine",
            "GSHint",
            "GSInstance",
            "GSNode",
            "GSPath",
            "NSBezierPath",
            "NSColor",
            "NSAffineTransform",
            "NSAffineTransformStruct",
            "NSDate",
            "NSImage",
        ]

        # Window 'self.w':
        windowWidth = 250
        windowHeight = 200
        windowWidthResize = 400  # user can resize width by this value
        windowHeightResize = 650  # user can resize height by this value
        self.w = vanilla.FloatingWindow(
            (windowWidth, windowHeight),  # default window size
            "Method Reporter",  # window title
            minSize=(windowWidth, windowHeight),  # minimum size (for resizing)
            maxSize=(windowWidth + windowWidthResize, windowHeight +
                     windowHeightResize),  # maximum size (for resizing)
            autosaveName=
            "com.mekkablue.MethodReporter.mainwindow"  # stores last window position and size
        )

        # UI ELEMENTS:

        # Method Picker:
        self.w.objectPicker = vanilla.ComboBox(
            (10, 10, 120, 19),
            self.mostImportantObjects,
            sizeStyle='small',
            completes=True,
            continuous=False,
            callback=self.MethodReporterMain)
        self.w.objectPicker.set("GSLayer")

        # Filter:
        self.w.text2 = vanilla.TextBox((140, 13, 35, 14),
                                       "Filter:",
                                       sizeStyle='small')
        self.w.filter = vanilla.EditText((180, 10, -10, 19),
                                         "",
                                         sizeStyle='small',
                                         callback=self.MethodReporterMain)

        # Listing of methods:
        self.w.methodList = vanilla.List(
            (0, 40, -0, -0),
            dir(GSLayer),
            autohidesScrollers=False,
            drawVerticalLines=True,
            doubleClickCallback=self.copySelection,
            rowHeight=19,
        )
        self.w.methodList.getNSTableView().tableColumns()[0].setWidth_(501)

        # Load Settings:
        if not self.LoadPreferences():
            print "Note: 'Method Reporter' could not load preferences. Will resort to defaults"

        # Open window and focus on it:
        self.w.open()
        self.w.makeKey()
        self.MethodReporterMain(None)
    def __init__(self):
        self.listOfMasters = []
        self.updateListOfMasters()

        # Window settings
        windowWidth = 470
        windowHeight = 390

        # Values used when the window is rezied by the user
        #windowWidthResize  = 500
        #windowHeightResize = 10
        self.pageFormats = [
            "A0", "A0Landscape", "A1", "A1Landscape", "A2", "A2Landscape",
            "A3", "A3Landscape", "A4", "A4Landscape", "A4Small",
            "A4SmallLandscape", "A5", "A5Landscape", "B4", "B4Landscape", "B5",
            "B5Landscape", "Executive", "ExecutiveLandscape", "Folio",
            "FolioLandscape", "Ledger", "LedgerLandscape", "Legal",
            "LegalLandscape", "Letter", "LetterLandscape", "LetterSmall",
            "LetterSmallLandscape", "Quarto", "QuartoLandscape", "Statement",
            "StatementLandscape", "Tabloid", "TabloidLandscape"
        ]

        # Building window
        self.w = vanilla.FloatingWindow(
            (windowWidth, windowHeight),  # default window size
            "Build Character Set",  # window title
            #minSize = ( windowWidth, windowHeight ), # minimum size (for resizing)
            #maxSize = ( windowWidth + windowWidthResize, windowHeight + windowHeightResize ), # maximum size (for resizing)
        )

        # UI elements
        linePos, margin, lineHeight = 20, 15, 25
        columnLine = margin + 145

        # Description text
        self.w.descriptionText = vanilla.TextBox(
            (margin, linePos, -margin, 14),
            u"Select some glyphs and choose the instances you want to see in the character set.",
            sizeStyle='small',
            selectable=True)
        linePos += lineHeight * 1.5

        # Text + list of masters
        self.w.text_anchor = vanilla.TextBox((margin, linePos + 2, 200, 17),
                                             "Set the character set in:",
                                             sizeStyle='small')
        self.w.master2Use = vanilla.List(
            (margin + 180, linePos, -margin, 268),
            self.listOfMasterNames(),
            selectionCallback=self.getMaster,
            allowsMultipleSelection=True,
        )
        #print(self.w.master2Use.getSelection()
        self.w.master2Use.enable(onOff=True)
        linePos += lineHeight

        # All instances
        self.w.allMasters = vanilla.CheckBox(
            (margin * 2, linePos - 1, 200, 20),
            "All instances",
            value=False,
            sizeStyle='small',
            callback=self.buttonCheck)
        linePos += lineHeight * 1.8

        self.w.line = vanilla.HorizontalLine(
            (margin, linePos - 10, columnLine, 1))
        linePos += lineHeight * .05

        # Number of columns
        self.w.colNumberLabel = vanilla.TextBox((margin, linePos + 3, 200, 17),
                                                "Number of columns:",
                                                sizeStyle='small')
        self.w.colNumberEdit = vanilla.EditText(
            (margin + 115, linePos, margin + 30, 20), "20", sizeStyle='small')
        linePos += lineHeight

        self.w.line2 = vanilla.HorizontalLine(
            (margin, linePos + 7, columnLine, 1))
        linePos += lineHeight * 0.8

        # Page format Pop-up
        self.w.pageFormatText = vanilla.TextBox((margin, linePos, 200, 17),
                                                "Page format:",
                                                sizeStyle='small')
        linePos += lineHeight
        self.w.pageFormat = vanilla.PopUpButton(
            (margin, linePos - 2, columnLine, 20),
            self.pageFormats,
            callback=self.popupFormat)

        # Default value to A4
        self.w.pageFormat.set(8)
        linePos += lineHeight

        self.w.line3 = vanilla.HorizontalLine(
            (margin, linePos + 7, columnLine, 1))
        linePos += lineHeight - 1

        # Enable/Disable grid
        self.w.rectangle = vanilla.CheckBox((margin, linePos - 5, 200, 20),
                                            "Grid",
                                            value=False,
                                            sizeStyle='small')
        self.w.rectangle.getNSButton().setToolTip_(
            "Enable or disable rectangle around each glyph.")

        linePos += lineHeight

        self.w.line4 = vanilla.HorizontalLine(
            (margin, linePos + 3, columnLine, 1))
        linePos += lineHeight

        # Enable/Disable text
        self.w.glyphText = vanilla.CheckBox((margin, linePos - 5, 200, 20),
                                            "Name & Unicode",
                                            value=False,
                                            sizeStyle='small')
        self.w.glyphText.getNSButton().setToolTip_(
            "If activated, prints each glyph's Name and Unicode value.")

        #print("Text",self.w.glyphText.get())
        linePos += lineHeight

        # Generate button
        self.w.buildChar = vanilla.Button((margin + 180, windowHeight * .83,
                                           -margin, margin + lineHeight * 2),
                                          "Generate",
                                          sizeStyle='small',
                                          callback=self.buildCharacterSet)

        # Opening the window
        self.w.open()
        self.w.makeKey()
Exemplo n.º 30
0
	def __init__( self ):
		windowWidth  = 600
		windowHeight = 260
		self.w = vanilla.FloatingWindow(
			( windowWidth, windowHeight ), # default window size
			"BubbleKern", # window title
			minSize = ( windowWidth, windowHeight ), # minimum size (for resizing)
			autosaveName = "com.Tosche.BubbleKern.mainwindow" # stores last window position and size
		)

		self.w.tabs = vanilla.Tabs((spX, spY, -spX, -spY*2-btnY), ["Pair List Builder", "Flat Text"])
		tab0 = self.w.tabs[0]
		tab0.options = vanilla.PopUpButton((spX, 0, 200, btnY), tab0options, callback=self.optionTasks )
		tab0.options._nsObject.menu().setAutoenablesItems_(False)
		emptyPermutation = [{" ":"", "Left":"", "Right":"", "Add Flipped":"", "Pair Count":"0" }]
		GroupColumnWidth = int((self.w.getPosSize()[2]-180-spX*5-prevX)/2+1)
		tab0.permList = vanilla.List((spX, spY+btnY, -prevX-spX*2, -spY*3), emptyPermutation,
			columnDescriptions=[
				{"title":" ", "width":20},
				{"title":"Left", "width":GroupColumnWidth},
				{"title":"Right", "width":GroupColumnWidth},
				{"title":"Add Flipped","cell":vanilla.CheckBoxListCell(), "width":70},
				{"title":"Pair Count", "width":90}
			],
		#	dragSettings = dict( type=NSString, callback=self.dragCallback ), # WHY DOES THIS THING NOT WORK?
			selfDropSettings=dict(type=toolOrderDragType, operation=NSDragOperationMove, callback=self.dropListSelfCallback),
			allowsMultipleSelection = False,
			selectionCallback = self.permListSelected,
			doubleClickCallback= self.permListDoubleClick,
		)

		tableView = tab0.permList._tableView
		tableView.setAllowsColumnReordering_(False)
		tableView.unbind_("sortDescriptors") # Disables sorting by clicking the title bar
		tableView.tableColumns()[0].setResizingMask_(0)
		tableView.tableColumns()[1].setResizingMask_(1)
		tableView.tableColumns()[2].setResizingMask_(1)
		tableView.tableColumns()[3].setResizingMask_(0)
		tableView.tableColumns()[4].setResizingMask_(0)
		tableView.setColumnAutoresizingStyle_(1)
# setResizingMask_() 0=Fixed, 1=Auto-Resizable (Not user-resizable). There may be more options?
# setColumnAutoresizingStyle accepts value from 0 to 5.
# For detail,see: http://api.monobjc.net/html/T_Monobjc_AppKit_NSTableViewColumnAutoresizingStyle.htm

		tab0.sectionPreview = vanilla.TextBox((-prevX-spX, spY+btnY-2, -spX, txY), "Section Preview", sizeStyle = "small")
		tab0.preview = vanilla.TextEditor((-prevX-spX, spY+btnY+txY, -spX, -spY*3), "", readOnly=True)
		tab0.preview._textView.setFont_( Menlo12 )
		tab0.total = vanilla.TextBox((-prevX-spX*2-75, -spY-txY, 100, txY), "", sizeStyle = "small")
		# Add & Delete Buttons:
		tab0.add = vanilla.SquareButton((spX, -spY*3-1, 30, 20), "+", sizeStyle = 'regular', callback=self.addButton)
		tab0.delete = vanilla.SquareButton((spX+29, -spY*3-1, 30, 20), u"–", sizeStyle = 'regular', callback=self.delButton)

		tab1 = self.w.tabs[1]
		tab1.loadButton = vanilla.Button((spX, 0, 160, btnY), "Load a Text File", callback=self.loadFile)

		tab1.flatPairs = vanilla.TextEditor((spX, spY+btnY, -spX, -spY*3), "", callback=self.refreshPairNum)
		tab1.flatPairs._textView.setFont_( Menlo12 )
		tab1.pairNum = vanilla.TextBox((10, -spY-txY, -10, txY), "", sizeStyle = "small")

		self.w.allButton = vanilla.Button((-spX*2-btnX*2-60, -btnY-spY, btnX, btnY), "Kern All Pairs", sizeStyle='regular', callback=self.BubbleKernMain)
		self.w.selButton = vanilla.Button((-spX-btnX-60, -btnY-spY, btnX+60, btnY), "Kern Pairs with Selected Glyphs", sizeStyle='regular', callback=self.BubbleKernMain )

		# Load Settings:
		if not self.LoadPreferences():
			print "Note: 'BubbleKern' could not load preferences. Will resort to defaults"

		self.refreshTotal()
		self.refreshSectionPreview(0)
		self.refreshPairNum(self.w)
		# Open window and focus on it:
		self.w.open()
		self.w.makeKey()