Пример #1
0
 def __init__(self):
     self.get_font()
     # window
     self.title = 'layers'
     self.height = self.button_height + (self.padding_y*3) + (self.text_height*8)
     self.w = HUDFloatingWindow((self.width, self.height), self.title)
     x = self.padding_x
     y = self.padding_y
     self.w.layers = List(
                 (x, y,
                 -self.padding_x,
                 self.text_height*8),
                 self.layers)
     y += self.padding_y + self.text_height*8
     self.w.button_apply = SquareButton(
                 (x, y,
                 -self.padding_x,
                 self.button_height),
                 "delete",
                 sizeStyle=self.size_style,
                 callback=self.apply_callback)
     # bind
     self.w.bind("became key", self.update_callback)
     self.w.bind("close", self.on_close_window)
     # observers
     addObserver(self, "update_callback", "fontBecameCurrent")
     # open
     self.w.open()
 def __init__(self):
     
     addObserver(self, "drawMetricsBox", "drawBackground")
     
     self.color = getDefault("glyphViewMarginColor")
     self.height = getDefault("glyphViewDefaultHeight") / 2
     self.useItalicAngle = getDefault("glyphViewShouldUseItalicAngleForDisplay")
    def __init__(self):

        self.draw = False
        self.swap = True

        self.radius = getExtensionDefault(
            "%s.%s" % (WurstSchreiberDefaultKey, "radius"), 60)

        color = NSColor.colorWithCalibratedRed_green_blue_alpha_(1, 0, 0, .5)
        colorValue = getExtensionDefaultColor(
            "%s.%s" % (WurstSchreiberDefaultKey, "color"), color)

        self.w = FloatingWindow((150, 170), "WurstSchreiber")
        x = 15
        y = 15
        self.w.preview = CheckBox(
            (x, y, -x, 20),
            "Preview",
            callback=self.previewChanged,
            value=True)
        y+=30
        self.w.slider = SliderGroup(
            (x, y, -x, 22), 0, 100, self.radius, callback=self.sliderChanged)
        y+=35
        self.w.color = ColorWell(
            (x, y, -x, 40), callback=self.colorChanged, color=colorValue)
        y+=55
        self.w.button = Button(
            (x, y, -x, 20), "Trace!", callback=self.traceButton)
        addObserver(self, "drawWurst", "drawBackground")
        self.w.bind("close", self.closing)
        self.w.open()
 def __init__(self):
     self.w = vanilla.Window((400, 400), minSize=(100, 100))
     self.w.glyphLineView = GlyphLineView((0, 0, 0, 0), pointSize=None, autohideScrollers=False, showPointSizePlacard=True)
     events.addObserver(self, "glyphChanged", "currentGlyphChanged")
     self.glyphChanged(dict(glyph=CurrentGlyph()))
     self.setUpBaseWindowBehavior()
     self.w.open()
Пример #5
0
	def __init__(self):

		self.w = FloatingWindow((250, 530),minSize=(200, 400),title = 'Version Control')

		self.PreviewPanel = Group((0, 0, -0, -0))
		self.PreviewPanel.Preview = GlyphPreview((0, 0, -15, 0))
		self.PreviewPanel.GlyphInfo = TextBox((5, -13, 0, 12), '', alignment='left', selectable=False, sizeStyle='mini')
		self.PreviewPanel.hline = HorizontalLine((5, -1, -5, 1))
		self.Control = Group((0, 0, -0, -0))

		self.Control.VersionsList = List((0, 30, -0, -0), [], allowsMultipleSelection = False,
																selectionCallback=self.selectionVersionCallback,
																doubleClickCallback=self.selectionDoubleVersionCallback)

		self.Control.btnAdd = Button((5,5,30,20), '+', callback=self.btnAddCallback)
		self.Control.btnDel = Button((40,5,30,20), '-', callback=self.btnDelCallback)
		self.Control.btnSwap = Button((75,5,40,20), '<>', callback=self.btnSwapCallback)
		self.Control.btnShow = Button((120,5,40,20), 'Sc', callback=self.btnShowCallback)

		self.Note = TextEditor((5, 5, -5, -5))

		descriptions = [
						dict(label="Preview", view=self.PreviewPanel, size=320, collapsed=False, canResize=True),
						dict(label="Control", view=self.Control, minSize=100, size=140, collapsed=False, canResize=True),
						dict(label="Note", view=self.Note, minSize=100, size=140, collapsed=True, canResize=True),
						]



		addObserver(self, "_currentGlyphChanged", "currentGlyphChanged")
		self.w.bind("close", self.windowClose)
		self.w.accordionView = AccordionView((0, 0, -0, -0), descriptions )
		checkVersionNumbers()
		self.updateVersionsList()
		self.w.open()
