def __init__( self ): # Window 'self.w': windowWidth = 300 windowHeight = 170 windowWidthResize = 500 # user can resize width by this value windowHeightResize = 0 # user can resize height by this value self.w = vanilla.FloatingWindow( ( windowWidth, windowHeight ), # default window size "Position Clicker", # window title minSize = ( windowWidth, windowHeight ), # minimum size (for resizing) maxSize = ( windowWidth + windowWidthResize, windowHeight + windowHeightResize ), # maximum size (for resizing) autosaveName = "com.mekkablue.PositionClicker.mainwindow" # stores last window position and size ) # UI elements: linePos, inset, lineHeight, indent = 12, 15, 22, 100 self.w.descriptionText = vanilla.TextBox( (inset, linePos, -inset, 14), "Report positional combos that do not click:", sizeStyle='small', selectable=True ) self.w.descriptionText.getNSTextField().setToolTip_("Clicking means that when two matching positional shapes follow each other (e.g. initial and final), they ‘click’, i.e., they share at least 2 point coordinates. Or whatever number is set in the minimal node count setting below.") linePos += lineHeight tooltip = "Reference glyph. Pick a medial glyph with paths for clicking. We recommend behDotless-ar.medi." self.w.referenceText = vanilla.TextBox( (inset, linePos+2, indent, 14), "Click with glyph", sizeStyle='small', selectable=True ) self.w.referenceText.getNSTextField().setToolTip_(tooltip) self.w.referenceGlyphName = vanilla.ComboBox( (inset+indent, linePos-4, -inset-23, 25), self.getAllMediGlyphNames(), callback=self.SavePreferences, sizeStyle='regular' ) self.w.referenceGlyphName.getNSComboBox().setFont_(NSFont.userFixedPitchFontOfSize_(11)) self.w.referenceGlyphName.getNSComboBox().setToolTip_(tooltip) self.w.updateButton = vanilla.SquareButton( (-inset-20, linePos-1, -inset, 18), "↺", sizeStyle='small', callback=self.updateReferenceGlyphs ) self.w.updateButton.getNSButton().setToolTip_("Update the list in the combo box with all .medi glyphs in the frontmost font.") linePos += lineHeight tooltip = "The amount of point coordinates that must be shared between two consecutive positional forms. E.g., if set to 2, an initial and a final shape must have two or more nodes exactly on top of each other when they follow each other." self.w.clickCountText = vanilla.TextBox( (inset, linePos+2, indent, 14), "Minimal node count", sizeStyle='small', selectable=True ) self.w.clickCount = vanilla.EditText( (inset+indent, linePos-1, -inset, 19), "2", callback=self.SavePreferences, sizeStyle='small' ) linePos += lineHeight self.w.includeNonExporting = vanilla.CheckBox( (inset, linePos-1, -inset, 20), "Include non-exporting glyphs", value=False, callback=self.SavePreferences, sizeStyle='small' ) self.w.includeNonExporting.getNSButton().setToolTip_("Will also measure glyphs that are set to not export.") linePos += lineHeight self.w.reuseTab = vanilla.CheckBox( (inset, linePos-1, -inset, 20), "Reuse current tab", value=False, callback=self.SavePreferences, sizeStyle='small' ) self.w.reuseTab.getNSButton().setToolTip_("Will use the current tab for output. Will open a new tab only if there is no Edit tab open already.") linePos += lineHeight # Run Button: self.w.runButton = vanilla.Button( (-100-inset, -20-inset, -inset, -inset), "Open Tab", sizeStyle='regular', callback=self.PositionClickerMain ) self.w.setDefaultButton( self.w.runButton ) # Load Settings: if not self.LoadPreferences(): print("Note: 'Position Clicker' could not load preferences. Will resort to defaults") # Open window and focus on it: self.w.open() self.w.makeKey()
def init(self): self = super(PyInterpreter, self).init() if self is None: return None self._font = NSFont.userFixedPitchFontOfSize_(10) self._historyLength = 50 self._history = [u""] self._historyView = 0 self._characterIndexForInput = 0 self._stdin = PseudoUTF8Input(self._nestedRunLoopReaderUntilEOLchars_) self._stderr = PseudoUTF8Output(self.writeStderr_) self._stdout = PseudoUTF8Output(self.writeStdout_) self._isInteracting = False self._console = AsyncInteractiveConsole() self._interp = self._console.asyncinteract(write=self.writeCode_).next self._autoscroll = True return self
def __init__(self): # Window 'self.w': windowWidth = 250 windowHeight = 200 windowWidthResize = 800 # user can resize width by this value windowHeightResize = 800 # user can resize height by this value self.w = vanilla.FloatingWindow( (windowWidth, windowHeight), # default window size "Rename Glyphs", # window title minSize=(windowWidth, windowHeight), # minimum size (for resizing) maxSize=(windowWidth + windowWidthResize, windowHeight + windowHeightResize), # maximum size (for resizing) autosaveName= "com.mekkablue.RenameGlyphs.mainwindow" # stores last window position and size ) # UI elements: self.w.text_1 = vanilla.TextBox((10, 12 + 2, -10, 14), "Add lines like oldname=newname:", sizeStyle='small') self.w.renameList = vanilla.TextEditor((1, 40, -1, -40), "oldname=newname", callback=self.SavePreferences) self.w.renameList.getNSTextView().setFont_( NSFont.userFixedPitchFontOfSize_(-1.0)) self.w.renameList.getNSTextView().turnOffLigatures_(1) self.w.renameList.getNSTextView().useStandardLigatures_(0) self.w.renameList.selectAll() # Run Button: self.w.runButton = vanilla.Button((-100, -35, -15, -15), "Rename", sizeStyle='regular', callback=self.RenameGlyphsMain) #self.w.setDefaultButton( self.w.runButton ) # Load Settings: if not self.LoadPreferences(): print( "Note: 'Rename Glyphs' could not load preferences. Will resort to defaults" ) # Open window and focus on it: self.w.open() self.w.makeKey()
def __init__( self ): # Window 'self.w': windowWidth = 350 windowHeight = 110 windowWidthResize = 500 # user can resize width by this value windowHeightResize = 0 # user can resize height by this value self.w = vanilla.FloatingWindow( ( windowWidth, windowHeight ), # default window size "Set Hidden App Preferences", # window title minSize = ( windowWidth, windowHeight ), # minimum size (for resizing) maxSize = ( windowWidth + windowWidthResize, windowHeight + windowHeightResize ), # maximum size (for resizing) autosaveName = "com.mekkablue.SetHiddenAppPreferences.mainwindow" # stores last window position and size ) # UI elements: linePos, inset, lineHeight = 8, 12, 22 self.w.descriptionText = vanilla.TextBox( (inset, linePos+2, -inset, 14), "Choose and apply the app defaults:", sizeStyle='small', selectable=True ) linePos += lineHeight self.w.pref = vanilla.ComboBox( (inset, linePos-2, -inset-100, 25), self.prefs, callback=self.SavePreferences, sizeStyle='regular' ) self.w.pref.getNSComboBox().setFont_(NSFont.userFixedPitchFontOfSize_(11)) self.w.pref.getNSComboBox().setToolTip_("Pick an app default from the list, or type in an identifier.") self.w.prefValue = vanilla.EditText( (-inset-90, linePos, -inset, 21), "", sizeStyle='regular' ) self.w.prefValue.getNSTextField().setToolTip_("Enter a value for the chosen app default.") linePos += lineHeight # Run Button: self.w.delButton = vanilla.Button( (-170-inset, -20-inset, -90-inset, -inset), "Reset", sizeStyle='regular', callback=self.SetHiddenAppPreferencesMain ) self.w.delButton.getNSButton().setToolTip_("Will delete the setting, effectively resetting it to its default.") self.w.runButton = vanilla.Button( (-80-inset, -20-inset, -inset, -inset), "Apply", sizeStyle='regular', callback=self.SetHiddenAppPreferencesMain ) self.w.runButton.getNSButton().setToolTip_("Sets the entered value for the chosen app default.") self.w.setDefaultButton( self.w.runButton ) # Load Settings: if not self.LoadPreferences(): print("Note: 'Set Hidden App Preferences' could not load preferences. Will resort to defaults") # Open window and focus on it: self.w.open() self.w.makeKey()
def __init__(self): self.alphabetSet = alphabetSetLower # set up window self.w = vanilla.Window((420, 150), "Pangrammer Helper") # set up remaining letters display self.w.alphabet = vanilla.TextBox((15, 15, -15, 20), self.alphabetSet) # set up text field, inserting Space Center text if available if CurrentSpaceCenter() is None: pangram = "Type your pangram here" else: sp = CurrentSpaceCenter() pangram = sp.getRaw() self.w.pangramEditor = vanilla.TextEditor( (15, 40, -15, 70), pangram, callback=self.textEditorCallback) self.w.counter = vanilla.TextBox((-250, 112, -15, 20), "Pangram length: 0", alignment='right') self.w.checkBox = vanilla.CheckBox((15, 110, -15, 20), "", callback=self.checkBoxCallback, value=False) self.w.checkBoxLabel = vanilla.TextBox( # don’t know how to access the NSText of a Vanilla check box label (32, 112, -15, 20), "Mixed case") # set the editor font to be monospaced, and the rest to be system font monospace_font = NSFont.userFixedPitchFontOfSize_(12) system_font = NSFont.systemFontOfSize_(12) self.w.pangramEditor.getNSTextView().setFont_(monospace_font) self.w.alphabet.getNSTextField().setFont_(system_font) self.w.counter.getNSTextField().setFont_(system_font) self.w.checkBoxLabel.getNSTextField().setFont_(system_font) self.w.open() # set remaining letters and counter to reflect contents of text field self.textEditorCallback(self)
def init(self): self = super().init() if self is None: return None self._font = NSFont.userFixedPitchFontOfSize_(10) self._historyLength = 50 self._history = [''] self._historyView = 0 self._characterIndexForInput = 0 self._stdin = PseudoUTF8Input(self._nestedRunLoopReaderUntilEOLchars_) self._stderr = PseudoUTF8Output(self.writeStderr_) self._stdout = PseudoUTF8Output(self.writeStdout_) self._isInteracting = False self._console = AsyncInteractiveConsole() self._interp = self._console.asyncinteract( write=self.writeCode_, banner="Python %s in %s\n%s\n" % ( sys.version, NSBundle.mainBundle().objectForInfoDictionaryKey_('CFBundleName'), 'Type "help", "copyright", "credits" or "license" for more information.' ) ).__next__ self._autoscroll = True return self