Skip to content

Commit

Permalink
Renamed BaseWrapper methods to match PEP-8 requirements (old names ar…
Browse files Browse the repository at this point in the history
…e saved as aliases)
  • Loading branch information
cetygamer committed Feb 23, 2016
1 parent b9a2c52 commit f1b98ca
Show file tree
Hide file tree
Showing 50 changed files with 856 additions and 782 deletions.
6 changes: 3 additions & 3 deletions examples/SaveFromFirefox.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
print("No Menu's in FireFox:", mozilla.MenuItems())

# File -> Save As
mozilla.TypeKeys("%FA")
mozilla.type_keys("%FA")
#ie.Toolbar3.PressButton("File")
app.SaveAs.Edit.SetEditText(outputfilename)

Expand All @@ -96,11 +96,11 @@
except WindowAmbiguousError as e:
for w in e.windows:
w = HwndWrapper(w)
print(w.WindowText(), w.Class())
print(w.window_text(), w.class_name())

print("saved:", outputfilename)

# File close tab or close
#(Firefox makes it easy for us having the same shortcut for both!
mozilla.TypeKeys("%FC")
mozilla.type_keys("%FC")

6 changes: 3 additions & 3 deletions examples/SaveFromInternetExplorer.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@

# ie doesn't define it's menus as Menu's but actually as a toolbar!
print("No Menu's in IE:", ie.MenuItems())
print("They are implemented as a toolbar:", ie.Toolbar3.Texts())
print("They are implemented as a toolbar:", ie.Toolbar3.texts())

ie.TypeKeys("%FA")
ie.type_keys("%FA")
#ie.Toolbar3.PressButton("File")
app.SaveWebPage.Edit.SetEditText(os.path.join(r"c:\.temp",outputfilename))

Expand All @@ -78,5 +78,5 @@
print("saved:", outputfilename)

# quit IE
ie.TypeKeys("%FC")
ie.type_keys("%FC")

4 changes: 2 additions & 2 deletions examples/notepad_fast.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,11 +223,11 @@ def run_notepad():
# "Insert Unicode control character -> IAFS", app.Notepad.ctrl_())
#time.sleep(1)

#app.Notepad.Edit.TypeKeys("{ESC}")
#app.Notepad.Edit.type_keys("{ESC}")