Пример #6
0
 def __init__(self, glyph):
     self.w = FloatingWindow((230, 300), "Contour Reorder", minSize=(200, 250))
     
     columnDescriptions = [
                 dict(title="contour", width=170), 
                 dict(title="", key="color", cell=ColorCell.alloc().init(), width=60)
                 ]
             
     self.w.contours = List((0, 0, -0, -0), [], columnDescriptions=columnDescriptions,
                         allowsEmptySelection=False, 
                         allowsMultipleSelection=False,
                         enableDelete=True,
                         dragSettings=dict(type=contourReoderPboardType, 
                                           callback=self.dragCallback),
                         selfDropSettings=dict(type=contourReoderPboardType, 
                                               operation=NSDragOperationMove, 
                                               callback=self.dropListSelfCallback)
                         )
     
     addObserver(self, "drawBackground", "drawBackground")
     addObserver(self, "currentGlyphChanged", "currentGlyphChanged")
     
     self.setUpBaseWindowBehavior()
     self.setGlyph(glyph)
     UpdateCurrentGlyphView()
     self.w.open()
Пример #7
0
    def __init__(self):
        self._states = []
        self._lastState = None    # place for the last state before we start interpolating
        self._lastName = ""
        self._currentGlyph = None
        height = 32
        self.w = vanilla.FloatingWindow(
            (250,height),
            "Interpolated State %s"%__version__,
            maxSize=(500, height+16),
            minSize=(150, height+16) )
        self.w.clearButton = vanilla.Button(
            (-30, 5, -5, 20), u"✕",
            callback=self.callbackClearButton)
        self.w.interpolateSlider = vanilla.Slider(
            (5, 5, -35, 20), 0, 100, 100,
            callback=self.callbackInterpolateSlider)
        self.w.interpolateSlider.enable(False)

        self.w.bind("close", self.bindingWindowClosed)
        self.reportStatus("Add a glyph.")
        addObserver(self, "currentGlyphChanged", "currentGlyphChanged")
        addObserver(self, "keyDown", "keyDown")
        self.subscribeGlyph()
        self.w.open()
    def __init__(self):
        self.filters = PenBallFiltersManager()
        # self.filters.loadFiltersFromJSON('/'.join([LOCALPATH, JSONFILE]))
        filtersList = getExtensionDefault('{0}.filtersList'.format(PENBALLWIZARD_EXTENSIONKEY), [])
        self.filters.loadFiltersList(filtersList)
        self.glyphNames = []
        self.observedGlyphs = []
        self.currentFont = CurrentFont()
        self.initCachedFont()
        filtersList = self.filters.keys()
        if len(filtersList) > 0:
            self.currentFilterName = filtersList[0]
        else:
            self.currentFilterName = None
        self.fill = True

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

        self.displaySettingsRecord = {
            1: (u'✓ Fill', True),
            2: (u'Stroke', False),
            3: (u'Inverse', False),
        }

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

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

        self.updateControls()

        self.w.bind('close', self.end)
        self.launchWindow()
        self.w.open()
