Ejemplo n.º 1
0
 def transformedValue_(self, priority):
     if priority is None:
         return NSColor.blackColor()
     elif priority > 4:
         return NSColor.redColor()
     elif priority > 3:
         return NSColor.orangeColor()
     elif priority > 2:
         return NSColor.blueColor()
     elif priority > 1:
         return NSColor.greenColor()
     elif priority > 0:
         return NSColor.brownColor()
     else:
         return NSColor.blackColor()
Ejemplo n.º 2
0
 def awakeFromNib(self):
     self.setFont_(NSFont.userFixedPitchFontOfSize_(10))
     self.p_colors = {
         "stderr": NSColor.redColor(),
         "stdout": NSColor.blueColor(),
         "code": NSColor.blackColor(),
     }
     self.setHistoryLength_(50)
     self.setHistoryView_(0)
     self.setInteracting_(False)
     self.setAutoScroll_(True)
     self.setSingleLineInteraction_(False)
     self.p_history = [""]
     self.p_input_callbacks = []
     self.p_input_lines = []
     self.setupTextView()
     self.interpreter.connect()
Ejemplo n.º 3
0
 def awakeFromNib(self):
     self = super(PyInterpreter, self).init()
     self._font = NSFont.userFixedPitchFontOfSize_(10)
     self._stderrColor = NSColor.redColor()
     self._stdoutColor = NSColor.blueColor()
     self._codeColor = NSColor.blackColor()
     self._historyLength = 50
     self._history = [""]
     self._historyView = 0
     self._characterIndexForInput = 0
     self._stdin = PseudoUTF8Input(self._nestedRunLoopReaderUntilEOLchars_)
     # self._stdin = PseudoUTF8Input(self.readStdin)
     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
     self.applicationDidFinishLaunching_(None)
Ejemplo n.º 4
0
 def awakeFromNib(self):
     self = super(PyInterpreter, self).init()
     self._font = NSFont.userFixedPitchFontOfSize_(10)
     self._stderrColor = NSColor.redColor()
     self._stdoutColor = NSColor.blueColor()
     self._codeColor = NSColor.blackColor()
     self._historyLength = 50
     self._history = ['']
     self._historyView = 0
     self._characterIndexForInput = 0
     self._stdin = PseudoUTF8Input(self._nestedRunLoopReaderUntilEOLchars_)
     #self._stdin = PseudoUTF8Input(self.readStdin)
     self._stderr = PseudoUTF8Output(self.writeStderr_)
     self._stdout = PseudoUTF8Output(self.writeStdout_)
     self._isInteracting = False
     self._console = AsyncInteractiveConsole()
     self._interp = partial(next, self._console.asyncinteract(
         write=self.writeCode_,
     ))
     self._autoscroll = True
Ejemplo n.º 5
0
import rumps
import subprocess

from AppKit import NSAttributedString
from PyObjCTools.Conversion import propertyListFromPythonCollection
from Cocoa import (NSFont, NSFontAttributeName, NSColor,
                   NSForegroundColorAttributeName)
from launchd.cmd import launchctl

ICON_PATH = "../assets/[email protected]"
USER_AGENTS = os.path.expanduser('~/Library/LaunchAgents')

FONT = NSFont.fontWithName_size_("Hack Nerd Font", 14.0)
color = {
    "red": NSColor.redColor(),
    "blue": NSColor.blueColor(),
    "green": NSColor.greenColor()
}
r_attr = propertyListFromPythonCollection(
    {
        # NSFontAttributeName: FONT,
        NSForegroundColorAttributeName: color['red']
    },
    conversionHelper=lambda x: x)
g_attr = propertyListFromPythonCollection(
    {
        # NSFontAttributeName: FONT,
        NSForegroundColorAttributeName: color['green']
    },
    conversionHelper=lambda x: x)
b_attr = propertyListFromPythonCollection(