-
-
Save ryanbugden/a6f152e995c875ebe599d3b0370a8d05 to your computer and use it in GitHub Desktop.
Run this script to toggle between some typical desirable cutoff positions. (RF4)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # menuTitle : Toggle SpaceCenter Cut-Off PosSize | |
| # shortCut : control + c | |
| from mojo.UI import getDefault, setDefault | |
| from lib.tools.notifications import PostNotification | |
| f = CurrentFont() | |
| # list of all start and end points you'd want to toggle between | |
| positions = [ | |
| (0, 'xHeight'), | |
| (0, f.info.capHeight), | |
| (0, f.info.ascender), | |
| (f.info.descender, 0), | |
| (f.info.descender, 'xHeight'), | |
| (f.info.descender, f.info.capHeight), | |
| (f.info.descender, f.info.ascender) | |
| ] | |
| positions.reverse() | |
| curr_pos = (getDefault('spaceCenterCutOffStartPosition'), getDefault('spaceCenterCutOffEndPosition')) | |
| hits = 0 # checking to see if the current cut-off is ANY of those above | |
| for pos_i in range(len(positions)): | |
| if curr_pos == positions[pos_i]: | |
| setDefault('spaceCenterCutOffStartPosition', positions[pos_i-1][0]) | |
| setDefault('spaceCenterCutOffEndPosition', positions[pos_i-1][1]) | |
| PostNotification("doodle.preferencesChanged") | |
| hits += 1 | |
| # ... because if not, it will start at the beginning of the list | |
| if hits == 0: | |
| setDefault('spaceCenterCutOffStartPosition', positions[0][0]) | |
| setDefault('spaceCenterCutOffEndPosition', positions[0][1]) | |
| PostNotification("doodle.preferencesChanged") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment