Skip to content

Commit

Permalink
Fix several landscape.io warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
vasily-v-ryabov committed Aug 3, 2015
1 parent bdf2f18 commit e12b75f
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 125 deletions.
3 changes: 1 addition & 2 deletions examples/windowmediaplayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# Suite 330,
# Boston, MA 02111-1307 USA

"Some automation of Windows Media player"
"""Some automation of Windows Media player"""
from __future__ import unicode_literals
from __future__ import print_function

Expand All @@ -33,7 +33,6 @@
import os.path
pywinauto_path = os.path.abspath(__file__)
pywinauto_path = os.path.split(os.path.split(pywinauto_path)[0])[0]
import sys
sys.path.append(pywinauto_path)
from pywinauto import application

Expand Down
39 changes: 1 addition & 38 deletions pywinauto/controls/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@
# Suite 330,
# Boston, MA 02111-1307 USA

"Controls package"

__revision__ = "$Revision$"
"""Controls package"""

from .HwndWrapper import GetDialogPropsFromHandle
from .HwndWrapper import InvalidWindowHandle
Expand All @@ -30,40 +28,5 @@

# import the control classes - this will register the classes they
# contain
from .. import six
from . import common_controls
from . import win32_controls

#
##====================================================================
#def _unittests():
# "Run some tests on the controls"
# from pywinauto import win32functions
#
# "do some basic testing"
# from pywinauto.findwindows import find_windows
# import sys
#
# if len(sys.argv) < 2:
# handle = win32functions.GetDesktopWindow()
# else:
# try:
# handle = int(eval(sys.argv[1]))
#
# except ValueError:
#
# handle = find_windows(
# title_re = "^" + sys.argv[1], class_name = "#32770", )
# #visible_only = False)
#
# if not handle:
# print "dialog not found"
# sys.exit()
#
#
# props = GetDialogPropsFromHandle(handle)
# print len(props)
# #pprint(GetDialogPropsFromHandle(handle))
#
#if __name__ == "__main__":
# _unittests()
149 changes: 73 additions & 76 deletions pywinauto/controls/common_controls.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,8 @@ def GetItemRect(self, item_index):

# if it succeeded
if not retval:
del remote_mem
raise RuntimeError("Did not succeed in getting rectangle")
del remote_mem
raise RuntimeError("Did not succeed in getting rectangle")

rect = remote_mem.Read(rect)

Expand Down Expand Up @@ -507,15 +507,15 @@ def GetSelectedCount(self):


# commented out as we can get these strings from the header
# col = remote_mem.Read(col)
# col = remote_mem.Read(col)
#
# charData = ctypes.create_unicode_buffer(2000)
#
# ret = remote_mem.Read(charData, col.pszText)
# ret = remote_mem.Read(charData, col.pszText)
#
# self.Titles.append(charData.value)
# else:
# break
# self.Titles.append(charData.value)
# else:
# break



Expand Down Expand Up @@ -1658,9 +1658,6 @@ def Select(self, tab):






#====================================================================
class _toolbar_button(object):
"Wrapper around Toolbar button (TBBUTTONINFO) items"
Expand Down Expand Up @@ -2153,16 +2150,16 @@ def CheckButton(self, button_identifier, make_checked, exact = True):
# ExStyle = extendedStyle
# )
# )
# # if button.fsStyle & TBSTYLE_DROPDOWN == TBSTYLE_DROPDOWN and \
# # (extendedStyle & TBSTYLE_EX_DRAWDDARROWS) != \
# # if button.fsStyle & TBSTYLE_DROPDOWN == TBSTYLE_DROPDOWN and \
# # (extendedStyle & TBSTYLE_EX_DRAWDDARROWS) != \
# # TBSTYLE_EX_DRAWDDARROWS:
# # props['Buttons'][-1]["DROPDOWNMENU"] = 1
# # props['Buttons'][-1]["DROPDOWNMENU"] = 1
# #
# # self.SendMessage(WM_COMMAND, button.idCommand)
# # self.SendMessage(WM_COMMAND, button.idCommand)
# #
# # print "Pressing", text.value
# # handle.SendMessage(TB_PRESSBUTTON, button.idCommand, 1)
# # handle.SendMessage(TB_PRESSBUTTON, button.idCommand, 0)
# # print "Pressing", text.value
# # handle.SendMessage(TB_PRESSBUTTON, button.idCommand, 1)
# # handle.SendMessage(TB_PRESSBUTTON, button.idCommand, 0)
#
# self._extra_texts.append(text.value)
#
Expand Down Expand Up @@ -2459,20 +2456,20 @@ class TrackbarWrapper(HwndWrapper.HwndWrapper):

