예제 #1
0
    def set_autocompletions(self, options):
        """ Set the autocompletion options for when the autocompletion mode
        is in 'all' or 'apis'.
            
        """
        # Delete the old if one exists
        if self.qsci_api:
            # Please note that it is not possible to add or remove entries
            # once you’ve “prepared” so we have to destroy and create
            # a new provider every time.
            self.qsci_api.deleteLater()
            self.qsci_api = None

        # Add the new options
        api = self.qsci_api = Qsci.QsciAPIs(self.widget.lexer())
        for option in options:
            api.add(option)
        api.prepare()
예제 #2
0
    def __init__(self):
        QtGui.QWidget.__init__(self)
        self.setupUi(self)
        self.stdout = sys.stdout
        self.stderr = sys.stderr
        self.connect(self.btnClose, QtCore.SIGNAL('clicked()'), self.close)
        self.connect(self.btnCopy, QtCore.SIGNAL('clicked()'), self._copy)
        self.sysout = SysOut(self.sci)

        self.PLX = Qsci.QsciLexerPython(self)
        self.ABS = Qsci.QsciAPIs(self.PLX)
        self.PLX.setAPIs(self.ABS)

        self.sci.setAutoCompletionSource(Qsci.QsciScintilla.AcsAll)
        self.sci.setLexer(self.PLX)
        self.sci.setAutoCompletionThreshold(1)
        self.sci.setAutoIndent(True)
        self.sci.setAutoCompletionFillupsEnabled(True)
        self.sci.setBraceMatching(Qsci.QsciScintilla.StrictBraceMatch)
        self.sci.setMarginWidth(1, 0)
        self.sci.setReadOnly(1)
        print '*** Python %s on %s.***' % (sys.version, sys.platform)

        self.btnCopy.setEnabled(0)
예제 #3
0
파일: autocomplete.py 프로젝트: songgz/toys
import sys
from PyQt4.QtGui import QApplication
from PyQt4 import QtCore, QtGui, Qsci
from PyQt4.Qsci import *

if __name__ == "__main__":
    app = QApplication(sys.argv)
    editor = QsciScintilla()

    ## Choose a lexer
    ## This can be any Scintilla lexer, but the original example used Python
    lexer = QsciLexerPython(editor)

    ## Create an API for us to populate with our autocomplete terms
    api = Qsci.QsciAPIs(lexer)
    ## Add autocompletion strings
    api.add("aLongString")
    api.add("aLongerString")
    api.add("aDifferentString")
    api.add("sOmethingElse")
    ## Compile the api for use in the lexer
    api.prepare()
    editor.setLexer(lexer)

    ## Set the length of the string before the editor tries to autocomplete
    ## In practise this would be higher than 1
    ## But its set lower here to make the autocompletion more obvious
    editor.setAutoCompletionThreshold(1)
    ## Tell the editor we are using a QsciAPI for the autocompletion

    editor.setAutoCompletionSource(QsciScintilla.AcsAPIs)
