Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Pythonwin/pywin/Demos/cmdserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,22 @@


class ThreadWriter:
"Assign an instance to sys.stdout for per-thread printing objects - Courtesy Guido!"
"""Assign an instance to sys.stdout for per-thread printing objects - Courtesy Guido!"""

def __init__(self):
"Constructor -- initialize the table of writers"
"""Constructor -- initialize the table of writers"""
self.writers = {}
self.origStdOut = None

def register(self, writer):
"Register the writer for the current thread"
"""Register the writer for the current thread"""
self.writers[_thread.get_ident()] = writer
if self.origStdOut is None:
self.origStdOut = sys.stdout
sys.stdout = self

def unregister(self):
"Remove the writer for the current thread, if any"
"""Remove the writer for the current thread, if any"""
try:
del self.writers[_thread.get_ident()]
except KeyError:
Expand All @@ -36,11 +36,11 @@ def unregister(self):
self.origStdOut = None

def getwriter(self):
"Return the current thread's writer, default sys.stdout"
"""Return the current thread's writer, default sys.stdout"""
self.writers.get(_thread.get_ident(), self.origStdOut)

def write(self, str):
"Write to the current thread's writer, default sys.stdout"
"""Write to the current thread's writer, default sys.stdout"""
self.getwriter().write(str)


Expand Down
2 changes: 1 addition & 1 deletion Pythonwin/pywin/Demos/ocx/flash.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def __init__(self, url=None):
self.url = regutil.GetRegisteredHelpFile("Main Python Documentation")
else:
self.url = url
pass # Don't call base class doc/view version...
# Don't call base class doc/view version...

def Create(self, title, rect=None, parent=None):
style = win32con.WS_CHILD | win32con.WS_VISIBLE | win32con.WS_OVERLAPPEDWINDOW
Expand Down
2 changes: 1 addition & 1 deletion Pythonwin/pywin/Demos/ocx/webbrowser.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def __init__(self, url=None):
self.url = "https://www.python.org"
else:
self.url = url
pass # Don't call base class doc/view version...
# Don't call base class doc/view version...

def Create(self, title, rect=None, parent=None):
style = win32con.WS_CHILD | win32con.WS_VISIBLE | win32con.WS_OVERLAPPEDWINDOW
Expand Down
2 changes: 1 addition & 1 deletion Pythonwin/pywin/Demos/threadedgui.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def ExitInstance(self):

class ThreadedFontFrame(window.MDIChildWnd):
def __init__(self):
pass # Don't call base class doc/view version...
# Don't call base class doc/view version...
self.thread = None

def Create(self, title, rect=None, parent=None):
Expand Down
2 changes: 1 addition & 1 deletion Pythonwin/pywin/debugger/dbgpyapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

class DebuggerPythonApp(intpyapp.InteractivePythonApp):
def LoadMainFrame(self):
"Create the main applications frame"
"""Create the main applications frame"""
self.frame = self.CreateMainFrame()
self.SetMainFrame(self.frame)
self.frame.LoadFrame(win32ui.IDR_DEBUGGER, win32con.WS_OVERLAPPEDWINDOW)
Expand Down
6 changes: 3 additions & 3 deletions Pythonwin/pywin/debugger/debugger.py
Original file line number Diff line number Diff line change
Expand Up @@ -948,7 +948,7 @@ def GUIAboutToRun(self):
return 1

def GUIAboutToBreak(self):
"Called as the GUI debugger is about to get context, and take control of the running program."
"""Called as the GUI debugger is about to get context, and take control of the running program."""
self.GUICheckInit()
self.RespondDebuggerState(DBGSTATE_BREAK)
self.GUIAboutToInteract()
Expand All @@ -962,7 +962,7 @@ def GUIAboutToBreak(self):
win32ui.GetMainFrame().PostMessage(win32con.WM_CLOSE)

def GUIAboutToInteract(self):
"Called as the GUI is about to perform any interaction with the user"
"""Called as the GUI is about to perform any interaction with the user"""
frame = win32ui.GetMainFrame()
# Remember the enabled state of our main frame
# may be disabled primarily if a modal dialog is displayed.
Expand Down Expand Up @@ -1069,7 +1069,7 @@ def ShowCurrentLine(self):
self.ShowLineState(fileName, lineNo, LINESTATE_CURRENT)

def _UnshowCurrentLine(self):
"Unshow the current line, and forget it"
"""Unshow the current line, and forget it"""
if self.shownLineCurrent is not None:
fname, lineno = self.shownLineCurrent
self.ResetLineState(fname, lineno, LINESTATE_CURRENT)
Expand Down
26 changes: 13 additions & 13 deletions Pythonwin/pywin/framework/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# The application is responsible for managing the main frame window.
#
# We also grab the FileOpen command, to invoke our Python editor
"The PythonWin application code. Manages most aspects of MDI, etc"
"""The PythonWin application code. Manages most aspects of MDI, etc"""

from __future__ import annotations

Expand Down Expand Up @@ -113,15 +113,15 @@ def OnDestroy(self, msg):


class CApp(WinApp):
"A class for the application"
"""A class for the application"""

