Skip to content

Commit

Permalink
Remove lib2to3 comments and workarounds
Browse files Browse the repository at this point in the history
  • Loading branch information
Avasam committed Oct 13, 2024
1 parent c670569 commit d546200
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
11 changes: 4 additions & 7 deletions Pythonwin/pywin/mfc/dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
import win32con
import win32ui

# sob - 2to3 doesn't see this as a relative import :(
from pywin.mfc import window
from . import window


def dllFromDll(dllid):
Expand Down Expand Up @@ -258,21 +257,19 @@ def GetSimpleInput(prompt, defValue="", title=None):
# uses a simple dialog to return a string object.
if title is None:
title = win32ui.GetMainFrame().GetWindowText()
# 2to3 insists on converting 'Dialog.__init__' to 'tkinter.dialog...'
DlgBaseClass = Dialog

class DlgSimpleInput(DlgBaseClass):
class DlgSimpleInput(Dialog):
def __init__(self, prompt, defValue, title):
self.title = title
DlgBaseClass.__init__(self, win32ui.IDD_SIMPLE_INPUT)
Dialog.__init__(self, win32ui.IDD_SIMPLE_INPUT)
self.AddDDX(win32ui.IDC_EDIT1, "result")
self.AddDDX(win32ui.IDC_PROMPT1, "prompt")
self._obj_.data["result"] = defValue
self._obj_.data["prompt"] = prompt

def OnInitDialog(self):
self.SetWindowText(self.title)
return DlgBaseClass.OnInitDialog(self)
return Dialog.OnInitDialog(self)

dlg = DlgSimpleInput(prompt, defValue, title)
if dlg.DoModal() != win32con.IDOK:
Expand Down
2 changes: 0 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -879,8 +879,6 @@ def run(self):
# for bdist_wininst to use) - in which case we must *not* run our
# installer
if not self.dry_run and not self.root:
# We must run the script we just installed into Scripts, as it
# may have had 2to3 run over it.
filename = os.path.join(self.install_scripts, "pywin32_postinstall.py")
if not os.path.isfile(filename):
raise RuntimeError(f"Can't find '{filename}'")
Expand Down

0 comments on commit d546200

Please sign in to comment.