예제 #4
0
    def __init__(self, parent=None, designMode=False):
        Qsci.QsciScintilla.__init__(self, parent)

        self.textEdit = Qsci.QsciScintilla()
        self.textEdit.setAutoCompletionThreshold(1)
        self.textEdit.setAutoCompletionSource(Qsci.QsciScintilla.AcsAll)
        self.textEdit.setAutoIndent(True)
        self.textEdit.setCallTipsStyle(Qsci.QsciScintilla.CallTipsContext)
        self.textEdit.setCallTipsVisible(0)
        self.pythonLexer = Qsci.QsciLexerPython(self.textEdit)
        self.api = Qsci.QsciAPIs(self.pythonLexer)
        self.api.add(Qt.QString("dupa(a,b)this is function dupa"))
        self.api.prepare()
        self.pythonLexer.setAPIs(self.api)
        self.textEdit.setLexer(self.pythonLexer)

        self.newAction = Qt.QAction(getThemeIcon("document-new"), "New", self)
        self.newAction.triggered.connect(self.newFile)
        self.newAction.setToolTip("Create new file")
        self.newAction.setShortcut("Ctrl+N")

        self.openAction = Qt.QAction(getThemeIcon("document-open"), "Open",
                                     self)
        self.openAction.triggered.connect(self.openFile)
        self.openAction.setToolTip("Open existing file")
        self.openAction.setShortcut("Ctrl+O")

        self.saveAction = Qt.QAction(getThemeIcon("document-save"), "Save",
                                     self)
        self.saveAction.triggered.connect(self.saveFile)
        self.saveAction.setToolTip("Save document to disk")
        self.saveAction.setShortcut("Ctrl+S")

        self.saveAsAction = Qt.QAction(getThemeIcon("document-save-as"),
                                       "Save as...", self)
        self.saveAction.triggered.connect(self.saveFile)
        self.saveAsAction.setToolTip("Save document under a new name")

        self.cutAction = Qt.QAction(getThemeIcon("edit-cut"), "Cut", self)
        self.cutAction.triggered.connect(self.cut)
        self.cutAction.setToolTip(
            "Cut current selection's contents to the clipboard")
        self.cutAction.setShortcut("Ctrl+X")
        self.cutAction.setEnabled(False)

        self.copyAction = Qt.QAction(getThemeIcon("edit-copy"), "Copy", self)
        self.copyAction.triggered.connect(self.copy)
        self.copyAction.setToolTip(
            "Copy current selection's contents to the clipboard")
        self.copyAction.setShortcut("Ctrl+C")
        self.copyAction.setEnabled(False)

        self.pasteAction = Qt.QAction(getThemeIcon("edit-paste"), "Paste",
                                      self)
        self.pasteAction.triggered.connect(self.paste)
        self.pasteAction.setToolTip(
            "Paste the clipboard's contents into the current selection")
        self.pasteAction.setShortcut("Ctrl+V")

        self.aboutAction = Qt.QAction("About", self)
        self.aboutAction.triggered.connect(self.about)
        self.aboutAction.setToolTip("Show the application's About box")

        self.textEdit.copyAvailable.connect(self.cutAction.setEnabled)
        self.textEdit.copyAvailable.connect(self.copyAction.setEnabled)

        self.setCurrentFile("")