def __init__(self):
self.oldCallbackCaller = None
WinApp.__init__(self, win32ui.GetApp())
self.idleHandlers = []

def InitInstance(self):
"Called to crank up the app"
"""Called to crank up the app"""
HookInput()
numMRU = win32ui.GetProfileVal("Settings", "Recent File List Size", 10)
win32ui.LoadStdProfileSettings(numMRU)
Expand All @@ -133,7 +133,7 @@ def InitInstance(self):
self.SetApplicationPaths()

def ExitInstance(self):
"Called as the app dies - too late to prevent it here!"
"""Called as the app dies - too late to prevent it here!"""
win32ui.OutputDebug("Application shutdown\n")
# Restore the callback manager, if any.
try:
Expand Down Expand Up @@ -184,7 +184,7 @@ def CreateMainFrame(self):
return MainFrame()

def LoadMainFrame(self):
"Create the main applications frame"
"""Create the main applications frame"""
self.frame = self.CreateMainFrame()
self.SetMainFrame(self.frame)
self.frame.LoadFrame(win32ui.IDR_MAINFRAME, win32con.WS_OVERLAPPEDWINDOW)
Expand Down Expand Up @@ -250,19 +250,19 @@ def SetApplicationPaths(self):
sys.path = new_path + sys.path

def OnRClick(self, params):
"Handle right click message"
"""Handle right click message"""
# put up the entire FILE menu!
menu = win32ui.LoadMenu(win32ui.IDR_TEXTTYPE).GetSubMenu(0)
menu.TrackPopupMenu(params[5]) # track at mouse position.
return 0

def OnDropFiles(self, msg):
"Handle a file being dropped from file manager"
"""Handle a file being dropped from file manager"""
hDropInfo = msg[2]
self.frame.SetActiveWindow() # active us
nFiles = win32api.DragQueryFile(hDropInfo)
try:
for iFile in range(0, nFiles):
for iFile in range(nFiles):
fileName = win32api.DragQueryFile(hDropInfo, iFile)
win32ui.GetApp().OpenDocumentFile(fileName)
finally:
Expand Down Expand Up @@ -294,20 +294,20 @@ def OnDropFiles(self, msg):

# Command handlers.
def OnFileMRU(self, id, code):
"Called when a File 1-n message is received"
"""Called when a File 1-n message is received"""
fileName = win32ui.GetRecentFileList()[id - win32ui.ID_FILE_MRU_FILE1]
win32ui.GetApp().OpenDocumentFile(fileName)

def HandleOnFileOpen(self, id, code):
"Called when FileOpen message is received"
"""Called when FileOpen message is received"""
win32ui.GetApp().OnFileOpen()

def HandleOnFileNew(self, id, code):
"Called when FileNew message is received"
"""Called when FileNew message is received"""
win32ui.GetApp().OnFileNew()

def OnHelpAbout(self, id, code):
"Called when HelpAbout message is received. Displays the About dialog."
"""Called when HelpAbout message is received. Displays the About dialog."""
win32ui.InitRichEdit()
dlg = AboutBox()
dlg.DoModal()
Expand Down Expand Up @@ -365,7 +365,7 @@ def OnButHomePage(self, id, code):


def Win32Input(prompt=None):
"Provide input() for gui apps"
"""Provide input() for gui apps"""
# flush stderr/out first.
try:
sys.stdout.flush()
Expand Down
4 changes: 2 additions & 2 deletions Pythonwin/pywin/framework/bitmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


class BitmapDocument(docview.Document):
"A bitmap document. Holds the bitmap data itself."
"""A bitmap document. Holds the bitmap data itself."""

def __init__(self, template):
docview.Document.__init__(self, template)
Expand Down Expand Up @@ -40,7 +40,7 @@ def DeleteContents(self):


class BitmapView(docview.ScrollView):
"A view of a bitmap. Obtains data from document."
"""A view of a bitmap. Obtains data from document."""

def __init__(self, doc):
docview.ScrollView.__init__(self, doc)
Expand Down
4 changes: 2 additions & 2 deletions Pythonwin/pywin/framework/dlgappcore.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@


class AppDialog(dialog.Dialog):
"The dialog box for the application"
"""The dialog box for the application"""

def __init__(self, id, dll=None):
self.iconId = win32ui.IDR_MAINFRAME
Expand Down Expand Up @@ -49,7 +49,7 @@ def PreDoModal(self):


class DialogApp(app.CApp):
"An application class, for an app with main dialog box"
"""An application class, for an app with main dialog box"""

def InitInstance(self):
# win32ui.SetProfileFileName('dlgapp.ini')
Expand Down
8 changes: 4 additions & 4 deletions Pythonwin/pywin/framework/editor/color/coloreditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@


class SyntEditDocument(EditorDocumentBase):
"A SyntEdit document."
"""A SyntEdit document."""

def OnDebuggerStateChange(self, state):
self._ApplyOptionalToViews("OnDebuggerStateChange", state)
Expand All @@ -40,7 +40,7 @@ def FinalizeViewCreation(self, view):


class SyntEditView(SyntEditViewParent):
"A view of a SyntEdit. Obtains data from document."
"""A view of a SyntEdit. Obtains data from document."""

