Utilities/__init__.py

changeset 53
c3eb7cc1ff8b
parent 46
b09750fd2a06
child 55
b5c84934de9c
--- a/Utilities/__init__.py	Tue Jan 12 18:33:34 2010 +0000
+++ b/Utilities/__init__.py	Tue Jan 12 18:36:05 2010 +0000
@@ -26,7 +26,7 @@
 
 from Globals import isWindowsPlatform   # import this method into the Utilities namespace
 
-from E4Gui.E4Application import e4App
+from E4Gui.E4Application import e5App
 
 from UI.Info import Program, Version
 
@@ -131,14 +131,14 @@
     """
     f = open(filename, "rb")
     text = f.read()
-    f.close()
-    return decode(text)
-
-def decode(text):
-    """
-    Function to decode some byte text into a string.
-    
-    @param text byte text to decode (bytes)
+    f.close()
+    return decode(text)
+
+def decode(text):
+    """
+    Function to decode some byte text into a string.
+    
+    @param text byte text to decode (bytes)
     @return tuple of decoded text and encoding (string, string)
     """
     try:
@@ -204,21 +204,21 @@
     @param text text to be written (string)
     @param orig_coding type of the original encoding (string)
     @return encoding used for writing the file (string)
-    """
-    etext, encoding = encode(text, orig_coding)
-    
+    """
+    etext, encoding = encode(text, orig_coding)
+    
     f = open(filename, "wb")
     f.write(etext)
     f.close()
     
     return encoding
-
-def encode(text, orig_coding):
-    """
-    Function to encode text into a byte text.
-    
-    @param text text to be encoded (string)
-    @param orig_coding type of the original encoding (string)
+
+def encode(text, orig_coding):
+    """
+    Function to encode text into a byte text.
+    
+    @param text text to be encoded (string)
+    @param orig_coding type of the original encoding (string)
     @return tuple of encoded text and encoding used (bytes, string)
     """
     encoding = None
@@ -745,7 +745,7 @@
     """
     if code in ["C", "%C"]:
         # column of the cursor of the current editor
-        aw = e4App().getObject("ViewManager").activeWindow()
+        aw = e5App().getObject("ViewManager").activeWindow()
         if aw is None:
             column = -1
         else:
@@ -753,7 +753,7 @@
         return "%d" % column
     elif code in ["D", "%D"]:
         # directory of active editor
-        aw = e4App().getObject("ViewManager").activeWindow()
+        aw = e5App().getObject("ViewManager").activeWindow()
         if aw is None:
             dn = "not_available"
         else:
@@ -765,7 +765,7 @@
         return dn
     elif code in ["F", "%F"]:
         # filename (complete) of active editor
-        aw = e4App().getObject("ViewManager").activeWindow()
+        aw = e5App().getObject("ViewManager").activeWindow()
         if aw is None:
             fn = "not_available"
         else:
@@ -778,7 +778,7 @@
         return getHomeDir()
     elif code in ["L", "%L"]:
         # line of the cursor of the current editor
-        aw = e4App().getObject("ViewManager").activeWindow()
+        aw = e5App().getObject("ViewManager").activeWindow()
         if aw is None:
             line = 0
         else:
@@ -786,13 +786,13 @@
         return "%d" % line
     elif code in ["P", "%P"]:
         # project path
-        projectPath = e4App().getObject("Project").getProjectPath()
+        projectPath = e5App().getObject("Project").getProjectPath()
         if not projectPath:
             projectPath = "not_available"
         return projectPath
     elif code in ["S", "%S"]:
         # selected text of the current editor
-        aw = e4App().getObject("ViewManager").activeWindow()
+        aw = e5App().getObject("ViewManager").activeWindow()
         if aw is None:
             text = "not_available"
         else:
@@ -1123,7 +1123,7 @@
     @return string with plugins version infos (string)
     """
     infoStr = ""
-    app = e4App()
+    app = e5App()
     if app is not None:
         try:
             pm = app.getObject("PluginManager")
@@ -1242,4 +1242,4 @@
             u = getEnvironmentEntry('USERNAME')
         except KeyError:
             u = getEnvironmentEntry('username', None)
-        return u
+        return u
\ No newline at end of file

eric ide

mercurial