예제 #5
0
    def setupUi(self, MainWindow):
        MainWindow.setObjectName(_fromUtf8("MainWindow"))
        MainWindow.resize(640, 480)
        self.vindu = QtGui.QWidget(MainWindow)
        self.vindu.setStyleSheet(_fromUtf8('notusedasyet'))
        # MainWindow.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
        self.filename = ""
        self.vindu.closeEvent = self.closeEvent
        self.vindu.setObjectName(_fromUtf8("vindu"))
        self.verticalLayout = QtGui.QVBoxLayout(self.vindu)
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(_fromUtf8(":/ico/python.png")),
                       QtGui.QIcon.Normal, QtGui.QIcon.On)
        MainWindow.setWindowIcon(icon)
        self.verticalLayout.setMargin(0)
        self.verticalLayout.setSpacing(0)
        self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
        self.codebox = Qsci.QsciScintilla(self.vindu)
        self.codebox.setToolTip(_fromUtf8(""))
        self.codebox.setWhatsThis(_fromUtf8(""))
        self.codebox.setAutoFillBackground(False)
        self.codebox.setFrameShape(QtGui.QFrame.NoFrame)
        self.codebox.setObjectName(_fromUtf8("codebox"))
        self.verticalLayout.addWidget(self.codebox)
        MainWindow.setCentralWidget(self.vindu)
        self.toolBar = QtGui.QToolBar(MainWindow)
        self.toolBar.setAutoFillBackground(False)
        self.toolBar.setIconSize(QtCore.QSize(32, 32))
        self.toolBar.setToolButtonStyle(QtCore.Qt.ToolButtonIconOnly)
        self.toolBar.setObjectName(_fromUtf8("toolBar"))
        MainWindow.addToolBar(QtCore.Qt.LeftToolBarArea, self.toolBar)
        self.toolBar.addSeparator()
        # getting ready for debugger
        self.codebox.setMarginSensitivity(1, True)
        self.codebox.connect(
            self.codebox,
            QtCore.SIGNAL('marginClicked(int, int, Qt::KeyboardModifiers)'),
            self.on_margin_clicked)
        self.codebox.markerDefine(QsciScintilla.FullRectangle,
                                  self.ARROW_MARKER_NUM)
        self.codebox.setMarkerBackgroundColor(QColor("#ee1111"),
                                              self.ARROW_MARKER_NUM)
        # first action Newfile
        self.toolBar.newAction = QtGui.QAction(QtGui.QIcon(":/ico/new.png"),
                                               "New", self.toolBar)
        self.toolBar.newAction.setStatusTip(
            "Clear TextBox or make new document.")
        self.toolBar.newAction.setShortcut("Ctrl+N")
        self.toolBar.newAction.triggered.connect(self.newfile)
        # second Action OpenFile
        self.toolBar.secondAction = QtGui.QAction(
            QtGui.QIcon(":/ico/open.png"), "Open", self.toolBar)
        self.toolBar.secondAction.setStatusTip(
            "Create a new document from scratch.")
        self.toolBar.secondAction.setShortcut("Ctrl+O")
        self.toolBar.secondAction.triggered.connect(self.open)
        # action 3 save file
        self.toolBar.Action3 = QtGui.QAction(QtGui.QIcon(":/ico/save.png"),
                                             "Save", self.toolBar)
        self.toolBar.Action3.setStatusTip("Save Your File.")
        self.toolBar.Action3.setShortcut("Ctrl+S")
        self.toolBar.Action3.triggered.connect(self.savefile)
        # action 4 run file
        self.toolBar.Action4 = QtGui.QAction(QtGui.QIcon(":/ico/run32.png"),
                                             "Run To Debugger", self.toolBar)
        self.toolBar.Action4.setStatusTip("Run your file within debugger.")
        self.toolBar.Action4.setShortcut("Ctrl+E")
        self.toolBar.Action4.triggered.connect(self.runto)
        # action 6 undo
        self.toolBar.Action6 = QtGui.QAction(QtGui.QIcon(":/ico/undo.png"),
                                             "Redo", self.toolBar)
        self.toolBar.Action6.setStatusTip("Undo.")
        self.toolBar.Action6.setShortcut("Ctrl+Z")
        self.toolBar.Action6.triggered.connect(self.codebox.undo)
        # action 7 redo
        self.toolBar.Action7 = QtGui.QAction(QtGui.QIcon(":/ico/redo.png"),
                                             "Redo", self.toolBar)
        self.toolBar.Action7.setStatusTip("Redo.")
        self.toolBar.Action7.setShortcut("Ctrl+Y")
        self.toolBar.Action7.triggered.connect(self.codebox.redo)
        # action8 rerset Folding
        self.toolBar.Action8 = QtGui.QAction(
            QtGui.QIcon(":/ico/align-justify.png"), "Reset Folding",
            self.toolBar)
        self.toolBar.Action8.setStatusTip("Reset Folding.")
        self.toolBar.Action8.setShortcut("Ctrl+R")
        self.toolBar.Action8.triggered.connect(self.nofoldingl)
        # actions9 CircledTreeFoldStyle
        self.toolBar.Action9 = QtGui.QAction(QtGui.QIcon(":/ico/bullet.png"),
                                             "Circled Tree Folding",
                                             self.toolBar)
        self.toolBar.Action9.setStatusTip("Circled Tree Folding.")
        self.toolBar.Action9.setShortcut("Ctrl+C")
        self.toolBar.Action9.triggered.connect(self.Circledfold)
        # actions10 plainFoldStyle
        self.toolBar.Action10 = QtGui.QAction(QtGui.QIcon(":/ico/number.png"),
                                              "Plain Folding", self.toolBar)
        self.toolBar.Action10.setStatusTip("Plain Folding")
        self.toolBar.Action10.setShortcut("Ctrl+P")
        self.toolBar.Action10.triggered.connect(self.plainfold)
        # fonts
        self.toolBar.Action21 = QtGui.QAction(QtGui.QIcon(":/ico4/font.png"),
                                              "Fonts", self.toolBar)
        self.toolBar.Action21.setStatusTip("Fonts")
        self.toolBar.Action21.setShortcut("Ctrl+F")
        self.toolBar.Action21.triggered.connect(self.font_choice)
        # web baby
        self.toolBar.Action11 = QtGui.QAction(QtGui.QIcon(":/ico/web.png"),
                                              "Hex-rays Homepage",
                                              self.toolBar)
        self.toolBar.Action11.setStatusTip("Home of Hex-rays")
        self.toolBar.Action11.setShortcut("Ctrl+W")
        self.toolBar.Action11.triggered.connect(self.webopen)
        # irc
        self.toolBar.Action12 = QtGui.QAction(
            QtGui.QIcon(":/ico3/settings.png"), "Open Ida Pro Python SDK",
            self.toolBar)
        self.toolBar.Action12.setStatusTip("Ida Pro Python SDK")
        self.toolBar.Action12.setShortcut("Ctrl+I")
        self.toolBar.Action12.triggered.connect(self.sdkopen)
        # github Python
        self.toolBar.Action14 = QtGui.QAction(QtGui.QIcon(":/ico/github.png"),
                                              "Open git python", self.toolBar)
        self.toolBar.Action14.setStatusTip("Open git python")
        self.toolBar.Action14.setShortcut("Ctrl+G")
        self.toolBar.Action14.triggered.connect(self.gitopen)
        # auther me :)
        self.toolBar.Action15 = QtGui.QAction(QtGui.QIcon(":/ico/auth.png"),
                                              "Author", self.toolBar)
        self.toolBar.Action15.setStatusTip("Author")
        self.toolBar.Action15.setShortcut("Ctrl+B")
        self.toolBar.Action15.triggered.connect(self.Author)
        # toggle off code regonision
        self.toolBar.Action16 = QtGui.QAction(
            QtGui.QIcon(":/ico2/pythonminus.png"), "Disable Code recognition",
            self.toolBar)
        self.toolBar.Action16.setStatusTip("Disable Code recognition")
        self.toolBar.Action16.setShortcut("Alt+D")
        self.toolBar.Action16.triggered.connect(self.Diablecode)
        # toogle on
        self.toolBar.Action17 = QtGui.QAction(
            QtGui.QIcon(":/ico2/pypluss.png"), "Enable Code recognition",
            self.toolBar)
        self.toolBar.Action17.setStatusTip("Enable Code recognition")
        self.toolBar.Action17.setShortcut("Alt+E")
        self.toolBar.Action17.triggered.connect(self.Reiablecode)
        # zoom in
        self.toolBar.Action18 = QtGui.QAction(QtGui.QIcon(":/ico3/in.png"),
                                              "Zoom In", self.toolBar)
        self.toolBar.Action18.setStatusTip("Zoom In")
        self.toolBar.Action18.setShortcut("CTRL+SHIFT++")
        self.toolBar.Action18.triggered.connect(self.udder)
        # zoom out
        self.toolBar.Action19 = QtGui.QAction(QtGui.QIcon(":/ico3/out.png"),
                                              "Zoom Out", self.toolBar)
        self.toolBar.Action19.setStatusTip("Zoom Out")
        self.toolBar.Action19.setShortcut("CTRL+SHIFT+-")
        self.toolBar.Action19.triggered.connect(self.odder)

        self.toolBar.Action20 = QtGui.QAction(QtGui.QIcon(":/ico3/10.png"),
                                              "Profile Code", self.toolBar)
        self.toolBar.Action20.setStatusTip("Profile Code")
        self.toolBar.Action20.setShortcut("CTRL+SHIFT+E")
        self.toolBar.Action20.triggered.connect(self.runtoprob)

        # actions
        self.toolBar.addAction(self.toolBar.newAction)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.toolBar.secondAction)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.toolBar.Action3)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.toolBar.Action4)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.toolBar.Action6)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.toolBar.Action7)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.toolBar.Action8)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.toolBar.Action9)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.toolBar.Action10)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.toolBar.Action21)
        self.toolBar.addSeparator()
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.toolBar.Action11)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.toolBar.Action12)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.toolBar.Action14)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.toolBar.Action15)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.toolBar.Action16)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.toolBar.Action17)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.toolBar.Action18)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.toolBar.Action19)
        self.toolBar.addSeparator()
        self.toolBar.addAction(self.toolBar.Action20)

        # font
        self.skrift = QFont()
        self.skrift.setFamily('Consolas')
        self.skrift.setFixedPitch(True)
        self.skrift.setPointSize(12)
        self.codebox.setFont(self.skrift)

        # python style
        self.lexer = QsciLexerPython(self.codebox)
        self.lexer.setFont(self.skrift)
        self.lexer.setEolFill(True)
        # api test not working
        api = Qsci.QsciAPIs(self.lexer)
        API_FILE = dn + '\\Python.api'
        API_FILE2 = dn + '\\idc.api'
        API_FILE3 = dn + '\\idaapi.api'
        api.load(API_FILE)
        api.load(API_FILE2)
        api.load(API_FILE3)

        api.prepare()
        self.codebox.setAutoCompletionThreshold(0)
        self.codebox.setAutoCompletionThreshold(6)
        self.codebox.setAutoCompletionThreshold(8)
        self.codebox.setAutoCompletionSource(Qsci.QsciScintilla.AcsAPIs)
        self.lexer.setDefaultFont(self.skrift)
        self.codebox.setLexer(self.lexer)
        self.codebox.SendScintilla(QsciScintilla.SCI_STYLESETFONT, 1,
                                   'Consolas')

        # line numbers
        fontmetrics = QFontMetrics(self.skrift)
        self.codebox.setMarginsFont(self.skrift)
        self.codebox.setMarginWidth(0, fontmetrics.width("0000") + 6)
        self.codebox.setTabWidth(4)

        # brace
        self.codebox.setBraceMatching(QsciScintilla.SloppyBraceMatch)

        # auto line tab =4
        self.codebox.setAutoIndent(True)

        # scroolbar
        self.codebox.SendScintilla(QsciScintilla.SCI_SETHSCROLLBAR, 1)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
        self.lbl = self.codebox