Пример #9
0
 def __init__(self):
     self._get_fonts()
     # create window
     self.title = 'anchors'
     self.column_1 = 130
     self.width = 123
     self.height = (self.text_height * 4) + (self.button_height) + (self.padding_y * 4)# - 2
     self.w = FloatingWindow((self.width, self.height), self.title)
     x = self.padding_x
     y = self.padding_y - 1
     # source font label
     self.w._source_label = TextBox(
                 (x, y,
                 -self.padding_x,
                 self.text_height),
                 "source font",
                 sizeStyle=self.size_style)
     y += self.text_height
     # source font value
     self.w._source_value = PopUpButton(
                 (x, y,
                 -self.padding_x,
                 self.text_height),
                 self.all_fonts_names,
                 sizeStyle=self.size_style)
     y += (self.text_height + self.padding_y)
     # target font label
     self.w._target_label = TextBox(
                 (x, y,
                 -self.padding_x,
                 self.text_height),
                 "target font",
                 sizeStyle=self.size_style)
     y += self.text_height
     # target font value
     self.w._target_value = PopUpButton(
                 (x, y,
                 -self.padding_x,
                 self.text_height),
                 self.all_fonts_names,
                 sizeStyle=self.size_style)
     # buttons
     y += (self.text_height + self.padding_y)
     self.w.button_apply = SquareButton(
                 (x, y,
                 -self.padding_x,
                 self.button_height),
                 "copy",
                 callback=self.apply_callback,
                 sizeStyle=self.size_style)
     # bind
     self.w.bind("became key", self.update_callback)
     self.w.bind("close", self.on_close_window)
     # observers
     addObserver(self, "update_callback", "fontDidOpen")
     addObserver(self, "update_callback", "fontDidClose")
     # open window
     self.w.open()
Пример #10
0
 def __init__(self, board, pinList, name):
     
     self.board = board
     self.name = name
     self.pin = pinList[0] 
     # BreakfastSerial component object:
     self.component = BSer.Led(self.board, self.pin)
     # Subscribe to all ControlBoardOutput notifications
     addObserver(self, "outputCallback", "ControlBoardOutput")
Пример #11
0
 def __init__(self):
     self._get_fonts()
     # window
     self.title = 'layers'
     self.width = 123
     self.height = (self.text_height * 4) + (self.button_height * 1) + (self.padding_y * 4) #- 2
     self.w = FloatingWindow((self.width, self.height), self.title)
     # source label
     x = self.padding_x
     y = self.padding_y - 1
     self.w._source_label = TextBox(
                 (x, y,
                 -self.padding_x,
                 self.text_height),
                 "foreground",
                 sizeStyle=self.size_style)
     y += self.text_height
     # source value
     self.w._source_value = PopUpButton(
                 (x, y,
                 -self.padding_x,
                 self.text_height),
                 self.all_fonts_names,
                 sizeStyle=self.size_style)
     y += (self.text_height + self.padding_y)
     # target label
     self.w._target_label = TextBox(
                 (x, y,
                 -self.padding_x,
                 self.text_height),
                 "background",
                 sizeStyle=self.size_style)
     y += self.text_height
     # target value
     self.w._target_value = PopUpButton(
                 (x, y,
                 -self.padding_x,
                 self.text_height),
                 self.all_fonts_names,
                 sizeStyle=self.size_style)
     # apply button
     y += (self.text_height + self.padding_y)
     self.w.button_apply = SquareButton(
                 (x, y,
                 -self.padding_x,
                 self.button_height),
                 "copy",
                 sizeStyle=self.size_style,
                 callback=self.apply_callback)
     # bind
     self.w.bind("became key", self.update_callback)
     self.w.bind("close", self.on_close_window)
     # observers
     addObserver(self, "update_callback", "fontDidOpen")
     addObserver(self, "update_callback", "fontDidClose")
     # open window
     self.w.open()
 def __init__(self):
     self.title = 'vmetrics'
     self.column_1 = 103
     self.width = self.column_1 + (self.padding_x * 2)
     self.height = (self.text_height * 4) + self.button_height + (self.padding_y * 4)
     self.w = FloatingWindow((self.width, self.height), self.title)
     # source font
     x = self.padding_x
     y = self.padding_y
     self.w.source_label = TextBox(
                 (x, y,
                 -self.padding_x,
                 self.text_height),
                 "source",
                 sizeStyle=self.size_style)
     y += self.text_height
     self.w.source_value = PopUpButton(
                 (x, y,
                 -self.padding_x,
                 self.text_height),
                 self.all_fonts_names,
                 sizeStyle=self.size_style)
     # target font
     y += self.text_height + self.padding_y
     self.w.target_label = TextBox(
                 (x, y,
                 -self.padding_x,
                 self.text_height),
                 "target",
                 sizeStyle=self.size_style)
     y += self.text_height
     self.w.target_value = PopUpButton(
                 (x, y,
                 -self.padding_x,
                 self.text_height),
                 self.all_fonts_names,
                 sizeStyle=self.size_style)
     # buttons
     y += self.text_height + self.padding_y
     self.w.button_apply = SquareButton(
                 (x, y,
                 -self.padding_x,
                 self.button_height),
                 "copy",
                 sizeStyle=self.size_style,
                 callback=self.apply_callback)
     # bind
     self.w.bind("became key", self.update_callback)
     self.w.bind("close", self.on_close_window)
     # observers
     addObserver(self, "update_callback", "fontDidOpen")
     addObserver(self, "update_callback", "fontDidClose")
     # open window
     self.w.open()
     self.get_fonts()