def __init__(self, doc):
SyntEditViewParent.__init__(self, doc)
Expand Down Expand Up @@ -538,7 +538,7 @@ def FoldExpandAllEvent(self, event):
if not self.bFolding:
return 1
win32ui.DoWaitCursor(1)
for lineno in range(0, self.GetLineCount()):
for lineno in range(self.GetLineCount()):
if self.SCIGetFoldLevel(
lineno
) & scintillacon.SC_FOLDLEVELHEADERFLAG and not self.SCIGetFoldExpanded(
Expand All @@ -563,7 +563,7 @@ def FoldCollapseAllEvent(self, event):
return 1
win32ui.DoWaitCursor(1)
self.Colorize()
for lineno in range(0, self.GetLineCount()):
for lineno in range(self.GetLineCount()):
if self.SCIGetFoldLevel(
lineno
) & scintillacon.SC_FOLDLEVELHEADERFLAG and self.SCIGetFoldExpanded(lineno):
Expand Down
10 changes: 5 additions & 5 deletions Pythonwin/pywin/framework/editor/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def SetAllLineColors(self, color=None):
view.SetAllLineColors(color)

def SetLineColor(self, lineNo, color):
"Color a line of all views"
"""Color a line of all views"""
for view in self.GetAllViews():
view.SetLineColor(lineNo, color)

Expand Down Expand Up @@ -200,7 +200,7 @@ def CutCurLine(self):
self._obj_.Cut()

def _PrepareUserStateChange(self):
"Return selection, lineindex, etc info, so it can be restored"
"""Return selection, lineindex, etc info, so it can be restored"""
self.SetRedraw(0)
return self.GetModify(), self.GetSel(), self.GetFirstVisibleLine()

Expand Down Expand Up @@ -229,7 +229,7 @@ def SetAllLineColors(self, color=None):
self._EndUserStateChange(info)

def SetLineColor(self, lineNo, color):
"lineNo is the 1 based line number to set. If color is None, default color is used."
"""lineNo is the 1 based line number to set. If color is None, default color is used."""
if isRichText:
info = self._PrepareUserStateChange()
try:
Expand Down Expand Up @@ -294,7 +294,7 @@ def Indent(self):
self._obj_.ReplaceSel(ins)

def BlockDent(self, isIndent, startLine, endLine):
"Indent/Undent all lines specified"
"""Indent/Undent all lines specified"""
if not self.GetDocument().CheckMakeDocumentWritable():
return 0
tabSize = self.tabSize # hard-code for now!
Expand All @@ -312,7 +312,7 @@ def BlockDent(self, isIndent, startLine, endLine):
if line[0] == "\t":
noToDel = 1
elif line[0] == " ":
for noToDel in range(0, tabSize):
for noToDel in range(tabSize):
if line[noToDel] != " ":
break
else:
Expand Down
2 changes: 1 addition & 1 deletion Pythonwin/pywin/framework/help.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def FinalizeHelp():


def OpenHelpFile(fileName, helpCmd=None, helpArg=None):
"Open a help file, given a full path"
"""Open a help file, given a full path"""
# default help arg.
win32ui.DoWaitCursor(1)
try:
Expand Down
2 changes: 1 addition & 1 deletion Pythonwin/pywin/framework/interact.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ def DoGetLine(self, line=-1):
return line

def AppendToPrompt(self, bufLines, oldPrompt=None):
"Take a command and stick it at the end of the buffer (with python prompts inserted if required)."
"""Take a command and stick it at the end of the buffer (with python prompts inserted if required)."""
self.flush()
lastLineNo = self.GetLineCount() - 1
line = self.DoGetLine(lastLineNo)
Expand Down
8 changes: 4 additions & 4 deletions Pythonwin/pywin/framework/intpyapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ def OnDDECommand(self, command):
# General handlers
#
def OnViewBrowse(self, id, code):
"Called when ViewBrowse message is received"
"""Called when ViewBrowse message is received"""
from pywin.tools import browser

obName = dialog.GetSimpleInput("Object", "__builtins__", "Browse Python Object")
Expand All @@ -421,13 +421,13 @@ def OnViewBrowse(self, id, code):
win32ui.MessageBox("This object can not be browsed")

def OnFileImport(self, id, code):
"Called when a FileImport message is received. Import the current or specified file"
"""Called when a FileImport message is received. Import the current or specified file"""
from . import scriptutils

scriptutils.ImportFile()

def OnFileCheck(self, id, code):
"Called when a FileCheck message is received. Check the current file."
"""Called when a FileCheck message is received. Check the current file."""
from . import scriptutils

scriptutils.CheckFile()
Expand All @@ -438,7 +438,7 @@ def OnUpdateFileCheck(self, cmdui):
cmdui.Enable(scriptutils.GetActiveFileName(0) is not None)

def OnFileRun(self, id, code):
"Called when a FileRun message is received."
"""Called when a FileRun message is received."""
from . import scriptutils

showDlg = win32api.GetKeyState(win32con.VK_SHIFT) >= 0
Expand Down
Loading
Loading