# the following shows that Sendtext does not accept
# accented characters - but does allow 'control' characters
app.Notepad.Edit.TypeKeys(u"{END}{ENTER}SendText d\xf6\xe9s "
app.Notepad.Edit.type_keys(u"{END}{ENTER}SendText d\xf6\xe9s "
u"s\xfcpp\xf4rt \xe0cce\xf1ted characters!!!", with_spaces = True)

# Try and save
Expand Down
4 changes: 2 additions & 2 deletions examples/notepad_slow.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,11 @@ def run_notepad():
#app.PopupMenu.MenuSelect("Insert Unicode control character -> IAFS", app.Notepad.ctrl_())
#time.sleep(1)

#app.Notepad.Edit.TypeKeys("{ESC}")
#app.Notepad.Edit.type_keys("{ESC}")

# the following shows that Sendtext does not accept
# accented characters - but does allow 'control' characters
app.Notepad.Edit.TypeKeys("{END}{ENTER}SendText d\xf6\xe9s "
app.Notepad.Edit.type_keys("{END}{ENTER}SendText d\xf6\xe9s "
u"s\xfcpp\xf4rt \xe0cce\xf1ted characters!!!", with_spaces = True)

# Try and save
Expand Down
4 changes: 2 additions & 2 deletions examples/test_DragDrop.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
dogs = tree.GetItem(r'\Dogs')

# drag-n-drop without focus on the window
#tree.DragMouse("left", birds.Rectangle().mid_point(), dogs.Rectangle().mid_point())
#tree.DragMouse("left", birds.rectangle().mid_point(), dogs.rectangle().mid_point())

# most natural drag-n-drop (with real moving mouse, like real user)
tree.DragMouseInput("left", birds.Rectangle().mid_point(), dogs.Rectangle().mid_point())
tree.drag_mouse_input("left", birds.rectangle().mid_point(), dogs.rectangle().mid_point())
4 changes: 2 additions & 2 deletions examples/test_sakura.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ def sakura_test():
# so using keys to select a menu item

# open some dialog
mainwin.TypeKeys("%OC")
mainwin.type_keys("%OC")

dlg = app.window_(title = u'共通設定')
dlg.window_(title_re = r"フリーカーソル.*").Click()
dlg.MSDOS.Click()
dlg.Cancel.Click()

# quit the application
mainwin.TypeKeys("%FX")
mainwin.type_keys("%FX")


def main():
Expand Down
4 changes: 2 additions & 2 deletions examples/test_sakura2.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def sakura_test():
# so using keys to select a menu item

# open some dialog
mainwin.TypeKeys("%OC")
mainwin.type_keys("%OC")

dlg = app[u'共通設定']

Expand All @@ -53,7 +53,7 @@ def sakura_test():
dlg.Cancel.Click()

# quit the application
mainwin.TypeKeys("%FX")
mainwin.type_keys("%FX")


def main():
Expand Down
12 changes: 6 additions & 6 deletions examples/uninstall_7zip.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
# Go to "Control Panel -> Programs and Features"
NewWindow = explorer.Window_(top_level_only=True, active_only=True, class_name='CabinetWClass')
try:
NewWindow.AddressBandRoot.ClickInput()
NewWindow.TypeKeys(r'Control Panel\Programs\Programs and Features{ENTER}',
with_spaces=True, set_foreground=False)
NewWindow.AddressBandRoot.click_input()
NewWindow.type_keys(r'Control Panel\Programs\Programs and Features{ENTER}',
with_spaces=True, set_foreground=False)
ProgramsAndFeatures = explorer.Window_(top_level_only=True, active_only=True,
title='Programs and Features', class_name='CabinetWClass')

Expand All @@ -26,12 +26,12 @@

item_7z = ProgramsAndFeatures.FolderView.GetItem('7-Zip 9.20 (x64 edition)')
item_7z.EnsureVisible()
item_7z.ClickInput(button='right', where='icon')
item_7z.click_input(button='right', where='icon')
explorer.PopupMenu.MenuItem('Uninstall').Click()

Confirmation = explorer.Window_(title='Programs and Features', class_name='#32770', active_only=True)
if Confirmation.Exists():
Confirmation.Yes.ClickInput()
Confirmation.Yes.click_input()
Confirmation.WaitNot('visible')

WindowsInstaller = explorer.Window_(title='Windows Installer', class_name='#32770', active_only=True)
Expand All @@ -42,7 +42,7 @@
if SevenZipInstaller.Exists():
SevenZipInstaller.WaitNot('visible', timeout=20)

if '7-Zip 9.20 (x64 edition)' not in ProgramsAndFeatures.FolderView.Texts():
if '7-Zip 9.20 (x64 edition)' not in ProgramsAndFeatures.FolderView.texts():
print('OK')
finally:
NewWindow.Close()
4 changes: 2 additions & 2 deletions examples/windowmediaplayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ def windows_media():
app.WindowsMediaPlayer.MenuSelect("View->GoTo->Library")
app.WindowsMediaPlayer.MenuSelect("View->Choose Columns")

#for ctrl in app.ChooseColumns.Children():
# print ctrl.Class()
#for ctrl in app.ChooseColumns.children():
# print ctrl.class_name()


print("Is it checked already:", app.ChooseColumsn.ListView.IsChecked(1))
Expand Down
2 changes: 1 addition & 1 deletion pywinauto/RemoteMemoryBlock.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class AccessDenied(RuntimeError):

#====================================================================
class RemoteMemoryBlock(object):
"Class that enables reading and writing memory in a different process"
"class_name that enables reading and writing memory in a different process"
#----------------------------------------------------------------
def __init__(self, ctrl, size = 4096): #4096): #16384):
"Allocate the memory"
Expand Down
2 changes: 1 addition & 1 deletion pywinauto/SendKeysCtypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def __str__(self):


class KeyAction(object):
"""Class that represents a single 'keyboard' action
"""class_name that represents a single 'keyboard' action
It represents either a PAUSE action (not reallly keyboard) or a keyboard
action (press or release or both) of a particular key.
Expand Down
12 changes: 6 additions & 6 deletions pywinauto/XMLHelpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,21 +463,21 @@ def ReadPropertiesFromFile(filename):

ctrl_prop['Fonts'] = [_XMLToStruct(ctrl_prop['FONT'], "LOGFONTW"), ]

ctrl_prop['Rectangle'] = \
ctrl_prop['rectangle'] = \
_XMLToStruct(ctrl_prop["RECTANGLE"], "RECT")

ctrl_prop['ClientRects'] = [
_XMLToStruct(ctrl_prop["CLIENTRECT"], "RECT"),]

ctrl_prop['Texts'] = _OLD_XMLToTitles(ctrl_prop["TITLES"])
ctrl_prop['texts'] = _OLD_XMLToTitles(ctrl_prop["TITLES"])

ctrl_prop['Class'] = ctrl_prop['CLASS']
ctrl_prop['class_name'] = ctrl_prop['CLASS']
ctrl_prop['ContextHelpID'] = ctrl_prop['HELPID']
ctrl_prop['ControlID'] = ctrl_prop['CTRLID']
ctrl_prop['control_id'] = ctrl_prop['CTRLID']
ctrl_prop['ExStyle'] = ctrl_prop['EXSTYLE']
ctrl_prop['FriendlyClassName'] = ctrl_prop['FRIENDLYCLASS']
ctrl_prop['friendly_class_name'] = ctrl_prop['FRIENDLYCLASS']
ctrl_prop['IsUnicode'] = ctrl_prop['ISUNICODE']
ctrl_prop['IsVisible'] = ctrl_prop['ISVISIBLE']
ctrl_prop['is_visible'] = ctrl_prop['ISVISIBLE']
ctrl_prop['Style'] = ctrl_prop['STYLE']
ctrl_prop['UserData'] = ctrl_prop['USERDATA']

Expand Down
Loading

0 comments on commit f1b98ca

Please sign in to comment.