Пример #13
0
    def __init__(self, board, pinList, name):

        self.board = board
        self.name = name
        self.pin = pinList[0]
        self.type = "Servo"
        # BreakfastSerial component object:
        self.component = BSer.Servo(self.board, self.pin)
        self.component.set_position(90)
        # Subscribe to all ControlBoardOutput notifications
        addObserver(self, "outputCallback", "ControlBoardOutput")
Пример #14
0
 def __init__(self):
     
     self.ledName = "Status Light"
     self.glyph = None
     
     self.w = vanilla.Window((200, 100), "Mark Color")
     self.w.bind("close", self.windowClosed)
     self.w.open()
     
     addObserver(self, "updateMark", "drawInactive")
     addObserver(self, "glyphChanged", "currentGlyphChanged")
Пример #15
0
 def __init__(self):
     self.glyph = CurrentGlyph()
     # create a window        
     self.w = FloatingWindow((400, 400), "Stencil Preview", minSize=(200, 200))
     # add the preview to the window
     self.w.preview = GlyphPreview((0, 0, -0, -0))
     # add an observer to get callbacks when a glyph changes in the glyph view
     addObserver(self, "viewDidChangeGlyph", "viewDidChangeGlyph")
     # open the window
     self.updateGlyph()
     self.w.open()
Пример #16
0
 def __init__(self):
     
     self.w = vanilla.Window((100, 100), "Previous/Next Glyph")
     self.w.bind("close", self.windowClosed)
     self.w.open()
     
     # When the state of any component on your board changes (button pressed, knob turned), a "ControlBoardInput" 
     # notification will be made. Start observing for these notifications and give a method name in this script
     # to be called when the notification comes in, in this case self.controlChanged
     addObserver(self, "controlChanged", "ControlBoardInput")
     self.controlName = "Rotary"
 def startStopButtonCallback(self, sender):
     # button callback, check the title
     if sender.getTitle() == "Start":
         # set "Stop" as title for the button
         sender.setTitle("Stop")
         # add an observer
         addObserver(self, "draw", "draw")
     else:
         # set "Start" as title for the button
         sender.setTitle("Start")
         # remove the observser
         removeObserver(self, "draw")            
Пример #18
0
 def __init__(self):
     self.get_fonts()
     self.title = 'interpol check'
     self.height = self.text_height*4 + self.padding_y*3 + self.button_height
     self.w = HUDFloatingWindow((self.width, self.height), self.title)
     # font 1
     x = self.padding_x
     y = self.padding_y - 6
     self.w.f1_label = TextBox(
                 (x, y + 3,
                 -self.padding_x,
                 self.text_height),
                 "font 1",
                 sizeStyle=self.size_style)
     y += self.text_height
     self.w.f1_font = PopUpButton(
                 (x, y,
                 -self.padding_x,
                 self.text_height),
                 self.all_fonts_names,
                 sizeStyle=self.size_style)
     y += self.text_height + 4
     # font 2
     self.w.f2_label = TextBox(
                 (x, y + 3,
                 -self.padding_x,
                 self.text_height),
                 "font 2",
                 sizeStyle=self.size_style)
     y += self.text_height
     self.w.f2_font = PopUpButton(
                 (x, y,
                 -self.padding_x,
                 self.text_height),
                 self.all_fonts_names,
                 sizeStyle=self.size_style)
     y += self.text_height + self.padding_y + 1
     # apply button
     self.w.apply_button = SquareButton(
                 (x, y,
                 -self.padding_x,
                 self.button_height),
                 'apply',
                 callback=self.apply_callback,
                 sizeStyle=self.size_style)
     # bind
     self.w.bind("became key", self.update_callback)
     self.w.bind("close", self.on_close_window)
     # observers
     addObserver(self, "update_callback", "fontDidOpen")
     addObserver(self, "update_callback", "fontDidClose")
     # open window
     self.w.open()
