Esempio n. 1
0
	def windowControllerDidLoadNib_(self, controller):
		self._script = _ci.newscript()
		self._pythonOutput = []
		self._rubyOutput = []
		self._currentStyle = self._pythonOutput
		self._script.setruncallbacks(send=eventformatter.makeCustomSendProc(
				_rubyapp, self._appendResult, _ci.componentcallbacks()[2]))
Esempio n. 2
0
 def runScript_(self, sender):
     self.resultView.setString_(u'')
     for lang in self._resultStores:
         while lang:
             lang.pop()
     try:
         sourceDesc = _standardCodecs.pack(self.codeView.string())
         handler = eventformatter.makeCustomSendProc(
             self._addResult, _userDefaults.boolForKey_('sendEvents'))
         result = astranslate.translate(
             sourceDesc,
             handler)  # returns tuple; first item indicates if ok
         if result[0]:  # script result
             script, result = (_standardCodecs.unpack(desc)
                               for desc in result[1:])
             self.codeView.setString_(script)
             self._addResult(kLangAll, u'OK')
         else:  # script error info
             script, errorNum, errorMsg, pos = (_standardCodecs.unpack(desc)
                                                for desc in result[1:])
             start, end = (pos[aem.AEType(k)] for k in ['srcs', 'srce'])
             if script:
                 errorKind = 'Runtime'
                 self.codeView.setString_(script)
             else:
                 errorKind = 'Compilation'
             self._addResult(
                 kLangAll,
                 u'%s Error:\n%s (%i)' % (errorKind, errorMsg, errorNum))
             self.codeView.setSelectedRange_((start, end - start))
     except aem.ae.MacOSError, e:
         self._addResult(kLangAll, u'OS Error: %i' % e.args[0])
Esempio n. 3
0
	def runScript_(self, sender):
		self.resultView.setString_(u'')
		for lang in self._resultStores:
			while lang:
				lang.pop()
		try:
			sourceDesc = _standardCodecs.pack(self.codeView.string())
			handler = eventformatter.makeCustomSendProc(
					self._addResult, _userDefaults.boolForKey_('sendEvents'))
			result = astranslate.translate(sourceDesc, handler) # returns tuple; first item indicates if ok
			if result[0]: # script result
				script, result = (_standardCodecs.unpack(desc) for desc in result[1:])
				self.codeView.setString_(script)
				self._addResult(kLangAll, u'OK')
			else: # script error info
				script, errorNum, errorMsg, pos = (_standardCodecs.unpack(desc) for desc in result[1:])
				start, end = (pos[aem.AEType(k)] for k in ['srcs', 'srce'])
				if script:
					errorKind = 'Runtime'
					self.codeView.setString_(script)
				else:
					errorKind = 'Compilation'
				self._addResult(kLangAll, 
						u'%s Error:\n%s (%i)' % (errorKind, errorMsg, errorNum))
				self.codeView.setSelectedRange_((start, end - start))
		except aem.ae.MacOSError, e:
			self._addResult(kLangAll, u'OS Error: %i' % e.args[0])
Esempio n. 4
0
 def windowControllerDidLoadNib_(self, controller):
     self._resultStores = [[] for _ in range(eventformatter.kLanguageCount)]
     self._script = _ci.newscript()
     self._script.setruncallbacks(
         send=eventformatter.makeCustomSendProc(self._addResult, _ci.componentcallbacks()[2])
     )
     self.currentStyle = _userDefaults.integerForKey_(u"defaultOutputLanguage")
Esempio n. 5
0
 def windowControllerDidLoadNib_(self, controller):
     self._resultStores = [[] for _ in range(eventformatter.kLanguageCount)]
     self._script = _ci.newscript()
     self._script.setruncallbacks(send=eventformatter.makeCustomSendProc(
         self._addResult,
         _ci.componentcallbacks()[2]))
     self.currentStyle = _userDefaults.integerForKey_(
         u'defaultOutputLanguage')
Esempio n. 6
0
 def windowControllerDidLoadNib_(self, controller):
     self._script = _ci.newscript()
     self._script.setruncallbacks(
         send=eventformatter.makeCustomSendProc(self._appendResult, _ci.componentcallbacks()[2])
     )
Esempio n. 7
0
 def windowControllerDidLoadNib_(self, controller):
     self._script = _ci.newscript()
     self._script.setruncallbacks(send=eventformatter.makeCustomSendProc(
         self._appendResult,
         _ci.componentcallbacks()[2]))