Update of /cvsroot/pywin32/pywin32/Pythonwin/pywin/framework
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14888/Pythonwin/pywin/framework
Modified Files:
Tag: py3k
dlgappcore.py help.py intpyapp.py scriptutils.py startup.py
stdin.py winout.py
Log Message:
Merge various changes from trunk and py3k-integration bzr branch
Index: intpyapp.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/framework/intpyapp.py,v
retrieving revision 1.11.2.2
retrieving revision 1.11.2.3
diff -C2 -d -r1.11.2.2 -r1.11.2.3
*** intpyapp.py 31 Aug 2008 08:31:27 -0000 1.11.2.2
--- intpyapp.py 26 Nov 2008 07:17:38 -0000 1.11.2.3
***************
*** 130,134 ****
from . import intpydde
except ImportError:
- traceback.print_exc()
# No dde support!
return None
--- 130,133 ----
***************
*** 178,181 ****
--- 177,182 ----
# Allow Pythonwin to host OCX controls.
win32ui.EnableControlContainer()
+
+ # Display the interactive window if the user wants it.
from . import interact
interact.CreateInteractiveWindowUserPreference()
***************
*** 277,286 ****
def LoadSystemModules(self):
! self.DoLoadModules("editor,stdin")
def LoadUserModules(self, moduleNames = None):
# Load the users modules.
if moduleNames is None:
! default = "sgrepmdi,mdi_pychecker"
moduleNames=win32ui.GetProfileVal('Python','Startup Modules',default)
self.DoLoadModules(moduleNames)
--- 278,287 ----
def LoadSystemModules(self):
! self.DoLoadModules("pywin.framework.editor,pywin.framework.stdin")
def LoadUserModules(self, moduleNames = None):
# Load the users modules.
if moduleNames is None:
! default = "pywin.framework.sgrepmdi,pywin.framework.mdi_pychecker"
moduleNames=win32ui.GetProfileVal('Python','Startup Modules',default)
self.DoLoadModules(moduleNames)
***************
*** 291,295 ****
for module in modules:
try:
! exec("from . import "+module)
except: # Catch em all, else the app itself dies! 'ImportError:
traceback.print_exc()
--- 292,296 ----
for module in modules:
try:
! exec("import "+module)
except: # Catch em all, else the app itself dies! 'ImportError:
traceback.print_exc()
Index: startup.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/framework/startup.py,v
retrieving revision 1.4.2.1
retrieving revision 1.4.2.2
diff -C2 -d -r1.4.2.1 -r1.4.2.2
*** startup.py 29 Aug 2008 06:16:42 -0000 1.4.2.1
--- startup.py 26 Nov 2008 07:17:38 -0000 1.4.2.2
***************
*** 38,42 ****
sys.appargv = sys.argv[:]
# Must check for /app param here.
! if len(sys.argv)>=2 and sys.argv[0].lower()=='/app':
from . import cmdline
moduleName = cmdline.FixArgFileName(sys.argv[1])
--- 38,42 ----
sys.appargv = sys.argv[:]
# Must check for /app param here.
! if len(sys.argv)>=2 and sys.argv[0].lower()=='/app':
from . import cmdline
moduleName = cmdline.FixArgFileName(sys.argv[1])
***************
*** 45,49 ****
# newargv.insert(0, sys.argv[0])
sys.argv = newargv
!
from . import intpyapp
--- 45,50 ----
# newargv.insert(0, sys.argv[0])
sys.argv = newargv
!
! # Import the module that runs our interactive app.
from . import intpyapp
Index: stdin.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/framework/stdin.py,v
retrieving revision 1.3.2.1
retrieving revision 1.3.2.2
diff -C2 -d -r1.3.2.1 -r1.3.2.2
*** stdin.py 29 Aug 2008 06:16:42 -0000 1.3.2.1
--- stdin.py 26 Nov 2008 07:17:38 -0000 1.3.2.2
***************
*** 18,37 ****
"""
import sys
- import string
! true = 1
! false = 0
!
! import code
! get_input_line = code.InteractiveConsole.raw_input
class Stdin:
def __init__(self):
! self.real_file = sys.stdin
self.buffer = ""
def __getattr__(self, name):
"""Forward most functions to the real sys.stdin for absolute realism.
"""
return getattr(self.real_file, name)
--- 18,39 ----
"""
import sys
! try:
! get_input_line = raw_input # py2x
! except NameError:
! import code
! get_input_line = code.InteractiveConsole.raw_input
class Stdin:
def __init__(self):
! self.real_file = sys.stdin # NOTE: Likely to be None in py3k
self.buffer = ""
+ self.closed = False
def __getattr__(self, name):
"""Forward most functions to the real sys.stdin for absolute realism.
"""
+ if self.real_file is None:
+ raise AttributeError, name
return getattr(self.real_file, name)
***************
*** 49,58 ****
EOF is encountered immediately. (For certain files, like ttys,
it makes sense to continue reading after an EOF is hit.)"""
- if self.closed:
- return self.real_file.read(size)
-
result_size = self.__get_lines(size)
return self.__extract_from_buffer(result_size)
-
def readline(self, size = -1):
--- 51,56 ----
***************
*** 66,72 ****
in the input.
"""
- if self.closed:
- return self.real_file.readline(size)
-
maximum_result_size = self.__get_lines(size, lambda buffer: '\n' in buffer)
--- 64,67 ----
***************
*** 87,91 ****
return result
! def __get_lines(self, desired_size, done_reading = lambda buffer: false):
"""Keep adding lines to our internal buffer until done_reading(self.buffer)
is true or EOF has been reached or we have desired_size bytes in the buffer.
--- 82,86 ----
return result
! def __get_lines(self, desired_size, done_reading = lambda buffer: False):
"""Keep adding lines to our internal buffer until done_reading(self.buffer)
is true or EOF has been reached or we have desired_size bytes in the buffer.
***************
*** 100,106 ****
try:
self.__get_line()
! except: # deal with cancellation of get_input_line dialog
desired_size = len(self.buffer) # Be satisfied!
! pass
if desired_size < 0:
return len(self.buffer)
--- 95,101 ----
try:
self.__get_line()
! except EOFError: # deal with cancellation of get_input_line dialog
desired_size = len(self.buffer) # Be satisfied!
!
if desired_size < 0:
return len(self.buffer)
***************
*** 121,127 ****
(possibly after rounding up to an internal buffer size) are read.
"""
- if self.closed:
- return self.real_file.readlines(*sizehint)
-
result = []
total_read = 0
--- 116,119 ----
***************
*** 161,165 ****
test_input = test_input[end_of_line_pos + 1:]
if len(result) == 0 or result[0] == '~':
! raise EOFError
return result
--- 153,157 ----
test_input = test_input[end_of_line_pos + 1:]
if len(result) == 0 or result[0] == '~':
! raise EOFError()
return result
Index: dlgappcore.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/framework/dlgappcore.py,v
retrieving revision 1.3.4.1
retrieving revision 1.3.4.2
diff -C2 -d -r1.3.4.1 -r1.3.4.2
*** dlgappcore.py 29 Aug 2008 06:16:41 -0000 1.3.4.1
--- dlgappcore.py 26 Nov 2008 07:17:38 -0000 1.3.4.2
***************
*** 1,2 ****
--- 1,6 ----
+ # dlgappcore.
+ #
+ # base classes for dialog based apps.
+
from . import app
import win32ui
Index: help.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/framework/help.py,v
retrieving revision 1.12.2.2
retrieving revision 1.12.2.3
diff -C2 -d -r1.12.2.2 -r1.12.2.3
*** help.py 2 Oct 2008 13:06:36 -0000 1.12.2.2
--- help.py 26 Nov 2008 07:17:38 -0000 1.12.2.3
***************
*** 143,147 ****
if helpIDMap:
! for id, (desc, fname) in list(helpIDMap.items()):
otherMenu.AppendMenu(win32con.MF_ENABLED|win32con.MF_STRING,id, desc)
else:
--- 143,147 ----
if helpIDMap:
! for id, (desc, fname) in helpIDMap.iteritems():
otherMenu.AppendMenu(win32con.MF_ENABLED|win32con.MF_STRING,id, desc)
else:
Index: winout.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/framework/winout.py,v
retrieving revision 1.14.2.1
retrieving revision 1.14.2.2
diff -C2 -d -r1.14.2.1 -r1.14.2.2
*** winout.py 29 Aug 2008 06:16:42 -0000 1.14.2.1
--- winout.py 26 Nov 2008 07:17:38 -0000 1.14.2.2
***************
*** 24,28 ****
from pywin.mfc import docview
from pywin.framework import app, window
- ## from pywintypes import UnicodeType
import win32ui, win32api, win32con
import queue
--- 24,27 ----
***************
*** 131,139 ****
return 1
except win32api.error as details:
! try:
! msg = details[2]
! except:
! msg = str(details)
! win32ui.SetStatusText("The help file could not be opened - %s" % msg)
return 1
except:
--- 130,134 ----
return 1
except win32api.error as details:
! win32ui.SetStatusText("The help file could not be opened - %s" % details.strerror)
return 1
except:
***************
*** 428,432 ****
return 0
! def QueueFlush(self, max = sys.maxsize):
# Returns true if the queue is empty after the flush
# debug("Queueflush - %d, %d\n" % (max, self.outputQueue.qsize()))
--- 423,427 ----
return 0
! def QueueFlush(self, max = None):
# Returns true if the queue is empty after the flush
# debug("Queueflush - %d, %d\n" % (max, self.outputQueue.qsize()))
***************
*** 434,454 ****
items = []
rc = 0
! while max > 0:
try:
item = self.outputQueue.get_nowait()
- ## if is_platform_unicode:
- ## # Note is_platform_unicode is never true any more!
- ## if not isinstance(item, UnicodeType):
- ## item = str(item, default_platform_encoding)
- ## item = item.encode(default_scintilla_encoding) # What scintilla uses.
- ## else:
- ## # try and display using mbcs encoding
- ## if isinstance(item, UnicodeType):
- ## item = item.encode("mbcs")
items.append(item)
except queue.Empty:
rc = 1
break
! max = max - 1
if len(items) != 0:
if not self.CheckRecreateWindow():
--- 429,441 ----
items = []
rc = 0
! while max is None or max > 0:
try:
item = self.outputQueue.get_nowait()
items.append(item)
except queue.Empty:
rc = 1
break
! if max is not None:
! max = max - 1
if len(items) != 0:
if not self.CheckRecreateWindow():
Index: scriptutils.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/framework/scriptutils.py,v
retrieving revision 1.18.2.1
retrieving revision 1.18.2.2
diff -C2 -d -r1.18.2.1 -r1.18.2.2
*** scriptutils.py 29 Aug 2008 06:16:42 -0000 1.18.2.1
--- scriptutils.py 26 Nov 2008 07:17:38 -0000 1.18.2.2
***************
*** 263,269 ****
try:
f = open(script)
! except IOError as xxx_todo_changeme:
! (code, msg) = xxx_todo_changeme.args
! win32ui.MessageBox("The file could not be opened - %s (%d)" % (msg, code))
return
--- 263,268 ----
try:
f = open(script)
! except IOError as exc:
! win32ui.MessageBox("The file could not be opened - %s (%d)" % (exc.strerror, exc.errno))
return
***************
*** 382,386 ****
modName, modExt = os.path.splitext(modName)
newPath = None
! for key, mod in list(sys.modules.items()):
if hasattr(mod, '__file__'):
fname = mod.__file__
--- 381,385 ----
modName, modExt = os.path.splitext(modName)
newPath = None
! for key, mod in sys.modules.iteritems():
if hasattr(mod, '__file__'):
fname = mod.__file__
***************
*** 460,464 ****
def RunTabNanny(filename):
! import io
tabnanny = FindTabNanny()
if tabnanny is None:
--- 459,466 ----
def RunTabNanny(filename):
! try:
! import cStringIO as io
! except ImportError:
! import io
tabnanny = FindTabNanny()
if tabnanny is None:
|