Пример #19
0
    def __init__(self):

        self.w = vanilla.Window((200, 150), "Button/Switch")
        self.w.titleState = vanilla.TextBox((20, 20, -10, 25), "Button is: ...")
        self.w.titleName = vanilla.TextBox((20, 70, -20, 25), "Button/Switch Name:")
        self.w.componentName = vanilla.EditText((20, 100, -20, 25), "My Component")
        self.w.open()

        # When the state of any component on your board changes (button pressed, knob turned), a "ControlBoardInput"
        # notification will be made. Start observing for these notifications and give a method name in this script
        # to be called when the notification comes in, in this case self.controlChanged
        addObserver(self, "controlChanged", "ControlBoardInput")
Пример #20
0
 def __init__(self):
     self.currentGlyph = None
     self.w = vanilla.Window((500, 500), "Plist Viewer", minSize=(100, 100))
     self.w.xml = CodeEditor((0, 0, -0, -30), "", lexer="xml")
     
     self.w.applyButton = vanilla.Button((-70, -25, -20, 22), "Apply", callback=self.applyCallback, sizeStyle="small")
     addObserver(self, "currentGlyphChanged", "currentGlyphChanged")
     self.setUpBaseWindowBehavior()
     
     self.currentGlyphChanged({})
     
     self.w.open()
Пример #21
0
 def __init__(self, board, pinList, name):
     
     self.board = board
     self.name = name
     self.pinRed = pinList[0] 
     self.pinGreen = pinList[1] 
     self.pinBlue = pinList[2] 
     # BreakfastSerial component object:
     self._red = ComponentLED(self.board, [self.pinRed], self.name + "-Red")
     self._green = ComponentLED(self.board, [self.pinGreen], self.name + "-Green")
     self._blue = ComponentLED(self.board, [self.pinBlue], self.name + "-Blue")
     # Subscribe to all ControlBoardOutput notifications
     addObserver(self, "outputCallback", "ControlBoardOutput")
Пример #22
0
 def __init__(self):
     
     # The name of the sensor (the potentiometer) and the servo:
     self.sensorName = "Knob"
     self.servoName = "Servo"
     
     self.w = vanilla.Window((200, 100), "Servo Demo")
     self.w.titleValue = vanilla.TextBox((20, 20, -10, 25), "Current value and angle:")
     self.w.knobValue = vanilla.TextBox((20, 40, -10, 25), "0.0, 0" + chr(176))
     self.w.bind("close", self.windowClosed)
     self.w.open()
     
     addObserver(self, "controlChanged", "ControlBoardInput")
