Skip to content

Commit

Permalink
Fix few 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 8064a19 commit bdf2f18
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 14 deletions.
13 changes: 13 additions & 0 deletions .landscape.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
doc-warnings: yes
test-warnings: no
strictness: medium
max-line-length: 120
autodetect: yes
requirements:
- dev-requirements.txt
ignore-paths:
- apps
- sandbox
- pywinauto/unittests
ignore-patterns:
- ^pywinauto/six.py$
1 change: 1 addition & 0 deletions pywinauto/sysinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
# Boston, MA 02111-1307 USA

import os, sys
import platform
import ctypes

def OS_architecture():
Expand Down
23 changes: 9 additions & 14 deletions pywinauto/taskbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

import warnings

from pywinauto import win32defines
from pywinauto import findwindows
from pywinauto import application

Expand All @@ -37,38 +36,34 @@ def TaskBarHandle():
return findwindows.find_windows(class_name = "Shell_TrayWnd")[0]


def _click_hidden_tray_icon(reqd_button, exact = True, by_tooltip = False, mouse_button = 'left'):
#ShowHiddenIconsButton.ClickInput()
def _click_hidden_tray_icon(reqd_button, mouse_button = 'left', exact = False, by_tooltip = False, double = False):
popup_dlg = explorer_app.Window_(class_name='NotifyIconOverflowWindow')
try:
popup_toolbar = popup_dlg.OverflowNotificationAreaToolbar.Wait('visible')
button_index = popup_toolbar.Button(reqd_button).index
button_index = popup_toolbar.Button(reqd_button, exact=exact, by_tooltip=by_tooltip).index
except:
ShowHiddenIconsButton.ClickInput() # may fail from PythonWin when script takes long time
popup_dlg = explorer_app.Window_(class_name='NotifyIconOverflowWindow')
popup_toolbar = popup_dlg.OverflowNotificationAreaToolbar.Wait('visible')
button_index = popup_toolbar.Button(reqd_button).index
button_index = popup_toolbar.Button(reqd_button, exact=exact, by_tooltip=by_tooltip).index

if is_left_click:
popup_toolbar.Button(button_index).ClickInput()
else:
popup_toolbar.Button(button_index).ClickInput(button='right')
popup_toolbar.Button(button_index).ClickInput(button=mouse_button, double=double)

def ClickSystemTrayIcon(button, exact = False, by_tooltip = False, double=False):
"Click on a visible tray icon given by button"
SystemTrayIcons.Button(button, double=double, exact=exact, by_tooltip=by_tooltip).ClickInput()
SystemTrayIcons.Button(button, exact=exact, by_tooltip=by_tooltip).ClickInput(double=double)

def RightClickSystemTrayIcon(button, exact = False, by_tooltip = False):
"Right click on a visible tray icon given by button"
SystemTrayIcons.Button(button, exact=exact, by_tooltip=by_tooltip).ClickInput(button='right')

def ClickHiddenSystemTrayIcon(button, exact = False, by_tooltip = False, double=False):
"Click on a hidden tray icon given by button"
_click_hidden_tray_icon(button, double=double, exact=exact, by_tooltip=by_tooltip)
_click_hidden_tray_icon(button, exact=exact, by_tooltip=by_tooltip, double=double)

def RightClickHiddenSystemTrayIcon(button, exact = False, by_tooltip=False):
"Right click on a hidden tray icon given by button"
_click_hidden_tray_icon(button, exact=exact, by_tooltip=by_tooltip, mouse_button='right')
_click_hidden_tray_icon(button, mouse_button='right', exact=exact, by_tooltip=by_tooltip)


# windows explorer owns all these windows so get that app
Expand All @@ -80,7 +75,7 @@ def RightClickHiddenSystemTrayIcon(button, exact = False, by_tooltip=False):
# The Start button
try:
StartButton = explorer_app.Window_(title='Start', class_name='Button').Wait('exists', 0.1) # Win7
except:
except Exception:
StartButton = TaskBar.Start # Win8.1

# the system tray - contains various windows
Expand All @@ -102,7 +97,7 @@ def RightClickHiddenSystemTrayIcon(button, exact = False, by_tooltip=False):
# the language bar
try:
LangPanel = TaskBar.CiceroUIWndFrame.Wait('exists', 0.1) # Win7
except:
except Exception:
LangPanel = TaskBar.TrayInputIndicatorWClass # Win8.1

# the hidden tray icons button (TODO: think how to optimize)
Expand Down

0 comments on commit bdf2f18

Please sign in to comment.