#-*- coding: UTF-8 -*-

# The MIT License (MIT)
# 
# Copyright (c) 2014 Mack Stone
# 
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
# the Software, and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
# 
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
# 
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

import keyword

from PySide import QtGui, QtCore
from maya import cmds

def getMayaWindowWidget():
	"get maya window widget for Qt"
	mwin = None
	mapp = QtGui.QApplication.instance()
	for widget in mapp.topLevelWidgets():
		if widget.objectName() = 'MayaWindow':
			mwin = widget
			break
	return mwin
			
@@ -1207,16 +1207,17 @@
 t cmds%0A%0A
+%0A
 def getM
@@ -1384,16 +1384,17 @@
 Name() =
+=
  'MayaWi
@@ -1439,11 +1439,598 @@
 rn mwin%0A
-%09%09%09
+%0Aclass Highlighter(QtGui.QSyntaxHighlighter):%0A%09%22%22%22syntax highlighter%22%22%22%0A%09def __init__(self, parent=None):%0A%09%09super(Highlighter, self).__init__(parent)%0A%09%09%0A%09%09self.__rules = %5B%5D%0A%09%09%0A%09def _keywordFormat(self):%0A%09%09'''set up keyword format'''%0A%09%09melKeywords = %5B%5D%0A%09%09pyKeywords = keyword.kwlist + %5B'False', 'True', 'None'%5D%0A%09%09# keyword format%0A%09%09keywordFormat = QtGui.QTextCharFormat()%0A%09%09keywordFormat.setForeground(QtCore.Qt.darkBlue)%0A%09%09keywordFormat.setFontWeight(QtGui.QFont.Bold)%0A%09%09self.__rules += %5B(QtCore.QRegExp('%5C%5Cb%25s%5C%5Cb' %25 keyword), keywordFormat) for %0A%09%09%09%09%09%09keyword in pyKeywords + melKeywords%5D%0A

implement keywordFormat()