Пример #23
0
    def __init__(self, parent_view, *args, **kwargs):
        super(ShowDistTextBox, self).__init__(*args, **kwargs)
        self.notifications = [
            'mouseUp',
            'mouseDragged',
            'keyUp', 'selectAll',
            'viewDidChangeGlyph'
        ]
        for notification_name in self.notifications:
            addObserver(
                self, 'update_info_callback', notification_name)

        addObserver(self, 'kill_observers', 'glyphWindowWillClose')
        self.parent_view = parent_view
 def __init__(self):
     bgColor = NSColor.colorWithCalibratedRed_green_blue_alpha_(255, 255, 255, 255)
     buttonColor = NSColor.colorWithCalibratedRed_green_blue_alpha_(0, 0, 0, 255)
     self.w = Window((1000, 400), 'Interpolation Matrix', minSize=(470, 300))
     self.w.getNSWindow().setBackgroundColor_(bgColor)
     self.w.glyphTitle = Box((10, 10, 200, 30))
     self.w.glyphTitle.name = EditText((5, 0, -5, 20), 'No current glyph', self.changeGlyph, continuous=False)
     glyphEdit = self.w.glyphTitle.name.getNSTextField()
     glyphEdit.setBordered_(False)
     glyphEdit.setBackgroundColor_(Transparent)
     glyphEdit.setFocusRingType_(NSFocusRingTypeNone)
     self.axesGrid = {'horizontal': 3, 'vertical': 1}
     self.masters = []
     self.instanceSpots = []
     self.mutator = None
     self.currentGlyph = None
     self.errorGlyph = errorGlyph()
     self.buildMatrix((self.axesGrid['horizontal'], self.axesGrid['vertical']))
     self.w.addColumn = SquareButton((-80, 10, 30, 30), u'+', callback=self.addColumn)
     self.w.removeColumn = SquareButton((-115, 10, 30, 30), u'-', callback=self.removeColumn)
     self.w.addLine = SquareButton((-40, -40, 30, 30), u'+', callback=self.addLine)
     self.w.removeLine = SquareButton((-40, -70, 30, 30), u'-', callback=self.removeLine)
     for button in [self.w.addColumn, self.w.removeColumn, self.w.addLine, self.w.removeLine]:
         button.getNSButton().setBezelStyle_(10)
     self.w.clearMatrix = Button((220, 15, 70, 20), 'Clear', callback=self.clearMatrix)
     self.w.generate = Button((300, 15, 100, 20), 'Generate', callback=self.instanceGeneration)
     # self.w.saveMatrix = Button((300, 15, 70, 20), 'Save', callback=self.saveMatrix)
     # self.w.loadMatrix = Button((380, 15, 70, 20), 'Load', callback=self.loadMatrix)
     addObserver(self, 'updateMatrix', 'currentGlyphChanged')
     addObserver(self, 'updateMatrix', 'fontDidClose')
     addObserver(self, 'updateMatrix', 'mouseUp')
     addObserver(self, 'updateMatrix', 'keyUp')
     self.w.bind('close', self.windowClose)
     self.w.bind('resize', self.windowResize)
     self.w.open()
Пример #25
0
 def __init__(self):
     self.enableGroupSpacing = False
     self.popupOpen = False
     addObserver(self, 'glyphEditCallback', 'spaceCenterKeyDown')
     addObserver(self, 'glyphEditedCallback', 'spaceCenterKeyUp')
     addObserver(self, 'spaceCenterOpenCallback', 'spaceCenterDidOpen')
     addObserver(self, 'fontOpenCallback', 'fontDidOpen')
     self.previousMargins = {'left': 0, 'right': 0}
 def __init__(self):
     # subscribe to the draw event
     addObserver(self, "draw", "draw")
     addObserver(self, "draw", "drawBackground")
     # create a background color
     self.backgroundColor = NSColor.redColor()
     # create a background stroke color
     self.backgroundStrokeColor = NSColor.whiteColor()
     # create a stroke color
     self.strokeColor = NSColor.redColor()
     # setting text attributes
     self.attributes = attributes = {
         NSFontAttributeName : NSFont.boldSystemFontOfSize_(9),
         NSForegroundColorAttributeName : NSColor.whiteColor(),
         }