#
# #----------------------------------------------------------------
# def GetNumTicks(self):
# return self.SendMessage(win32defines.TBM_GETNUMTICS)
# def GetNumTicks(self):
# return self.SendMessage(win32defines.TBM_GETNUMTICS)
#
# #----------------------------------------------------------------
# def GetPos(self):
# return self.SendMessage(win32defines.TBM_GETPOS)
# def GetPos(self):
# return self.SendMessage(win32defines.TBM_GETPOS)
#
# #----------------------------------------------------------------
# def GetRangeMax(self):
# return self.SendMessage(win32defines.TBM_GETRANGEMAX)
# def GetRangeMax(self):
# return self.SendMessage(win32defines.TBM_GETRANGEMAX)
#
# #----------------------------------------------------------------
# def GetRangeMin(self):
# return self.SendMessage(win32defines.TBM_GETRANGEMIN)
# def GetRangeMin(self):
# return self.SendMessage(win32defines.TBM_GETRANGEMIN)
#
# #----------------------------------------------------------------
# def GetToolTipsControl(self):
Expand Down Expand Up @@ -2646,80 +2643,80 @@ def StepIt(self):
##
###====================================================================
##class ComboBoxEx(Controls_Standard.ComboBox):
## #----------------------------------------------------------------
## def __init__(self, hwndOrXML):
# Window.__init__(self, hwndOrXML)
## #----------------------------------------------------------------
## def __init__(self, hwndOrXML):
# Window.__init__(self, hwndOrXML)
##
# if isinstance(hwndOrXML, (int, long)):
## comboCntrl = SendMessage(
## hwndOrXML,
## CBEM_GETCOMBOCONTROL,
## 0,
## 0)
# if isinstance(hwndOrXML, (int, long)):
## comboCntrl = SendMessage(
## hwndOrXML,
## CBEM_GETCOMBOCONTROL,
## 0,
## 0)
##
## print "--"*20, comboCntrl
## Controls_Standard.ComboBox.__init__(self, comboCntrl)
## print self.DroppedRect
## print "--"*20, comboCntrl
## Controls_Standard.ComboBox.__init__(self, comboCntrl)
## print self.DroppedRect
##
##
##
## droppedRect = win32structures.RECT()
## droppedRect = win32structures.RECT()
##
## SendMessage(
## self,
## CB_GETDROPPEDCONTROLRECT,
## 0,
## ctypes.byref(droppedRect))
## SendMessage(
## self,
## CB_GETDROPPEDCONTROLRECT,
## 0,
## ctypes.byref(droppedRect))
##
## props['DroppedRect'] = droppedRect
## props['DroppedRect'] = droppedRect
#
#
#
#
#
#
# # find out how many text items are in the combobox
# numItems = SendMessage(
# self,
# CB_GETCOUNT,
# 0,
# 0)
# # find out how many text items are in the combobox
# numItems = SendMessage(
# self,
# CB_GETCOUNT,
# 0,
# 0)
#
# print "*"*20, numItems
## remote_mem = RemoteMemoryBlock(self)
# print "*"*20, numItems
## remote_mem = RemoteMemoryBlock(self)
##
##
## # get the text for each item in the combobox
## while True:
## item = COMBOBOXEXITEMW()
## # get the text for each item in the combobox
## while True:
## item = COMBOBOXEXITEMW()
##
## item.mask = CBEIF_TEXT
## item.cchTextMax = 4000
## item.pszText = remote_mem.Address() + ctypes.sizeof(item) + 1
## item.mask = CBEIF_TEXT
## item.cchTextMax = 4000
## item.pszText = remote_mem.Address() + ctypes.sizeof(item) + 1
##
## remote_mem.Write(item)
## remote_mem.Write(item)
##
## retval = SendMessage (
## self,
## CBEM_GETITEMW,
## 0,
## remote_mem
## )
## retval = SendMessage (
## self,
## CBEM_GETITEMW,
## 0,
## remote_mem
## )
##
## if retval:
## item = remote_mem.Read(item)
## if retval:
## item = remote_mem.Read(item)
##
## # Read the remote text string
## # Read the remote text string
## charData = ctypes.create_unicode_buffer(4000)
## remote_mem.Read(charData, item.pszText)
## self.Titles.append(charData.value)
## else:
## break
## remote_mem.Read(charData, item.pszText)
## self.Titles.append(charData.value)
## else:
## break
##
#
# else:
# else:
#
# # get the dropped Rect form
# droppedRect = XMLToRect(hwndOrXML.find("DROPPEDRECT"))
# props['DroppedRect'] = droppedRect
# # get the dropped Rect form
# droppedRect = XMLToRect(hwndOrXML.find("DROPPEDRECT"))
# props['DroppedRect'] = droppedRect

1 change: 0 additions & 1 deletion pywinauto/controls/win32_controls.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,6 @@ def _get_multiple_text_items(wrapper, count_msg, item_len_msg, item_get_msg):
if six.PY3:
texts.append(text.value.replace('\u200e', ''))
else:
import locale
texts.append(text.value.decode(locale.getpreferredencoding(), 'ignore').replace('?', ''))

return texts
Expand Down
2 changes: 1 addition & 1 deletion pywinauto/findbestmatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def _get_match_ratios(texts, match_against):
best_ratio = 0
best_text = ''

global cache
global _cache

for text in texts:

Expand Down
2 changes: 0 additions & 2 deletions pywinauto/unittests/test_XMLHelpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@

"""Module containing tests for XMLHelpers Module"""

__revision__ = "$Revision: 236 $"

import sys
sys.path.append(".")

Expand Down
7 changes: 2 additions & 5 deletions pywinauto/unittests/test_win32functions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# GUI Application automation and testing library
# Copyright (C) 2015 Intel Corporation
# Copyright (C) 2007 Mark Mc Mahon
#
# This library is free software; you can redistribute it and/or
Expand All @@ -18,18 +19,14 @@
# Suite 330,
# Boston, MA 02111-1307 USA

"Tests for win32functions.py"

__revision__ = "$Revision: 234 $"
"""Tests for win32functions.py"""

import unittest

import sys
sys.path.append(".")
from pywinauto.win32functions import *

#import struct


class Win32FunctionsTestCases(unittest.TestCase):
"Unit tests for the win32function methods"
Expand Down

0 comments on commit e12b75f

Please sign in to comment.