예제 #6
0
    def setupUi(self, vindu):
        self.codebox = Qsci.QsciScintilla(vindu)
        vindu.setObjectName(_fromUtf8("vindu"))
        vindu.resize(1093, 734)
        vindu.setStyleSheet(
            _fromUtf8("QWidget { \n"
                      "    background-color: #c0c0c0;\n"
                      "    color: #ddd;\n"
                      "}\n"
                      "\n"
                      "\n"
                      "\n"
                      "QPushButton {\n"
                      "color: #333;\n"
                      "border: 2px solid #555;\n"
                      "border-radius: 0px;\n"
                      "padding: 5px;\n"
                      "background: qradialgradient(cx: 0.3, cy: -0.4,\n"
                      "fx: 0.3, fy: -0.4,\n"
                      "radius: 1.35, stop: 0 #fff, stop: 1 #888);\n"
                      "min-width: 80px;\n"
                      "}\n"
                      " \n"
                      "QPushButton:hover {\n"
                      "background: qradialgradient(cx: 0.3, cy: -0.4,\n"
                      "fx: 0.3, fy: -0.4,\n"
                      "radius: 1.35, stop: 0 #fff, stop: 1 #bbb);\n"
                      "}\n"
                      " \n"
                      "QPushButton:pressed {\n"
                      "background: qradialgradient(cx: 0.4, cy: -0.1,\n"
                      "fx: 0.4, fy: -0.1,\n"
                      "radius: 1.35, stop: 0 #fff, stop: 1 #ddd);\n"
                      "}"))
        self.codebox = Qsci.QsciScintilla(vindu)
        self.codebox.setGeometry(QtCore.QRect(-1, -1, 1101, 661))
        self.codebox.setToolTip(_fromUtf8(""))
        self.codebox.setWhatsThis(_fromUtf8(""))
        self.codebox.setObjectName(_fromUtf8("codebox"))
        self.curFile = ''

        #font
        skrift = QFont()
        skrift.setFamily('Consolas')
        skrift.setFixedPitch(True)
        skrift.setPointSize(12)
        self.codebox.setFont(skrift)

        self.runbtr = QtGui.QPushButton(vindu)
        self.runbtr.setGeometry(QtCore.QRect(790, 680, 94, 34))
        self.runbtr.setObjectName(_fromUtf8("runbtr"))
        self.impbtr = QtGui.QPushButton(vindu)
        self.impbtr.setGeometry(QtCore.QRect(890, 680, 94, 34))
        self.impbtr.setObjectName(_fromUtf8("impbtr"))
        self.exbtr = QtGui.QPushButton(vindu)
        self.exbtr.setGeometry(QtCore.QRect(990, 680, 94, 34))
        self.exbtr.setObjectName(_fromUtf8("exbtr"))
        #python style
        lexer = QsciLexerPython()
        lexer.setDefaultFont(skrift)
        self.codebox.setLexer(lexer)
        self.codebox.SendScintilla(QsciScintilla.SCI_STYLESETFONT, 1,
                                   'Consolas')

        #line numbers
        fontmetrics = QFontMetrics(skrift)
        self.codebox.setMarginsFont(skrift)
        self.codebox.setMarginWidth(0, fontmetrics.width("00000") + 6)
        self.codebox.setTabWidth(4)
        #self.codebox.setWhitespaceVisibility(True)
        #self.codebox.setWhitespaceSize(40)
        #self.codebox.setWhitespaceBackgroundColor(QColor(255, 0, 0, 127))
        self.codebox.setMarginLineNumbers(0, True)
        self.codebox.setMarginsBackgroundColor(QColor("#cccccc"))

        #brace
        self.codebox.setBraceMatching(QsciScintilla.SloppyBraceMatch)
        self.codebox.setCaretLineBackgroundColor(QColor("#ffe4e4"))

        #try to load api
        api = Qsci.QsciAPIs(lexer)

        api.load('idaapi.py')
        api.prepare()
        self.codebox.setAutoCompletionThreshold(1)
        self.codebox.setAutoCompletionSource(Qsci.QsciScintilla.AcsAPIs)
        self.codebox.setLexer(lexer)

        self.retranslateUi(vindu)
        QtCore.QObject.connect(self.runbtr,
                               QtCore.SIGNAL(_fromUtf8("clicked()")),
                               self.codebox.selectAll)
        QtCore.QMetaObject.connectSlotsByName(vindu)