Пример #27
0
 def __init__(self):
     
     self.w = Window((400, 400), "mojo.event observer", minSize=(200, 200))
     
     self.w.list = List((10, 10, 200, -40), [], selectionCallback=self.listSelection)
     self.w.info = TextEditor((220, 10, -10, -40), readOnly=True)
     
     self.w.ignoreText = TextBox((10, -30, 100, 22), "Ignore:")
     self.w.ignore = EditText((70, -30, -100, 22), "mouseMoved")
     
     self.w.clear = Button((-70, -30, 60, 22), "Clear", self.clearListCallback)
     
     addObserver(self, "notification", None)
     self.setUpBaseWindowBehavior()
     self.w.open()
	def __init__(self):
		BaseWindowController.__init__(self)
		self.w = FloatingWindow((340, 220), 'Quadratic Converter')
		# ---------------------------
		top = 10
		self.w.maxDistanceTitle = TextBox((10, top, 100, 20), "Max Distance: ")
		minMaxDist  = 0.01
		maxMaxDist  = 10.0
		self.initMaxDist = 1.0
		self.maxDistanceValue = self.initMaxDist
		self.w.maxDistanceValueText = TextBox((110, top, -90, 22), str(self.initMaxDist))
		self.w.maxDistanceResetButton = Button((-80, top, -10, 22), "Reset", callback=self.maxDistanceResetCallback)
		self.w.maxDistanceSlider = Slider( (10, top+20, -10, 20),
				minValue=log(minMaxDist), maxValue=log(maxMaxDist),
				value=log(self.initMaxDist), callback=self.maxDistanceSliderCallback )
		# ---------------------------
		top = 60
		self.w.minLengthTitle = TextBox((10, top, 150, 20), "Min Segment Length: ")
		minMinLen  = 0
		maxMinLen  = 100
		initMinLen = 30
		self.minLengthValue = initMinLen
		self.w.minLengthValueText = TextBox((160, top, -10, 22), str(initMinLen))
		self.w.minLengthSlider = Slider( (10, top+20, -10, 20),
				minValue=minMinLen, maxValue=maxMinLen,
				value=initMinLen, callback=self.minLengthSliderCallback )
		# ---------------------------
		top = 110
		self.useArcLength = True
		#self.w.arclencheckbox = CheckBox((10, top, 90, 20), "Arc length", callback=self.arcLengthCheckBoxCallback, value=self.useArcLength)
		self.calculatePreview = True
		self.w.previewCheckBox = CheckBox((10, top, 70, 20), "Preview", callback=self.previewCheckBoxCallback, value=self.calculatePreview)
		self.w.closeButton = Button((120, top, 70, 20), "Close", callback=self.closeCallBack)
		self.w.convertCurrentFont = Button((210, top, 120, 20), "Convert Font", callback=self.convertCurrentFontCallback)
		# ---------------------------
		top = 150
		self.layers = ["foreground"]+CurrentFont().layerOrder
		self.w.layerText = TextBox((10, top, 120, 20), "Layer (per-glyph): ")
		self.w.layerPopup = PopUpButton((130, top, 90, 20), self.layers)#, callback=self.arcLengthCheckBoxCallback)
		self.w.convertCurrentGlyph = Button((225, top, 105, 20), "Convert Glyph", callback=self.convertCurrentGlyphCallback)
		# ---------------------------
		self.w.infoText = TextBox((10, -38, -10, 34), "WARNING. Un-saved modifications in a UFO will not be converted.")
		# ---------------------------
		self.w.open()
		self.w.bind("close", self.windowClosed)
		addObserver(self, "draw", "draw")
		UpdateCurrentGlyphView()
    def __init__(self):
        self.filters = PenBallFiltersManager()
        self.filters.loadFiltersFromJSON('/'.join([LOCALPATH, JSONFILE]))
        self.glyphNames = []
        self.observedGlyphs = []
        self.cachedFont = RFont(showUI=False)
        self.currentFont = CurrentFont()
        filtersList = self.filters.keys()
        if len(filtersList) > 0:
            self.currentFilterName = filtersList[0]
        else:
            self.currentFilterName = None
        self.fill = True

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

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

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

        self.updateControls()

        self.w.bind('close', self.end)
        self.launchWindow()
        self.w.open()
Пример #30
0
 def __init__(self):
             
     self.w = Window((400, 400), "Layer Preview", minSize=(400, 300))
     
     self.w.preview = GlyphLayerPreview((0, 0, -0, -30))
     self.currentGlyphChanged()
     
     self.w.useColor = CheckBox((10, -30, 100, 22), "Use Color:", callback=self.useColorCallback)
     
     self.w.color = ColorWell((120, -35, 40, 30), color=NSColor.blackColor(), callback=self.colorCallback)
     
     self.w.testInstall = Button((-170, -30, -10, 22), "Test Install Layers", callback=self.testInstallCallback)
     
     addObserver(self, "currentGlyphChanged", "currentGlyphChanged")
     
     self.setUpBaseWindowBehavior()
     self.w.open()