示例#1
0
def startIep():
    """ startIep()
    Run IEP.
    """
    
    # Do some imports
    from iep.iepcore import iepLogging # to start logging asap
    from iep.iepcore.main import MainWindow
    
    # Set to be aware of the systems native colors, fonts, etc.
    QtGui.QApplication.setDesktopSettingsAware(True)
    
    # Prevent loading plugins form the system plugin dir since this may
    # cause multiple versions of the Qt library to be loaded at once,
    # which will conflict.  Note also the writing of qt.conf in the
    # freezeSctipt
    # But on KDE this means that the style of IEP does not fit in, see
    # issue 138. Therefore do *not* disable if running from source on KDE
    disableLibraryPaths = True
    if os.environ.get('KDE_FULL_SESSION'):  # relatively safe way to detect KDE
        if QtGui.__file__.startswith('/usr/'):
            disableLibraryPaths = False
    if disableLibraryPaths:
        QtGui.QApplication.setLibraryPaths([])
    
    # Instantiate the application
    QtGui.qApp = QtGui.QApplication([])
    
    # Choose language, get locale
    locale = setLanguage(config.settings.language)
    
    # Create main window, using the selected locale
    frame = MainWindow(None, locale)
    
    # Enter the main loop
    QtGui.qApp.exec_()
示例#2
0
        # Show completion list if required. 
        self.textCtrl.autocompleteShow(len(self.needle), names)
    
    def nameInImportNames(self, importNames):
        """ nameInImportNames(importNames)
        Test whether the name, or a base part of it is present in the
        given list of names. Returns the (part of) the name that's in
        the list, or None otherwise.
        """
        baseName = self.name
        while baseName not in importNames:
            if '.' in baseName:
                baseName = baseName.rsplit('.',1)[0]
            else:
                baseName = None
                break
        return baseName
    
    
if __name__=="__main__":
    app = QtGui.QApplication([])
    win = BaseTextCtrl(None)
#     win.setStyle('.py')
    tmp = "foo(bar)\nfor bar in range(5):\n  print bar\n"
    tmp += "\nclass aap:\n  def monkey(self):\n    pass\n\n"
    tmp += "a\u20acb\n"
    win.setPlainText(tmp)    
    win.show()
    app.exec_()