예제 #7
0
    def __init__(self,
                 parent=None,
                 ShowPrint=True,
                 ShowError=True,
                 StatusBar=None,
                 AsDock=False,
                 SaveLogRefreshDays=30,
                 ScriptsPath='Scripts/',
                 InitalizeScripts=True):
        '''
        Parent - Pass QWIDGET based objects. Else I will create my own.
        ShowPrint - Redirect standard prints
        ShowError - Redirect standard errors
        StatusBar - Attach DevC Invoke button to this status bar else You should invoke DevC explicitly
        AsDock - If True creates DevC as a dock else as a dialog window
        '''

        if not parent:
            print 'No parent widget specified! Creating my own parent!'
            prn = QtGui.QWidget()
            prn.setObjectName('DevC')
            self.standalone = 1
        else:
            prn = parent
            self.standalone = 0

        if not hasattr(prn, 'addDockWidget') and not self.standalone:
            AsDock = False
            print 'Current parent does not support dock!'

        if ShowPrint: sys.stdout = self
        if ShowError: sys.stderr = self
        winObj = str(prn.objectName())
        setattr(__builtin__, winObj if winObj else 'mainwin', prn)

        if AsDock:
            self.win = QtGui.QDockWidget(prn)
            base = QtGui.QWidget()
            self.setupUi(base)
            self.win.setWidget(base)
            prn.addDockWidget(QtCore.Qt.DockWidgetArea(2), self.win)
        else:
            self.win = QtGui.QDialog(prn)
            self.setupUi(self.win)

        self.parent = prn
        self.inter = InteractiveInterpreter()
        self.inter.locals['dev'] = self
        self.inter.locals['self'] = self.parent

        self.win.setWindowIcon(prn.windowIcon())
        self.win.setWindowTitle('K Python Interpreter')

        self.PLX = Qsci.QsciLexerPython(self.win)
        self.ABS = Qsci.QsciAPIs(self.PLX)
        self.PLX.setAPIs(self.ABS)

        self.sciInput.setAutoCompletionSource(Qsci.QsciScintilla.AcsAll)
        self.sciInput.setLexer(self.PLX)
        self.sciInput.setAutoCompletionThreshold(1)
        self.sciInput.setAutoIndent(True)
        self.sciInput.setAutoCompletionFillupsEnabled(True)
        self.sciInput.setBraceMatching(Qsci.QsciScintilla.StrictBraceMatch)
        self.sciInput.setMarginLineNumbers(1, 1)
        self.sciInput.setMarginWidth(1, 45)

        self.sciOutput.setReadOnly(1)
        self.sciOutput.setAutoCompletionSource(Qsci.QsciScintilla.AcsAll)
        self.sciOutput.setLexer(self.PLX)
        self.sciOutput.setAutoCompletionThreshold(1)
        self.sciOutput.setAutoIndent(True)
        self.sciOutput.setAutoCompletionFillupsEnabled(True)
        self.sciOutput.setBraceMatching(Qsci.QsciScintilla.StrictBraceMatch)
        self.sciOutput.setMarginLineNumbers(1, 1)
        self.sciOutput.setMarginWidth(1, 45)

        #Connections
        self.parent.connect(self.btnClearInput, QtCore.SIGNAL('clicked()'),
                            self.btnRedirector)
        self.parent.connect(self.btnClearOutput, QtCore.SIGNAL('clicked()'),
                            self.btnRedirector)
        self.parent.connect(self.btnExecute, QtCore.SIGNAL('clicked()'),
                            self.btnRedirector)
        self.parent.connect(self.btnLoadScript, QtCore.SIGNAL('clicked()'),
                            self.btnRedirector)
        self.parent.connect(self.btnSaveScript, QtCore.SIGNAL('clicked()'),
                            self.btnRedirector)
        self.parent.connect(self.cline, QtCore.SIGNAL('returnPressed()'),
                            self.commandLineExecute)

        if StatusBar:
            self.stsBtnDebugger = QtGui.QToolButton()
            self.stsBtnDebugger.setText('DevConsole')
            self.stsBtnDebugger.setToolTip('DevConsole')
            self.stsBtnDebugger.setAutoRaise(1)
            self.stsBtnDebugger.setMaximumHeight(18)
            StatusBar.addPermanentWidget(self.stsBtnDebugger, 0)
            self.parent.connect(self.stsBtnDebugger,
                                QtCore.SIGNAL('clicked()'), self.btnRedirector)
        else:
            self.stsBtnDebugger = None

        self.win.hide()

        print 'Simple Python Scripting Environment (SPSE)'
        print '--------------------------------'
        print 'Initiated!'

        print '\nLog Start Time: ' + str(strftime("%Y/%m/%d %H:%M:%S"))
        print '\n---------------------------------------\n'
        print '*** Python %s on %s.***' % (sys.version, sys.platform)
        print sys.copyright
        print ''
        print 'Platform: ' + sys.platform
        print 'Version: ' + str(sys.getwindowsversion())
        print 'FileSys encodeing: ' + str(sys.getfilesystemencoding())

        print '\n---------------------------------------\n'
        self.credit = '\n---------------------------------------\nAbout Python Interactive Interpreter! \nExpreimental Feature developed by \nL.Kumaresan \nFor ABX Studios\n---------------------------------------\n '

        self.InitalizeScripts = InitalizeScripts
        self.SaveLogRefreshDays = SaveLogRefreshDays
        self.scriptPath = ScriptsPath
        if self.scriptPath:
            if self.InitalizeScripts and self.scriptPath and not os.path.exists(
                    self.scriptPath):
                os.makedirs(self.scriptPath)
        else:
            print 'Invalid script path!'

        try:
            if self.InitalizeScripts:
                self.execStartUp()
        except:
            print errorReport()
            print 'Error on startup'